我正在尝试在qemu中使用加密狗3G和openwrt环境。加密狗参考:HUAWEi - 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中的主机上禁用了auto usb_modeswitch。
我的加密狗有两个产品/供应商ID,当我们在存储模式中使用它时为12d1:14c1,在加密狗3G mod中使用12d1:14c6。我用usb选项运行我的qemu:
-usb -usbdevice host:12d1:14c6 -usbdevice host:12d1:14c1
我在qemu机器上使用lsusb在存储模式中检测到我的设备。现在我必须用/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我的加密狗成功切换但是dev入口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发送到我的加密狗?
谢谢,