47 #include <asm/unaligned.h>
48 #include <linux/tty.h>
49 #include <linux/slab.h>
50 #include <linux/module.h>
56 #define AIRCABLE_VID 0x16CA
57 #define AIRCABLE_USB_PID 0x1502
60 #define HCI_HEADER_LENGTH 0x4
61 #define TX_HEADER_0 0x20
62 #define TX_HEADER_1 0x29
63 #define RX_HEADER_0 0x00
64 #define RX_HEADER_1 0x20
65 #define HCI_COMPLETE_FRAME 64
68 #define THROTTLED 0x01
69 #define ACTUALLY_THROTTLED 0x02
74 #define DRIVER_VERSION "v2.0"
76 #define DRIVER_DESC "AIRcable USB Driver"
95 put_unaligned_le16(count, &buf[2]);
103 struct usb_host_interface *iface_desc = serial->
interface->
106 int num_bulk_out = 0;
109 for (i = 0; i < iface_desc->desc.bNumEndpoints; i++) {
110 endpoint = &iface_desc->endpoint[
i].desc;
111 if (usb_endpoint_is_bulk_out(endpoint)) {
113 "found bulk out on endpoint %d\n", i);
118 if (num_bulk_out == 0) {
119 dev_dbg(&serial->
dev->dev,
"Invalid interface, discarding\n");
126 static int aircable_process_packet(
struct tty_struct *tty,
135 dev_dbg(&port->
dev,
"%s - malformed packet\n", __func__);
139 tty_insert_flip_string(tty, packet, len);
144 static void aircable_process_read_urb(
struct urb *
urb)
147 char *
data = (
char *)urb->transfer_buffer;
158 has_headers = (urb->actual_length > 2 && data[0] ==
RX_HEADER_0);
163 count += aircable_process_packet(tty, port, has_headers,
180 .probe = aircable_probe,
181 .process_read_urb = aircable_process_read_urb,
182 .prepare_write_buffer = aircable_prepare_write_buffer,
188 &aircable_device,
NULL