On Fri, Feb 20, 2009 at 9:10 AM, Jack stone <lsb6...@sina.com> wrote:
> > David Turner , thank for your reply. > And now my /dev/ttyVSP0 can't be opened in android, if it is > opened ,then kernel panic. It' s big problem. > mmm, it certainly means a buggy driver in your kernel. There is no way a user program should crash the kernel if it is properly written. > > By the way, if /dev/ttyVSP0(a char device map to uart 0) driver works > well, i just need to implement reference-ril.c, such as(1) change the > Open() device,(2)modify AT command for my GSM module. Like this , > radio will work. > If I remember correctly, the reference ril uses the serial device to implement the AT command channel, but data itself will go through a different device file, connected to the pppd daemon. Depending on how your GSM module is implemented, you might want to change this too. But apart from that, yes; that's the plan > > If i need to modify other files under ril directory? > > > On 2月20日, 上午6时18分, David Turner <di...@android.com> wrote: > > the value of errno should give you more information about the error. I > > suspect a permission problem, but I don't know how these are setup in the > > system for device files. > > > > On Thu, Feb 19, 2009 at 11:04 AM, dephon...@gmail.com > > <dephon...@gmail.com>wrote: > > > > > > > > > > > > > Hi, all: > > > > > I am porting Android GSM CALL function to my EVB. I have a /dev/ > > > ttyVSP0 device which used to send AT command. > > > > > But fd = open ("/dev/ttyVSP0", O_RDWR); always returen -1 in mainLoop > > > () (locate in reference-ril.c). > > > > > My code looks like this: > > > > > static void * mainLoop(void *param) //reference-ril.c > > > > > {..... > > > > > while (fd < 0) { > > > > > if (s_port > 0) { > > > > > fd = socket_loopback_client(s_port, SOCK_STREAM); > > > > > LOGI("mainLoop 111\n"); > > > > > } else if (s_device_socket) { > > > > > fd = socket_local_client( s_device_path, > > > > > ANDROID_SOCKET_NAMESPACE_FILESYSTEM, > > > > > SOCK_STREAM ); > > > > > LOGI("mainLoop 222\n"); > > > > > } else if (s_device_path != NULL) { > > > > > LOGI("mainLoop 333\n"); > > > > > fd = open (s_device_path, O_RDWR); > > > > > LOGI("mainLoop open return %d.\n", fd); > > > > > if ( fd >= 0 && !memcmp( s_device_path, "/dev/ > > > ttyVSP0", 12 ) ) { > > > > > /* disable echo on serial ports */ > > > > > struct termios ios; > > > > > tcgetattr( fd, &ios ); > > > > > ios.c_lflag = 0; /* disable ECHO, ICANON, etc... > > > */ > > > > > tcsetattr( fd, TCSANOW, &ios ); > > > > > LOGI("mainLoop 444\n"); > > > > > } > > > > > } > > > > > if (fd < 0) { > > > > > perror ("opening AT interface. retrying..."); > > > > > LOGI("mainLoop 555\n"); > > > > > sleep(10); > > > > > /* never returns */ > > > > > } > > > > > else > > > > > { > > > > > LOGI("mainLoop exit while\n"); > > > > > } > > > > > ...... > > > } > > > > > My debug info is (Just get by: logcat -b radio) > > > > > # logcat -b radio > > > > > I/RIL ( 408): Opening tty device /dev/ttyVSP0 > > > > > I/RIL ( 408): mainLoop 333 > > > > > I/RIL ( 408): mainLoop open return -1. > > > > > I/RIL ( 408): mainLoop 555 > > > > > I/RIL ( 408): mainLoop 333 > > > > > I/RIL ( 408): mainLoop open return -1. > > > > > I/RIL ( 408): mainLoop 555 > > > > > I/RIL ( 408): mainLoop 333 > > > > > I/RIL ( 408): mainLoop open return -1. > > > > > I/RIL ( 408): mainLoop 555 > > > > > I/RIL ( 408): mainLoop 333 > > > > > I/RIL ( 408): mainLoop open return -1. > > > > > I/RIL ( 408): mainLoop 555 > > > > > I/RIL ( 408): mainLoop 333 > > > > > I/RIL ( 408): mainLoop open return -1. > > > > > I/RIL ( 408): mainLoop 555 > > > > > I/RILJ ( 455): Connected to 'rild' socket > > > > > I/RILC ( 408): libril: new connection > > > > > I/RILC ( 408): RIL Daemon version: zmzmzm reference-ril 1.0 > > > > > D/RILJ ( 455): [UNSL]< UNSOL_RESPONSE_RADIO_STATE_CHANGED > > > RADIO_UNAVAILABLE > > > > > W/GSM ( 455): Can't open /system/etc/voicemail-conf.xml > > > > > D/RILJ ( 455): [0000]> GET_CURRENT_CALLS > > > > > D/GSM ( 455): Poll ServiceState done: oldSS=[1 home null null > > > null ] newSS=[1 home null null null ] oldGprs=1 newGprs=1 > > > oldType=unknown newType=unknown > > > > > D/RIL ( 408): onRequest: GET_CURRENT_CALLS > > > > > D/RILJ ( 455): [0000]< GET_CURRENT_CALLS error: > > > com.android.internal.telephony.gsm.CommandException: > > > RADIO_NOT_AVAILABLE > > > > > D/GSM ( 455): [DataConnectionTracker] Radio is off and clean up > > > all connection > > > > > D/GSM ( 455): [DataConnectionTracker] Clean up connection due to > > > radioTurnedOff > > > > > D/GSM ( 455): [DataConnection] Stop poll NetStat > > > > > D/GSM ( 455): [DataConnectionTracker] setState: IDLE > > > > > D/GSM ( 455): [DataConnection] Stop poll NetStat > > > > > D/GSM ( 455): [DataConnectionTracker] ***trySetupData due to > > > roamingOff > > > > > D/GSM ( 455): [DataConnectionTracker] trySetupData: Not ready for > > > data: dataState=IDLE gprsState=1 sim=false UMTS=false phoneState=IDLE > > > dataEnabled=true roaming=false dataOnRoamingEnable=false > > > > > D/GSM ( 455): [GsmSimCard] Broadcasting intent > > > SIM_STATE_CHANGED_ACTION NOT_READY reason null > > > > > I/RIL ( 408): mainLoop 333 > > > > > I/RIL ( 408): mainLoop open return -1. > > > > > I/RIL ( 408): mainLoop 555 > > > > > D/STK ( 455): StkAppService$ServiceHandler: OP_BOOT_COMPLETED > > > > > I/RIL ( 408): mainLoop 333 > > > > > I/RIL ( 408): mainLoop open return -1. > > > > > I/RIL ( 408): mainLoop 555 > > > > > I/RIL ( 408): mainLoop 333 > > > > > I/RIL ( 408): mainLoop open return -1. > > > > > I/RIL ( 408): mainLoop 555 > > > > > I/RIL ( 408): mainLoop 333 > > > > > I/RIL ( 408): mainLoop open return -1. > > > > > I/RIL ( 408): mainLoop 555 > > > > > I/RIL ( 408): mainLoop 333 > > > > > I/RIL ( 408): mainLoop open return -1. > > > > > I/RIL ( 408): mainLoop 555 > > > > > I/RIL ( 408): mainLoop 333 > > > > > I/RIL ( 408): mainLoop open return -1. > > > > > I/RIL ( 408): mainLoop 555 > > > > > I/RIL ( 408): mainLoop 333 > > > > > I/RIL ( 408): mainLoop open return -1. > > > > > I/RIL ( 408): mainLoop 555 > > > > > [ 121.580000] android_power: sleep (0->2) at 121572574640 (1970-01-01 > > > 00:02:01.572582011 UTC) > > > > > My /dev info: > > > > > # ls -l /dev/ttyVSP0 > > > > > crw------- root root 250, 0 1970-01-01 00:00 ttyVSP0 > > > > > # ls -l /system/lib/libreference-ril.so > > > > > -rw-r--r-- system system 21896 2009-02-02 03:41 libreference- > > > ril.so > > > > > # ls -l /system/lib/libril.so > > > > > -rw-r--r-- system system 27112 2009-02-02 03:27 libril.so > > > > > £š2£(c)If i chang /dev/ttyVSP0£¬Open("/dev/ttyVSP0") successful, bu > > > kernel panic. if i chmod 772, Open() OK£¬ otherwise (such as 644, 774, > > > 744) permission defiend: > > > > > # /system/bin/rild -l /system/lib/libreference-ril.so -- -d /dev/ > > > ttyVSP0 > > > > > opening AT interface. retrying...: Permission denied > > > > > # chmod 644 /dev/ttyVSP0 > > > > > # /system/bin/rild -l /system/lib/libreference-ril.so -- -d /dev/ > > > ttyVSP0 > > > > > opening AT interface. retrying...: Permission denied > > > > > # chmod 744 /dev/ttyVSP0 > > > > > # /system/bin/rild -l /system/lib/libreference-ril.so -- -d /dev/ > > > ttyVSP0 > > > > > opening AT interface. retrying...: Permission denied > > > > > # chmod 772 /dev/ttyVSP0 > > > > > #/system/bin/rild -l /system/lib/libreference-ril.so -- -d /dev/ > > > ttyVSP0 > > > > > [ 140.940000] > > > > > [ 140.940000] MUTEX_LOCK = 0 > > > > > [ 140.950000] > > > > > [ 140.950000] MUTEX_LOCK = 0 > > > > > [ 140.950000] > > > > > [ 140.950000] MUTEX_LOCK = 0 > > > > > [ 140.960000] > > > > > [ 140.960000] MUTEX_LOCK = 0 > > > > > [ 140.960000] vsp_tty_open: port number 0 //but mainLoop still > > > while (fd < 0) > > > > > Kernel panic info: > > > > > # chmod 777 /dev/ttyVSP0 > > > > > [ 247.690000] > > > > > [ 247.690000] MUTEX_LOCK = 0 > > > > > [ 247.690000] > > > > > [ 247.690000] MUTEX_LOCK = 0 > > > > > [ 247.690000] > > > > > [ 247.690000] MUTEX_LOCK = 0 > > > > > [ 247.700000] > > > > > [ 247.700000] MUTEX_LOCK = 0 > > > > > [ 247.700000] vsp_tty_open: port number 0 //this is my debug > > > info in my VSP driver. > > > > > [ 247.920000] Unable to handle kernel NULL pointer dereference at > > > virtual address 00000000 > > > > > [ 247.920000] pgd = c0004000 > > > > > [ 247.920000] [00000000] *pgd=00000000 > > > > > [ 247.920000] Internal error: Oops: 817 [#1] PREEMPT > > > > > [ 247.920000] Modules linked in: > > > > > [ 247.920000] CPU: 0 Not tainted (2.6.25 #31) > > > > > [ 247.920000] PC is at ghdi_gpdma_set_property+0x2cc/0x388 > > > > > [ 247.920000] LR is at 0xc02dfc50 > > > > > [ 247.920000] pc : [<c0196dbc>] lr : [<c02dfc50>] psr: 60000093 > > > > > [ 247.920000] sp : c68b1f20 ip : 00000000 fp : c68b1f44 > > > > > [ 247.920000] r10: 00000000 r9 : 00000001 r8 : ffc00000 > > > > > [ 247.920000] r7 : c02df5d0 r6 : c68b1f68 r5 : 00000000 r4 : > > > 00000001 > > > > > [ 247.920000] r3 : 00000000 r2 : 0000058f r1 : c68b0000 r0 : > > > 00000000 > > > > > [ 247.920000] Flags: nZCv IRQs off FIQs on Mode SVC_32 ISA ARM > > > Segment kernel > > > > > [ 247.920000] Control: 0005317f Table: 473bc000 DAC: 00000017 > > > > > [ 247.920000] Process swapper (pid: 224, stack limit = 0xc68b0268) > > > > > [ 247.920000] Stack: (0xc68b1f20 to 0xc68b2000) > > > > > [ 247.920000] 1f20: c0193b80 20000013 c68b1f44 00000000 c68b1f68 > > > c882ab6c c68b1fa4 c68b1f48 > > > > > [ 247.920000] 1f40: c0195aa8 c0196b00 00000000 40000013 468d3000 > > > 00000000 c02df5f8 0000011a > > > > > [ 247.920000] 1f60: 468d3000 c7355400 0000058f 00000400 0000011a > > > 2002e010 c0141c40 0000011a > > > > > [ 247.920000] 1f80: 00000000 c02df5f8 00000000 00000000 00000000 > > > c02df5d0 c68b1ff4 c68b1fa8 > > > > > [ 247.920000] 1fa0: c01961dc c0195908 00000000 00000000 00000001 > > > 00000000 c68b1fb8 c68b1fb8 > > > > > [ 247.920000] 1fc0: 2002d7b0 00000010 00000000 00000000 00000000 > > > 00000000 00000000 00000000 > > > > > [ 247.920000] 1fe0: 00000000 00000000 00000000 c68b1ff8 c003eef0 > > > c0195e50 00000000 00000000 > > > > > [ 247.920000] Backtrace: > > > > > [ 247.920000] [<c0196af0>] (ghdi_gpdma_set_property+0x0/0x388) from > > > [<c0195aa8>] (vsp_read+0x1b0/0x4f8) > > > > > [ 247.920000] r6:c882ab6c r5:c68b1f68 r4:00000000 > > > > > [ 247.920000] [<c01958f8>] (vsp_read+0x0/0x4f8) from [<c01961dc>] > > > (crm_manager_a9+0x39c/0x578) > > > > > [ 247.920000] [<c0195e40>] (crm_manager_a9+0x0/0x578) from > > > [<c003eef0>] (do_exit+0x0/0x68c) > > > > > [ 247.920000] Code: e023e39c e5962000 e5933050 e3a04001 (e5832000) > > > > > [ 247.930000] Kernel panic - not syncing: Fatal exception > > > > > My question is: > > > > > (1)Why i can't open("/dev/ttyVSP0") Ok£¬but Open("/dev/ttyS0") OK¡£ > > > > > # ls -l /dev/ttyVSP0 > > > > > crw------- root root 250, 0 1970-01-01 00:00 ttyVSP0 > > > > > # ls -l /dev/ttyS0 > > > > > crw------- root > > > > ... > > > > 阅读更多 »- 隐藏被引用文字 - > > > > - 显示引用的文字 - > > > --~--~---------~--~----~------------~-------~--~----~ unsubscribe: android-porting+unsubscr...@googlegroups.com website: http://groups.google.com/group/android-porting -~----------~----~----~----~------~----~------~--~---