storage R&D guy.
全部博文(1000)
分类: 服务器与存储
2015-03-25 10:16:15
内核版本:linux-2.6.36.4
SCSI必须配置:
CONFIG_SCSI_MOD=y
CONFIG_SCSI=y
CONFIG_BLK_DEV_SD=y
CONFIG_BLK_DEV_SR=y
CONFIG_BLK_DEV_SR_VENDOR=y
CONFIG_CHR_DEV_SG=y
USB必须配置:
CONFIG_USB_SUPPORT=y
CONFIG_USB_ARCH_HAS_HCD=y
CONFIG_USB_ARCH_HAS_OHCI=y
CONFIG_USB=y
CONFIG_USB_OHCI_HCD=y
CONFIG_USB_OHCI_LITTLE_ENDIAN=y
CONFIG_USB_STORAGE=m
CONFIG_USB_LIBUSUAL=y
CONFIG_USB_SERIAL=y
CONFIG_USB_SERIAL_WWAN=m
CONFIG_USB_SERIAL_OPTION=m
编译后将产生模块:usb_wwan.ko、option.ko和usb-storage.ko
插入模块顺序:
insmod usb_wwan.ko
insmod option.ko
insmod usb-storage.ko
必须修改的源码:
文件:drivers/usb/storage/initializers.c
增加:
int usb_stor_huawei_init(struct us_data *us)
{
int result = 0;
us->iobuf[0] = 0x0;
result = usb_stor_control_msg(us, us->send_ctrl_pipe,
USB_REQ_SET_FEATURE,
USB_TYPE_STANDARD | USB_RECIP_DEVICE,
0x01, 0x0, us->iobuf, 0x0, 1000);
US_DEBUGP("usb_control_msg performing result is %d\n", result);
return 0;
}
int usb_stor_huawei_scsi_init(struct us_data *us)
{
int result = 0;
int act_len = 0;
unsigned char cmd[32] = {0x55, 0x53, 0x42, 0x43, 0xEE, 0x00, 0x00, 0x00,
0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x11,
0x06, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
result = usb_stor_bulk_transfer_buf (us, us->send_bulk_pipe, cmd, 31, &act_len);
US_DEBUGP("usb_stor_bulk_transfer_buf performing result is %d, transfer the actual length=%d\n",
result, act_len);
return result;
}
文件:drivers/usb/storage/initializers.h
增加:
int usb_stor_huawei_init(struct us_data *us);
int usb_stor_huawei_scsi_init(struct us_data *us);
文件:drivers/usb/storage/unusual_devs.h
增加:
UNUSUAL_DEV( 0x12d1, 0x1505, 0x0000, 0x0000,
"HUAWEI MOBILE",
"Mass Storage",
US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_scsi_init,
0),
总结:这款USB上网转换模块就是垃圾,还必须做个USB模式切换。