Commit e618834e authored by James Maki's avatar James Maki Committed by Greg Kroah-Hartman

USB: option.c: option_indat_callback: Resubmit some unsuccessful URBs

All unsuccessful (non-zero status) URBs were being dropped. After N_IN_URBs are
dropped you will no longer be able to receive data.

This patch resubmits unsuccessful URBs unless the status indicates that it should
be terminated. The statuses that indicate the URB should be terminated was
gathered from other similar drivers.
Signed-off-by: default avatarJames Maki <jamescmaki@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 71adf118
...@@ -1019,31 +1019,42 @@ static void option_indat_callback(struct urb *urb) ...@@ -1019,31 +1019,42 @@ static void option_indat_callback(struct urb *urb)
dbg("%s: %p", __func__, urb); dbg("%s: %p", __func__, urb);
endpoint = usb_pipeendpoint(urb->pipe); endpoint = usb_pipeendpoint(urb->pipe);
port = urb->context; port = urb->context;
if (status) { switch (status) {
case 0:
/* success */
break;
case -ECONNRESET:
case -ENOENT:
case -ESHUTDOWN:
/* this urb is terminated, clean up */
dbg("%s: urb shutting down with status: %d on endpoint %02x.",
__func__, status, endpoint);
return;
default:
dbg("%s: nonzero status: %d on endpoint %02x.", dbg("%s: nonzero status: %d on endpoint %02x.",
__func__, status, endpoint); __func__, status, endpoint);
} else { goto exit;
}
if (urb->actual_length) {
tty = tty_port_tty_get(&port->port); tty = tty_port_tty_get(&port->port);
if (urb->actual_length) { tty_insert_flip_string(tty, data, urb->actual_length);
tty_insert_flip_string(tty, data, urb->actual_length); tty_flip_buffer_push(tty);
tty_flip_buffer_push(tty);
} else
dbg("%s: empty read urb received", __func__);
tty_kref_put(tty); tty_kref_put(tty);
} else
dbg("%s: empty read urb received", __func__);
/* Resubmit urb so we continue receiving */ exit:
if (status != -ESHUTDOWN) { /* Resubmit urb so we continue receiving */
err = usb_submit_urb(urb, GFP_ATOMIC); err = usb_submit_urb(urb, GFP_ATOMIC);
if (err && err != -EPERM) if (err && err != -EPERM)
printk(KERN_ERR "%s: resubmit read urb failed. " printk(KERN_ERR "%s: resubmit read urb failed. "
"(%d)", __func__, err); "(%d)", __func__, err);
else else
usb_mark_last_busy(port->serial->dev); usb_mark_last_busy(port->serial->dev);
}
}
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment