12 #include <linux/kernel.h>
14 #include <linux/tty.h>
15 #include <linux/slab.h>
18 #include <linux/module.h>
24 { USB_DEVICE(0x05e0, 0x0600) },
45 static void symbol_int_callback(
struct urb *
urb)
48 unsigned char *
data = urb->transfer_buffer;
63 dev_dbg(&port->
dev,
"%s - urb shutting down with status: %d\n",
67 dev_dbg(&port->
dev,
"%s - nonzero urb status received: %d\n",
72 usb_serial_debug_data(&port->
dev, __func__, urb->actual_length, data);
74 if (urb->actual_length > 1) {
75 data_length = urb->actual_length - 1;
87 tty_insert_flip_string(tty, &data[1], data_length);
93 "Improper amount of data received from the device, "
94 "%d bytes", urb->actual_length);
98 spin_lock(&priv->
lock);
103 usb_rcvintpipe(priv->
udev,
106 symbol_int_callback, priv, priv->
bInterval);
110 "%s - failed resubmitting read urb, error %d\n",
114 spin_unlock(&priv->
lock);
127 spin_unlock_irqrestore(&priv->
lock, flags);
133 symbol_int_callback, priv, priv->
bInterval);
137 "%s - failed resubmitting read urb, error %d\n",
150 static void symbol_throttle(
struct tty_struct *tty)
155 spin_lock_irq(&priv->
lock);
157 spin_unlock_irq(&priv->
lock);
160 static void symbol_unthrottle(
struct tty_struct *tty)
167 spin_lock_irq(&priv->
lock);
171 spin_unlock_irq(&priv->
lock);
177 "%s - failed submitting read urb, error %d\n",
185 struct usb_host_interface *
intf;
188 bool int_in_found =
false;
193 dev_err(&serial->
dev->dev,
"%s - Out of memory\n", __func__);
203 for (i = 0; i < intf->desc.bNumEndpoints; ++
i) {
206 endpoint = &intf->endpoint[
i].desc;
207 if (!usb_endpoint_is_int_in(endpoint))
216 priv->
buffer_size = usb_endpoint_maxp(endpoint) * 2;
228 usb_rcvintpipe(priv->
udev,
231 symbol_int_callback, priv, priv->
bInterval);
239 "Error - the proper endpoints were not found!\n");
243 usb_set_serial_data(serial, priv);
253 static void symbol_disconnect(
struct usb_serial *serial)
261 static void symbol_release(
struct usb_serial *serial)
276 .attach = symbol_startup,
278 .close = symbol_close,
279 .disconnect = symbol_disconnect,
280 .release = symbol_release,
281 .throttle = symbol_throttle,
282 .unthrottle = symbol_unthrottle,