R40eUbuntu-Sempron26Debian

ubuntu 在 R40e 上 還有 Debian 在 Sempron 2600 上

2012年2月23日星期四

android 內含 ? kernel 的 build script。
會參考

create my kernel defconfig file

kernel config 中增加一個新的 defconfig.

defconfig 的內容還是會經過所有 Kconfig 的檢驗,所以最好是用 make menuconfig 產生 .config 後,
再 copy 到 arch/XXX/configs/ 下

要注意,檔名結尾一定要是 _defconfig,因為 makefile 是用 *_defconfig 來找所有 config file。



以增加一個 boot splash logo option 為例:

在 drivers/video/logo/Kconfig 增加一個 entry: config LOGO_TOB bool "tob" default n
然後 drivers/video/logo/Makefile 增加: obj-$(CONFIG_LOGO_TOB) += logo_tob_clut224.o
然後做好 logo_tob_clut224.ppm

這邊要注意一下,Makefile 是依照filename 最後的 clut224, mono, vga16 等字樣,
用不同的 convert program 轉成 c

make 確認 OK 後,就可以把 .config copy 到 arch/arm/configs/imx_tob_defconfig

最後測試: make distclean && make imx_tob_defconfig && make uImage

2012年2月22日星期三

property_get, set 在 /system/core/libcutils/properties.c

裡面implement 三種方法,分別依有否定義
  1. HAVE_LIBC_SYSTEM_PROPERTIES
  2. HAVE_SYSTEM_PROPERTY_SERVER
而有不同。
兒這些定義非別定義在:
/system/core/include/arch/....

裡面, linux-arm, linux-x86 .. 分別使用不同的定義。

linux-arm 使用 HAVE_LIBC_SYSTEM_PROPERTIES..


Service Socket 定義在 bionic: ./bionic/libc/include/sys/_system_properties.h:#define PROP_SERVICE_NAME "property_service" Service 啟動在 /system/core/init/property_service.c:

property_set 是由 property server (listen socket) 提供。
property_get 由 libc 的 system_property_xxx 提供,直接由一塊記憶體中讀取。<br>

2012年2月15日星期三

Unhandled fault: external abort on non-linefetch (0x1018) at 0x2b7d0054 -- imx android

from :
http://imxcommunity.org/profiles/blogs/what-is-the-error-message-unhandled-fault-external-abort-on-non

他說:
It is not the error message, it just means Freescale MMCodec had been used, such information was generated by MMCodec in liscense checking.

真糟。

驗證的方法就是follow 他的說明,把 codec 都關掉: To disable the FSL codec, in init.rc, set the followed parameters to 0 # fsl omx graphic manager media framework property setprop media.omxgm.enable-player 0 setprop media.omxgm.enable-record 0 setprop media.omxgm.enable-scan 0
結果 這個 unhandled exception 真的都沒出現了。

2012年2月14日星期二

D-Link HSPDA Dongle - DWN-156

會先出現 cd rom,然後要切 modeswitch,才會出現 serial port。
在 windows 上會出現三個 serial port (其中一個是 USB Modem):
  1. D-Link HSPDA DataCard Diagnostics Interface
  2. D-Link HSPDA DataCard NMEA Device
  3. D-Link HSPDA DataCard Propertiery USB Modem

這又是一個 有 usb cdrom 模式的 3g dongle。
剛插入系統,會是 cd rom。
要先 switch 到 modem 後,才會出現 usb serial。

剛插入時,vid , pid 是:
New USB device found, idVendor=07d1, idProduct=a804
mount 再 umount 後,vid, pid 是:
New USB device found, idVendor=07d1, idProduct=7e11
但是這時後也沒有出現 usb serial port。



大概用兩個步驟:
  1. usb-modeswitch, 切換到 modem mode
  2. 手動 load usb-serial ,指定 vid, pid

usb-modeswitch:

debian 已經有安裝,但是 /etc/usb_modeswitch.d/ 下面沒有 07d1:a804 的設定檔,
所以要寫 /etc/usb_modeswitch.d/ 下的 vid:pid 檔:
sudo vi /etc/usb_modeswitch.d/07d1:a804 ######################################################## # D-Link DWM-156 HSUPA 3.75G USB Modem DefaultVendor= 0x07d1 DefaultProduct=0xa804 TargetVendor= 0x07d1 TargetProduct= 0x7e11 MessageContent="5553424312345678000000000000061b000000020000000000000000000000" CheckSuccess=20 寫好就可以用 usb_modeswitch 來切了..

先插入 dwn-156, dmesg 內容是: [25387.281621] usb 2-1.1.4.2: new high speed USB device using ehci_hcd and address 19 [25387.391940] usb 2-1.1.4.2: New USB device found, idVendor=07d1, idProduct=a804 [25387.391946] usb 2-1.1.4.2: New USB device strings: Mfr=3, Product=2, SerialNumber=4 [25387.391950] usb 2-1.1.4.2: Product: D-Link WCDMA Technologies MSM [25387.391954] usb 2-1.1.4.2: Manufacturer: D-Link,Incorporated [25387.391957] usb 2-1.1.4.2: SerialNumber: MF112DDLKD010000 [25387.392114] usb 2-1.1.4.2: configuration #1 chosen from 1 choice [25387.394534] scsi16 : SCSI emulation for USB Mass Storage devices [25387.394655] usb-storage: device found at 19 [25387.394659] usb-storage: waiting for device to settle before scanning [25392.392130] usb-storage: device scan complete [25392.392810] scsi 16:0:0:0: CD-ROM HSPA USB SCSI CD-ROM 2.31 PQ: 0 ANSI: 2 [25392.397282] sr1: scsi-1 drive [25392.397481] sr 16:0:0:0: Attached scsi CD-ROM sr1 [25392.397632] sr 16:0:0:0: Attached scsi generic sg4 type 5 用 usb_modeswitch 來切換 mode: $ sudo usb_modeswitch -c /etc/usb_modeswitch.d/07d1:a804 Looking for target devices ... No devices in target mode or class found Looking for default devices ... Found devices in default mode or class (1) Accessing device 022 on bus 002 ... Using endpoints 0x01 (out) and 0x81 (in) Using endpoints 0x01 (out) and 0x81 (in) Inquiring device details; driver will be detached ... Looking for active driver ... OK, driver found ("usb-storage") OK, driver "usb-storage" detached SCSI inquiry data (for identification) ------------------------- Vendor String: HSPA Model String: USB SCSI CD-ROM Revision String: 2.31 ------------------------- USB description data (for identification) ------------------------- Manufacturer: D-Link,Incorporated Product: D-Link WCDMA Technologies MSM Serial No.: MF112DDLKD010000 ------------------------- Setting up communication with interface 0 ... Using endpoint 0x01 for message sending ... Trying to send message 1 to endpoint 0x01 ... OK, message successfully sent Resetting response endpoint 0x81 Resetting message endpoint 0x01 Checking for mode switch (max. 20 times, once per second) ... Waiting for original device to vanish ... Waiting for original device to vanish ... Original device can't be accessed anymore. Good. Searching for target devices ... Found correct target device Mode switch succeeded. Bye.
看一下 dmesg: [38715.226573] usb 2-1.1.4.2: new high speed USB device using ehci_hcd and address 23 [38715.337316] usb 2-1.1.4.2: New USB device found, idVendor=07d1, idProduct=7e11 [38715.337321] usb 2-1.1.4.2: New USB device strings: Mfr=3, Product=2, SerialNumber=4 [38715.337324] usb 2-1.1.4.2: Product: D-Link WCDMA Technologies MSM [38715.337327] usb 2-1.1.4.2: Manufacturer: D-Link,Incorporated [38715.337329] usb 2-1.1.4.2: SerialNumber: MF112DDLKD010000 [38715.337460] usb 2-1.1.4.2: configuration #1 chosen from 1 choice
已經切換了。

然後動 load usb-serial module,指定 vid,pid sudo modprobe usbserial vendor=0x07d1 product=0x7e11
dmesg 可以看到 ttyUSB 出現: [38715.339951] usbserial_generic 2-1.1.4.2:1.0: generic converter detected [38715.340069] usb 2-1.1.4.2: generic converter now attached to ttyUSB0 [38715.340178] usbserial_generic 2-1.1.4.2:1.1: generic converter detected [38715.340280] usb 2-1.1.4.2: generic converter now attached to ttyUSB1 [38715.340537] scsi20 : SCSI emulation for USB Mass Storage devices [38715.340695] usb-storage: device found at 23 [38715.340699] usb-storage: waiting for device to settle before scanning [38715.340788] usbserial_generic 2-1.1.4.2:1.3: generic converter detected [38715.340889] usb 2-1.1.4.2: generic converter now attached to ttyUSB2 [38720.337127] usb-storage: device scan complete

這時候,在 panel 的 network widget 就可以看到 "Chungwha Telecom..",
打勾 就可以連上了。



ref: http://www.draisberghof.de/usb_modeswitch/bb/viewtopic.php?t=817&sid=e08d0632f3a91e6379a0367bd258809c

2012年2月9日星期四

Android Set System Time.

/framework/base/libs/utils/SystemClock.cpp:
#if HAVE_ANDROID_OS fd = open("/dev/alarm", O_RDWR); if(fd < 0) { LOGW("Unable to open alarm driver: %s\n", strerror(errno)); return -1; } ts.tv_sec = tv.tv_sec; ts.tv_nsec = tv.tv_usec * 1000; res = ioctl(fd, ANDROID_ALARM_SET_RTC, &ts); if(res < 0) { LOGW("Unable to set rtc to %ld: %s\n", tv.tv_sec, strerror(errno)); ret = -1; } close(fd); #else if (settimeofday(&tv, NULL) != 0) { LOGW("Unable to set clock to %d.%d: %s\n", (int) tv.tv_sec, (int) tv.tv_usec, strerror(errno)); ret = -1; } #endif 可以看到 Android 設定系統時間,用 ioctl,不能直接 call settimeofday.

settimeofday ,系統時間會改,但是 RTC 不會改, 所以 system reboot 後,時間還是沒變更。




手動設會有 D/SystemClock( 2399): Setting time of day to sec=31622433 D/ ( 2269): enter Cmd: L D/dalvikvm( 2269): GC_CONCURRENT freed 1061K, 45% free 2224K/3971K, external 3688K/4325K, paused 3ms+3ms D/AlarmManagerService( 2269): Kernel timezone updated to -540 minutes west of GMT

Time Sync with GPS

Time Sync with GPS
  1. 設定 enable/disable 放在 Settings.system 中
  2. 應該由 Location Service 讀取內容,負責動作。
Location Service 和 hardware gps 的分層負責就因人而異了。

可以增加 interface (?),讓 service 告知 gps driver 收到 gps time nmea data 時,set system time。
也可以 service 自己作,當取得 nmea time data 時,依照 Setting 內容決定。

要sync system time 的時機:
  1. 改 Auto Sync 設定時
  2. GPS lock 時
所以要寫在兩個地方,互相 check 對方。

但是要確認 gps driver , check lock 的時間,要比 server 啟動, check system setting 的後面才行。
否則就會不同步。



直接把 GPS NMEA Channel cat 出來.. (只列出 GPRMC)..並且修改 location data.. (所以 checksum 是錯的) $GPRMC,080058.000,A,2502.9061,N,14122.4832,E,0.00,0.00,090212,,,A*6x $GPRMC,080100.000,A,2502.9061,N,14122.4832,E,0.00,0.00,090212,,,A*6x $GPRMC,080101.000,A,2502.9061,N,14122.4832,E,0.00,0.00,090212,,,A*6x $GPRMC,080102.000,A,2502.9061,N,14122.4832,E,0.00,0.00,090212,,,A*6x GPRMC format : (http://aprs.gids.nl/nmea/#rmc)
eg1. $GPRMC,081836,A,3751.65,S,14507.36,E,000.0,360.0,130998,011.3,E*62
eg2. $GPRMC,225446,A,4916.45,N,12311.12,W,000.5,054.7,191194,020.3,E*68


           225446       Time of fix 22:54:46 UTC
           A            Navigation receiver warning A = OK, V = warning
           4916.45,N    Latitude 49 deg. 16.45 min North
           12311.12,W   Longitude 123 deg. 11.12 min West
           000.5        Speed over ground, Knots
           054.7        Course Made Good, True
           191194       Date of fix  19 November 1994
           020.3,E      Magnetic variation 20.3 deg East
           *68          mandatory checksum
GPS FIX 的資料是在 $GPGGA - Global Positioning System Fix Data (http://aprs.gids.nl/nmea/)
eg2. $--GGA,hhmmss.ss,llll.ll,a,yyyyy.yy,a,x,xx,x.x,x.x,M,x.x,M,x.x,xxxx

hhmmss.ss = UTC of position 
llll.ll = latitude of position
a = N or S
yyyyy.yy = Longitude of position
a = E or W 
x = GPS Quality indicator (0=no fix, 1=GPS fix, 2=Dif. GPS fix) 
xx = number of satellites in use 
x.x = horizontal dilution of precision 
x.x = Antenna altitude above mean-sea-level
M = units of antenna altitude, meters 
x.x = Geoidal separation
M = units of geoidal separation, meters 
x.x = Age of Differential GPS data (seconds) 
xxxx = Differential reference station ID 
其中 'GPS Quality indicator' 就是 FIX 的狀態..
實際的資料: (pull-out gps antenna): $GPGGA,000935.066,0000.0000,N,00000.0000,E,0,00,,0.0,M,0.0,M,,0000*4C $GPGGA,000936.064,0000.0000,N,00000.0000,E,0,00,,0.0,M,0.0,M,,0000*4D $GPGGA,000938.066,0000.0000,N,00000.0000,E,0,00,,0.0,M,0.0,M,,0000*41 $GPGGA,000940.075,0000.0000,N,00000.0000,E,0,00,,0.0,M,0.0,M,,0000*4C $GPGGA,000941.065,0000.0000,N,00000.0000,E,0,00,,0.0,M,0.0,M,,0000*4C

標籤

網誌存檔