- 取得win7 ISO(win7 image 皆包含所有版本)
- 下載refus, 使用他將ISO檔製作開機USB 碟
- 雖然win7 image 皆包含所有版本,但有的ISO 無法選擇版本
- 原因是版本已經寫死在source/ei.cfg,由於已經做成隨身碟,將這個檔案拿掉即可選擇
2014年12月14日 星期日
製作windows7 安裝隨身碟
2011年6月16日 星期四
android honeycomb SPP 連線第二次無法順利連上
遇到SPP連線disconnect之後第二次連接時會丟出exception: Service discovery failed 的問題,
這是因為在BluetoothSocket中做connect時,rfcomm值小於1。
應該是framework內某些邏輯出了問題所導致,
在BluetoothService.java中fetchRemoteUuids()內最後加上updateDeviceServiceChannelCache()可以解決此問題。
這是因為在BluetoothSocket中做connect時,rfcomm值小於1。
應該是framework內某些邏輯出了問題所導致,
在BluetoothService.java中fetchRemoteUuids()內最後加上updateDeviceServiceChannelCache()可以解決此問題。
2011年5月16日 星期一
2011年5月14日 星期六
分析window電源管理的狀況
使用系統管理員權限開啟 cmd.exe,
執行powercfg /energy
會產生一個report的網頁:
C:\Windows\system32\energy-report.html
執行powercfg /energy
會產生一個report的網頁:
C:\Windows\system32\energy-report.html
2011年5月11日 星期三
bluetooth debug
可以使用hcidump擷取所有hci層的資料
直接觀看:
hcidump -XVt
存成binary,使用FTS4BT觀看
hcidump -B -w /tmp/XXX.cfa
直接觀看:
hcidump -XVt
存成binary,使用FTS4BT觀看
hcidump -B -w /tmp/XXX.cfa
2011年4月20日 星期三
android 使用標示為hide的API
framework中,有許多function上面使用@hide標示為隱藏,
在eclipse上面使用也無法編譯
不過可以使用下列方法解決:
http://eeepage.info/java-hide-class/
http://java.sun.com/developer/technicalArticles/ALT/Reflection/
舉例來說,開關softap使用wifiManager.setWifiApEnabled(),
但setWifiApEnabled()標示hide
可以用下列方法直接呼叫:
Method mMethod = mWifiManager.getClass().getMethod("setWifiApEnabled", WifiConfiguration.class, boolean.class);
mMethod.invoke(mWifiManager, new Object[] { null, true });
class.getMethod()的第一個參數為method名稱(字串),後面為這個method自己所需的參數(args)
method.invoke的第一個參數為執行這個method的class, 第二個參數為物件陣列,內容是要傳進此method的參數
在eclipse上面使用也無法編譯
不過可以使用下列方法解決:
http://eeepage.info/java-hide-class/
http://java.sun.com/developer/technicalArticles/ALT/Reflection/
舉例來說,開關softap使用wifiManager.setWifiApEnabled(),
但setWifiApEnabled()標示hide
可以用下列方法直接呼叫:
Method mMethod = mWifiManager.getClass().getMethod("setWifiApEnabled", WifiConfiguration.class, boolean.class);
mMethod.invoke(mWifiManager, new Object[] { null, true });
class.getMethod()的第一個參數為method名稱(字串),後面為這個method自己所需的參數(args)
method.invoke的第一個參數為執行這個method的class, 第二個參數為物件陣列,內容是要傳進此method的參數
標籤:
程式設計,
android,
android app
2011年4月19日 星期二
android 將檔案放入程式在/data下的目錄中
在專案的res下面增加raw資料夾
將需要的檔案放進去(不要包含".")
使用 copyFile("XXX.sh", R.raw.XXX);
存放進去的路徑可使用this.getFilesDir()取得
目錄應該是/data/data/com.YYY.ZZZ/files
將需要的檔案放進去(不要包含".")
使用 copyFile("XXX.sh", R.raw.XXX);
存放進去的路徑可使用this.getFilesDir()取得
目錄應該是/data/data/com.YYY.ZZZ/files
private boolean copyFile(String fName, int rawId){
InputStream inS = null;
OutputStream outS = null;
byte [] buf = new byte[1024];
int readByte = 0;
try {
inS = getApplicationContext().getResources().openRawResource(rawId);
outS = openFileOutput(fName,MODE_PRIVATE);
while((readByte = inS.read(buf, 0, 1024)) != -1){
outS.write(buf, 0, readByte);
}
inS.close();
outS.close();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return true;
}
標籤:
程式設計,
android,
android app
2011年4月2日 星期六
android 使用proxy連接至網路
http://forum.xda-developers.com/showthread.php?t=766569
http://darkk.net.ru/redsocks/
in nexus one(cyanogenmod 7):
eth0/wl0.1
wifi/softap(BCM4329)
lo
loopback
rmnet0
3G
in rooted and installed superuser phone, if run "su root", the superuser program will ask user to confirm root access via UI.
transproxy.apk
This program use redsock internal
This tool allows you to redirect any TCP connection to SOCKS or HTTPS proxy using your firewall, so redirection is system-wide.
after install this program, some file will be placed in data/data/com.hasbox.tproxy/, I found there are some scripts in "files" directory
enable transproxy
sh data/data/com.hasbox.tproxy/files/proxy.sh start /data/data/com.hasbox.tproxy/files type=http host= port= auth=false user= pass=
sh data/data/com.hasbox.tproxy/files/redirect.sh start http
disable transproxy
sh data/data/com.hasbox.tproxy/files/proxy.sh stop /data/data/com.hasbox.tproxy/files
sh data/data/com.hasbox.tproxy/files/redirect.sh stop
when execution /data/data/com.hasbox.tproxy/files/redirect.sh,because android bionic libc not implement getprotobyname(), so there some warning messabe
in my environment, 3G need use proxy but wifi can direct access , so modify redirect.sh, add " -o rmnet0" in each rule, only 3G access use proxy
bugs
android's netd will reset ipatbles when disable tethering(ether wifi or usb), so the setting by transproxy will gone.
must set transproxy.apk after disable tethering
http://darkk.net.ru/redsocks/
in nexus one(cyanogenmod 7):
eth0/wl0.1
wifi/softap(BCM4329)
lo
loopback
rmnet0
3G
in rooted and installed superuser phone, if run "su root", the superuser program will ask user to confirm root access via UI.
transproxy.apk
This program use redsock internal
This tool allows you to redirect any TCP connection to SOCKS or HTTPS proxy using your firewall, so redirection is system-wide.
after install this program, some file will be placed in data/data/com.hasbox.tproxy/, I found there are some scripts in "files" directory
enable transproxy
sh data/data/com.hasbox.tproxy/files/proxy.sh start /data/data/com.hasbox.tproxy/files type=http host= port= auth=false user= pass=
sh data/data/com.hasbox.tproxy/files/redirect.sh start http
disable transproxy
sh data/data/com.hasbox.tproxy/files/proxy.sh stop /data/data/com.hasbox.tproxy/files
sh data/data/com.hasbox.tproxy/files/redirect.sh stop
when execution /data/data/com.hasbox.tproxy/files/redirect.sh,because android bionic libc not implement getprotobyname(), so there some warning messabe
in my environment, 3G need use proxy but wifi can direct access , so modify redirect.sh, add " -o rmnet0" in each rule, only 3G access use proxy
bugs
android's netd will reset ipatbles when disable tethering(ether wifi or usb), so the setting by transproxy will gone.
must set transproxy.apk after disable tethering
標籤:
android,
android app,
linux,
shell script
2011年3月29日 星期二
使用批次檔修改proxy與ip
http://www.robvanderwoude.com/regedit.php
登錄編輯程式: regedit
想要做一個修改某機碼的.reg檔案
可以先開啟登錄編輯程式找到要改的資料夾,匯出後再修改匯出的內容會比較快
============================
判斷目前proxy是否有開啟並反向設定
@ECHO OFF
FOR /F %%A IN ('REG QUERY "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable ^| grep ProxyEnable ^| awk "{print $3}"' ) DO IF "%%A"=="0x1" (call:on) ELSE (call:off)
GOTO:EOF
:on
ECHO =================
ECHO proxy狀態: 開啟
ECHO 關閉proxy中...
regedit /s proxy_off.reg
ECHO 完成
ECHO =================
pause
GOTO:EOF
:off
ECHO =================
ECHO proxy狀態: 關閉
ECHO 開啟proxy中...
regedit /s proxy_on.reg
ECHO 完成
ECHO =================
pause
GOTO:EOF
登錄編輯程式: regedit
想要做一個修改某機碼的.reg檔案
可以先開啟登錄編輯程式找到要改的資料夾,匯出後再修改匯出的內容會比較快
============================
判斷目前proxy是否有開啟並反向設定
@ECHO OFF
FOR /F %%A IN ('REG QUERY "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable ^| grep ProxyEnable ^| awk "{print $3}"' ) DO IF "%%A"=="0x1" (call:on) ELSE (call:off)
GOTO:EOF
:on
ECHO =================
ECHO proxy狀態: 開啟
ECHO 關閉proxy中...
regedit /s proxy_off.reg
ECHO 完成
ECHO =================
pause
GOTO:EOF
:off
ECHO =================
ECHO proxy狀態: 關閉
ECHO 開啟proxy中...
regedit /s proxy_on.reg
ECHO 完成
ECHO =================
pause
GOTO:EOF
2011年3月2日 星期三
避免編譯時產生錯誤 - error: void value not ignored as it ought to be
假設...
int aaa(){
...
}
void bbb(){
...
}
若遇到下面這種寫法
ret=flag? aaa(): bbb();
編譯時會發生錯誤:
error: void value not ignored as it ought to be
因為此時若flag為0,則ret=bbb();
但是bbb()沒有回傳東西(void),
此時可以使用下面這種寫法:
ret=flag? aaa(): (bbb(),NULL);
其中(bbb(),NULL)永遠回傳0(NULL)
http://en.wikipedia.org/wiki/Comma_operator
int aaa(){
...
}
void bbb(){
...
}
若遇到下面這種寫法
ret=flag? aaa(): bbb();
編譯時會發生錯誤:
error: void value not ignored as it ought to be
因為此時若flag為0,則ret=bbb();
但是bbb()沒有回傳東西(void),
此時可以使用下面這種寫法:
ret=flag? aaa(): (bbb(),NULL);
其中(bbb(),NULL)永遠回傳0(NULL)
http://en.wikipedia.org/wiki/Comma_operator
標籤:
C programming
2011年2月25日 星期五
script內判斷cpu數量
CPUs=$(echo `cat /proc/cpuinfo | grep processor | tail -1 | awk'{print $3}'` +1 | bc)
標籤:
linux,
shell script
2011年2月23日 星期三
TCXO
TCXO (Temperature Compensate X'tal (crystal) Oscillator)
具有溫度補償的石英震盪器, 提供高精準度的頻率輸出(因為通常震盪頻率會因為溫度而改變)
http://baike.baidu.com/view/1010371.htm
具有溫度補償的石英震盪器, 提供高精準度的頻率輸出(因為通常震盪頻率會因為溫度而改變)
http://baike.baidu.com/view/1010371.htm
2011年2月15日 星期二
windows: 不允許使用多於一個使用者名稱的相同使用者有多個連線到一個伺服器或共用資源
架了一台samba server
不過在windows上面要登入時卻出現這個訊息
"不允許使用多於一個使用者名稱的相同使用者有多個連線到一個伺服器或共用資源"
可以使用net use指令看是否有連線存在
再使用net use \\XXX.XXX.XXX.XXX\YYY /del 刪除此連線
參考
http://freetoad.pixnet.net/blog/post/23509679
不過在windows上面要登入時卻出現這個訊息
"不允許使用多於一個使用者名稱的相同使用者有多個連線到一個伺服器或共用資源"
可以使用net use指令看是否有連線存在
再使用net use \\XXX.XXX.XXX.XXX\YYY /del 刪除此連線
參考
http://freetoad.pixnet.net/blog/post/23509679
2011年2月14日 星期一
製作win7 usb 安裝隨身碟
在eeepc 901上面,
使用微軟的工具製作的隨身碟無法開機(http://store.microsoft.com/help/iso-tool)
後來發現使用HPUSBFW就可以使用
參考
http://www.umpcfever.com/viewthread.php?tid=4409
1.使用HPUSBFW格式化隨身碟, 並建立開機磁區
2.掛載win7 iso
3.複製cdrom內容至隨身碟
4.把Windows 7 開機檔灌入USB當中(ex:H:\boot\bootsect /nt60 F: )
使用微軟的工具製作的隨身碟無法開機(http://store.microsoft.com/help/iso-tool)
後來發現使用HPUSBFW就可以使用
參考
http://www.umpcfever.com/viewthread.php?tid=4409
1.使用HPUSBFW格式化隨身碟, 並建立開機磁區
2.掛載win7 iso
3.複製cdrom內容至隨身碟
4.把Windows 7 開機檔灌入USB當中(ex:H:\boot\bootsect /nt60 F: )
2011年2月9日 星期三
ubuntu 連接wep加密AP密碼編碼的問題
AP使用wep 64(40)bit 加密, 密碼設定為1234567890, 為hex格式
不過ubuntu連線時卻無法成功
原因可能是因為把1234567890轉成ascii時,第一個ascii "12"(18)為不可顯示字元,
所以就直接把1234567890當成ascii所導致
不過ubuntu連線時卻無法成功
原因可能是因為把1234567890轉成ascii時,第一個ascii "12"(18)為不可顯示字元,
所以就直接把1234567890當成ascii所導致
2011年2月8日 星期二
android kernel menuconfig
in BSP directory:
source build/envsetup.sh
make ONE_SHOT_MAKEFILE=`pwd`/kernel/AndroidKernel.mk kernelconfig
source build/envsetup.sh
make ONE_SHOT_MAKEFILE=`pwd`/kernel/AndroidKernel.mk kernelconfig
標籤:
android,
linux kernel
2011年1月19日 星期三
修改android裝置的boot image
參考此網頁
http://android-dls.com/wiki/index.php?title=HOWTO:_Unpack,_Edit,_and_Re-Pack_Boot_Images
一開始要先有手機的root的權限,
取得分割表名稱
cat /proc/mtd
抓出boot.img
cat /device/mtdXX > /data/boot.img
使用上面網址提供的unpack-bootimg.pl來解開boot.img
修改完root file system 需要重包成myboot.img
mkbootfs ./boot.img-ramdisk | minigzip > my-ramdisk.cpio.gz
mkbootimg --kernel ./boot.img-kernel.gz --ramdisk my-ramdisk.cpio.gz --pagesize 2048 --cmdline 'mem=203M console=ttyMSM2 androidboot.hardware=qctmsm7x27surf' --base 0x12c00000 --output myboot.img
將device開到fastboot mode, 使用fastboot燒錄myboot.img
fastboot erase bot
fastboot flash boot myboot.img
fastboot reboot
=================================================================
若系統抓得到USB裝置,但fastboot無法抓到,可能是fastboot內沒有內建此裝置的vid, 隨便找一個android的source,到system/core/fastboot/fastboot.c加入自己的vid(可用lsusb查看vid/pid)再重編fastboot就可以了
source ../../../build/envsetup.sh;
mm;
--base的參數可由原本取出的boot.img得知
in bsp/system/core/mkbootimg/mkbootimg.c
kernel的offset為0x10008000
包成的myboot.img 最前面為一個struct boot_img_hdr
in bsp/system/core/mkbootimg/bootimg.h
boot_img_hdr 的kernel_addr在12-16 byte
使用16進位編輯器去讀取boot.img的2-16 byte(little endian)減掉kernel的offset(0x10008000)即可算出--base所需的參數
--cmdline內容也可經由16進位編輯器去讀取boot.img看到(boot_img_hdr.cmdline)
要注意的是使用unpack-bootimg.pl切出來的kernel大小可能是錯的(後面有一些多餘資料?)
實際大小須參考boot.img中的boot_img_hdr.kernel_size
然後修改mkbootimg.c, 在讀取完kernel後將boot_img_hdr.kernel_size設成正確大小
之後重編並使用此版本的mkbootimg才可正常開機
http://android-dls.com/wiki/index.php?title=HOWTO:_Unpack,_Edit,_and_Re-Pack_Boot_Images
一開始要先有手機的root的權限,
取得分割表名稱
cat /proc/mtd
抓出boot.img
cat /device/mtdXX > /data/boot.img
使用上面網址提供的unpack-bootimg.pl來解開boot.img
修改完root file system 需要重包成myboot.img
mkbootfs ./boot.img-ramdisk | minigzip > my-ramdisk.cpio.gz
mkbootimg --kernel ./boot.img-kernel.gz --ramdisk my-ramdisk.cpio.gz --pagesize 2048 --cmdline 'mem=203M console=ttyMSM2 androidboot.hardware=qctmsm7x27surf' --base 0x12c00000 --output myboot.img
將device開到fastboot mode, 使用fastboot燒錄myboot.img
fastboot erase bot
fastboot flash boot myboot.img
fastboot reboot
=================================================================
若系統抓得到USB裝置,但fastboot無法抓到,可能是fastboot內沒有內建此裝置的vid, 隨便找一個android的source,到system/core/fastboot/fastboot.c加入自己的vid(可用lsusb查看vid/pid)再重編fastboot就可以了
source ../../../build/envsetup.sh;
mm;
--base的參數可由原本取出的boot.img得知
in bsp/system/core/mkbootimg/mkbootimg.c
kernel的offset為0x10008000
包成的myboot.img 最前面為一個struct boot_img_hdr
in bsp/system/core/mkbootimg/bootimg.h
boot_img_hdr 的kernel_addr在12-16 byte
使用16進位編輯器去讀取boot.img的2-16 byte(little endian)減掉kernel的offset(0x10008000)即可算出--base所需的參數
--cmdline內容也可經由16進位編輯器去讀取boot.img看到(boot_img_hdr.cmdline)
要注意的是使用unpack-bootimg.pl切出來的kernel大小可能是錯的(後面有一些多餘資料?)
實際大小須參考boot.img中的boot_img_hdr.kernel_size
然後修改mkbootimg.c, 在讀取完kernel後將boot_img_hdr.kernel_size設成正確大小
之後重編並使用此版本的mkbootimg才可正常開機
2011年1月14日 星期五
android 模擬SD card裝上
mkdir /data/virtual_sdcard
mount -o remount,rw /
rm /sdcard
ln -s /data/virtual_sdcard /sdcard
setprop EXTERNAL_STORAGE_MOUNT /sdcard
因為沒有sdcard
這樣做homerun battle第一次啟動就可以下載資料檔了
mount -o remount,rw /
rm /sdcard
ln -s /data/virtual_sdcard /sdcard
setprop EXTERNAL_STORAGE_MOUNT /sdcard
因為沒有sdcard
這樣做homerun battle第一次啟動就可以下載資料檔了
android 定時執行script
可以使用phonePrioritizer:
http://forum.xda-developers.com/showthread.php?t=558822&highlight=phoneprioritizer
可以自己寫scritp放在/sdcard/phonePrioritizer/script.txt內
然後使用UI設定執行時間間隔
也可以設定定時關機與開機時要做什麼
http://forum.xda-developers.com/showthread.php?t=558822&highlight=phoneprioritizer
可以自己寫scritp放在/sdcard/phonePrioritizer/script.txt內
然後使用UI設定執行時間間隔
也可以設定定時關機與開機時要做什麼
訂閱:
文章 (Atom)

