Commit b7562261 authored by Alon Ziv's avatar Alon Ziv Committed by Greg Kroah-Hartman

USB: opticon: Fix long-standing bugs in opticon driver

commit 97cd8dc4 upstream.

The bulk-read callback had two bugs:
a) The bulk-in packet's leading two zeros were returned (and the two last
   bytes truncated)
b) The wrong URB was transmitted for the second (and later) read requests,
   causing further reads to return the entire packet (including leading
   zeros)
Signed-off-by: default avatarAlon Ziv <alon-git@nolaviz.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 12a9dbf4
...@@ -99,8 +99,8 @@ static void opticon_bulk_callback(struct urb *urb) ...@@ -99,8 +99,8 @@ static void opticon_bulk_callback(struct urb *urb)
available_room = tty_buffer_request_room(tty, available_room = tty_buffer_request_room(tty,
data_length); data_length);
if (available_room) { if (available_room) {
tty_insert_flip_string(tty, data, tty_insert_flip_string(tty, data + 2,
available_room); data_length);
tty_flip_buffer_push(tty); tty_flip_buffer_push(tty);
} }
tty_kref_put(tty); tty_kref_put(tty);
...@@ -134,7 +134,7 @@ static void opticon_bulk_callback(struct urb *urb) ...@@ -134,7 +134,7 @@ static void opticon_bulk_callback(struct urb *urb)
priv->bulk_address), priv->bulk_address),
priv->bulk_in_buffer, priv->buffer_size, priv->bulk_in_buffer, priv->buffer_size,
opticon_bulk_callback, priv); opticon_bulk_callback, priv);
result = usb_submit_urb(port->read_urb, GFP_ATOMIC); result = usb_submit_urb(priv->bulk_read_urb, GFP_ATOMIC);
if (result) if (result)
dev_err(&port->dev, dev_err(&port->dev,
"%s - failed resubmitting read urb, error %d\n", "%s - failed resubmitting read urb, error %d\n",
......
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