]>
Commit | Line | Data |
---|---|---|
c5d96f5a | 1 | --- linux-2.4.19.old/drivers/bluetooth/hci_usb.c Sat Aug 3 02:39:43 2002 |
2 | +++ linux-2.4.19/drivers/bluetooth/hci_usb.c Mon Nov 25 12:26:26 2002 | |
3 | @@ -28,9 +28,9 @@ | |
4 | * Copyright (c) 2000 Greg Kroah-Hartman <greg@kroah.com> | |
5 | * Copyright (c) 2000 Mark Douglas Corner <mcorner@umich.edu> | |
6 | * | |
7 | - * $Id$ | |
8 | + * $Id$ | |
9 | */ | |
10 | -#define VERSION "2.0" | |
11 | +#define VERSION "2.1" | |
12 | ||
13 | #include <linux/config.h> | |
14 | #include <linux/module.h> | |
15 | @@ -73,7 +73,7 @@ | |
16 | ||
17 | static struct usb_driver hci_usb_driver; | |
18 | ||
19 | -static struct usb_device_id usb_bluetooth_ids [] = { | |
20 | +static struct usb_device_id bluetooth_ids[] = { | |
21 | /* Generic Bluetooth USB device */ | |
22 | { USB_DEVICE_INFO(HCI_DEV_CLASS, HCI_DEV_SUBCLASS, HCI_DEV_PROTOCOL) }, | |
23 | ||
24 | @@ -83,16 +83,23 @@ | |
25 | { } /* Terminating entry */ | |
26 | }; | |
27 | ||
28 | -MODULE_DEVICE_TABLE (usb, usb_bluetooth_ids); | |
29 | +MODULE_DEVICE_TABLE (usb, bluetooth_ids); | |
30 | + | |
31 | +static struct usb_device_id ignore_ids[] = { | |
32 | + /* Broadcom BCM2033 without firmware */ | |
33 | + { USB_DEVICE(0x0a5c, 0x2033) }, | |
34 | + | |
35 | + { } /* Terminating entry */ | |
36 | +}; | |
37 | ||
38 | static void hci_usb_interrupt(struct urb *urb); | |
39 | static void hci_usb_rx_complete(struct urb *urb); | |
40 | static void hci_usb_tx_complete(struct urb *urb); | |
41 | ||
42 | -static purb_t hci_usb_get_completed(struct hci_usb *husb) | |
43 | +static struct urb *hci_usb_get_completed(struct hci_usb *husb) | |
44 | { | |
45 | struct sk_buff *skb; | |
46 | - purb_t urb = NULL; | |
47 | + struct urb *urb = NULL; | |
48 | ||
49 | skb = skb_dequeue(&husb->completed_q); | |
50 | if (skb) { | |
51 | @@ -194,22 +201,26 @@ | |
52 | { | |
53 | struct hci_usb *husb = (struct hci_usb *) hdev->driver_data; | |
54 | int i, err; | |
55 | - long flags; | |
56 | + unsigned long flags; | |
57 | ||
58 | BT_DBG("%s", hdev->name); | |
59 | ||
60 | if (test_and_set_bit(HCI_RUNNING, &hdev->flags)) | |
61 | return 0; | |
62 | ||
63 | + MOD_INC_USE_COUNT; | |
64 | + | |
65 | write_lock_irqsave(&husb->completion_lock, flags); | |
66 | ||
67 | err = hci_usb_enable_intr(husb); | |
68 | if (!err) { | |
69 | for (i = 0; i < HCI_MAX_BULK_TX; i++) | |
70 | hci_usb_rx_submit(husb, NULL); | |
71 | - } else | |
72 | + } else { | |
73 | clear_bit(HCI_RUNNING, &hdev->flags); | |
74 | - | |
75 | + MOD_DEC_USE_COUNT; | |
76 | + } | |
77 | + | |
78 | write_unlock_irqrestore(&husb->completion_lock, flags); | |
79 | return err; | |
80 | } | |
81 | @@ -229,7 +240,7 @@ | |
82 | static inline void hci_usb_unlink_urbs(struct hci_usb *husb) | |
83 | { | |
84 | struct sk_buff *skb; | |
85 | - purb_t urb; | |
86 | + struct urb *urb; | |
87 | ||
88 | BT_DBG("%s", husb->hdev.name); | |
89 | ||
90 | @@ -247,7 +258,7 @@ | |
91 | static int hci_usb_close(struct hci_dev *hdev) | |
92 | { | |
93 | struct hci_usb *husb = (struct hci_usb *) hdev->driver_data; | |
94 | - long flags; | |
95 | + unsigned long flags; | |
96 | ||
97 | if (!test_and_clear_bit(HCI_RUNNING, &hdev->flags)) | |
98 | return 0; | |
99 | @@ -261,14 +272,16 @@ | |
100 | hci_usb_flush(hdev); | |
101 | ||
102 | write_unlock_irqrestore(&husb->completion_lock, flags); | |
103 | + | |
104 | + MOD_DEC_USE_COUNT; | |
105 | return 0; | |
106 | } | |
107 | ||
108 | static inline int hci_usb_send_ctrl(struct hci_usb *husb, struct sk_buff *skb) | |
109 | { | |
110 | struct hci_usb_scb *scb = (void *) skb->cb; | |
111 | - purb_t urb = hci_usb_get_completed(husb); | |
112 | - devrequest *dr; | |
113 | + struct urb *urb = hci_usb_get_completed(husb); | |
114 | + struct usb_ctrlrequest *dr; | |
115 | int pipe, err; | |
116 | ||
117 | if (!urb && !(urb = usb_alloc_urb(0))) | |
118 | @@ -281,11 +294,11 @@ | |
119 | ||
120 | pipe = usb_sndctrlpipe(husb->udev, 0); | |
121 | ||
122 | - dr->requesttype = HCI_CTRL_REQ; | |
123 | - dr->request = 0; | |
124 | - dr->index = 0; | |
125 | - dr->value = 0; | |
126 | - dr->length = __cpu_to_le16(skb->len); | |
127 | + dr->bRequestType = HCI_CTRL_REQ; | |
128 | + dr->bRequest = 0; | |
129 | + dr->wIndex = 0; | |
130 | + dr->wValue = 0; | |
131 | + dr->wLength = __cpu_to_le16(skb->len); | |
132 | ||
133 | FILL_CONTROL_URB(urb, husb->udev, pipe, (void *) dr, | |
134 | skb->data, skb->len, hci_usb_tx_complete, skb); | |
135 | @@ -308,7 +321,7 @@ | |
136 | static inline int hci_usb_send_bulk(struct hci_usb *husb, struct sk_buff *skb) | |
137 | { | |
138 | struct hci_usb_scb *scb = (void *) skb->cb; | |
139 | - purb_t urb = hci_usb_get_completed(husb); | |
140 | + struct urb *urb = hci_usb_get_completed(husb); | |
141 | int pipe, err; | |
142 | ||
143 | if (!urb && !(urb = usb_alloc_urb(0))) | |
144 | @@ -588,76 +601,9 @@ | |
145 | ||
146 | husb = (struct hci_usb *) hdev->driver_data; | |
147 | kfree(husb); | |
148 | - | |
149 | - MOD_DEC_USE_COUNT; | |
150 | -} | |
151 | - | |
152 | -#ifdef CONFIG_BLUEZ_USB_FW_LOAD | |
153 | - | |
154 | -/* Support for user mode Bluetooth USB firmware loader */ | |
155 | - | |
156 | -#define FW_LOADER "/sbin/bluefw" | |
157 | -static int errno; | |
158 | - | |
159 | -static int hci_usb_fw_exec(void *dev) | |
160 | -{ | |
161 | - char *envp[] = { "HOME=/", "TERM=linux", | |
162 | - "PATH=/sbin:/usr/sbin:/bin:/usr/bin", NULL }; | |
163 | - char *argv[] = { FW_LOADER, dev, NULL }; | |
164 | - int err; | |
165 | - | |
166 | - err = exec_usermodehelper(FW_LOADER, argv, envp); | |
167 | - if (err) | |
168 | - BT_ERR("failed to exec %s %s", FW_LOADER, (char *)dev); | |
169 | - return err; | |
170 | } | |
171 | ||
172 | -static int hci_usb_fw_load(struct usb_device *udev) | |
173 | -{ | |
174 | - sigset_t tmpsig; | |
175 | - char dev[16]; | |
176 | - pid_t pid; | |
177 | - int result; | |
178 | - | |
179 | - /* Check if root fs is mounted */ | |
180 | - if (!current->fs->root) { | |
181 | - BT_ERR("root fs not mounted"); | |
182 | - return -EPERM; | |
183 | - } | |
184 | - | |
185 | - sprintf(dev, "%3.3d/%3.3d", udev->bus->busnum, udev->devnum); | |
186 | - | |
187 | - pid = kernel_thread(hci_usb_fw_exec, (void *)dev, 0); | |
188 | - if (pid < 0) { | |
189 | - BT_ERR("fork failed, errno %d\n", -pid); | |
190 | - return pid; | |
191 | - } | |
192 | - | |
193 | - /* Block signals, everything but SIGKILL/SIGSTOP */ | |
194 | - spin_lock_irq(¤t->sigmask_lock); | |
195 | - tmpsig = current->blocked; | |
196 | - siginitsetinv(¤t->blocked, sigmask(SIGKILL) | sigmask(SIGSTOP)); | |
197 | - recalc_sigpending(current); | |
198 | - spin_unlock_irq(¤t->sigmask_lock); | |
199 | - | |
200 | - result = waitpid(pid, NULL, __WCLONE); | |
201 | - | |
202 | - /* Allow signals again */ | |
203 | - spin_lock_irq(¤t->sigmask_lock); | |
204 | - current->blocked = tmpsig; | |
205 | - recalc_sigpending(current); | |
206 | - spin_unlock_irq(¤t->sigmask_lock); | |
207 | - | |
208 | - if (result != pid) { | |
209 | - BT_ERR("waitpid failed pid %d errno %d\n", pid, -result); | |
210 | - return -result; | |
211 | - } | |
212 | - return 0; | |
213 | -} | |
214 | - | |
215 | -#endif /* CONFIG_BLUEZ_USB_FW_LOAD */ | |
216 | - | |
217 | -static void * hci_usb_probe(struct usb_device *udev, unsigned int ifnum, const struct usb_device_id *id) | |
218 | +static void *hci_usb_probe(struct usb_device *udev, unsigned int ifnum, const struct usb_device_id *id) | |
219 | { | |
220 | struct usb_endpoint_descriptor *bulk_out_ep[HCI_MAX_IFACE_NUM]; | |
221 | struct usb_endpoint_descriptor *isoc_out_ep[HCI_MAX_IFACE_NUM]; | |
222 | @@ -673,16 +619,16 @@ | |
223 | ||
224 | BT_DBG("udev %p ifnum %d", udev, ifnum); | |
225 | ||
226 | + iface = &udev->actconfig->interface[0]; | |
227 | + | |
228 | + /* Check our black list */ | |
229 | + if (usb_match_id(udev, iface, ignore_ids)) | |
230 | + return NULL; | |
231 | + | |
232 | /* Check number of endpoints */ | |
233 | if (udev->actconfig->interface[ifnum].altsetting[0].bNumEndpoints < 3) | |
234 | return NULL; | |
235 | ||
236 | - MOD_INC_USE_COUNT; | |
237 | - | |
238 | -#ifdef CONFIG_BLUEZ_USB_FW_LOAD | |
239 | - hci_usb_fw_load(udev); | |
240 | -#endif | |
241 | - | |
242 | memset(bulk_out_ep, 0, sizeof(bulk_out_ep)); | |
243 | memset(isoc_out_ep, 0, sizeof(isoc_out_ep)); | |
244 | memset(bulk_in_ep, 0, sizeof(bulk_in_ep)); | |
245 | @@ -801,7 +747,6 @@ | |
246 | kfree(husb); | |
247 | ||
248 | done: | |
249 | - MOD_DEC_USE_COUNT; | |
250 | return NULL; | |
251 | } | |
252 | ||
253 | @@ -828,7 +773,7 @@ | |
254 | name: "hci_usb", | |
255 | probe: hci_usb_probe, | |
256 | disconnect: hci_usb_disconnect, | |
257 | - id_table: usb_bluetooth_ids, | |
258 | + id_table: bluetooth_ids, | |
259 | }; | |
260 | ||
261 | int hci_usb_init(void) | |
262 | --- linux-2.4.19.old/drivers/bluetooth/hci_usb.h Sat Aug 3 02:39:43 2002 | |
263 | +++ linux-2.4.19/drivers/bluetooth/hci_usb.h Mon Nov 25 12:26:26 2002 | |
264 | @@ -55,7 +55,7 @@ | |
265 | ||
266 | __u8 intr_ep; | |
267 | __u8 intr_interval; | |
268 | - purb_t intr_urb; | |
269 | + struct urb *intr_urb; | |
270 | struct sk_buff * intr_skb; | |
271 | ||
272 | rwlock_t completion_lock; |