11 #include <linux/kernel.h>
12 #include <linux/module.h>
14 #include <linux/netdevice.h>
28 #define VENDOR_ID 0x1291
29 #define PRODUCT_ID 0x11
39 static bool gPollingfailed =
FALSE;
40 static int ft1000_poll_thread(
void *
arg)
46 if (!gPollingfailed) {
49 DEBUG(
"ft1000_poll_thread: polling failed\n");
50 gPollingfailed =
TRUE;
60 struct usb_host_interface *iface_desc;
62 struct usb_device *
dev;
63 unsigned numaltsetting;
73 pr_err(
"out of memory allocating device structure\n");
77 dev = interface_to_usbdev(interface);
78 DEBUG(
"ft1000_probe: usb device descriptor info:\n");
79 DEBUG(
"ft1000_probe: number of configuration is %d\n",
80 dev->descriptor.bNumConfigurations);
88 DEBUG(
"ft1000_probe is called\n");
89 numaltsetting = interface->num_altsetting;
90 DEBUG(
"ft1000_probe: number of alt settings is :%d\n", numaltsetting);
91 iface_desc = interface->cur_altsetting;
92 DEBUG(
"ft1000_probe: number of endpoints is %d\n",
93 iface_desc->desc.bNumEndpoints);
94 DEBUG(
"ft1000_probe: descriptor type is %d\n",
95 iface_desc->desc.bDescriptorType);
96 DEBUG(
"ft1000_probe: interface number is %d\n",
97 iface_desc->desc.bInterfaceNumber);
98 DEBUG(
"ft1000_probe: alternatesetting is %d\n",
99 iface_desc->desc.bAlternateSetting);
100 DEBUG(
"ft1000_probe: interface class is %d\n",
101 iface_desc->desc.bInterfaceClass);
102 DEBUG(
"ft1000_probe: control endpoint info:\n");
103 DEBUG(
"ft1000_probe: descriptor0 type -- %d\n",
104 iface_desc->endpoint[0].desc.bmAttributes);
105 DEBUG(
"ft1000_probe: descriptor1 type -- %d\n",
106 iface_desc->endpoint[1].desc.bmAttributes);
107 DEBUG(
"ft1000_probe: descriptor2 type -- %d\n",
108 iface_desc->endpoint[2].desc.bmAttributes);
110 for (i = 0; i < iface_desc->desc.bNumEndpoints; i++) {
114 DEBUG(
"endpoint %d\n", i);
115 DEBUG(
"bEndpointAddress=%x, bmAttributes=%x\n",
122 DEBUG(
"ft1000_probe: in: %d\n",
131 DEBUG(
"ft1000_probe: out: %d\n",
141 pr_err(
"Error request_firmware().\n");
158 DEBUG(
"ft1000_probe: start downloading dsp image...\n");
164 pft1000info = netdev_priv(ft1000dev->
net);
166 DEBUG(
"In probe: pft1000info=%p\n", pft1000info);
169 pr_err(
"Problem with DSP image loading\n");
173 gPollingfailed =
FALSE;
175 kthread_run(ft1000_poll_thread, ft1000dev,
"ft1000_poll");
185 if (gPollingfailed) {
190 DEBUG(
"ft1000_probe::Waiting for Card Ready\n");
193 DEBUG(
"ft1000_probe::Card Ready!!!! Registering network device\n");
219 static void ft1000_disconnect(
struct usb_interface *interface)
223 DEBUG(
"ft1000_disconnect is called\n");
225 pft1000info = (
struct ft1000_info *) usb_get_intfdata(interface);
226 DEBUG(
"In disconnect pft1000info=%p\n", pft1000info);
233 DEBUG(
"ft1000_disconnect: threads are terminated\n");
236 DEBUG(
"ft1000_disconnect: destroy char driver\n");
240 (
"ft1000_disconnect: network device unregistered\n");
248 DEBUG(
"ft1000_disconnect: urb freed\n");
257 static struct usb_driver ft1000_usb_driver = {
259 .probe = ft1000_probe,
260 .disconnect = ft1000_disconnect,
261 .id_table = id_table,