天嵌 ARM开发社区

 找回密码
 注册
查看: 4400|回复: 5

usb_modeswitch转换模式 出错

[复制链接]
y296144646q 发表于 2010-6-11 12:30:35 | 显示全部楼层 |阅读模式
本帖最后由 y296144646q 于 2010-6-11 12:34 编辑

你好,我最近在做华为ET128的3G驱动,网上说第一次插进开发板时是被认作CD-ROM  所以就要转换成MODEOM模式 所以我移植了usblib usb_modeswitch工具,信息如下:

[root@296144646 /]# usb 1-1: new full speed USB device using s3c2410-ohci and address 4
lusb 1-1: New USB device found, idVendor=12d1, idProduct=1da1
usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 1-1: Product: HUAWEI Mobile System Solution
usb 1-1: Manufacturer: HUAWEI Mobile
usb 1-1: SerialNumber: 000000-00-000000
usb 1-1: configuration #2 chosen from 1 choice
scsi1 : SCSI emulation for USB Mass Storage devices

[root@296144646 /]# usb 1-1: reset full speed USB device using s3c2410-ohci and address 4
scsi 1:0:0:0: CD-ROM            HUAWEI   Mobile CMCC CD   1.25 PQ: 0 ANSI: 0
sr0: scsi-1 drive

[root@296144646/]# lsusb
Bus 001 Device 004: ID 12d1:1da1 Huawei Technologies Co., Ltd.
Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
[root@EmbedSky /]# usb_modeswitch -W
Reading config file: /etc/usb_modeswitch.setup

* usb-modeswitch: handle USB devices with multiple modes
* Version 1.1.2alpha (C) Josua Dietze 2010
* Based on libusb0 (0.1.12 and above)

! PLEASE REPORT NEW CONFIGURATIONS !

DefaultVendor=  0x12d1
DefaultProduct= 0x1da1
TargetVendor=   0x12d1
TargetProduct=  not set
TargetClass=    not set

DetachStorageOnly=0
HuaweiMode=0
SierraMode=0
SonyMode=0
GCTMode=0
MessageEndpoint= not set
MessageContent="55534243123456780000000000000011060000000000000000000000000000"
NeedResponse=0
ResponseEndpoint= not set
Interface=0x00

InquireDevice enabled (default)
Success check enabled, max. wait time 20 seconds
System integration mode disabled

usb_set_debug: Setting debugging level to 15 (on)
usb_os_find_busses: Found 001
usb_os_find_busses: Skipping non bus directory devices
usb_os_find_devices: Found 004 on 001
usb_os_find_devices: Found 001 on 001
error obtaining child information: Inappropriate ioctl for device

Looking for target devices ...
  searching devices, found USB ID 0100:0201
No devices in target mode or class found
Looking for default devices ...
  searching devices, found USB ID 0100:0201
No devices in default mode or class found. Nothing to do. Bye.

我就是想问下found USB ID 0100:0201这个ID是啥啊 我没有这个ID的USB设备啊 他读的啥啊 (我用usb_modeswitch.c是1.1.2版本的)
希望研究过和做过这方面东西的高手指点下
补充:我将3G网卡拿掉,没有硬件时,信息如下(还是有个ID):
[root@296144646/]# lsusb
Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
[root@296144646/]# usb_modeswitch -W
Reading config file: /etc/usb_modeswitch.setup

* usb-modeswitch: handle USB devices with multiple modes
* Version 1.1.2alpha (C) Josua Dietze 2010
* Based on libusb0 (0.1.12 and above)

! PLEASE REPORT NEW CONFIGURATIONS !

DefaultVendor=  0x12d1
DefaultProduct= 0x1da1
TargetVendor=   0x12d1
TargetProduct=  not set
TargetClass=    not set

DetachStorageOnly=0
HuaweiMode=0
SierraMode=0
SonyMode=0
GCTMode=0
MessageEndpoint= not set
MessageContent="55534243123456780000000000000011060000000000000000000000000000"
NeedResponse=0
ResponseEndpoint= not set
Interface=0x00

InquireDevice enabled (default)
Success check enabled, max. wait time 20 seconds
System integration mode disabled

usb_set_debug: Setting debugging level to 15 (on)
usb_os_find_busses: Found 001
usb_os_find_busses: Skipping non bus directory devices
usb_os_find_devices: Found 001 on 001

Looking for target devices ...
  searching devices, found USB ID 0206:0203
No devices in target mode or class found
Looking for default devices ...
  searching devices, found USB ID 0206:0203
No devices in default mode or class found. Nothing to do. Bye.

(/etc/usb_modeswitch.setup内容如下:
DefaultVendor=  0x12d1
DefaultProduct=  0x1da1

TargetVendor=   0x12d1
#TargetProduct=  0x1001
#TargetClass= 0x01

# only for reference and 0.x versions
#MessageEndpoint=0x01
CheckSuccess=20
MessageContent="55534243123456780000000000000011060000000000000000000000000000"
HuaweiMode=0
 楼主| y296144646q 发表于 2010-6-12 10:46:17 | 显示全部楼层
上面的问题不要看了 是我移植的东西有问题 以解决  关键是有出新问题啦
信息如下:
[root@EmbedSky /]# usb_modeswitch -W
Reading config file: /etc/usb_modeswitch.setup

* usb-modeswitch: handle USB devices with multiple modes
* Version 1.1.2alpha (C) Josua Dietze 2010
* Based on libusb0 (0.1.12 and above)

! PLEASE REPORT NEW CONFIGURATIONS !

DefaultVendor=  0x12d1
DefaultProduct= 0x1da1
TargetVendor=   0x12d1
TargetProduct=  not set
TargetClass=    not set

DetachStorageOnly=0
HuaweiMode=0
SierraMode=0
SonyMode=0
GCTMode=0
MessageEndpoint= not set
MessageContent="55534243123456780000000000000011060000000000000000000000000000"
NeedResponse=0
ResponseEndpoint= not set
Interface=0x00

InquireDevice enabled (default)
Success check disabled
System integration mode disabled

usb_set_debug: Setting debugging level to 15 (on)
usb_os_find_busses: Found 001
usb_os_find_busses: Skipping non bus directory devices
usb_os_find_devices: Found 002 on 001
usb_os_find_devices: Found 001 on 001
error obtaining child information: Inappropriate ioctl for device

Looking for target devices ...
  searching devices, found USB ID 12d1:1da1
   found matching vendor ID
  searching devices, found USB ID 1d6b:0001
No devices in target mode or class found
Looking for default devices ...
  searching devices, found USB ID 12d1:1da1
   found matching vendor ID
   found matching product ID
   adding device
  searching devices, found USB ID 1d6b:0001
Found devices in default mode or classzhe shi na a
(1)
Accessing device 002 on bus 001 ...
Ambiguous Class/InterfaceClass: 0x02/0x08Using endpoints 0x05 (out) and 0x85 (in)
Inquiring device details; driver will be detached ...
Looking for active driver ...
OK, driver found ("usb-storage")
OK, driver "usb-storage" detached
到这一步就停啦  我也不知道咋回事。。。。。。按照网上说的完整信息应如下:
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: HUAWEI
Model String: Mass Storage
Revision String: 2.31
-------------------------

USB description usb 1-1: usbfs: process 1172 (usb_modeswitch) did not claim interface 0 before use
data (for identification)
-------------------------
Manufacturer: HUAWEI Technology
Product: HUAWEI Mobile
Serial No.: not provided
-------------------------
Setting up communication with interface 0 ...
Using endpoint 0x01 for message sending ...
Trying to send message 1 to endpoint 0x01 ...
OK, message successfully sent
usb 1-1: usb_modeswitch timed out on ep0out
usb 1-1: USB disconnect, address 2
Device is gone, skipping any further commands
-> Run lsusb to note any changes. Bye.
我到哪一步之后再没反映啦 想请问下是啥原因啊
 楼主| y296144646q 发表于 2010-6-13 11:55:03 | 显示全部楼层
本帖最后由 y296144646q 于 2010-6-13 12:04 编辑

我通过打印信息测试得知是如下过程出错:
在usb_modeswitch.c中的ret = usb_bulk_write(devh, MessageEndpoint, (char *)command, 31, 0);和ret = usb_bulk_read(devh, ResponseEndpoint, data, 36, 0);我的程序走过了usb_bulk_write,却在usb_bulk_read中进入了死循环。。。。。然后我在移植的libusb库中找到了int usb_bulk_write(usb_dev_handle *dev, int ep, char *bytes, int size,
        int timeout)
{
  /* Ensure the endpoint address is correct */
  return usb_urb_transfer(dev, ep, USB_URB_TYPE_BULK, bytes, size,
                timeout);
}

int usb_bulk_read(usb_dev_handle *dev, int ep, char *bytes, int size,
        int timeout)
{
  /* Ensure the endpoint address is correct */
  ep |= USB_ENDPOINT_IN;
  return usb_urb_transfer(dev, ep, USB_URB_TYPE_BULK, bytes, size,
                timeout);
}

/*然后通过打印信息知道是在usb_urb_transfer中的    while (!urb.usercontext && ((ret = ioctl(dev->fd, IOCTL_USB_REAPURBNDELAY, &context)) == -1) && waiting) {
      tv.tv_sec = 0;
      tv.tv_usec = 1000; // 1 msec
      select(dev->fd + 1, NULL, &writefds, NULL, &tv); //sub second wait
  }   usb_bulk_write执行一次就退出来拉  而usb_bulk_read确实无限循环  网上有 人说是卡里没钱啦 但这段代码和卡里有没有钱好像没关系啊

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
亚瑟王 发表于 2010-6-13 16:40:00 | 显示全部楼层
根据你的描述,好像还没有到拨号哦,现在还只是在找设备。应该是驱动方面没有驱动好导致的。
L143007 发表于 2011-1-24 17:00:52 | 显示全部楼层
楼主在吗???我现在也在移植这个,你具体步骤怎么做啊?
[root@EmbedSky /etc]# usb_modeswitch -W

* usb_modeswitch: handle USB devices with multiple modes
* Version 1.1.6 (C) Josua Dietze 2010
* Based on libusb0 (0.1.12 and above)

! PLEASE REPORT NEW CONFIGURATIONS !

DefaultVendor=  not set
DefaultProduct= not set
TargetVendor=   not set
TargetProduct=  not set
TargetClass=    not set
TargetProductList=""

DetachStorageOnly=0
HuaweiMode=0
SierraMode=0
SonyMode=0
GCTMode=0
KobilMode=0
MessageEndpoint=  not set
MessageContent=""
NeedResponse=0
ResponseEndpoint= not set
Interface=0x00

InquireDevice enabled (default)
Success check disabled
System integration mode disabled

usb_set_debug: Setting debugging level to 15 (on)
USB error: couldn't opendir(): No such file or directory
No default vendor/product ID given. Aborting.
我出现这样的错误。。。。。楼主帮我看看 谢谢!!!具体步骤告诉我行不?
L143007 发表于 2011-1-25 09:13:42 | 显示全部楼层
我现在想移植 3G上网卡 到RQ2440  具体怎么做啊!!!!!有人做过吗??
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

i.MX8系列ARM cortex A53 M4 工控板上一条 /1 下一条

Archiver|手机版|小黑屋|天嵌 嵌入式开发社区 ( 粤ICP备11094220号-2 )

GMT+8, 2024-10-6 06:46 , Processed in 1.021419 second(s), 19 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表