1 diff -Naur -X /home/marcelo/lib/dontdiff linux-2.4.19/drivers/bluetooth/hci_usb.c linux-2.4.20/drivers/bluetooth/hci_usb.c
2 --- linux-2.4.19/drivers/bluetooth/hci_usb.c 2002-08-03 00:39:43.000000000 +0000
3 +++ linux-2.4.20/drivers/bluetooth/hci_usb.c 2002-10-29 11:18:38.000000000 +0000
5 * Copyright (c) 2000 Greg Kroah-Hartman <greg@kroah.com>
6 * Copyright (c) 2000 Mark Douglas Corner <mcorner@umich.edu>
11 -#define VERSION "2.0"
12 +#define VERSION "2.1"
14 #include <linux/config.h>
15 #include <linux/module.h>
18 static struct usb_driver hci_usb_driver;
20 -static struct usb_device_id usb_bluetooth_ids [] = {
21 +static struct usb_device_id bluetooth_ids[] = {
22 /* Generic Bluetooth USB device */
23 { USB_DEVICE_INFO(HCI_DEV_CLASS, HCI_DEV_SUBCLASS, HCI_DEV_PROTOCOL) },
26 { } /* Terminating entry */
29 -MODULE_DEVICE_TABLE (usb, usb_bluetooth_ids);
30 +MODULE_DEVICE_TABLE (usb, bluetooth_ids);
32 +static struct usb_device_id ignore_ids[] = {
33 + /* Broadcom BCM2033 without firmware */
34 + { USB_DEVICE(0x0a5c, 0x2033) },
36 + { } /* Terminating entry */
39 static void hci_usb_interrupt(struct urb *urb);
40 static void hci_usb_rx_complete(struct urb *urb);
41 static void hci_usb_tx_complete(struct urb *urb);
43 -static purb_t hci_usb_get_completed(struct hci_usb *husb)
44 +static struct urb *hci_usb_get_completed(struct hci_usb *husb)
48 + struct urb *urb = NULL;
50 skb = skb_dequeue(&husb->completed_q);
54 struct hci_usb *husb = (struct hci_usb *) hdev->driver_data;
57 + unsigned long flags;
59 BT_DBG("%s", hdev->name);
61 if (test_and_set_bit(HCI_RUNNING, &hdev->flags))
66 write_lock_irqsave(&husb->completion_lock, flags);
68 err = hci_usb_enable_intr(husb);
70 for (i = 0; i < HCI_MAX_BULK_TX; i++)
71 hci_usb_rx_submit(husb, NULL);
74 clear_bit(HCI_RUNNING, &hdev->flags);
79 write_unlock_irqrestore(&husb->completion_lock, flags);
83 static inline void hci_usb_unlink_urbs(struct hci_usb *husb)
89 BT_DBG("%s", husb->hdev.name);
92 static int hci_usb_close(struct hci_dev *hdev)
94 struct hci_usb *husb = (struct hci_usb *) hdev->driver_data;
96 + unsigned long flags;
98 if (!test_and_clear_bit(HCI_RUNNING, &hdev->flags))
100 @@ -261,14 +272,16 @@
103 write_unlock_irqrestore(&husb->completion_lock, flags);
109 static inline int hci_usb_send_ctrl(struct hci_usb *husb, struct sk_buff *skb)
111 struct hci_usb_scb *scb = (void *) skb->cb;
112 - purb_t urb = hci_usb_get_completed(husb);
114 + struct urb *urb = hci_usb_get_completed(husb);
115 + struct usb_ctrlrequest *dr;
118 if (!urb && !(urb = usb_alloc_urb(0)))
119 @@ -281,11 +294,11 @@
121 pipe = usb_sndctrlpipe(husb->udev, 0);
123 - dr->requesttype = HCI_CTRL_REQ;
127 - dr->length = __cpu_to_le16(skb->len);
128 + dr->bRequestType = HCI_CTRL_REQ;
132 + dr->wLength = __cpu_to_le16(skb->len);
134 FILL_CONTROL_URB(urb, husb->udev, pipe, (void *) dr,
135 skb->data, skb->len, hci_usb_tx_complete, skb);
137 static inline int hci_usb_send_bulk(struct hci_usb *husb, struct sk_buff *skb)
139 struct hci_usb_scb *scb = (void *) skb->cb;
140 - purb_t urb = hci_usb_get_completed(husb);
141 + struct urb *urb = hci_usb_get_completed(husb);
144 if (!urb && !(urb = usb_alloc_urb(0)))
147 husb = (struct hci_usb *) hdev->driver_data;
153 -#ifdef CONFIG_BLUEZ_USB_FW_LOAD
155 -/* Support for user mode Bluetooth USB firmware loader */
157 -#define FW_LOADER "/sbin/bluefw"
160 -static int hci_usb_fw_exec(void *dev)
162 - char *envp[] = { "HOME=/", "TERM=linux",
163 - "PATH=/sbin:/usr/sbin:/bin:/usr/bin", NULL };
164 - char *argv[] = { FW_LOADER, dev, NULL };
167 - err = exec_usermodehelper(FW_LOADER, argv, envp);
169 - BT_ERR("failed to exec %s %s", FW_LOADER, (char *)dev);
173 -static int hci_usb_fw_load(struct usb_device *udev)
180 - /* Check if root fs is mounted */
181 - if (!current->fs->root) {
182 - BT_ERR("root fs not mounted");
186 - sprintf(dev, "%3.3d/%3.3d", udev->bus->busnum, udev->devnum);
188 - pid = kernel_thread(hci_usb_fw_exec, (void *)dev, 0);
190 - BT_ERR("fork failed, errno %d\n", -pid);
194 - /* Block signals, everything but SIGKILL/SIGSTOP */
195 - spin_lock_irq(¤t->sigmask_lock);
196 - tmpsig = current->blocked;
197 - siginitsetinv(¤t->blocked, sigmask(SIGKILL) | sigmask(SIGSTOP));
198 - recalc_sigpending(current);
199 - spin_unlock_irq(¤t->sigmask_lock);
201 - result = waitpid(pid, NULL, __WCLONE);
203 - /* Allow signals again */
204 - spin_lock_irq(¤t->sigmask_lock);
205 - current->blocked = tmpsig;
206 - recalc_sigpending(current);
207 - spin_unlock_irq(¤t->sigmask_lock);
209 - if (result != pid) {
210 - BT_ERR("waitpid failed pid %d errno %d\n", pid, -result);
216 -#endif /* CONFIG_BLUEZ_USB_FW_LOAD */
218 -static void * hci_usb_probe(struct usb_device *udev, unsigned int ifnum, const struct usb_device_id *id)
219 +static void *hci_usb_probe(struct usb_device *udev, unsigned int ifnum, const struct usb_device_id *id)
221 struct usb_endpoint_descriptor *bulk_out_ep[HCI_MAX_IFACE_NUM];
222 struct usb_endpoint_descriptor *isoc_out_ep[HCI_MAX_IFACE_NUM];
223 @@ -673,16 +619,16 @@
225 BT_DBG("udev %p ifnum %d", udev, ifnum);
227 + iface = &udev->actconfig->interface[0];
229 + /* Check our black list */
230 + if (usb_match_id(udev, iface, ignore_ids))
233 /* Check number of endpoints */
234 if (udev->actconfig->interface[ifnum].altsetting[0].bNumEndpoints < 3)
239 -#ifdef CONFIG_BLUEZ_USB_FW_LOAD
240 - hci_usb_fw_load(udev);
243 memset(bulk_out_ep, 0, sizeof(bulk_out_ep));
244 memset(isoc_out_ep, 0, sizeof(isoc_out_ep));
245 memset(bulk_in_ep, 0, sizeof(bulk_in_ep));
256 probe: hci_usb_probe,
257 disconnect: hci_usb_disconnect,
258 - id_table: usb_bluetooth_ids,
259 + id_table: bluetooth_ids,
262 int hci_usb_init(void)
263 diff -Naur -X /home/marcelo/lib/dontdiff linux-2.4.19/drivers/bluetooth/hci_usb.h linux-2.4.20/drivers/bluetooth/hci_usb.h
264 --- linux-2.4.19/drivers/bluetooth/hci_usb.h 2002-08-03 00:39:43.000000000 +0000
265 +++ linux-2.4.20/drivers/bluetooth/hci_usb.h 2002-10-29 11:18:32.000000000 +0000
271 + struct urb *intr_urb;
272 struct sk_buff * intr_skb;
274 rwlock_t completion_lock;