感觉找到一点对应的东西了。 [Android 硬件] 华为E1750移植在开发板上的问题! http://www.eoeandroid.com/thread-70677-1-1.html插上E1750后,可以看到E1750的ID信息:1.# lsusb1.Bus 001 Device 001: ID 1d6b:00022.Bus 002 Device 001: ID 1d6b:00023.Bus 001 Device 003: ID 12d1:1446挂在usbfs: 1.# mount -t usbfs none /proc/bus/usb在/dev下还没有E1750转换成的tty串口设备1.# ls dev/tty1.dev/tty dev/tty17 dev/tty26 dev/tty35 dev/tty44 dev/tty53 dev/tty622.dev/tty0 dev/tty18 dev/tty27 dev/tty36 dev/tty45 dev/tty54 dev/tty633.dev/tty1 dev/tty19 dev/tty28 dev/tty37 dev/tty46 dev/tty55 dev/tty74.dev/tty10 dev/tty2 dev/tty29 dev/tty38 dev/tty47 dev/tty56 dev/tty85.dev/tty11 dev/tty20 dev/tty3 dev/tty39 dev/tty48 dev/tty57 dev/tty96.dev/tty12 dev/tty21 dev/tty30 dev/tty4 dev/tty49 dev/tty58 dev/ttyS07.dev/tty13 dev/tty22 dev/tty31 dev/tty40 dev/tty5 dev/tty59 dev/ttyS18.dev/tty14 dev/tty23 dev/tty32 dev/tty41 dev/tty50 dev/tty6 dev/ttyS29.dev/tty15 dev/tty24 dev/tty33 dev/tty42 dev/tty51 dev/tty60 dev/ttyS310.dev/tty16 dev/tty25 dev/tty34 dev/tty43 dev/tty52 dev/tty61 使用usb_modeswitch转换模块: 1>出现错误: USB error: error sending control message: Protocol error Error: getting the current configuration failed (error -71). Aborting.1.# ./usb_modeswitch -W -c usb_modeswitch.conf1.2.Reading config file: usb_modeswitch.conf3.4.* usb_modeswitch: handle USB devices with multiple modes5.* Version 1.1.6 (C) Josua Dietze 20106.* Based on libusb0 (0.1.12 and above)7.8.! PLEASE REPORT NEW CONFIGURATIONS !9.10.DefaultVendor= 0x12d111.DefaultProduct= 0x144612.TargetVendor= 0x12d113.TargetProduct= 0x100114.TargetClass= not set15.TargetProductList=""16.17.DetachStorageOnly=018.HuaweiMode=019.SierraMode=020.SonyMode=021.GCTMode=022.KobilMode=023.MessageEndpoint= not set24.MessageContent="55534243123456780000000000000011060000000000000000000000000000"25.NeedResponse=026.ResponseEndpoint= not set27.Interface=0x0028.29.InquireDevice enabled (default)30.Success check enabled, max. wait time 5 seconds31.System integration mode disabled32.33.usb_set_debug: Setting debugging level to 15 (on)34.usb_os_find_busses: Found 00235.usb_os_find_busses: Found 00136.usb_os_find_busses: Skipping non bus directory devices37.usb_os_find_devices: Found 001 on 00238.usb_os_find_devices: Found 003 on 00139.usb_os_find_devices: Found 001 on 00140.error obtaining child information: Inappropriate ioctl for device41.42.Looking for target devices ...43. searching devices, found USB ID 1d6b:000244. searching devices, found USB ID 12d1:144645. found matching vendor ID46. searching devices, found USB ID 1d6b:000247.No devices in target mode or class found48.Looking for default devices ...49. searching devices, found USB ID 1d6b:000250. searching devices, found USB ID 12d1:144651. found matching vendor ID52. found matching product ID53. adding device54. searching devices, found USB ID 1d6b:000255.Found devices in default mode, class or configuration (1)56.Accessing device 003 on bus 001 ...57.Getting the current device configuration ...58.USB error: error sending control message: Protocol error59.Error: getting the current configuration failed (error -71). Aborting.60.61.# ./usb_modeswitch -W -c usb_modeswitch.conf62.63.Reading config file: usb_modeswitch.conf64.65.* usb_modeswitch: handle USB devices with multiple modes66.* Version 1.1.6 (C) Josua Dietze 201067.* Based on libusb0 (0.1.12 and above)68.69.! PLEASE REPORT NEW CONFIGURATIONS !70.71.DefaultVendor= 0x12d172.DefaultProduct= 0x144673.TargetVendor= 0x12d174.TargetProduct= 0x100175.TargetClass= not set76.TargetProductList=""77.78.DetachStorageOnly=079.HuaweiMode=080.SierraMode=081.SonyMode=082.GCTMode=083.KobilMode=084.MessageEndpoint= not set85.MessageContent="55534243123456780000000000000011060000000000000000000000000000"86.NeedResponse=087.ResponseEndpoint= not set88.Interface=0x0089.90.InquireDevice enabled (default)91.Success check enabled, max. wait time 5 seconds92.System integration mode disabled93.94.usb_set_debug: Setting debugging level to 15 (on)95.usb_os_find_busses: Found 00296.usb_os_find_busses: Found 00197.usb_os_find_busses: Skipping non bus directory devices98.usb_os_find_busses: Skipping non bus directory devices99.usb_os_find_devices: Found 003 on 001100.usb_os_find_devices: Found 001 on 001101.error obtaining child information: Inappropriate ioctl for device102.103.Looking for target devices ...104. searching devices, found USB ID 1d6b:0002105. searching devices, found USB ID 12d1:1446106. found matching vendor ID107. searching devices, found USB ID 1d6b:0002108.No devices in target mode or class found109.Looking for default devices ...110. searching devices, found USB ID 1d6b:0002111. searching devices, found USB ID 12d1:1446112. found matching vendor ID113. found matching product ID114. adding device115. searching devices, found USB ID 1d6b:0002116.Found devices in default mode, class or configuration (1)117.Accessing device 003 on bus 001 ...118.Getting the current device configuration ...119.USB error: error sending control message: Protocol error120.Error: getting the current configuration failed (error -71). Aborting. //--------------- 2>重启系统后在使用usb_modeswitch转换成功# ./usb_modeswitch -W -c usb_modeswitch.conf
《求助》在android2.3.4上 加入3G模块,usb_modeswitch失败,发送短信失败 http://bbs.witech.com.cn/thread-7356-1-1.html首先插入3G模块后能自动识别如下: usb 1-1: USB disconnect, address 5 usb 1-1: new full speed USB device using s3c2410-ohci and address 6 usb 1-1: New USB device found, idVendor=19d2, idProduct=ffeb usb 1-1: New USB device strings: Mfr=3, Product=2, SerialNumber=0 usb 1-1: Product: ZTEMT Technologies usb 1-1: Manufacturer: Qualcomm, Incorporated 然后我使用命令: usb_modeswitch -c /etc/usb_modeswitch.d/19d2\^\%ffeb -W Error: Could not find file /etc/usb_modeswitch.d/19d2^%ffeb 我去/etc/usb_modeswitch.d/下看了,也确实没有该文件/dev/下也没有ttyUSB* 不知道这个是什么原因 我的3G模块不能用吗。还有 我想3G 模块应该能发短信, 但是发送后 系统提示,短信不能发送 说是短信服务没有启动之类的, 我重启了一下,可还是没有启动,这个不知道怎么启动?我这个项目需要自动发送短信,所以这一块比较急,请求帮忙。。
在我的平台上运行USB-MODESWITCH老是报下面的错误Syntax error: word unexpected (expecting ")") http://hi.baidu.com/dsfire/blog/item/5d922458886ad589800a188b.html从昨天到现在都在测试ad驱动,每当在开发板上运行./s3c2440_adc_test 就会出现:Syntax error: word unexpected (expect ing ")"),郁闷了好久! 一直都是用ftp将s3c2440_adc_test传到开发板上,没有发现什么错误,但运行就是出错。 最终确定:s3c2440_adc_test文件传输的不完整, 导致运行s3c2440_adc_test出现错误:Syntax error: word unexpected (expect ing ")") 重新用ftp传输,出现: local: s3c2440_adc_test remote: s3c2440_adc_test 200 PORT command successful. 150 Opening BINARY mode data connection for 's3c2440_adc_test'. 226 Transfer complete. 521701 bytes sent in 0.62 secs (825.0 kB/s) 表示成功! 或者用nfs,然后运行,ok了!
http://blog.sina.com.cn/s/blog_6b918a190100tilr.html
http://www.kklinux.com/html/Love-Linux/Fedora/200910/28-6368.html最近搞了个联通的3G上网卡,型号是华为E1750,在Windows下使用没有问题,但在Ubuntu无法识别。上网Google了一个,找到了一个解决办法。首先下载usb_modeswitch 1.02,因为是源码需要编译安装:make install然后打开/etc/usb_modeswitch.conf,加入代码:#---- DefaultVendor= 0x12d1;
DefaultProduct= 0x1446
TargetVendor= 0x12d1
TargetProduct= 0x1001
MessageContent="55534243000000000000000000000011060000000000000000000000000000"
CheckSuccess=5
#--最后,运行:usb_modeswitch -W在网络管理器中建立无线连接,OK。
http://bbs.imp3.net/thread-10427765-1-1.html华为E1750吗,如果试了好几个支持3G的固件都不行的话,那试一试禁用E1750的CD-ROM功能吧。
方法如下: 把华为E1750插在电脑上,然后打开“设备管理器”,在调制解调器那个类里,你会看到E1750,然后右键点击属性,在“高级”选项卡里面,会有一个“额外的初始化命令”,在里面输入:AT^U2DIAG=0 。然后确定,禁止cd-rom模式了。做好后再插到A500上试试,如果还不行的话,我就没辙了。
另外提醒一句,执行这个操作之前,最好把E1750里面的软件备份一下,禁止cd-rom后,1750插在电脑上可能就无法显示出一个存储光盘了。
上2张截图,由于木有E1750,所以图片里不是E1750的
http://bbs.gfan.com/viewthread.php?tid=2012213&extra=&ordertype=1我在某3G论坛查到,华为E1750的AT命令,具体如下:
AT^U2DIAG=255 或 276 工廠設定
AT^U2DIAG=256 關閉CD
AT^U2DIAG=1 關閉SD卡
AT^U2DIAG=0 關閉CD 和SD卡 第一次用AT^U2DIAG=0这指令,CDROM和SD卡均被禁止了,由于一直没搞定A500的移动网络设置,于是又用AT^U2DIAG=276命令回复了CDROM和SD卡。从此AT命令对我的E1750失效了,无法再通过这些参数来禁止CDROM了,即使刷最新固件也不行。杯具!
http://mac.pcbeta.com/thread-69118-1-1.html
http://www.padcn.com/t-4339-1-1.html上网卡禁用CD-rom恢复方法..很有用..感谢那位朋友分享..刷3.1之后折腾3G上网卡,因为是朋友的卡,没敢禁用CD-ROM,怕还给人家不能用,刚才在网上找到一个恢复方法,还没试,打算等下去试试去,特发给需要恢复的机油,一起试试看效果如何请教店主3G-fever,说可以用AT指令恢复,并给了两个网址http://3g-modem.wetpaint.com/page/Huawei+E1750%2C+E1752http://3g-modem.wetpaint.com/pag ... mands+under+Windows1.点"开始",点“控制面板”,点“性能和维护”,点“系统” 点“硬件”,点“设备管理器” 双击你想要变更的装置类型 点开“调至解调器” 右键“HUAWEI(华为) Mobile Connect - 3G modem”或者类似项,然后选择“属性” 点击“调至解调器”标签 ,选择“端口” ,这样你就知道你用的是什么端口了 最好的选择是“PUTTY” ,你需要先下载PUTTY 安装PUTTY之前,确保你的设备是完全关闭的,确保没有其他应用程序连接到你的设备,然后运行PUTTY 然后到第六步 ,按照图中123就可以了 ,然后输入ATZ,ATI接着输入AT^U2DIAG=256或者AT^U2DIAG=268精彩二选一,我只成功恢复了CDROM驱动,反复试验读卡器功能就是恢复不了我还刷了新加坡的固件,还是不行,算了,不折腾了设备管理器 modem 属性 高级 额外初始化命令 AT+ZCDRUN=F
http://www.360doc.com/content/11/1116/11/3989678_164744374.shtml
http://bbs.zhiqifans.com/thread-25580-1-1.html首先智器并没有把所有的3G上网卡的驱动做到系统里面,所以紧支持大唐、中兴、华为的几款上网卡。不过华为的驱动好像是最通用的,所以即使没有列表中的型号也可以试试,我的就是E176G.
1.确认”设置“--”USB模式“--”OTG模式“是在”主模式“的状态下;
2.点击"3G拨号“,确认”3G拨号“没有打勾的状态下把上网卡插上;
3.上网卡闪绿灯后会闪蓝灯,证明已经识别上网卡;(不同型号闪灯的颜色会不一样)
4.在"3G拨号“后打勾,上网卡又会经过闪绿灯后会闪蓝灯的过程;
5.点”选择设备“中的上网卡型号,联通华为的点”180“或”1750“都可以;
6.蓝灯长亮,状态栏出现“3G”符号,上网正常;
7.如果不行,尝试多点几次”选择设备“中的上网卡型号。
断网:
1.去掉”3G拨号“后面的勾;
2.在”3G拨号“后面打勾,这时上网卡才能断网;
3.去掉”3G拨号“后面的勾,不然下次就上不了;
如果第二次连不了网,可以尝试把上网卡拔出,在重复以上步骤。
http://bbs.gfan.com/android-1847802-1-1.html
刷3.1之后折腾3G上网卡,因为是朋友的卡,没敢禁用CD-ROM,怕还给人家不能用,刚才在网上找到一个恢复方法,还没试,打算等下去试试去,特发给需要恢复的机油,一起试试看效果如何请教店主3G-fever,说可以用AT指令恢复,并给了两个网址http://3g-modem.wetpaint.com/page/Huawei+E1750%2C+E1752http://3g-modem.wetpaint.com/pag ... mands+under+Windows1.点"开始",点“控制面板”,点“性能和维护”,点“系统” 点“硬件”,点“设备管理器” 双击你想要变更的装置类型 点开“调至解调器” 右键“HUAWEI(华为) Mobile Connect - 3G modem”或者类似项,然后选择“属性” 点击“调至解调器”标签 ,选择“端口” ,这样你就知道你用的是什么端口了 最好的选择是“PUTTY” ,你需要先下载PUTTY 安装PUTTY之前,确保你的设备是完全关闭的,确保没有其他应用程序连接到你的设备,然后运行PUTTY 然后到第六步 ,按照图中123就可以了 ,然后输入ATZ,ATI接着输入AT^U2DIAG=256或者AT^U2DIAG=268精彩二选一,我只成功恢复了CDROM驱动,反复试验读卡器功能就是恢复不了我还刷了新加坡的固件,还是不行,算了,不折腾了重要的是三楼回复:
设备管理器 modem 属性 高级 额外初始化命令 AT+ZCDRUN=F原帖地址:http://www.test3g.com/thread-141208-1-1.html
how to execute AT-commands under Windowshttp://3g-modem.wetpaint.com/page/executing+AT-commands+under+Windows
http://www.eoeandroid.com/thread-70677-1-1.html插上E1750后,可以看到E1750的ID信息:1.# lsusb1.Bus 001 Device 001: ID 1d6b:00022.Bus 002 Device 001: ID 1d6b:00023.Bus 001 Device 003: ID 12d1:1446挂在usbfs:
1.# mount -t usbfs none /proc/bus/usb在/dev下还没有E1750转换成的tty串口设备1.# ls dev/tty1.dev/tty dev/tty17 dev/tty26 dev/tty35 dev/tty44 dev/tty53 dev/tty622.dev/tty0 dev/tty18 dev/tty27 dev/tty36 dev/tty45 dev/tty54 dev/tty633.dev/tty1 dev/tty19 dev/tty28 dev/tty37 dev/tty46 dev/tty55 dev/tty74.dev/tty10 dev/tty2 dev/tty29 dev/tty38 dev/tty47 dev/tty56 dev/tty85.dev/tty11 dev/tty20 dev/tty3 dev/tty39 dev/tty48 dev/tty57 dev/tty96.dev/tty12 dev/tty21 dev/tty30 dev/tty4 dev/tty49 dev/tty58 dev/ttyS07.dev/tty13 dev/tty22 dev/tty31 dev/tty40 dev/tty5 dev/tty59 dev/ttyS18.dev/tty14 dev/tty23 dev/tty32 dev/tty41 dev/tty50 dev/tty6 dev/ttyS29.dev/tty15 dev/tty24 dev/tty33 dev/tty42 dev/tty51 dev/tty60 dev/ttyS310.dev/tty16 dev/tty25 dev/tty34 dev/tty43 dev/tty52 dev/tty61
使用usb_modeswitch转换模块:
1>出现错误:
USB error: error sending control message: Protocol error
Error: getting the current configuration failed (error -71). Aborting.1.# ./usb_modeswitch -W -c usb_modeswitch.conf1.2.Reading config file: usb_modeswitch.conf3.4.* usb_modeswitch: handle USB devices with multiple modes5.* Version 1.1.6 (C) Josua Dietze 20106.* Based on libusb0 (0.1.12 and above)7.8.! PLEASE REPORT NEW CONFIGURATIONS !9.10.DefaultVendor= 0x12d111.DefaultProduct= 0x144612.TargetVendor= 0x12d113.TargetProduct= 0x100114.TargetClass= not set15.TargetProductList=""16.17.DetachStorageOnly=018.HuaweiMode=019.SierraMode=020.SonyMode=021.GCTMode=022.KobilMode=023.MessageEndpoint= not set24.MessageContent="55534243123456780000000000000011060000000000000000000000000000"25.NeedResponse=026.ResponseEndpoint= not set27.Interface=0x0028.29.InquireDevice enabled (default)30.Success check enabled, max. wait time 5 seconds31.System integration mode disabled32.33.usb_set_debug: Setting debugging level to 15 (on)34.usb_os_find_busses: Found 00235.usb_os_find_busses: Found 00136.usb_os_find_busses: Skipping non bus directory devices37.usb_os_find_devices: Found 001 on 00238.usb_os_find_devices: Found 003 on 00139.usb_os_find_devices: Found 001 on 00140.error obtaining child information: Inappropriate ioctl for device41.42.Looking for target devices ...43. searching devices, found USB ID 1d6b:000244. searching devices, found USB ID 12d1:144645. found matching vendor ID46. searching devices, found USB ID 1d6b:000247.No devices in target mode or class found48.Looking for default devices ...49. searching devices, found USB ID 1d6b:000250. searching devices, found USB ID 12d1:144651. found matching vendor ID52. found matching product ID53. adding device54. searching devices, found USB ID 1d6b:000255.Found devices in default mode, class or configuration (1)56.Accessing device 003 on bus 001 ...57.Getting the current device configuration ...58.USB error: error sending control message: Protocol error59.Error: getting the current configuration failed (error -71). Aborting.60.61.# ./usb_modeswitch -W -c usb_modeswitch.conf62.63.Reading config file: usb_modeswitch.conf64.65.* usb_modeswitch: handle USB devices with multiple modes66.* Version 1.1.6 (C) Josua Dietze 201067.* Based on libusb0 (0.1.12 and above)68.69.! PLEASE REPORT NEW CONFIGURATIONS !70.71.DefaultVendor= 0x12d172.DefaultProduct= 0x144673.TargetVendor= 0x12d174.TargetProduct= 0x100175.TargetClass= not set76.TargetProductList=""77.78.DetachStorageOnly=079.HuaweiMode=080.SierraMode=081.SonyMode=082.GCTMode=083.KobilMode=084.MessageEndpoint= not set85.MessageContent="55534243123456780000000000000011060000000000000000000000000000"86.NeedResponse=087.ResponseEndpoint= not set88.Interface=0x0089.90.InquireDevice enabled (default)91.Success check enabled, max. wait time 5 seconds92.System integration mode disabled93.94.usb_set_debug: Setting debugging level to 15 (on)95.usb_os_find_busses: Found 00296.usb_os_find_busses: Found 00197.usb_os_find_busses: Skipping non bus directory devices98.usb_os_find_busses: Skipping non bus directory devices99.usb_os_find_devices: Found 003 on 001100.usb_os_find_devices: Found 001 on 001101.error obtaining child information: Inappropriate ioctl for device102.103.Looking for target devices ...104. searching devices, found USB ID 1d6b:0002105. searching devices, found USB ID 12d1:1446106. found matching vendor ID107. searching devices, found USB ID 1d6b:0002108.No devices in target mode or class found109.Looking for default devices ...110. searching devices, found USB ID 1d6b:0002111. searching devices, found USB ID 12d1:1446112. found matching vendor ID113. found matching product ID114. adding device115. searching devices, found USB ID 1d6b:0002116.Found devices in default mode, class or configuration (1)117.Accessing device 003 on bus 001 ...118.Getting the current device configuration ...119.USB error: error sending control message: Protocol error120.Error: getting the current configuration failed (error -71). Aborting.
//---------------
2>重启系统后在使用usb_modeswitch转换成功# ./usb_modeswitch -W -c usb_modeswitch.conf
http://bbs.witech.com.cn/thread-7356-1-1.html首先插入3G模块后能自动识别如下:
usb 1-1: USB disconnect, address 5
usb 1-1: new full speed USB device using s3c2410-ohci and address 6
usb 1-1: New USB device found, idVendor=19d2, idProduct=ffeb
usb 1-1: New USB device strings: Mfr=3, Product=2, SerialNumber=0
usb 1-1: Product: ZTEMT Technologies
usb 1-1: Manufacturer: Qualcomm, Incorporated 然后我使用命令:
usb_modeswitch -c /etc/usb_modeswitch.d/19d2\^\%ffeb -W
Error: Could not find file /etc/usb_modeswitch.d/19d2^%ffeb
我去/etc/usb_modeswitch.d/下看了,也确实没有该文件/dev/下也没有ttyUSB* 不知道这个是什么原因 我的3G模块不能用吗。还有 我想3G 模块应该能发短信, 但是发送后 系统提示,短信不能发送 说是短信服务没有启动之类的,
我重启了一下,可还是没有启动,这个不知道怎么启动?我这个项目需要自动发送短信,所以这一块比较急,请求帮忙。。
http://blog.csdn.net/maeom/article/details/6583858
环境系统:Android-2.3 板子:友善之臂提供s3c6410当一个新的usb插入时,内核会发送一个uevent时间。上层接收到后,做出相应的处理。如:我使用的为HuaWei ET127的3G网卡,插入arm板上后。没有正确识别成为ttyACM*设备。无法进行AT命令发送。这时。我们需要转换模式。 我使用的是usb_modeswitch可以去官网下载,然后使用arm-gcc进行编译。首先看一下消息流向在Android-2.3/system/core/libsysutils/src/NetlinkListener.cpp文件中
view plaincopy to clipboardprint?
01.bool NetlinkListener::onDataAvailable(SocketClient *cli)
02.{
03. int socket = cli->getSocket();
04. int count;
05. if ((count = recv(socket, mBuffer, sizeof(mBuffer), 0)) < 0) {
06. return false;
07. }
08. //这里buffer形式为:add@/devices/platform/s3c2410-ohci/usb1/1-1/1-1.2
09. NetlinkEvent *evt = new NetlinkEvent();
10. if (!evt->decode(mBuffer, count)) {
11. goto out;
12. }
13.
14. onEvent(evt);
15.out:
16. delete evt;
17. return true;
18.}
bool NetlinkListener::onDataAvailable(SocketClient *cli)
{
int socket = cli->getSocket();
int count;
if ((count = recv(socket, mBuffer, sizeof(mBuffer), 0)) < 0) {
return false;
}
//这里buffer形式为:add@/devices/platform/s3c2410-ohci/usb1/1-1/1-1.2
NetlinkEvent *evt = new NetlinkEvent();
if (!evt->decode(mBuffer, count)) {
goto out;
} onEvent(evt);
out:
delete evt;
return true;
}这里的decode调用的为
view plaincopy to clipboardprint?
01.//Android-2.3/system/core/libsysutils/src/NetlinkEvent.cpp 这里循环将buffer数据提取出来
02.bool NetlinkEvent::decode(char *buffer, int size) {
03. while (s < end) {
04. if (first) {
05. ......
06. for (p = s; *p != '@'; p++);
07. mPath = strdup(p);
08. .......
09. } else {
10. if (!strncmp(s, "ACTION=", strlen("ACTION="))) {
11. char *a = s + strlen("ACTION=");
12. if (!strcmp(a, "add"))
13. mAction = NlActionAdd;
14. else if (!strcmp(a, "remove"))
15. mAction = NlActionRemove;
16. else if (!strcmp(a, "change"))
17. mAction = NlActionChange;
18. } else if (!strncmp(s, "SEQNUM=", strlen("SEQNUM=")))
19. mSeq = atoi(s + strlen("SEQNUM="));
20. else if (!strncmp(s, "SUBSYSTEM=", strlen("SUBSYSTEM=")))
21. mSubsystem = strdup(s + strlen("SUBSYSTEM="));
22. else
23. mParams[param_idx++] = strdup(s);
24. }
25. }
26.}
//Android-2.3/system/core/libsysutils/src/NetlinkEvent.cpp 这里循环将buffer数据提取出来
bool NetlinkEvent::decode(char *buffer, int size) {
while (s < end) {
if (first) {
......
for (p = s; *p != '@'; p++);
mPath = strdup(p);
.......
} else {
if (!strncmp(s, "ACTION=", strlen("ACTION="))) {
char *a = s + strlen("ACTION=");
if (!strcmp(a, "add"))
mAction = NlActionAdd;
else if (!strcmp(a, "remove"))
mAction = NlActionRemove;
else if (!strcmp(a, "change"))
mAction = NlActionChange;
} else if (!strncmp(s, "SEQNUM=", strlen("SEQNUM=")))
mSeq = atoi(s + strlen("SEQNUM="));
else if (!strncmp(s, "SUBSYSTEM=", strlen("SUBSYSTEM=")))
mSubsystem = strdup(s + strlen("SUBSYSTEM="));
else
mParams[param_idx++] = strdup(s);
}
}
}继续调用onEvent函数,会有两处调用onEvent函数1:为vold 2:为netd 程序。 两者类似。 只看下vold
view plaincopy to clipboardprint?
01.//Android-2.3/system/vold/NetlinkHandler.cpp
02.void NetlinkHandler::onEvent(NetlinkEvent *evt) {
03. VolumeManager *vm = VolumeManager::Instance();
04. const char *subsys = evt->getSubsystem();
05.
06. if (!strcmp(subsys, "block")) {
07. vm->handleBlockEvent(evt);
08. } else if (!strcmp(subsys, "usb_composite")) {
09. vm->handleUsbCompositeEvent(evt);
10. //这里没有usb,我们添加一项,如下3行
11. } else if (!strcmp(subsys, "usb")) {
12. vm->handleUsbEvent(evt); //此函数需要在 Event类中添加
13. }
14.}
//Android-2.3/system/vold/NetlinkHandler.cpp
void NetlinkHandler::onEvent(NetlinkEvent *evt) {
VolumeManager *vm = VolumeManager::Instance();
const char *subsys = evt->getSubsystem(); if (!strcmp(subsys, "block")) {
vm->handleBlockEvent(evt);
} else if (!strcmp(subsys, "usb_composite")) {
vm->handleUsbCompositeEvent(evt);
//这里没有usb,我们添加一项,如下3行
} else if (!strcmp(subsys, "usb")) {
vm->handleUsbEvent(evt); //此函数需要在 Event类中添加
}
}view plaincopy to clipboardprint?
01.//在/Android-2.3/system/vold/VolumeManager.h
02.class VolumeManager {
03.public:
04. //增加如下一行
05. void handleUsbEvent(NetlinkEvent *evt);
06.}
//在/Android-2.3/system/vold/VolumeManager.h
class VolumeManager {
public:
//增加如下一行
void handleUsbEvent(NetlinkEvent *evt);
}
view plaincopy to clipboardprint?
01.//文件Android-2.3/system/vold/VolumeManager.cpp中,增加函数
02.void VolumeManager::handleUsbEvent(NetlinkEvent *evt) {
03. const char *devtype = evt->findParam("DEVTYPE");
04. char *cmd;
05. //如下判断设备类型,和是否为add模式。 进行相应操作
06. if(1 == evt->getAction() && !strcmp(devtype, "usb_device")) {
07. /*call usb mode switch function*/
08. asprintf(&cmd, "usb_modeswitch -W -c /12d1\\:1da1"); //这里应该调用外部shell脚本,这里为测试程序。所以写死了
09. system(cmd);
10. free(cmd);
11. }
12.}
http://blog.csdn.net/ipromiseu/article/details/5154004
http://blog.csdn.net/linfeng999/article/details/5846474
http://blog.csdn.net/tanxs001/article/details/5118986
http://hi.baidu.com/wugangseu/blog/item/cdbab0943b74a8027bf480bc.html
由于要在板子上驱动3G模块,所以要交叉编译usb_modeswitch
usb_modeswitch是什么样的一个东西就不多说了,在usb_modeswitch howto上说的很明白了下载usb_modeswitch-1.0.5.tar.bz2
解压
修改Makefile
STRIP = arm-linux-strip
CC = arm-linux-gcc
直接make all 提示的是缺少usb.h这个库,然后下面是一堆的报错
上网查了查,原来编译usb_modeswitch还缺少libusb这个库下载libusb-0.1.12.tar.gz执行 mkdir install
./configure --build=i686-linux --host=arm-linux --prefix=/opt/libusb-0.1.12/install注:红字标示处出错了,我原来写的是--host=i686-linux 晕~~~
make
make instal
如果没什么错误的话就会在install文件下生成lib,include。其中在include下就有我们需要的usb.h重新交叉编译usb_modeswitch
修改Makefile
STRIP = arm-linux-strip
CC = arm-linux-gcc
$(CC) $(CCFLAGS) -I /opt/libusb-1.0.4/install/include/libusb-1.0 -L /disk2/3G/libusb-1.0.4/install/lib -o $(PROG) $(OBJS)
其中,-I -L 是指定include以及lib所在的位置
然后make all
顺利编译出usb_modeswitch的可执行文件把usb_modeswitch的可执行文件放到板子上的/usr/sbin ,再把libusb中所生成的lib文件拷到板子上的lib文件下,将usb_modeswitch.conf文件放到/etc下之后
执行usb_modeswitch,郁闷的是板子就死掉了,但就是不知道哪里出了问题,还需要进一步的排查。好啦,解决了这个--host的问题之后,编译生成可执行文件,再在板子上执行,还是死机!这下郁闷了,因为用这种方式在angelaws网友的omap平台以及在三星的板子上都是没问题的!最后经过排查,终于发现原来竟然是0x14所导致的问题,哎最后再说一下一个发现,在高版本的内核上,针对一些数据卡(比如华为的ec169),在高版本的内核的板子上,可以直接被识别成为ttyusb设备。但是,当把这个高版本内核选项中有关scsi的选项去掉的时候,就识别不出来了。因此,是不是低版本的内核也是如此,是否低版本的内核加入了对scsi的支持就能直接认出ttyusb设备,还有待验证。
http://blog.sina.com.cn/s/blog_6d2a0a1a0100vyl1.html华为E17503G上网卡在s3c2416板上,输入usb_modeswitch -W -c /etc/usb_modeswitch.conf后控制台上输出这样的错误提示:usb_modeswitch -W -c Illegal instruction 找了半天的原因,发现犯了两个很低级的错误:1、在内核函数driver/usb/serial/option.c中要加入 #define HUAWEI_PRODUCT_E1750 0X1446 而我却写成了: #define HUAWEI_PRODUCT_E7150 0X1466 真是晕啊,就俩数字都写错了。2、交叉编译器版本问题: 我的s3c2416的板上的,u-boot、kernel等所有的东西都是用cross_compile 4.3.2编译的,而E1750所有用的上网卡驱动,libusb、usb_modeswitch却用友善之臂提供的4.5.1交叉编译器.之后换成4.3.2的交叉编译器,重新编译,libusb、usb_modeswitch、pppd 、chat一切OK
2>对应的系统头文件怎么让交叉编译工具链找到
3>LIBUSB库中的头文件+库文件怎么让交叉编译工具链找到----可以考虑放到交叉编译工具链的INCLUDE/LIB目录下就可以了
http://hi.baidu.com/dsfire/blog/item/5d922458886ad589800a188b.html从昨天到现在都在测试ad驱动,每当在开发板上运行./s3c2440_adc_test
就会出现:Syntax error: word unexpected (expect ing ")"),郁闷了好久!
一直都是用ftp将s3c2440_adc_test传到开发板上,没有发现什么错误,但运行就是出错。
最终确定:s3c2440_adc_test文件传输的不完整,
导致运行s3c2440_adc_test出现错误:Syntax error: word unexpected (expect ing ")")
重新用ftp传输,出现:
local: s3c2440_adc_test remote: s3c2440_adc_test
200 PORT command successful.
150 Opening BINARY mode data connection for 's3c2440_adc_test'.
226 Transfer complete.
521701 bytes sent in 0.62 secs (825.0 kB/s)
表示成功!
或者用nfs,然后运行,ok了!
http://hi.baidu.com/serial_story/blog/item/450b060113846a067aec2cc2.html/cmtid/9e5675edc51727dbb21cb133
2>apn:3gnet
3>mcc:460
4>mnc:01