2012年10月2日星期二

C# HttpListener Access Denied when start on Windows 7

netsh http add urlacl url=http://+:80/MyUri user=DOMAIN\user

This is helpful, but for completeness, the URL specified in this line of code: httpListener.Prefixes.Add("http://*:4444/"); must match EXACTLY with the one in the netsh command. For example, I had httpListener.Prefixes.Add("http://127.0.0.1:80/"); and the same netsh command you have, and the HttpListenerException will still be thrown. I needed to change httpListener.Prefixes.Add(http://+:80/);

http://stackoverflow.com/questions/4019466/httplistener-access-denied-c-sharp-windows-7

2012年9月30日星期日

Apple TV 备忘录

apple tv3不越狱可以看国内电影,超级简单,修改一下网络的
dns: 180.153.225.136 210.129.145.150 58.215.188.082 (任选一个, 用210.129.145.150)

原理, 改变DNS使http://trailers.apple.com/appletv/index.xml, 重定向到 http://180.153.225.136:8000/index.xml上.

http://www.atvttvv.net/index.html
UID: 7437071030927024025

Additional DNSMasq Options
address=/trailers.apple.com/210.129.145.150


Live TV URLs

Some Live TV Link

TVB
TVB-J2 http://live1.ms.tvb.com/tvb/tv/j2/04/prog_index.m3u8 TVB http://upload.wikimedia.org/wikipedia/zh/thumb/c/c8/J2.svg/200px-J2.svg.png
TVB新闻 http://live1.ms.tvb.com/tvb/tv/inews/044.m3u8 TVB http://img.tvb.com/epg/img/phd_logos_v2/gif/inews.gif
TVB高清 http://live1.ms.tvb.com/tvb/tv/jade/044.m3u8 TVB http://upload.wikimedia.org/wikipedia/zh/thumb/e/e1/Hdjade.svg/200px-Hdjade.svg.png
上海卫视
东方卫视 http://114.112.34.103:82/live/5/45/887d4d23ee894ceb8f5f457fa24f3e97.m3u 上海卫视 http://www.smg.cn/upload/LPmxCDkjEL.jpg
第一财经 http://114.112.34.103:82/live/5/45/2f7e274ef02b4cb68339d6bd54693753.m3u 上海卫视 http://www.smg.cn/upload/77hUw942M0.jpg
东方财经 http://114.112.34.103:82/live/5/45/4268c1d55d8f459882af62e005ba056d.m3u 上海卫视 http://www.smg.cn/upload/UjVSdvOTTl.jpg
上海星尚 http://114.112.34.103:82/live/5/45/e938555554d042d681e8025c2f11dfb9.m3u 上海卫视 http://www.smg.cn/upload/FKybnNejgt.jpg
炫动卡通 http://114.112.34.103:82/live/5/45/622698d290214399bc83dad5cdee2168.m3u 上海卫视 http://www.smg.cn/upload/IwYxhNAsYJ.jpg
上视纪实 http://114.112.34.103:82/live/5/45/d953c071448342209819363fcca12f95.m3u 上海卫视 http://www.smg.cn/upload/8w5mHwfQWh.jpg
上海外语 http://114.112.34.103:82/live/5/45/25ba66637e7b438e942db99dd783a25a.m3u 上海卫视 http://www.smg.cn/upload/9cNkyAP1Ae.jpg
国内卫视
凤凰中文 http://210.51.19.156/live/iphone/zxt/index_350k.m3u8 国内卫视 http://upload.wikimedia.org/wikipedia/zh/thumb/3/34/Phoenix_Chinese.svg/90px-Phoenix_Chinese.svg.png
凤凰资讯 http://210.51.19.156/live/iphone/zwt/index_350k.m3u8 国内卫视 http://upload.wikimedia.org/wikipedia/zh/thumb/1/16/Phoenix_InfoNews.svg/185px-Phoenix_InfoNews.svg.png
北京卫视 http://114.112.34.103:82/live/5/45/d005a79e2c474848a7b316f6f87cecee.m3u 国内卫视 http://upload.wikimedia.org/wikipedia/zh/thumb/e/e4/BTV2011.jpg/200px-BTV2011.jpg
旅游卫视 http://114.112.34.103:82/live/5/45/0b5ee10d0b2548329e6c8febecc305a4.m3u 国内卫视 http://upload.wikimedia.org/wikipedia/zh/thumb/0/05/Travel_Channel_Logo.png/200px-Travel_Channel_Logo.png
湖南国际 http://3glivehntv.doplive.com.cn/video3/index_128k.m3u8 国内卫视 http://upload.wikimedia.org/wikipedia/zh/2/28/Hunan_TV_World_Logo.png
湖南卫视 http://114.112.34.103:82/live/5/45/e9301e073cf94732a380b765c8b9573d.m3u 国内卫视 http://upload.wikimedia.org/wikipedia/zh/5/5e/Hunantv_logo.png
湖北卫视 http://tsl5.hls.cutv.com/cutvlive/hw2bvyV/hls/live_sd.m3u8 国内卫视 http://upload.wikimedia.org/wikipedia/zh/thumb/6/65/HBTV_logo.png/170px-HBTV_logo.png
浙江卫视 http://114.112.34.103:82/live/5/45/ecc14bb80dc347769932f57a9c0b3870.m3u 国内卫视 http://upload.wikimedia.org/wikipedia/zh/3/36/Zhejiangweishilogo.jpg
江苏卫视 http://114.112.34.103:82/live/5/45/238baa4ac12f427896cecf12234159ef.m3u 国内卫视 http://tp1.sinaimg.cn/1575527140/180/5627471108/1
天津卫视 http://114.112.34.103:82/live/5/45/0e14818cc6cf4b5e8469ffc9a15113a1.m3u 国内卫视 http://upload.wikimedia.org/wikipedia/zh/e/ef/Tjtvlogo.jpg
辽宁卫视 http://114.112.34.103:82/live/5/45/99c55805bf3f4867a34bc5bf7c9c4bc0.m3u 国内卫视 http://upload.wikimedia.org/wikipedia/zh/d/d4/Liaoning_Television_Logo.png
四川卫视 http://114.112.34.103:82/live/5/45/76e11ccfb107429d8a0725fe8db4ecac.m3u 国内卫视 http://upload.wikimedia.org/wikipedia/zh/thumb/f/fc/SCTV_logo.png/200px-SCTV_logo.png
重庆卫视 http://114.112.34.103:82/live/5/45/28d22e95eeac4098b7a7ceb3fccd1438.m3u 国内卫视 http://upload.wikimedia.org/wikipedia/zh/1/1b/CQTV_logo.png
吉林卫视 http://114.112.34.103:82/live/5/45/1fe374ae8a084e9290579d2b6982b71a.m3u 国内卫视 http://upload.wikimedia.org/wikipedia/zh/thumb/6/63/JLTV_logo.png/170px-JLTV_logo.png
山东卫视 http://114.112.34.103:82/live/5/45/3791a3d4b5214540bfe99b0680fbc76f.m3u 国内卫视 http://upload.wikimedia.org/wikipedia/zh/thumb/7/79/SDTV_logo.png/200px-SDTV_logo.png
贵州卫视 http://114.112.34.103:82/live/5/45/5ecc73f9106341609b9f629d7940e355.m3u 国内卫视 http://upload.wikimedia.org/wikipedia/zh/1/12/Guizhou_tv.jpg
兵团卫视 http://114.112.34.103:82/live/5/45/6bda77778d8146689ace3363f6a4d207.m3u 国内卫视 http://upload.wikimedia.org/wikipedia/zh/thumb/e/e8/Bingtuan_Television_Logo_20090828.png/200px-Bingtuan_Television_Logo_20090828.png
广西卫视 http://114.112.34.103:82/live/5/45/3f8a56bdf383478b85fb380343587b43.m3u 国内卫视 http://upload.wikimedia.org/wikipedia/zh/thumb/f/fd/LOGOGuangxiTV.jpg/200px-LOGOGuangxiTV.jpg
河南卫视 http://114.112.34.103:82/live/5/45/44919ebf659e4a15b02b0e3328a03e6c.m3u 国内卫视 http://upload.wikimedia.org/wikipedia/zh/thumb/a/aa/HNTV_non-on_screen_logo.jpg/130px-HNTV_non-on_screen_logo.jpg
安徽卫视 http://114.112.34.103:82/live/5/45/e4c8a2dc060b4f729bb8ce73df08c0d9.m3u 国内卫视 http://upload.wikimedia.org/wikipedia/zh/thumb/2/27/Anhui_STV_Logo.jpg/200px-Anhui_STV_Logo.jpg
黑龙江卫视 http://114.112.34.103:82/live/5/45/f59d2cc92d944fd6baa0e7c6ffd0a0fc.m3u 国内卫视 http://upload.wikimedia.org/wikipedia/zh/thumb/4/49/HLJTV_logo.png/200px-HLJTV_logo.png
厦门卫视 http://114.112.34.103:82/live/5/45/661496c1495e4d1a936dc8e4ce149189.m3u 国内卫视 http://upload.wikimedia.org/wikipedia/zh/1/15/Xiamenstar.png
河北卫视 http://114.112.34.103:82/live/5/45/676ccb4d1a1544998ac93d34011c8534.m3u 国内卫视 http://upload.wikimedia.org/wikipedia/zh/thumb/a/a2/Hebtv_logo.png/170px-Hebtv_logo.png
江西卫视 http://114.112.34.103:82/live/5/45/d682c6b5487b471aa253d00b62f7db4b.m3u 国内卫视 http://upload.wikimedia.org/wikipedia/zh/thumb/0/02/Jiang_xi_wei_shi.jpg/200px-Jiang_xi_wei_shi.jpg
内蒙古卫视 http://114.112.34.103:82/live/5/45/328304f701f34f618ada1bec1eb20206.m3u 国内卫视 http://upload.wikimedia.org/wikipedia/zh/thumb/1/1d/NMTV_logo.png/200px-NMTV_logo.png
山西卫视 http://114.112.34.103:82/live/5/45/7ea95625827d434a81dd9f45bb1b1c9a.m3u 国内卫视 http://upload.wikimedia.org/wikipedia/zh/9/9b/ShanxiTV_Logo.png
云南卫视 http://114.112.34.103:82/live/5/45/dd0d29c07db24341b703bbb16a92b287.m3u 国内卫视 http://program.yntv.cn/images/ynws.jpg
青海卫视 http://114.112.34.103:82/live/5/45/0b94e35aa6be48b5b749f3fe160efc5e.m3u 国内卫视 http://upload.wikimedia.org/wikipedia/zh/8/80/Qhtvlogo.jpg
陕西卫视 http://114.112.34.103:82/live/5/45/c477690dc6c540eb948273bfd5f145d6.m3u 国内卫视 http://upload.wikimedia.org/wikipedia/zh/thumb/3/3c/ShaanxiTV.jpg/200px-ShaanxiTV.jpg
广东卫视
广东卫视 http://114.112.34.103:82/live/5/45/e0a1564fc9cd4fb4bb4efe9e804d8bcf.m3u 广东卫视 http://img.gdtv.cn/templates/default/images/c4_logo.png
广东珠江 http://114.112.34.103:82/live/5/45/035c7371dcd44f4da64979badb6ef559.m3u 广东卫视 http://img.gdtv.cn/templates/default/images/logo_c_5.png
广东公共 http://114.112.34.103:82/live/5/45/251d45879d00488fa0826582fa397216.m3u 广东卫视 http://img.gdtv.cn/templates/default/images/c17_logo.png
广东新闻 http://114.112.34.103:82/live/5/45/8a4131d106f34fc3a632f5e804a5e944.m3u 广东卫视 http://img.gdtv.cn/templates/default/images/c19_logo.png
广东嘉佳 http://114.112.34.103:82/live/5/45/cefe6b1030b747e1bca4d7218f3ccc44.m3u 广东卫视 http://img.gdtv.cn/templates/default/images/c20_logo.png
深圳卫视
深圳卫视 http://114.112.34.103:82/live/5/45/66c56c64eda94929bf45dd212eaaa14f.m3u 深圳卫视
深圳少儿 http://tsl1.hls.cutv.com/cutvlive/1SIQj6s/hls/live_sd.m3u8 深圳卫视
深圳公共 http://tsl1.hls.cutv.com/cutvlive/2q76Sw2/hls/live_sd.m3u8 深圳卫视
深圳都市 http://tsl1.hls.cutv.com/cutvlive/ZwxzUXr/hls/live_sd.m3u8 深圳卫视
深圳电视 http://tsl1.hls.cutv.com/cutvlive/4azbkoY/hls/live_sd.m3u8 深圳卫视
深圳体育 http://tsl1.hls.cutv.com/cutvlive/4i8RVtK/hls/live_sd.m3u8 深圳卫视
深圳财经 http://tsl1.hls.cutv.com/cutvlive/3vlcoxP/hls/live_sd.m3u8 深圳卫视

English
BBC新闻 http://akamedia2.lsops.net/live/smil:bbcnews_en.smil/playlist.m3u8 English http://mandmglobal.com/Libraries/IMZ_company_logos/BBC_WorldNews_Stack_Rev_RGB_1.sflb.ashx
CNN http://akamedia2.lsops.net/live/smil:cnn_en.smil/playlist.m3u8 English http://i.cdn.turner.com/cnn/.e/img/3.0/global/header/intl/hdr-globe-central.gif
美国Cartoon http://118.69.198.230:1935/live/Cartoon.stream/playlist.m3u8 English
美国NASA http://www.nasa.gov/multimedia/nasatv/NTV-Public-IPS.m3u8 English
国家地理 http://118.69.198.230:1935/live/NaGeo.stream/playlist.m3u8 English
美国AXN http://118.69.198.230:1935/live/AXN.stream/playlist.m3u8 English
CinemaxHD http://118.69.198.230:1935/live/Cinemax.stream/playlist.m3u8 English
STAR电影 http://118.69.198.230:1935/live/StarMovie.stream/playlist.m3u8 English
Discovery http://118.69.198.230:1935/live/Discovery.stream/playlist.m3u8 English

台湾频道
生命电视 http://mobile.ccdntech.com/live/_definst_/vod116_Live/201108211/playlist.m3u8 台湾频道
一新闻 http://newshls-i.akamaihd.net/hls/live/202100/newshls/wifistream.m3u8 台湾频道

境外频道
日本NHK http://plslive3.nhk.or.jp/nhkworld/app/live.m3u8 境外频道 http://www3.nhk.or.jp/nhkworld/english/common/images/header_logo.gif
KBS http://news24kbs-2.gscdn.com/news24_300/_definst_/news24_300.stream/playlist.m3u8 境外频道 http://english.kbs.co.kr/v2/images/common/top_kbs_logo.gif
伊朗PressTV http://akamedia2.lsops.net/live/smil:presstv_en.smil/playlist.m3u8 境外频道 http://www.presstv.ir/images/logo1.jpg
德国arte http://iphone.envivio.com/iphone/downloads/ch1/index.m3u8 境外频道 http://www.arte.tv/header-include/assets/img/arte-tv.png
半岛电视台  http://akamedia2.lsops.net/live/smil:aljazeer_en.smil/playlist.m3u8?token=0680320b260f258c3dc99 境外频道
今日俄罗斯 RussiaToday http://akamedia2.lsops.net/live/smil:rustoday_en.smil/playlist.m3u8 境外频道
马来西亚BernamaTV http://110.74.142.92/demo/iphone/bernama_mqs/bernama_mqs_variant.m3u8 境外频道
泰国电视3台 http://111.223.37.194:1935/liverepeater/ruenglao/playlist.m3u8 境外频道
越南VTV1  http://112.197.2.16:1935/live/vtv1.stream/playlist.m3u8 境外频道
维京电台 http://wow01.105.net/live/virgin1/playlist.m3u8  境外频道
法国24 http://stream7.france24.yacast.net/iphone/france24/fr/iPad.f24_fr.m3u8 境外频道
法国时尚 http://217.146.95.164:8081/ch27yiphone.m3u8 境外频道
德国arte http://iphone.envivio.com/iphone/downloads/ch1/index.m3u8 境外频道

测试

2012年2月26日星期日

WinDBG命令

在断点上打log, 然后继续执行.
bp 10843770 "dd @esp+4 L 4; g"

设置条件断点
bp 10843770 ".if (poi(@esp+4)=0x00110214) {} .else {gc}"
bp 10843770 ".if (poi(@esp+4)=0x10204) {.if (poi(@esp+8)=0x7) {} .else {gc} } .else {gc}"

从内核一直调试到用户
http://www.codeproject.com/Articles/7913/Debug-Tutorial-Part-6-Navigating-The-Kernel-Debugg

During kernel-mode debugging, you can set the process context by using the .process (Set Process Context) command. Use this command to select which processs page directory is used to interpret virtual addresses. After you set the process context, you can use this context in any command that takes addresses. You can even set breakpoints at this address. By including a /i option in the .process command to specify invasive debugging, you can also use the kernel debugger to set breakpoints in user space.

You can also set user-mode breakpoints from the kernel debugger by using a process-specific breakpoint on a kernel-space function. Set strategic breakpoints and wait for the appropriate context to come up.

With WinDBG, another thing you can do is use !bpid to have the kernel debugger break into the context of the process you e interested in and then you can set your breakpoints in the user-mode code (after running .reload to reload your symbols).

For example, setting a breakpoint in CreateFileW in a process:
0: kd> !process 0 0
**** NT ACTIVE PROCESS DUMP ****
....
PROCESS 861c9d90 SessionId: 1 Cid: 0f10 Peb: 7ffd3000 ParentCid: 0b48
DirBase: 0174e2a0 ObjectTable: 96f14eb0 HandleCount: 5.
Image: testapp.exe
1: kd> .process /r /p 861c9d90
Implicit process is now 861c9d90
..cache forcedecodeuser done
Loading User Symbols

2012年2月23日星期四

Ubuntu上build insight

insight-6.8-1
1. sudo apt-get install libx11-dev
2. sudo apt-get install libncurses5-dev
3. tar -xjvf insight-6.8-1.tar.bz2
4. cd insight-6.8-1/
5. ./configure (need do configure first)
5. ./configure –disable-werror
6. make
7. sudo make install

解决电话加锁

am startservice -a com.fd.settings -d content://device/unlock -n com.futuredial.FDSettingsService/.FDSettingsService

adb shell am start -n com.futuredial.fdbox721/.fdbox721Activity

2012年2月10日星期五

.net 4.0 新的非托管异常处理机制.

在.NET 4.0之后,CLR将会区别出一些异常(都是SEH异常),将这些异常标识为破坏性异常(Corrupted State Exception)。针对这些异常,CLR的catch块不会捕捉这些异常,即使你用类似下面的代码:
try
{
TestMethod();
}
catch (Exception e)
{
Console.WriteLine("Catching exception: {0}", e);
}
也没有办法捕捉到这些异常。之所以要这样设计,在MSDN的文章Handling Corrupted State Exceptions里已经提到了。即,有一些支持插件的程序,例如Visual Studio或者SQL Server,它们支持调用托管代码编写成的插件,但是它们自己本身有很多代码是由非托管的C++写成的。由于插件经常会调用到非托管的API,而很多时间,这些插件的代码根本就不知道如何处理非托管的API抛出来的SEH异常。在4.0以前,因为SEH异常被转换成了跟普通.NET异常相同的异常,这样程序员只要用catch ( Exception e)的模式就可以捕捉到所有的异常。这样处理的问题是,由于SEH异常通常都不是托管代码抛出的,托管代码根本就不知道SHE异常被扔出来的原因,简单的catch ( Exception e)处理使得整个程序会处于一个非常不稳定的状态,使得前面被忽略的问题在后面以更严重的方式出现 — 例如保存被破坏的数据。这样,看起来使用catch ( Exception e)处理所有的异常的方法很简单,但实际上让程序员或者用户在问题延后发生时,分析起来需要花费更多的精力。

因此在4.0以后,大部分SHE(我怀疑是所有)异常都被标识成破坏性异常,在.NET里,默认情况下CLR不会捕捉它们,而是任由操作系统来处理—即关闭程序,并打开一个错误对话框通知用户。为了保证兼容性,在4.0以前编译的程序,例如在2.0、3.0和3.5编译的程序,依然采用的是老的策略—即.NET会同时捕捉.NET异常和SHE异常。而在4.0下面编译的程序才会使用新的策略,这也是在文章的开头,我的朋友所碰到的问题。你可以在.NET 4.0下面编译下面的程序,体验一下这个新变化:

Program.cs:
using System; using System.Runtime.InteropServices; namespace ConsoleApplication1 { class Program { [DllImport("Ref.dll")] private extern static void TestMethod(); static void Main(string[] args) { try { TestMethod(); } catch (Exception e) { Console.WriteLine("Catching exception: {0}", e); } } } }

Ref.cpp:
#include "stdafx.h" extern "C" __declspec(dllexport) void TestMethod() { int *p = NULL; // 会导致.NET抛出一个AccessViolation异常 *p = 10; }

上面的代码里,Program.cs使用P/Invoke技术调用了Ref.dll文件里的TestMethod,但是TestMethod尝试给一个空指针赋值,导致一个AccessViolation异常。如果你在2.0下面编译program.cs,并执行的话,这个AccessViolation异常会被catch(Exception e)捕捉到,而如果你在4.0下面编译并执行的话,你会发现catch (Exception e)是不能捕捉到这个异常的。

然而并不是所有人都想要这个新的异常机制,如果你的程序是在4.0下面编译并运行,而你又想在.NET程序里捕捉到SHE异常的话,有两个方案可以尝试:
1. 在托管程序的.config文件里,启用legacyCorruptedStateExceptionsPolicy这个属性,即简化的.config文件类似下面的文件:

App.config:


 
 
 





 
 
 





这个设置告诉CLR 4.0,整个.NET程序都要使用老的异常捕捉机制。

2. 在需要捕捉破坏性异常的函数外面加一个HandleProcessCorruptedStateExceptions属性,这个属性只控制一个函数,对托管程序的其他函数没有影响,例如:
[HandleProcessCorruptedStateExceptions] static void Main(string[] args) { try { TestMethod(); } catch (Exception e) { Console.WriteLine("Catching exception: {0}", e); } }

2011年6月2日星期四

HTC(多普达)手机的生产日期及主机序列号


一直想了解自己手机的生产日期等信息,今天终于解开了这个秘密,把它记下来,也希望对想买(HTC)多普达手机的朋友有点帮助。。。。
           可以通过S/N进行查询:
           例如 S/N: SSYWWPPZZZZZ  
           SS: 
是生产地代码,一般HTCH比较常见

           HT 是新竹(台湾HTC总部工厂)
           CH 是武汉
           SZ 是深圳
           SH 是上海
           Y: 是生产年份的最后一个数字,如9即表示该手机为2009年生产的.
           WW: 是生产的周:有01-54周,(09年用新的方法了,月是123456789ABC代表123456789101112月。日从19AZ(26个字母中不使用到其中的四个“IOQU”)是代表191031)1=1 2=2 3=3 4=4 5=5 6=6 7=7 8=8 9=9 10=A 11=B 12=C 13=D 14=E 15=F 16=G 17=H 18=J 19=K 20=L 21=M 22=N 23=P 24=R 25=S 26=T 27=V 28=W 29=X 30=Y 31=Z 
           PP:
是产品代码  
           ZZZZZ:
是序号

2011年4月25日星期一

Flash NVidia Tegra APX device

IDK what knowledge (in case of eLocity A7) have Koush, but i'm trying to allocate all info about hard-flashing process here.

------------------------------------------------------------------------

1. Recovery

eLocity A7 has Android System Recovery <1e>. According info from official update: recovery.img will flash to partition named "SOS"
To get into recovery you should:
- turn Tablet off
- quickly turn on and release power-button (notice green light)
- press power again and hold till text "Booting recovery kernel image"
- if you hold longer your Tablet will turn off)

2. ADB (Android Debug Bridge)

2.1 Cable
Ensure you have USB Cable A-A like in attached image
http://forum.xda-developers.com/attachment.php?attachmentid=530427&stc=1&d=1298973504

2.2 Drivers
Ensure you have Android SDK Tools. If you have SDK Tools already you could start from section "Modifying drivers"

2.2.1 Installing SDK Tools
- Download it from http://developer.android.com/sdk/index.html
- Unpack it to (avoid long-names and desktop-folders; good folder: c:\asdk)
- Run "sdk manager.exe"
- From "Android repository" download "Android SDK Platform-tools"
- From "Third-party Add-ons / Google Inc. add-ons" download "Google USB Driver package"
- Exit from SDK Manager

2.2.2 Modifying drivers
- Go to /google-usb_driver
- Find android_winusb.inf and edit it
- Add following to both sections [Google.NTx86] and [Google.NTamd64]
;NVIDIA Tegra
%SingleAdbInterface% = USB_Install, USB\VID_0955&PID_7000
%CompositeAdbInterface% = USB_Install, USB\VID_0955&PID_7100&MI_01
%CompositeAdbInterface% = USB_Install, USB\VID_0955&PID_7100
- Save and exit
- Run Windows command-promt and type
echo 0x955 >> "%USERPROFILE%\.android\adb_usb.ini"

2.3 Switch modes
eLocity A7 has USB-Host "out-of-box", but it can be converted to simple USB

- Ensure you have Root Explorer
- Run it and go to /data/data
- Create folder name com.compal.usb_otg
- Go into and make file usb.txt
- In usb.txt write 0
- Connect tablet to PC with USB Cable A-A
- Reboot (tablet can switch modes only while rebooting)

Note: 
0 - USB Slave mode
1 - USB Host mode

2.4 Checking ADB
- If you done steps above correctly Windows would search adb-drivers. Point them at /google-usb_driver
- Check connection by running adb from /platform-tools
adb devices
If it returned serial number you have success

3. APX mode

3.1 Getting Nvidia Tools
- Go to http://developer.nvidia.com/tegra/devkit-250tango and download "Android 2.2 (Froyo) for Tegra 250 & Tango ONLY" (one or both Windows/ Linux)
Speedlinks (NVidia updated tools 7 feb 2011, so links would change in future)
Windows: http://developer.download.nvidia.com/tegra/files/os/tegra_froyo_20110207.msi
Linux: http://developer.download.nvidia.com/tegra/files/os/tegra_froyo_20110207.run.gz
- [WIN] Install it in (default it is there C:\Program Files\NVIDIA Corporation\tegra_froyo_20110207) 

3.2 Running into APX
- Connect to PC (remember: in USB Slave mode and with Cable A-A)
- Run following command in terminal emulator
echo 1 >/proc/naz10_diag/force_recovery
- Tablet should reboot into APX
- If you've connected properly Windows should search another drivers
- Point them to /usbpcdriver

3.3 Getting partitions
- Go to
- Run nvflash-command to get into bootloader. I used stock bootloader from elocity official update. I didn't use bootloader from .
nvflash --bl bootloader.bin --go
- Tablet should write something at screen (recovery mode bla-bla)
- Run nvflash-command to get list of partitions
nvflash -r --getpartitiontable partitiontable.txt
- I have last official update and in partitiontable.txt "SOS"-partition has number 6
- Run nvflash-command to get specified X partition
nvflash -r --read X part-X.img

I successfully got partition number 6 and it is about 8 MB
I got partition "APP" (with number 9) and it is about 500 Mb - i think our system image can be extended ;)
nvflash has command "--download N filename". It downloads partition filename to N. But i'm afraid to experiments, cause don't have warranty
------------------------------------------------------------------------

Things to investigate

- Running into APX-mode with hardware-buttons. I don't know how it can be. Viewsonic GTablet owners have to press VolumeDown and Power to get into. But our Tablet doesn't have VolumeDown. I tried Volume already but it seems that this button starts working after system was loaded.
Without this method we have only two methods to restore:
1) If tablet is booting properly -> nvflash
2) If tablet won't boot -> recovery

- Custom recovery. It would be great if Koush will realize it. Last step left)
------------------------------------------------------------------------
Thanks to
- greenar
- Dexter_nlb
- nicofs (he added info about nvflash to toshiba ac100 wiki)

2010年12月8日星期三

XP - 全自动开启匿名GUEST访问局域网共享

彻底解决winXP访问问题:
一、首先启用guest来宾帐户;
二、控制面板→管理工具→本地安全策略→本地策略→用户权利指派里

  • “从网络访问此计算机”中加入guest帐户
  • “拒绝从网络访问这台计算机”中删除guest帐户
三、我的电脑→工具→文件夹选项→查看→去掉“使用简单文件共享(推荐)”前的勾;
四、设置共享文件夹;
五、控制面板→管理工具→本地安全策略→本地策略→安全选项里,
  • 把“网络访问:本地帐户的共享和安全模式”设为“仅来宾-本地用户以来宾的身份验证”(可选,此项设置可去除访问时要求输入密码的对话框,也可视情况设为“经典-本地用户以自己的身份验证”);

2010年9月11日星期六

Build ARM code on Linux/eclipse


Know how to setup ARM toolchain;

(http://www.icdev.com.cn/?734/viewspace-653.html).

安装交叉编译环境

1. 安装标准的C开发环境,由于Ubuntu安装默认是不安装的,所以需要先安装一下:

sudo apt-get install gcc g++ libgcc1 libg++ make gdb

2.安装交叉编译器

从ftp://ftp.arm.linux.org.uk/pub/armlinux/toolchain/下载交叉编译器cross-3.2.tar.bz2,然后解压sudo tar jxvf /home/engelbert/cross-3.2.tar.bz2(/home/engelbert/为你存放cross-3.2.tar.bz2的路径),然后将解压后的文件都转移到/usr/local/下,

sudo mv /home/engelbert/usr/local/arm /usr/local

3.把交叉编译器的路径加入到PATH

sudo vi /etc/bash.bashrc

在后面加入如下代码:

if [ -d /usr/local/arm ] ; then

PATH=/usr/local/arm/bin:"${PATH}"

fi

4.使新的环境变量生效

# source /etc/profile

5.检查是否将路径加入PATH的方法:

echo $PATH

如果显示的内容中有/usr/local/arm/bin,说明已经将交叉编译器的路径加入PATH

自此,交叉编译环境安装完成。

下面我们就来测试一个简单的例子。

/*Hello.c*/

#include

3. main()

{

printf(hello ubuntu!\n);

}

程序输好以后确认无误,保存。进入程序文件所在目录

arm-linux-gcc hello.c –o hello(-o 可以理解为“目标为生成”)

arm-linux-gcc是第一次出现,有人可能会问这个哪里来的,不妨打开刚才安装的交叉编译工具目录/usr/local/arm-linux/arm-linux/bin/可以发现里面有一个arm-linux-gcc文件,这个就是针对arm的CPU的gcc编译器了。以后用其它编译工具链式也可以通过这种方法看看其编译器是什么了。编译好了以后就可以下载到目标机进行测试了。当然也可以先在PC机上测试正误。用gcc hello.c –o hello就可以生成PC机上程序了,在运行./hello 就可以发现终端显示hello!字样。用arm-linux-gcc编译的程序在PC机上是不能运行的,运行后给出错误报告:无法执行二进制文件。说明经过交叉编译环境编译出的文件是硬件可执行的二进制代码文件。







Put ARM toolchain in Eclipse

http://www.cnblogs.com/xubing/archive/2010/06/02/1749798.html

http://www.cnblogs.com/xubing/archive/2010/06/07/1752405.html

http://www.cnblogs.com/xubing/archive/2010/06/07/1753257.html

默认情况下,arm-linux-gcc会被解压到/usr/local/arm/4.3.2/目录中,其中,可执行文件存储在/usr/local/arm/4.3.2/bin中。解压成功后,我们需要修改环境变量,使得Linux可以找到arm-linux-gcc。使用gedit打开/etc/environment,在原有语句后面加上/usr/local/arm/4.3.2/bin。

我的/etc/environment是这样的:



PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/arm/4.3.2/bin"

注意:Linux中有3个级别的环境变量。这个/etc/environment是其中级别较高的一个。



如果我们修改私有的环境变量,Eclipse会提示无法找到arm-linux-gcc。必须修改/etc/environment,才能让Eclipse找到arm-linux-gcc。我猜测这是由于Eclipse运行于JAVA虚拟机上造成的。

至此,arm-linux-gcc就已经安装完成了,注销一下,再重新登录。打开一个终端,在里面输入arm-linux-gcc -v,如果返回了版本信息的话,就说明arm-linux-gcc安装成功了!







Re-use Android ARM toolchain both command line

http://www.pocketmagic.net/?p=682

Android uses a simplified version of libc, called bionic. We need to compile using Android's prebuilt cross-compiler arm-eabi-gcc, and use the bionic library on the phone.

The easy way to do this is to use the agcc perl wrapper. You can download the original file here, and modify

my $TOOLCHAIN = "$DROID/prebuilt/linux-x86/toolchain/arm-eabi-4.2.1";

to

my $TOOLCHAIN = "$DROID/prebuilt/linux-x86/toolchain/arm-eabi-4.3.1";



Or download this updated version directly.

Copy agcc to your home directory, and chmod it:



chmod +x agcc



then set the PATH to the bionic libs and the agcc location:



$ PATH=$PATH:~/mydroid/prebuilt/linux-x86/toolchain/arm-eabi-4.3.1/bin:~/:~/mydroid/

Now you can compile the test.c file:



agcc test.c -o test

Take the resulting test binary and upload it to your android using:



adb push test /data/local/test



Then run it:



adb shell

chmod 775 test

./test





2010年8月19日星期四

How to build Android source code from source.android.com

Start from the clean Ubuntu 10.04 install, and target to build the Android Éclair.
Learn from : http://devtcg.blogspot.com/2009/03/building-running-and-debugging-android.html
and http://mmmyddd.freeshell.net/wiki/android/build.html.

1. Follow the http://source.android.com/source/download.html instruction,

a) Setup the development environment:

i. $ sudo apt-get install git-core gnupg sun-java5-jdk flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev

ii. $ sudo apt-get install valgrind

2. install and use repo

a) $ curl http://android.git.kernel.org/repo > ~/bin/repo

b) $ chmod a+x ~/bin/repo

3. get source from source.android.com

a) $ mkdir ~/android/éclair; (this folder will be the root folder for build and debug, all command invoke will be from this folder).

b) $ cd ~/android/éclair

c) $ repo init -u git://android.git.kernel.org/platform/manifest.git -b éclair

Note: -b specified the branch, code name is the branch, like éclair, cupcake, donut and froyo.

d) $ repo sync

4. Build the eclair

a) Before build the android, some commands suggest to invoke:

i. $ source ./build/envsetup.sh

ii. $ lunch 1

b) Need export JAVA_HOME and add PATH

 $ export JAVA_HOME=/usr/lib/jvm/java-1.50-sun

 $ export ANDROID_JAVA_HOME=$JAVA_HOME

c) $ make

5. After build success, invoke the ./out/host/linux-x86/bin/emulator to start the android emulator.

6. Import the Android platform source code into eclipse. (we don’t need Android SDK and ADT tool, since we are going to debug the Android build-in application and all tools has been built in the folder ./out/host/linux-x86/bin. Follow the steps from http://source.android.com/source/using-eclipse.html.

Note: create a JAVA project. Not a Android project.

7. Launch ./out/hot/linux-x86/bin/ddms to start the debugging. Once ddms starts, attach the Android process on local machine port 8700 to debug.

8. Blocks the selected application from loading until a debugger attaches. This way you can set a breakpoint in onCreate(), which is important to debug the startup process of an Activity. When you change this option, any currently running instances of the selected application will be killed. In order to check this box, you must have selected a debug application as described in the previous option. You can do the same thing by adding waitForDebugger() to your code.

9 after add android.os.Debug.waitForDebugger(); in first line of onCreate of settings.jave, use following command to rebuild the module and image, of course shutdown the emulator first
$ mmm packages/apps/Settings // rebuild the settings apk
$ make snod // rebuild the system.img
then restart the emulator, select settings, now can attach and debug the application startup.





2010年8月16日星期一

Start using Ubuntu

Install the Ubuntu 10.04 today (08/16) on an external USB disk.
- Install KVpnc and vpnc for the VPN client;
- Install Skype;
- Install Eclipse, apt-get install eclipse (it will install the eclipse platform and JDT and OpenJDK);
- Install Sun Java JDK6;
- Install Android ADT and SDK;
- Install moonlight (silverlight) to listen the music online like "www.1ting.com"; 







2010年8月13日星期五

How to install Sun Java 1.5/1.6 on Ubuntu 10.04

Ubuntu (10.04) only supports Java 1.6 (and prefers OpenJDK too). Here's how to get Sun Java 1.5 installed on Ubuntu 10.04:



Add the following to /etc/apt/sources.list:

deb http://us.archive.ubuntu.com/ubuntu/ jaunty multiverse

deb http://us.archive.ubuntu.com/ubuntu/ jaunty-updates multiverse



Update the package list:

sudo apt-get update



Install Sun Java 1.5/1.6:

sudo apt-get install sun-java5-jdk
sudo apt-get install sun-java6-jdk


Depending on your setup you might need to set this as the default. Check what version is default:

java -version


And list all Java versions installed:
sudo update-java-alternatives -l

Then if necessary:
sudo update-java-alternatives -s java-1.5.0-sun
or
sudo update-java-alternatives -s java-1.6.0-sun

2010年8月6日星期五

Learn Android from APK

1. Unpack the APK file by using apktool (http://code.google.com/p/android-apktool/).

Apktool will generate the readable XML files, include the AndroidMenifest.XML and layout XML files. It also will generate the Java bytecode from java class.

2. Rename the APK to ZIP and unzip it, get the DEX file. Using dex2jar (http://code.google.com/p/dex2jar/)
Generate the JAR file.

3. Get Java file by JD (http://java.decompiler.free.fr/).
Generate the java files

4. Using Source Insight to browser the code.

Google Android secret_code for launching hidden activity

Dial *#*#<code>#*#* to launch the hidden activities.

For example:
Dial <*#*#4636#*#*> will be received by "TestingSettingsBroadcastReceiver".

--Phone.java------------------------------------------------------------------------------
static boolean handleSecretCode(Context context, String input) {


// Secret codes are in the form *#*##*#*

int len = input.length();

if (len > 8 && input.startsWith("*#*#") && input.endsWith("#*#*")) {

Intent intent = new Intent(Intents.SECRET_CODE_ACTION,

Uri.parse("android_secret_code://" + input.substring(4, len - 4)));

context.sendBroadcast(intent);

return true;

}


return false;

}
------------------------------------------------------------------------------

<receiver android:name="TestingSettingsBroadcastReceiver">

<intent-filter>
<action android:name="android.provider.Telephony.SECRET_CODE" />
<data android:scheme="android_secret_code" android:host="4636" />
</intent-filter>
</receiver>
------------------------------------------------------------------------------

<receiver android:name="TestingSettingsBroadcastReceiver">

<intent-filter>
<action android:name="android.provider.Telephony.SECRET_CODE" />
<data android:scheme="android_secret_code" android:host="225" />
</intent-filter>
</receiver>




2010年7月23日星期五

Install XP/Windows 7 by command line

硬盘安装XP的实用方法:
用WINPE x86/x64启动, 运行:
winnt32.exe /syspart:c /tempdrive:c /makelocalsource

硬盘安装windows7:
1、imagex /apply d:\sources\install.wim 5 c: (注意,这里5是指ultimate版,要装其它版本把这个数字换成其它)
2、bcdboot c:\windows /s e: /l zh-CN (一条命令搞定bootmgr和bcd,并把启动菜单设成中文的)
3、bootsect /nt60 e: (写入c:盘的bootmgr引导扇区)   
启动即可继续安装.


硬盘安装windows7的高级实用方法:
1、把镜像用虚拟光驱加载,然后拷贝到任一硬盘分区中,我的是E:\windwos7。  


2、把E:\windwos7目录下的bootmgr和boot目录(其实只要里面的boot.sdi和bcd文件)拷贝到c盘根目录下,并在C盘根目录下建个sources文件夹。(原系统是vista的话需要取得权限,覆盖相应文件,取得权限的方法参照vista区的vista优化大师的右键取得管理权限法)  

3、把E:\windwos7\sources下的boot.win复制到C盘下sourse文件夹。  

4、用管理员身份运行cmd,然后输入c:\boot\bootsect.exe /nt60 c:

(注意,此处bootsect在c:\boot目录下),然后提示successful(即成功了!)
再将系统盘的卷名称改为英文:本地磁盘--bdcp  

5、重启计算机,正在启动安装程序  

6、安装程序启动,选择你要安装的语言类型,同时选择适合自己的时间和货币显示种类及键盘和输入方式。  

7、出现“开始安装界面”,(要注意了,不点击“现在安装”)点左下角“修复计算机”(repair my computer)。  

8、进入“系统恢复选项”,选择最后一项“命令提示符”(command prompt),进入DOS窗口。

9、执行格式化命令format c:/q(注:如C盘是FAT32格式,想转NTFS格式的话,执行format c:/fs:ntfs)。
注:此步可能需要输入卷的名称bdcp  

10、安装系统,输入E:windwos7sourcessetup.exe(注意文件路径是在E盘的windwos7文件夹下的sources文件里),之后就是正常的安装了。

2010年7月13日星期二

Visual Studio 2005 Remote Debugging to Vista and Windows 7

When you run MSVSMON.EXE on Vista and Windows 7, do you get the dreaded message indicating that you need to set the firewall, but when you do, MSVSMON.EXE errors out with an Incorrect Function message? After much struggle, I finally found the trick to remote debugging working correctly. Many thanks to this post on the MSDN Forums from Sam George.

It seems that even with the Vista SP1 Update, MSVSMON.EXE does not properly set the firewall. You'll need to set it up manually with the following batch file:


netsh advfirewall firewall add rule name="Microsoft Visual Studio Remote Debugger - UDP 137" dir=in action=allow enable=yes localport=137 protocol=udp

netsh advfirewall firewall add rule name="Microsoft Visual Studio Remote Debugger - UDP 138" dir=in action=allow enable=yes localport=138 protocol=udp

netsh advfirewall firewall add rule name="Microsoft Visual Studio Remote Debugger - TCP 139" dir=in action=allow enable=yes localport=139 protocol=tcp

netsh advfirewall firewall add rule name="Microsoft Visual Studio Remote Debugger - TCP 445" dir=in action=allow enable=yes localport=445 protocol=tcp

Of course, make sure you run the batch file from an elevated command prompt.