2

我正在尝试在带有 openwrt 环境的 qemu 中使用加密狗 3G。加密狗参考:华为-K4605。

首先,我在 option.c 中有补丁内核源代码:

--- option.c    2010-12-09 22:29:45.000000000 +0100
+++ option.c    2012-11-12 17:39:17.000000000 +0100
@@ -165,6 +165,7 @@
 #define HUAWEI_PRODUCT_E143D           0x143D
 #define HUAWEI_PRODUCT_E143E           0x143E
 #define HUAWEI_PRODUCT_E143F           0x143F
+#define HUAWEI_PRODUCT_E14C6           0x14C6
 #define HUAWEI_PRODUCT_K4505           0x1464
 #define HUAWEI_PRODUCT_K3765           0x1465
 #define HUAWEI_PRODUCT_E14AC           0x14AC
@@ -477,6 +478,7 @@
    { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E143E, 0xff, 0xff, 0xff) },
    { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E143F, 0xff, 0xff, 0xff) },
    { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4505, 0xff, 0xff, 0xff) },
+   { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E14C6, 0xff, 0xff, 0xff) },
    { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3765, 0xff, 0xff, 0xff) },
    { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_ETS1220, 0xff, 0xff, 0xff) },
    { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E14AC, 0xff, 0xff, 0xff) },

我还将内核模块安装为 kmod-usb-serial-option 或 kmod-usb-uhci。接下来,我在 /etc/usb_modeswitch.conf 中禁用了主机上的自动 usb_modeswitch。

我的加密狗有两个产品/供应商 ID,当我们在存储模块中使用它时为 12d1:14c1,在加密狗 3G 模块中使用它时为 12d1:14c6。我使用 usb 选项运行我的 qemu:

-usb -usbdevice host:12d1:14c6 -usbdevice host:12d1:14c1 

我在存储模块中使用 lsusb 在我的 qemu 机器上检测到我的设备。现在我必须切换它:/usr/bin/usb_modeswitch -v 12d1 -p 14c1 -W -M "55534243123456780000000000000011062000000100000000000000000000"

此步骤不起作用。在 usb_modeswitch.c 中放入一些调试代码后,我可以看到 usb_bulk_write 正在工作,但 usb_bulk_read 没有响应。我修改了 usb_modeswitch 的来源,以消除 usb_bulk_read 的无限等待。由于这个修改,我可以通过 lsusb 看到我的加密狗成功切换,但开发条目 ttyUSB0 不是在 /dev 中创建...

usb_modeswitch 的跟踪是:

root@OpenWrt:~# /usr/bin/usb_modeswitch -v 12d1 -p 14c1 -W -M "55534243123456780000000000000011062000000100000000000000000000"
scsi 2:0:0:0: CD-ROM            Vodafone CD ROM (Huawei)  2.31 PQ: 0 ANSI: 2
scsi 3:0:0:0: Direct-Access     Vodafone Storage (Huawei)      PQ: 0 ANSI: 2
sd 3:0:0:0: [sdb] Attached SCSI removable disk

Taking all parameters from the command line


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

 PLEASE REPORT NEW CONFIGURATIONS !

DefaultVendor=  0x12d1
DefaultProduct= 0x14c1
TargetVendor=   not set
TargetProduct=  not set
TargetClass=    not set
TargetProductList=""

DetachStorageOnly=0
HuaweiMode=0
SierraMode=0
SonyMode=0
QisdaMode=0
GCTMode=0
KobilMode=0
SequansMode=0
MobileActionMode=0
CiscoMode=0
MessageEndpoint=  not set
MessageContent="55534243123456780000000000000011062000000100000000000000000000"
NeedResponse=0
ResponseEndpoint= not set

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


Looking for default devices ...
  searching devices, found USB ID 1d6b:0001
  searching devices, found USB ID 0409:55aa
  searching devices, found USB ID 12d1:14c1
   found matching vendor ID
   found matching product ID
   adding device
 Found device in default mode, class or configuration (1)
Accessing device 003 on bus 001 ...
Getting the current device configuration ...
 OK, got current device configuration (1)
Using first interface: 0x00
Using endpoints 0x01 (out) and 0x81 (in)
Inquiring device details; driver will be detached ...
Looking for active driver ...
 OK, driver found; name unknown, limitation of libusb1
 OK, driver "unkown" detached
 Could not get INQUIRY response (error -110)

USB description data (for identification)
-------------------------
Manufacturer: Vodafone Group (Huawei) 
     Product: Vodafone Mobile Broadband (Huawei) 
  Serial No.: not provided
-------------------------
Looking for active driver ...
 No driver found. Either detached before or never attached
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
libusb:error [op_clear_halt] clear_halt failed error -1 errno 32
 Could not reset endpoint (probably harmless): -34
Resetting message endpoint 0x01
libusb:error [op_clear_halt] clear_halt failed error -1 errno 32
 Could not reset endpoint (probably harmless): -34
usb 1-2.1: USB disconnect, address 3
 Device is gone, skipping any further commands
-> Run lsusb to note any changes. Bye.

有人有解决方案吗?我是否必须以某种方式配置 qemu 才能通过批量端点将 msg 发送到我的加密狗?

谢谢,

4

0 回答 0