提交 3dd2ae81 编写于 作者: O Oliver Neukum 提交者: Greg Kroah-Hartman

[PATCH] USB: update for acm in quirks and debug

this adds
better debugging output &
an update of the quirk list
to the acm driver
Signed-off-by: NOliver Neukum <oliver@neukum.name>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 9189bfc2
...@@ -291,13 +291,13 @@ static void acm_read_bulk(struct urb *urb, struct pt_regs *regs) ...@@ -291,13 +291,13 @@ static void acm_read_bulk(struct urb *urb, struct pt_regs *regs)
struct acm_ru *rcv = urb->context; struct acm_ru *rcv = urb->context;
struct acm *acm = rcv->instance; struct acm *acm = rcv->instance;
int status = urb->status; int status = urb->status;
dbg("Entering acm_read_bulk with status %d\n", urb->status); dbg("Entering acm_read_bulk with status %d", urb->status);
if (!ACM_READY(acm)) if (!ACM_READY(acm))
return; return;
if (status) if (status)
dev_dbg(&acm->data->dev, "bulk rx status %d\n", status); dev_dbg(&acm->data->dev, "bulk rx status %d", status);
buf = rcv->buffer; buf = rcv->buffer;
buf->size = urb->actual_length; buf->size = urb->actual_length;
...@@ -343,7 +343,7 @@ static void acm_rx_tasklet(unsigned long _acm) ...@@ -343,7 +343,7 @@ static void acm_rx_tasklet(unsigned long _acm)
list_del(&buf->list); list_del(&buf->list);
spin_unlock(&acm->read_lock); spin_unlock(&acm->read_lock);
dbg("acm_rx_tasklet: procesing buf 0x%p, size = %d\n", buf, buf->size); dbg("acm_rx_tasklet: procesing buf 0x%p, size = %d", buf, buf->size);
tty_buffer_request_room(tty, buf->size); tty_buffer_request_room(tty, buf->size);
if (!acm->throttle) if (!acm->throttle)
...@@ -394,7 +394,7 @@ static void acm_rx_tasklet(unsigned long _acm) ...@@ -394,7 +394,7 @@ static void acm_rx_tasklet(unsigned long _acm)
rcv->urb->transfer_dma = buf->dma; rcv->urb->transfer_dma = buf->dma;
rcv->urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; rcv->urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
dbg("acm_rx_tasklet: sending urb 0x%p, rcv 0x%p, buf 0x%p\n", rcv->urb, rcv, buf); dbg("acm_rx_tasklet: sending urb 0x%p, rcv 0x%p, buf 0x%p", rcv->urb, rcv, buf);
/* This shouldn't kill the driver as unsuccessful URBs are returned to the /* This shouldn't kill the driver as unsuccessful URBs are returned to the
free-urbs-pool and resubmited ASAP */ free-urbs-pool and resubmited ASAP */
...@@ -413,7 +413,7 @@ static void acm_write_bulk(struct urb *urb, struct pt_regs *regs) ...@@ -413,7 +413,7 @@ static void acm_write_bulk(struct urb *urb, struct pt_regs *regs)
{ {
struct acm *acm = (struct acm *)urb->context; struct acm *acm = (struct acm *)urb->context;
dbg("Entering acm_write_bulk with status %d\n", urb->status); dbg("Entering acm_write_bulk with status %d", urb->status);
acm_write_done(acm); acm_write_done(acm);
acm_write_start(acm); acm_write_start(acm);
...@@ -424,7 +424,7 @@ static void acm_write_bulk(struct urb *urb, struct pt_regs *regs) ...@@ -424,7 +424,7 @@ static void acm_write_bulk(struct urb *urb, struct pt_regs *regs)
static void acm_softint(void *private) static void acm_softint(void *private)
{ {
struct acm *acm = private; struct acm *acm = private;
dbg("Entering acm_softint.\n"); dbg("Entering acm_softint.");
if (!ACM_READY(acm)) if (!ACM_READY(acm))
return; return;
...@@ -440,7 +440,7 @@ static int acm_tty_open(struct tty_struct *tty, struct file *filp) ...@@ -440,7 +440,7 @@ static int acm_tty_open(struct tty_struct *tty, struct file *filp)
struct acm *acm; struct acm *acm;
int rv = -EINVAL; int rv = -EINVAL;
int i; int i;
dbg("Entering acm_tty_open.\n"); dbg("Entering acm_tty_open.");
mutex_lock(&open_mutex); mutex_lock(&open_mutex);
...@@ -541,7 +541,7 @@ static int acm_tty_write(struct tty_struct *tty, const unsigned char *buf, int c ...@@ -541,7 +541,7 @@ static int acm_tty_write(struct tty_struct *tty, const unsigned char *buf, int c
int wbn; int wbn;
struct acm_wb *wb; struct acm_wb *wb;
dbg("Entering acm_tty_write to write %d bytes,\n", count); dbg("Entering acm_tty_write to write %d bytes,", count);
if (!ACM_READY(acm)) if (!ACM_READY(acm))
return -EINVAL; return -EINVAL;
...@@ -793,7 +793,7 @@ static int acm_probe (struct usb_interface *intf, ...@@ -793,7 +793,7 @@ static int acm_probe (struct usb_interface *intf,
if (!buflen) { if (!buflen) {
if (intf->cur_altsetting->endpoint->extralen && intf->cur_altsetting->endpoint->extra) { if (intf->cur_altsetting->endpoint->extralen && intf->cur_altsetting->endpoint->extra) {
dev_dbg(&intf->dev,"Seeking extra descriptors on endpoint\n"); dev_dbg(&intf->dev,"Seeking extra descriptors on endpoint");
buflen = intf->cur_altsetting->endpoint->extralen; buflen = intf->cur_altsetting->endpoint->extralen;
buffer = intf->cur_altsetting->endpoint->extra; buffer = intf->cur_altsetting->endpoint->extra;
} else { } else {
...@@ -842,24 +842,24 @@ static int acm_probe (struct usb_interface *intf, ...@@ -842,24 +842,24 @@ static int acm_probe (struct usb_interface *intf,
if (!union_header) { if (!union_header) {
if (call_interface_num > 0) { if (call_interface_num > 0) {
dev_dbg(&intf->dev,"No union descriptor, using call management descriptor\n"); dev_dbg(&intf->dev,"No union descriptor, using call management descriptor");
data_interface = usb_ifnum_to_if(usb_dev, (data_interface_num = call_interface_num)); data_interface = usb_ifnum_to_if(usb_dev, (data_interface_num = call_interface_num));
control_interface = intf; control_interface = intf;
} else { } else {
dev_dbg(&intf->dev,"No union descriptor, giving up\n"); dev_dbg(&intf->dev,"No union descriptor, giving up");
return -ENODEV; return -ENODEV;
} }
} else { } else {
control_interface = usb_ifnum_to_if(usb_dev, union_header->bMasterInterface0); control_interface = usb_ifnum_to_if(usb_dev, union_header->bMasterInterface0);
data_interface = usb_ifnum_to_if(usb_dev, (data_interface_num = union_header->bSlaveInterface0)); data_interface = usb_ifnum_to_if(usb_dev, (data_interface_num = union_header->bSlaveInterface0));
if (!control_interface || !data_interface) { if (!control_interface || !data_interface) {
dev_dbg(&intf->dev,"no interfaces\n"); dev_dbg(&intf->dev,"no interfaces");
return -ENODEV; return -ENODEV;
} }
} }
if (data_interface_num != call_interface_num) if (data_interface_num != call_interface_num)
dev_dbg(&intf->dev,"Seperate call control interface. That is not fully supported.\n"); dev_dbg(&intf->dev,"Seperate call control interface. That is not fully supported.");
skip_normal_probe: skip_normal_probe:
...@@ -867,7 +867,7 @@ static int acm_probe (struct usb_interface *intf, ...@@ -867,7 +867,7 @@ static int acm_probe (struct usb_interface *intf,
if (data_interface->cur_altsetting->desc.bInterfaceClass != CDC_DATA_INTERFACE_TYPE) { if (data_interface->cur_altsetting->desc.bInterfaceClass != CDC_DATA_INTERFACE_TYPE) {
if (control_interface->cur_altsetting->desc.bInterfaceClass == CDC_DATA_INTERFACE_TYPE) { if (control_interface->cur_altsetting->desc.bInterfaceClass == CDC_DATA_INTERFACE_TYPE) {
struct usb_interface *t; struct usb_interface *t;
dev_dbg(&intf->dev,"Your device has switched interfaces.\n"); dev_dbg(&intf->dev,"Your device has switched interfaces.");
t = control_interface; t = control_interface;
control_interface = data_interface; control_interface = data_interface;
...@@ -878,7 +878,7 @@ static int acm_probe (struct usb_interface *intf, ...@@ -878,7 +878,7 @@ static int acm_probe (struct usb_interface *intf,
} }
if (usb_interface_claimed(data_interface)) { /* valid in this context */ if (usb_interface_claimed(data_interface)) { /* valid in this context */
dev_dbg(&intf->dev,"The data interface isn't available\n"); dev_dbg(&intf->dev,"The data interface isn't available");
return -EBUSY; return -EBUSY;
} }
...@@ -895,7 +895,7 @@ static int acm_probe (struct usb_interface *intf, ...@@ -895,7 +895,7 @@ static int acm_probe (struct usb_interface *intf,
if ((epread->bEndpointAddress & USB_DIR_IN) != USB_DIR_IN) { if ((epread->bEndpointAddress & USB_DIR_IN) != USB_DIR_IN) {
/* descriptors are swapped */ /* descriptors are swapped */
struct usb_endpoint_descriptor *t; struct usb_endpoint_descriptor *t;
dev_dbg(&intf->dev,"The data interface has switched endpoints\n"); dev_dbg(&intf->dev,"The data interface has switched endpoints");
t = epread; t = epread;
epread = epwrite; epread = epwrite;
...@@ -910,7 +910,7 @@ static int acm_probe (struct usb_interface *intf, ...@@ -910,7 +910,7 @@ static int acm_probe (struct usb_interface *intf,
} }
if (!(acm = kzalloc(sizeof(struct acm), GFP_KERNEL))) { if (!(acm = kzalloc(sizeof(struct acm), GFP_KERNEL))) {
dev_dbg(&intf->dev, "out of memory (acm kzalloc)\n"); dev_dbg(&intf->dev, "out of memory (acm kzalloc)");
goto alloc_fail; goto alloc_fail;
} }
...@@ -936,26 +936,26 @@ static int acm_probe (struct usb_interface *intf, ...@@ -936,26 +936,26 @@ static int acm_probe (struct usb_interface *intf,
buf = usb_buffer_alloc(usb_dev, ctrlsize, GFP_KERNEL, &acm->ctrl_dma); buf = usb_buffer_alloc(usb_dev, ctrlsize, GFP_KERNEL, &acm->ctrl_dma);
if (!buf) { if (!buf) {
dev_dbg(&intf->dev, "out of memory (ctrl buffer alloc)\n"); dev_dbg(&intf->dev, "out of memory (ctrl buffer alloc)");
goto alloc_fail2; goto alloc_fail2;
} }
acm->ctrl_buffer = buf; acm->ctrl_buffer = buf;
if (acm_write_buffers_alloc(acm) < 0) { if (acm_write_buffers_alloc(acm) < 0) {
dev_dbg(&intf->dev, "out of memory (write buffer alloc)\n"); dev_dbg(&intf->dev, "out of memory (write buffer alloc)");
goto alloc_fail4; goto alloc_fail4;
} }
acm->ctrlurb = usb_alloc_urb(0, GFP_KERNEL); acm->ctrlurb = usb_alloc_urb(0, GFP_KERNEL);
if (!acm->ctrlurb) { if (!acm->ctrlurb) {
dev_dbg(&intf->dev, "out of memory (ctrlurb kmalloc)\n"); dev_dbg(&intf->dev, "out of memory (ctrlurb kmalloc)");
goto alloc_fail5; goto alloc_fail5;
} }
for (i = 0; i < num_rx_buf; i++) { for (i = 0; i < num_rx_buf; i++) {
struct acm_ru *rcv = &(acm->ru[i]); struct acm_ru *rcv = &(acm->ru[i]);
if (!(rcv->urb = usb_alloc_urb(0, GFP_KERNEL))) { if (!(rcv->urb = usb_alloc_urb(0, GFP_KERNEL))) {
dev_dbg(&intf->dev, "out of memory (read urbs usb_alloc_urb)\n"); dev_dbg(&intf->dev, "out of memory (read urbs usb_alloc_urb)");
goto alloc_fail7; goto alloc_fail7;
} }
...@@ -966,13 +966,13 @@ static int acm_probe (struct usb_interface *intf, ...@@ -966,13 +966,13 @@ static int acm_probe (struct usb_interface *intf,
struct acm_rb *buf = &(acm->rb[i]); struct acm_rb *buf = &(acm->rb[i]);
if (!(buf->base = usb_buffer_alloc(acm->dev, readsize, GFP_KERNEL, &buf->dma))) { if (!(buf->base = usb_buffer_alloc(acm->dev, readsize, GFP_KERNEL, &buf->dma))) {
dev_dbg(&intf->dev, "out of memory (read bufs usb_buffer_alloc)\n"); dev_dbg(&intf->dev, "out of memory (read bufs usb_buffer_alloc)");
goto alloc_fail7; goto alloc_fail7;
} }
} }
acm->writeurb = usb_alloc_urb(0, GFP_KERNEL); acm->writeurb = usb_alloc_urb(0, GFP_KERNEL);
if (!acm->writeurb) { if (!acm->writeurb) {
dev_dbg(&intf->dev, "out of memory (writeurb kmalloc)\n"); dev_dbg(&intf->dev, "out of memory (writeurb kmalloc)");
goto alloc_fail7; goto alloc_fail7;
} }
...@@ -1086,6 +1086,9 @@ static struct usb_device_id acm_ids[] = { ...@@ -1086,6 +1086,9 @@ static struct usb_device_id acm_ids[] = {
{ USB_DEVICE(0x0ace, 0x1608), /* ZyDAS 56K USB MODEM */ { USB_DEVICE(0x0ace, 0x1608), /* ZyDAS 56K USB MODEM */
.driver_info = SINGLE_RX_URB, /* firmware bug */ .driver_info = SINGLE_RX_URB, /* firmware bug */
}, },
{ USB_DEVICE(0x0ace, 0x1611), /* ZyDAS 56K USB MODEM - new version */
.driver_info = SINGLE_RX_URB, /* firmware bug */
},
/* control interfaces with various AT-command sets */ /* control interfaces with various AT-command sets */
{ USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM, { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM,
USB_CDC_ACM_PROTO_AT_V25TER) }, USB_CDC_ACM_PROTO_AT_V25TER) },
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册