linux平台添加usb 3g的流程 (usb 接口中兴AC580)

12 篇文章 1 订阅
4 篇文章 0 订阅
我说一下,我的编写流程:
1.在storage/unusual_devs.h中添加
UNUSUAL_DEV(0x19D2,0x0026,0x0000,0x0000,
"ZTE MOBILE",
"Mass Storage",
US_SC_DEVICE,US_PR_DEVICE,usb_stor_ZTE_AC580_init,
0),

2.在storage/Initializers.h中添加
int usb_stor_ZTE_AC580_init(struct us_data *us);

3.在storage/Initializers.c中添加
int usb_stor_ZTE_AC580_init(struct us_data *us)  // PID = 0x0026
{
int result = 0;
int act_len = 0;

unsigned char cmd[32] = { 
0x55, 0x53, 0x42, 0x43, 0x28, 0x4e, 0xbc, 0x88, 
0x24, 0x00, 0x00, 0x00, 0x80, 0x00, 0x06, 0x85, 
0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};


result = usb_stor_control_msg(us, us->send_ctrl_pipe,USB_REQ_SET_FEATURE,
      USB_TYPE_STANDARD | USB_RECIP_DEVICE,0x01, 0x0, NULL, 0x0, 1000);
US_DEBUGP("usb_stor_control_msg performing result is %d\n", result);
printk("====AC580===>usb_stor_control_msg performing result is %d\n", result);

result |= usb_stor_bulk_transfer_buf (us, us->send_bulk_pipe, cmd, 31, &act_len);
US_DEBUGP("usb_stor_bulk_transfer_buf performing result12 is %d, transfer the actual length=%d\n", result, act_len);
printk("usb_stor_bulk_transfer_buf performing result is %d, transfer the actual length=%d\n", result, act_len);

return (result ? 0 : -ENODEV);
}

5.在Serial/option.c中添加
#define ZTE_VENDOR_ID 0x19D2
#define ZTE_PRODUCT_AC580 0x0094
{USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID,0x0026,0xff,0xff,0xff)},
{USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID,ZTE_PRODUCT_AC580,0xff,0xff,0xff)},
  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值