当前位置:   article > 正文

OpenWrt 支持 合宙 cat1 Luat 4G Air 724UG模块 ttyUSB功能_openwrt没有ttyusb

openwrt没有ttyusb

1、make menuconfig

需要支持

Kenrel modules -> USB Support -> kmod-usb-net -> kmod-usb-net-rndis
  • 1

2、添加配置。
内核文件路径大致如下


openwrt/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/linux-ramips_mt7628/linux-3.18.29/drivers/usb/serial/option.c
  • 1
  • 2

修改两个文件 :

注意 P_ID 和 V_ID 需要使用对应的地址(可在官方手册上查)。

1) option.c

第一个位置:
static const struct usb_device_id option_ids[] = {
//+add by airm2m for Air72x
{ USB_DEVICE(0x1782, 0x4e00) },
//-add by airm2m for Air72x
***
}

第二个位置:
#ifdef CONFIG_PM
.suspend = usb_wwan_suspend,
.resume = usb_wwan_resume,
//+add by airm2m for Air726
.reset_resume = usb_wwan_resume,
//-add by airm2m for Air726
***

第三个位置(避免当成usb存储设备):
static int option_probe(struct usb_serial *serial,
            const struct usb_device_id *id)
{
***
if (is_blacklisted(
iface_desc->bInterfaceNumber,
OPTION_BLACKLIST_RESERVED_IF,
(const struct option_blacklist_info *) id->driver_info))
return -ENODEV;
//+add by airm2m for Air72x
  if(dev_desc->idVendor == cpu_to_le16(0x1782) &&
     dev_desc->idProduct == cpu_to_le16(0x4e00) &&
     iface_desc->bInterfaceNumber <= 1)
        return -ENODEV;
//-add by airm2m for Air72x
***
}

2) usb_wwan.c文件
static struct urb *usb_wwan_setup_urb(struct usb_serial_port *port,
int endpoint,
int dir, void *ctx, char *buf, int len,
void (*callback) (struct urb *))
{
struct usb_serial *serial = port->serial;
struct urb *urb;

urb = usb_alloc_urb(0, GFP_KERNEL); /* No ISO */
if (!urb)
return NULL;

usb_fill_bulk_urb(urb, serial->dev,
usb_sndbulkpipe(serial->dev, endpoint) | dir,
buf, len, callback, ctx);
//+add by airm2m for Air72x
if(dir == USB_DIR_OUT){
struct usb_device_descriptor *desc = &serial->dev->descriptor;
if(desc->idVendor == cpu_to_le16(0x1782) && desc->idProduct == cpu_to_le16(0x4e00))
{
urb->transfer_flags |= URB_ZERO_PACKET;
}
}
//-add by airm2m for Air72x
***
}

3、修改内核

make kernel_menuconfig

勾选如下:
[*] Device Drivers →
     [*] USB Support → 
         <*>Support for Host-side USB →
             [*] USB Serial Converter support →
                 [*] USB driver for GSM and CDMA modems

重新编译 make V=s

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家小花儿/article/detail/359572
推荐阅读
相关标签
  

闽ICP备14008679号