Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions drivers/usb/serial/option.c
Original file line number Diff line number Diff line change
Expand Up @@ -971,6 +971,7 @@ static const struct usb_device_id option_ids[] = {
{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x06, 0x7A) },
{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x06, 0x7B) },
{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x06, 0x7C) },
{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x06, 0x7C) },

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

if (serial->dev->descriptor.idVendor == HUAWEI_VENDOR_ID) {
if ( 0 != (serial->dev->config->desc.bmAttributes & 0x20)){
usb_enable_autosuspend(serial->dev);
}
}

data = kzalloc(sizeof(struct usb_wwan_intf_private), GFP_KERNEL);
if (!data)
return -ENOMEM;
Expand Down
13 changes: 13 additions & 0 deletions drivers/usb/serial/usb_wwan.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
#include <linux/serial.h>
#include "usb-wwan.h"

#define HW_bcdUSB 0x0110
#define HUAWEI_VENDOR_ID 0x12d1

/*
* Generate DTR/RTS signals on the port using the SET_CONTROL_LINE_STATE request
* in CDC ACM.
Expand Down Expand Up @@ -217,6 +220,7 @@ int usb_wwan_write(struct tty_struct *tty, struct usb_serial_port *port,
{
struct usb_wwan_port_private *portdata;
struct usb_wwan_intf_private *intfdata;
struct usb_host_endpoint *ep;
int i;
int left, todo;
struct urb *this_urb = NULL; /* spurious */
Expand Down Expand Up @@ -256,6 +260,15 @@ int usb_wwan_write(struct tty_struct *tty, struct usb_serial_port *port,
memcpy(this_urb->transfer_buffer, buf, todo);
this_urb->transfer_buffer_length = todo;

if((HUAWEI_VENDOR_ID == port->serial->dev->descriptor.idVendor)
&& (HW_bcdUSB != port->serial->dev->descriptor.bcdUSB)){
ep = usb_pipe_endpoint(this_urb->dev, this_urb->pipe);
if(ep && (0 != this_urb->transfer_buffer_length)
&& (0 == this_urb->transfer_buffer_length % ep->desc.wMaxPacketSize)){
this_urb->transfer_flags |= URB_ZERO_PACKET;
}
}

spin_lock_irqsave(&intfdata->susp_lock, flags);
if (intfdata->suspended) {
usb_anchor_urb(this_urb, &portdata->delayed);
Expand Down