Skip to content

Commit ee3a190

Browse files
authored
Merge pull request hardkernel#24 from yan-wyb/khadas-vims-4.9.y
Add HUAWEI ME906s Supports
2 parents 40178b4 + 72ebcbb commit ee3a190

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

drivers/usb/serial/option.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -971,6 +971,7 @@ static const struct usb_device_id option_ids[] = {
971971
{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x06, 0x7A) },
972972
{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x06, 0x7B) },
973973
{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x06, 0x7C) },
974+
{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x06, 0x7C) },
974975

975976
/* Motorola devices */
976977
{ USB_DEVICE_AND_INTERFACE_INFO(0x22b8, 0x2a70, 0xff, 0xff, 0xff) }, /* mdm6600 */
@@ -2113,6 +2114,12 @@ static int option_attach(struct usb_serial *serial)
21132114
struct usb_wwan_intf_private *data;
21142115
unsigned long device_flags;
21152116

2117+
if (serial->dev->descriptor.idVendor == HUAWEI_VENDOR_ID) {
2118+
if ( 0 != (serial->dev->config->desc.bmAttributes & 0x20)){
2119+
usb_enable_autosuspend(serial->dev);
2120+
}
2121+
}
2122+
21162123
data = kzalloc(sizeof(struct usb_wwan_intf_private), GFP_KERNEL);
21172124
if (!data)
21182125
return -ENOMEM;

drivers/usb/serial/usb_wwan.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@
3636
#include <linux/serial.h>
3737
#include "usb-wwan.h"
3838

39+
#define HW_bcdUSB 0x0110
40+
#define HUAWEI_VENDOR_ID 0x12d1
41+
3942
/*
4043
* Generate DTR/RTS signals on the port using the SET_CONTROL_LINE_STATE request
4144
* in CDC ACM.
@@ -217,6 +220,7 @@ int usb_wwan_write(struct tty_struct *tty, struct usb_serial_port *port,
217220
{
218221
struct usb_wwan_port_private *portdata;
219222
struct usb_wwan_intf_private *intfdata;
223+
struct usb_host_endpoint *ep;
220224
int i;
221225
int left, todo;
222226
struct urb *this_urb = NULL; /* spurious */
@@ -256,6 +260,15 @@ int usb_wwan_write(struct tty_struct *tty, struct usb_serial_port *port,
256260
memcpy(this_urb->transfer_buffer, buf, todo);
257261
this_urb->transfer_buffer_length = todo;
258262

263+
if((HUAWEI_VENDOR_ID == port->serial->dev->descriptor.idVendor)
264+
&& (HW_bcdUSB != port->serial->dev->descriptor.bcdUSB)){
265+
ep = usb_pipe_endpoint(this_urb->dev, this_urb->pipe);
266+
if(ep && (0 != this_urb->transfer_buffer_length)
267+
&& (0 == this_urb->transfer_buffer_length % ep->desc.wMaxPacketSize)){
268+
this_urb->transfer_flags |= URB_ZERO_PACKET;
269+
}
270+
}
271+
259272
spin_lock_irqsave(&intfdata->susp_lock, flags);
260273
if (intfdata->suspended) {
261274
usb_anchor_urb(this_urb, &portdata->delayed);

0 commit comments

Comments
 (0)