btusb.c 30 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246
  1. /*
  2. *
  3. * Generic Bluetooth USB driver
  4. *
  5. * Copyright (C) 2005-2008 Marcel Holtmann <marcel@holtmann.org>
  6. *
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  21. *
  22. */
  23. #include <linux/module.h>
  24. #include <linux/usb.h>
  25. #include <net/bluetooth/bluetooth.h>
  26. #include <net/bluetooth/hci_core.h>
  27. #define VERSION "0.6"
  28. static bool ignore_dga;
  29. static bool ignore_csr;
  30. static bool ignore_sniffer;
  31. static bool disable_scofix;
  32. static bool force_scofix;
  33. static bool reset = 1;
  34. static struct usb_driver btusb_driver;
  35. #define BTUSB_IGNORE 0x01
  36. #define BTUSB_DIGIANSWER 0x02
  37. #define BTUSB_CSR 0x04
  38. #define BTUSB_SNIFFER 0x08
  39. #define BTUSB_BCM92035 0x10
  40. #define BTUSB_BROKEN_ISOC 0x20
  41. #define BTUSB_WRONG_SCO_MTU 0x40
  42. #define BTUSB_ATH3012 0x80
  43. static struct usb_device_id btusb_table[] = {
  44. /* Generic Bluetooth USB device */
  45. { USB_DEVICE_INFO(0xe0, 0x01, 0x01) },
  46. /* Broadcom SoftSailing reporting vendor specific */
  47. { USB_DEVICE(0x0a5c, 0x21e1) },
  48. /* Apple MacBookPro 7,1 */
  49. { USB_DEVICE(0x05ac, 0x8213) },
  50. /* Apple iMac11,1 */
  51. { USB_DEVICE(0x05ac, 0x8215) },
  52. /* Apple MacBookPro6,2 */
  53. { USB_DEVICE(0x05ac, 0x8218) },
  54. /* Apple MacBookAir3,1, MacBookAir3,2 */
  55. { USB_DEVICE(0x05ac, 0x821b) },
  56. /* Apple MacBookAir4,1 */
  57. { USB_DEVICE(0x05ac, 0x821f) },
  58. /* Apple MacBookPro8,2 */
  59. { USB_DEVICE(0x05ac, 0x821a) },
  60. /* Apple MacMini5,1 */
  61. { USB_DEVICE(0x05ac, 0x8281) },
  62. /* AVM BlueFRITZ! USB v2.0 */
  63. { USB_DEVICE(0x057c, 0x3800) },
  64. /* Bluetooth Ultraport Module from IBM */
  65. { USB_DEVICE(0x04bf, 0x030a) },
  66. /* ALPS Modules with non-standard id */
  67. { USB_DEVICE(0x044e, 0x3001) },
  68. { USB_DEVICE(0x044e, 0x3002) },
  69. /* Ericsson with non-standard id */
  70. { USB_DEVICE(0x0bdb, 0x1002) },
  71. /* Canyon CN-BTU1 with HID interfaces */
  72. { USB_DEVICE(0x0c10, 0x0000) },
  73. /* Broadcom BCM20702A0 */
  74. { USB_DEVICE(0x0489, 0xe042) },
  75. { USB_DEVICE(0x0a5c, 0x21e3) },
  76. { USB_DEVICE(0x0a5c, 0x21e6) },
  77. { USB_DEVICE(0x0a5c, 0x21e8) },
  78. { USB_DEVICE(0x0a5c, 0x21f3) },
  79. { USB_DEVICE(0x413c, 0x8197) },
  80. /* Foxconn - Hon Hai */
  81. { USB_DEVICE(0x0489, 0xe033) },
  82. { } /* Terminating entry */
  83. };
  84. MODULE_DEVICE_TABLE(usb, btusb_table);
  85. static struct usb_device_id blacklist_table[] = {
  86. /* CSR BlueCore devices */
  87. { USB_DEVICE(0x0a12, 0x0001), .driver_info = BTUSB_CSR },
  88. /* Broadcom BCM2033 without firmware */
  89. { USB_DEVICE(0x0a5c, 0x2033), .driver_info = BTUSB_IGNORE },
  90. /* Atheros 3011 with sflash firmware */
  91. { USB_DEVICE(0x0cf3, 0x3002), .driver_info = BTUSB_IGNORE },
  92. { USB_DEVICE(0x0cf3, 0xe019), .driver_info = BTUSB_IGNORE },
  93. { USB_DEVICE(0x13d3, 0x3304), .driver_info = BTUSB_IGNORE },
  94. { USB_DEVICE(0x0930, 0x0215), .driver_info = BTUSB_IGNORE },
  95. { USB_DEVICE(0x0489, 0xe03d), .driver_info = BTUSB_IGNORE },
  96. /* Atheros AR9285 Malbec with sflash firmware */
  97. { USB_DEVICE(0x03f0, 0x311d), .driver_info = BTUSB_IGNORE },
  98. /* Atheros 3012 with sflash firmware */
  99. { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 },
  100. { USB_DEVICE(0x0cf3, 0x311d), .driver_info = BTUSB_ATH3012 },
  101. { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 },
  102. { USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 },
  103. { USB_DEVICE(0x13d3, 0x3362), .driver_info = BTUSB_ATH3012 },
  104. { USB_DEVICE(0x0cf3, 0xe004), .driver_info = BTUSB_ATH3012 },
  105. { USB_DEVICE(0x0930, 0x0219), .driver_info = BTUSB_ATH3012 },
  106. /* Atheros AR5BBU12 with sflash firmware */
  107. { USB_DEVICE(0x0489, 0xe02c), .driver_info = BTUSB_IGNORE },
  108. /* Atheros AR5BBU12 with sflash firmware */
  109. { USB_DEVICE(0x0489, 0xe03c), .driver_info = BTUSB_ATH3012 },
  110. /* Broadcom BCM2035 */
  111. { USB_DEVICE(0x0a5c, 0x2035), .driver_info = BTUSB_WRONG_SCO_MTU },
  112. { USB_DEVICE(0x0a5c, 0x200a), .driver_info = BTUSB_WRONG_SCO_MTU },
  113. { USB_DEVICE(0x0a5c, 0x2009), .driver_info = BTUSB_BCM92035 },
  114. /* Broadcom BCM2045 */
  115. { USB_DEVICE(0x0a5c, 0x2039), .driver_info = BTUSB_WRONG_SCO_MTU },
  116. { USB_DEVICE(0x0a5c, 0x2101), .driver_info = BTUSB_WRONG_SCO_MTU },
  117. /* IBM/Lenovo ThinkPad with Broadcom chip */
  118. { USB_DEVICE(0x0a5c, 0x201e), .driver_info = BTUSB_WRONG_SCO_MTU },
  119. { USB_DEVICE(0x0a5c, 0x2110), .driver_info = BTUSB_WRONG_SCO_MTU },
  120. /* HP laptop with Broadcom chip */
  121. { USB_DEVICE(0x03f0, 0x171d), .driver_info = BTUSB_WRONG_SCO_MTU },
  122. /* Dell laptop with Broadcom chip */
  123. { USB_DEVICE(0x413c, 0x8126), .driver_info = BTUSB_WRONG_SCO_MTU },
  124. /* Dell Wireless 370 and 410 devices */
  125. { USB_DEVICE(0x413c, 0x8152), .driver_info = BTUSB_WRONG_SCO_MTU },
  126. { USB_DEVICE(0x413c, 0x8156), .driver_info = BTUSB_WRONG_SCO_MTU },
  127. /* Belkin F8T012 and F8T013 devices */
  128. { USB_DEVICE(0x050d, 0x0012), .driver_info = BTUSB_WRONG_SCO_MTU },
  129. { USB_DEVICE(0x050d, 0x0013), .driver_info = BTUSB_WRONG_SCO_MTU },
  130. /* Asus WL-BTD202 device */
  131. { USB_DEVICE(0x0b05, 0x1715), .driver_info = BTUSB_WRONG_SCO_MTU },
  132. /* Kensington Bluetooth USB adapter */
  133. { USB_DEVICE(0x047d, 0x105e), .driver_info = BTUSB_WRONG_SCO_MTU },
  134. /* RTX Telecom based adapters with buggy SCO support */
  135. { USB_DEVICE(0x0400, 0x0807), .driver_info = BTUSB_BROKEN_ISOC },
  136. { USB_DEVICE(0x0400, 0x080a), .driver_info = BTUSB_BROKEN_ISOC },
  137. /* CONWISE Technology based adapters with buggy SCO support */
  138. { USB_DEVICE(0x0e5e, 0x6622), .driver_info = BTUSB_BROKEN_ISOC },
  139. /* Digianswer devices */
  140. { USB_DEVICE(0x08fd, 0x0001), .driver_info = BTUSB_DIGIANSWER },
  141. { USB_DEVICE(0x08fd, 0x0002), .driver_info = BTUSB_IGNORE },
  142. /* CSR BlueCore Bluetooth Sniffer */
  143. { USB_DEVICE(0x0a12, 0x0002), .driver_info = BTUSB_SNIFFER },
  144. /* Frontline ComProbe Bluetooth Sniffer */
  145. { USB_DEVICE(0x16d3, 0x0002), .driver_info = BTUSB_SNIFFER },
  146. { } /* Terminating entry */
  147. };
  148. #define BTUSB_MAX_ISOC_FRAMES 10
  149. #define BTUSB_INTR_RUNNING 0
  150. #define BTUSB_BULK_RUNNING 1
  151. #define BTUSB_ISOC_RUNNING 2
  152. #define BTUSB_SUSPENDING 3
  153. #define BTUSB_DID_ISO_RESUME 4
  154. struct btusb_data {
  155. struct hci_dev *hdev;
  156. struct usb_device *udev;
  157. struct usb_interface *intf;
  158. struct usb_interface *isoc;
  159. spinlock_t lock;
  160. unsigned long flags;
  161. struct work_struct work;
  162. struct work_struct waker;
  163. struct usb_anchor tx_anchor;
  164. struct usb_anchor intr_anchor;
  165. struct usb_anchor bulk_anchor;
  166. struct usb_anchor isoc_anchor;
  167. struct usb_anchor deferred;
  168. int tx_in_flight;
  169. spinlock_t txlock;
  170. struct usb_endpoint_descriptor *intr_ep;
  171. struct usb_endpoint_descriptor *bulk_tx_ep;
  172. struct usb_endpoint_descriptor *bulk_rx_ep;
  173. struct usb_endpoint_descriptor *isoc_tx_ep;
  174. struct usb_endpoint_descriptor *isoc_rx_ep;
  175. __u8 cmdreq_type;
  176. unsigned int sco_num;
  177. int isoc_altsetting;
  178. int suspend_count;
  179. };
  180. static int inc_tx(struct btusb_data *data)
  181. {
  182. unsigned long flags;
  183. int rv;
  184. spin_lock_irqsave(&data->txlock, flags);
  185. rv = test_bit(BTUSB_SUSPENDING, &data->flags);
  186. if (!rv)
  187. data->tx_in_flight++;
  188. spin_unlock_irqrestore(&data->txlock, flags);
  189. return rv;
  190. }
  191. static void btusb_intr_complete(struct urb *urb)
  192. {
  193. struct hci_dev *hdev = urb->context;
  194. struct btusb_data *data = hci_get_drvdata(hdev);
  195. int err;
  196. BT_DBG("%s urb %p status %d count %d", hdev->name,
  197. urb, urb->status, urb->actual_length);
  198. if (!test_bit(HCI_RUNNING, &hdev->flags))
  199. return;
  200. if (urb->status == 0) {
  201. hdev->stat.byte_rx += urb->actual_length;
  202. if (hci_recv_fragment(hdev, HCI_EVENT_PKT,
  203. urb->transfer_buffer,
  204. urb->actual_length) < 0) {
  205. BT_ERR("%s corrupted event packet", hdev->name);
  206. hdev->stat.err_rx++;
  207. }
  208. }
  209. if (!test_bit(BTUSB_INTR_RUNNING, &data->flags))
  210. return;
  211. usb_mark_last_busy(data->udev);
  212. usb_anchor_urb(urb, &data->intr_anchor);
  213. err = usb_submit_urb(urb, GFP_ATOMIC);
  214. if (err < 0) {
  215. /* -EPERM: urb is being killed;
  216. * -ENODEV: device got disconnected */
  217. if (err != -EPERM && err != -ENODEV)
  218. BT_ERR("%s urb %p failed to resubmit (%d)",
  219. hdev->name, urb, -err);
  220. usb_unanchor_urb(urb);
  221. }
  222. }
  223. static int btusb_submit_intr_urb(struct hci_dev *hdev, gfp_t mem_flags)
  224. {
  225. struct btusb_data *data = hci_get_drvdata(hdev);
  226. struct urb *urb;
  227. unsigned char *buf;
  228. unsigned int pipe;
  229. int err, size;
  230. BT_DBG("%s", hdev->name);
  231. if (!data->intr_ep)
  232. return -ENODEV;
  233. urb = usb_alloc_urb(0, mem_flags);
  234. if (!urb)
  235. return -ENOMEM;
  236. size = le16_to_cpu(data->intr_ep->wMaxPacketSize);
  237. buf = kmalloc(size, mem_flags);
  238. if (!buf) {
  239. usb_free_urb(urb);
  240. return -ENOMEM;
  241. }
  242. pipe = usb_rcvintpipe(data->udev, data->intr_ep->bEndpointAddress);
  243. usb_fill_int_urb(urb, data->udev, pipe, buf, size,
  244. btusb_intr_complete, hdev,
  245. data->intr_ep->bInterval);
  246. urb->transfer_flags |= URB_FREE_BUFFER;
  247. usb_anchor_urb(urb, &data->intr_anchor);
  248. err = usb_submit_urb(urb, mem_flags);
  249. if (err < 0) {
  250. if (err != -EPERM && err != -ENODEV)
  251. BT_ERR("%s urb %p submission failed (%d)",
  252. hdev->name, urb, -err);
  253. usb_unanchor_urb(urb);
  254. }
  255. usb_free_urb(urb);
  256. return err;
  257. }
  258. static void btusb_bulk_complete(struct urb *urb)
  259. {
  260. struct hci_dev *hdev = urb->context;
  261. struct btusb_data *data = hci_get_drvdata(hdev);
  262. int err;
  263. BT_DBG("%s urb %p status %d count %d", hdev->name,
  264. urb, urb->status, urb->actual_length);
  265. if (!test_bit(HCI_RUNNING, &hdev->flags))
  266. return;
  267. if (urb->status == 0) {
  268. hdev->stat.byte_rx += urb->actual_length;
  269. if (hci_recv_fragment(hdev, HCI_ACLDATA_PKT,
  270. urb->transfer_buffer,
  271. urb->actual_length) < 0) {
  272. BT_ERR("%s corrupted ACL packet", hdev->name);
  273. hdev->stat.err_rx++;
  274. }
  275. }
  276. if (!test_bit(BTUSB_BULK_RUNNING, &data->flags))
  277. return;
  278. usb_anchor_urb(urb, &data->bulk_anchor);
  279. usb_mark_last_busy(data->udev);
  280. err = usb_submit_urb(urb, GFP_ATOMIC);
  281. if (err < 0) {
  282. /* -EPERM: urb is being killed;
  283. * -ENODEV: device got disconnected */
  284. if (err != -EPERM && err != -ENODEV)
  285. BT_ERR("%s urb %p failed to resubmit (%d)",
  286. hdev->name, urb, -err);
  287. usb_unanchor_urb(urb);
  288. }
  289. }
  290. static int btusb_submit_bulk_urb(struct hci_dev *hdev, gfp_t mem_flags)
  291. {
  292. struct btusb_data *data = hci_get_drvdata(hdev);
  293. struct urb *urb;
  294. unsigned char *buf;
  295. unsigned int pipe;
  296. int err, size = HCI_MAX_FRAME_SIZE;
  297. BT_DBG("%s", hdev->name);
  298. if (!data->bulk_rx_ep)
  299. return -ENODEV;
  300. urb = usb_alloc_urb(0, mem_flags);
  301. if (!urb)
  302. return -ENOMEM;
  303. buf = kmalloc(size, mem_flags);
  304. if (!buf) {
  305. usb_free_urb(urb);
  306. return -ENOMEM;
  307. }
  308. pipe = usb_rcvbulkpipe(data->udev, data->bulk_rx_ep->bEndpointAddress);
  309. usb_fill_bulk_urb(urb, data->udev, pipe,
  310. buf, size, btusb_bulk_complete, hdev);
  311. urb->transfer_flags |= URB_FREE_BUFFER;
  312. usb_mark_last_busy(data->udev);
  313. usb_anchor_urb(urb, &data->bulk_anchor);
  314. err = usb_submit_urb(urb, mem_flags);
  315. if (err < 0) {
  316. if (err != -EPERM && err != -ENODEV)
  317. BT_ERR("%s urb %p submission failed (%d)",
  318. hdev->name, urb, -err);
  319. usb_unanchor_urb(urb);
  320. }
  321. usb_free_urb(urb);
  322. return err;
  323. }
  324. static void btusb_isoc_complete(struct urb *urb)
  325. {
  326. struct hci_dev *hdev = urb->context;
  327. struct btusb_data *data = hci_get_drvdata(hdev);
  328. int i, err;
  329. BT_DBG("%s urb %p status %d count %d", hdev->name,
  330. urb, urb->status, urb->actual_length);
  331. if (!test_bit(HCI_RUNNING, &hdev->flags))
  332. return;
  333. if (urb->status == 0) {
  334. for (i = 0; i < urb->number_of_packets; i++) {
  335. unsigned int offset = urb->iso_frame_desc[i].offset;
  336. unsigned int length = urb->iso_frame_desc[i].actual_length;
  337. if (urb->iso_frame_desc[i].status)
  338. continue;
  339. hdev->stat.byte_rx += length;
  340. if (hci_recv_fragment(hdev, HCI_SCODATA_PKT,
  341. urb->transfer_buffer + offset,
  342. length) < 0) {
  343. BT_ERR("%s corrupted SCO packet", hdev->name);
  344. hdev->stat.err_rx++;
  345. }
  346. }
  347. }
  348. if (!test_bit(BTUSB_ISOC_RUNNING, &data->flags))
  349. return;
  350. usb_anchor_urb(urb, &data->isoc_anchor);
  351. err = usb_submit_urb(urb, GFP_ATOMIC);
  352. if (err < 0) {
  353. /* -EPERM: urb is being killed;
  354. * -ENODEV: device got disconnected */
  355. if (err != -EPERM && err != -ENODEV)
  356. BT_ERR("%s urb %p failed to resubmit (%d)",
  357. hdev->name, urb, -err);
  358. usb_unanchor_urb(urb);
  359. }
  360. }
  361. static inline void __fill_isoc_descriptor(struct urb *urb, int len, int mtu)
  362. {
  363. int i, offset = 0;
  364. BT_DBG("len %d mtu %d", len, mtu);
  365. for (i = 0; i < BTUSB_MAX_ISOC_FRAMES && len >= mtu;
  366. i++, offset += mtu, len -= mtu) {
  367. urb->iso_frame_desc[i].offset = offset;
  368. urb->iso_frame_desc[i].length = mtu;
  369. }
  370. if (len && i < BTUSB_MAX_ISOC_FRAMES) {
  371. urb->iso_frame_desc[i].offset = offset;
  372. urb->iso_frame_desc[i].length = len;
  373. i++;
  374. }
  375. urb->number_of_packets = i;
  376. }
  377. static int btusb_submit_isoc_urb(struct hci_dev *hdev, gfp_t mem_flags)
  378. {
  379. struct btusb_data *data = hci_get_drvdata(hdev);
  380. struct urb *urb;
  381. unsigned char *buf;
  382. unsigned int pipe;
  383. int err, size;
  384. BT_DBG("%s", hdev->name);
  385. if (!data->isoc_rx_ep)
  386. return -ENODEV;
  387. urb = usb_alloc_urb(BTUSB_MAX_ISOC_FRAMES, mem_flags);
  388. if (!urb)
  389. return -ENOMEM;
  390. size = le16_to_cpu(data->isoc_rx_ep->wMaxPacketSize) *
  391. BTUSB_MAX_ISOC_FRAMES;
  392. buf = kmalloc(size, mem_flags);
  393. if (!buf) {
  394. usb_free_urb(urb);
  395. return -ENOMEM;
  396. }
  397. pipe = usb_rcvisocpipe(data->udev, data->isoc_rx_ep->bEndpointAddress);
  398. usb_fill_int_urb(urb, data->udev, pipe, buf, size, btusb_isoc_complete,
  399. hdev, data->isoc_rx_ep->bInterval);
  400. urb->transfer_flags = URB_FREE_BUFFER | URB_ISO_ASAP;
  401. __fill_isoc_descriptor(urb, size,
  402. le16_to_cpu(data->isoc_rx_ep->wMaxPacketSize));
  403. usb_anchor_urb(urb, &data->isoc_anchor);
  404. err = usb_submit_urb(urb, mem_flags);
  405. if (err < 0) {
  406. if (err != -EPERM && err != -ENODEV)
  407. BT_ERR("%s urb %p submission failed (%d)",
  408. hdev->name, urb, -err);
  409. usb_unanchor_urb(urb);
  410. }
  411. usb_free_urb(urb);
  412. return err;
  413. }
  414. static void btusb_tx_complete(struct urb *urb)
  415. {
  416. struct sk_buff *skb = urb->context;
  417. struct hci_dev *hdev = (struct hci_dev *) skb->dev;
  418. struct btusb_data *data = hci_get_drvdata(hdev);
  419. BT_DBG("%s urb %p status %d count %d", hdev->name,
  420. urb, urb->status, urb->actual_length);
  421. if (!test_bit(HCI_RUNNING, &hdev->flags))
  422. goto done;
  423. if (!urb->status)
  424. hdev->stat.byte_tx += urb->transfer_buffer_length;
  425. else
  426. hdev->stat.err_tx++;
  427. done:
  428. spin_lock(&data->txlock);
  429. data->tx_in_flight--;
  430. spin_unlock(&data->txlock);
  431. kfree(urb->setup_packet);
  432. kfree_skb(skb);
  433. }
  434. static void btusb_isoc_tx_complete(struct urb *urb)
  435. {
  436. struct sk_buff *skb = urb->context;
  437. struct hci_dev *hdev = (struct hci_dev *) skb->dev;
  438. BT_DBG("%s urb %p status %d count %d", hdev->name,
  439. urb, urb->status, urb->actual_length);
  440. if (!test_bit(HCI_RUNNING, &hdev->flags))
  441. goto done;
  442. if (!urb->status)
  443. hdev->stat.byte_tx += urb->transfer_buffer_length;
  444. else
  445. hdev->stat.err_tx++;
  446. done:
  447. kfree(urb->setup_packet);
  448. kfree_skb(skb);
  449. }
  450. static int btusb_open(struct hci_dev *hdev)
  451. {
  452. struct btusb_data *data = hci_get_drvdata(hdev);
  453. int err;
  454. BT_DBG("%s", hdev->name);
  455. err = usb_autopm_get_interface(data->intf);
  456. if (err < 0)
  457. return err;
  458. data->intf->needs_remote_wakeup = 1;
  459. if (test_and_set_bit(HCI_RUNNING, &hdev->flags))
  460. goto done;
  461. if (test_and_set_bit(BTUSB_INTR_RUNNING, &data->flags))
  462. goto done;
  463. err = btusb_submit_intr_urb(hdev, GFP_KERNEL);
  464. if (err < 0)
  465. goto failed;
  466. err = btusb_submit_bulk_urb(hdev, GFP_KERNEL);
  467. if (err < 0) {
  468. usb_kill_anchored_urbs(&data->intr_anchor);
  469. goto failed;
  470. }
  471. set_bit(BTUSB_BULK_RUNNING, &data->flags);
  472. btusb_submit_bulk_urb(hdev, GFP_KERNEL);
  473. done:
  474. usb_autopm_put_interface(data->intf);
  475. return 0;
  476. failed:
  477. clear_bit(BTUSB_INTR_RUNNING, &data->flags);
  478. clear_bit(HCI_RUNNING, &hdev->flags);
  479. usb_autopm_put_interface(data->intf);
  480. return err;
  481. }
  482. static void btusb_stop_traffic(struct btusb_data *data)
  483. {
  484. usb_kill_anchored_urbs(&data->intr_anchor);
  485. usb_kill_anchored_urbs(&data->bulk_anchor);
  486. usb_kill_anchored_urbs(&data->isoc_anchor);
  487. }
  488. static int btusb_close(struct hci_dev *hdev)
  489. {
  490. struct btusb_data *data = hci_get_drvdata(hdev);
  491. int err;
  492. BT_DBG("%s", hdev->name);
  493. if (!test_and_clear_bit(HCI_RUNNING, &hdev->flags))
  494. return 0;
  495. cancel_work_sync(&data->work);
  496. cancel_work_sync(&data->waker);
  497. clear_bit(BTUSB_ISOC_RUNNING, &data->flags);
  498. clear_bit(BTUSB_BULK_RUNNING, &data->flags);
  499. clear_bit(BTUSB_INTR_RUNNING, &data->flags);
  500. btusb_stop_traffic(data);
  501. err = usb_autopm_get_interface(data->intf);
  502. if (err < 0)
  503. goto failed;
  504. data->intf->needs_remote_wakeup = 0;
  505. usb_autopm_put_interface(data->intf);
  506. failed:
  507. usb_scuttle_anchored_urbs(&data->deferred);
  508. return 0;
  509. }
  510. static int btusb_flush(struct hci_dev *hdev)
  511. {
  512. struct btusb_data *data = hci_get_drvdata(hdev);
  513. BT_DBG("%s", hdev->name);
  514. usb_kill_anchored_urbs(&data->tx_anchor);
  515. return 0;
  516. }
  517. static int btusb_send_frame(struct sk_buff *skb)
  518. {
  519. struct hci_dev *hdev = (struct hci_dev *) skb->dev;
  520. struct btusb_data *data = hci_get_drvdata(hdev);
  521. struct usb_ctrlrequest *dr;
  522. struct urb *urb;
  523. unsigned int pipe;
  524. int err;
  525. BT_DBG("%s", hdev->name);
  526. if (!test_bit(HCI_RUNNING, &hdev->flags))
  527. return -EBUSY;
  528. switch (bt_cb(skb)->pkt_type) {
  529. case HCI_COMMAND_PKT:
  530. urb = usb_alloc_urb(0, GFP_ATOMIC);
  531. if (!urb)
  532. return -ENOMEM;
  533. dr = kmalloc(sizeof(*dr), GFP_ATOMIC);
  534. if (!dr) {
  535. usb_free_urb(urb);
  536. return -ENOMEM;
  537. }
  538. dr->bRequestType = data->cmdreq_type;
  539. dr->bRequest = 0;
  540. dr->wIndex = 0;
  541. dr->wValue = 0;
  542. dr->wLength = __cpu_to_le16(skb->len);
  543. pipe = usb_sndctrlpipe(data->udev, 0x00);
  544. usb_fill_control_urb(urb, data->udev, pipe, (void *) dr,
  545. skb->data, skb->len, btusb_tx_complete, skb);
  546. hdev->stat.cmd_tx++;
  547. break;
  548. case HCI_ACLDATA_PKT:
  549. if (!data->bulk_tx_ep)
  550. return -ENODEV;
  551. urb = usb_alloc_urb(0, GFP_ATOMIC);
  552. if (!urb)
  553. return -ENOMEM;
  554. pipe = usb_sndbulkpipe(data->udev,
  555. data->bulk_tx_ep->bEndpointAddress);
  556. usb_fill_bulk_urb(urb, data->udev, pipe,
  557. skb->data, skb->len, btusb_tx_complete, skb);
  558. hdev->stat.acl_tx++;
  559. break;
  560. case HCI_SCODATA_PKT:
  561. if (!data->isoc_tx_ep || hdev->conn_hash.sco_num < 1)
  562. return -ENODEV;
  563. urb = usb_alloc_urb(BTUSB_MAX_ISOC_FRAMES, GFP_ATOMIC);
  564. if (!urb)
  565. return -ENOMEM;
  566. pipe = usb_sndisocpipe(data->udev,
  567. data->isoc_tx_ep->bEndpointAddress);
  568. usb_fill_int_urb(urb, data->udev, pipe,
  569. skb->data, skb->len, btusb_isoc_tx_complete,
  570. skb, data->isoc_tx_ep->bInterval);
  571. urb->transfer_flags = URB_ISO_ASAP;
  572. __fill_isoc_descriptor(urb, skb->len,
  573. le16_to_cpu(data->isoc_tx_ep->wMaxPacketSize));
  574. hdev->stat.sco_tx++;
  575. goto skip_waking;
  576. default:
  577. return -EILSEQ;
  578. }
  579. err = inc_tx(data);
  580. if (err) {
  581. usb_anchor_urb(urb, &data->deferred);
  582. schedule_work(&data->waker);
  583. err = 0;
  584. goto done;
  585. }
  586. skip_waking:
  587. usb_anchor_urb(urb, &data->tx_anchor);
  588. err = usb_submit_urb(urb, GFP_ATOMIC);
  589. if (err < 0) {
  590. if (err != -EPERM && err != -ENODEV)
  591. BT_ERR("%s urb %p submission failed (%d)",
  592. hdev->name, urb, -err);
  593. kfree(urb->setup_packet);
  594. usb_unanchor_urb(urb);
  595. } else {
  596. usb_mark_last_busy(data->udev);
  597. }
  598. done:
  599. usb_free_urb(urb);
  600. return err;
  601. }
  602. static void btusb_notify(struct hci_dev *hdev, unsigned int evt)
  603. {
  604. struct btusb_data *data = hci_get_drvdata(hdev);
  605. BT_DBG("%s evt %d", hdev->name, evt);
  606. if (hdev->conn_hash.sco_num != data->sco_num) {
  607. data->sco_num = hdev->conn_hash.sco_num;
  608. schedule_work(&data->work);
  609. }
  610. }
  611. static inline int __set_isoc_interface(struct hci_dev *hdev, int altsetting)
  612. {
  613. struct btusb_data *data = hci_get_drvdata(hdev);
  614. struct usb_interface *intf = data->isoc;
  615. struct usb_endpoint_descriptor *ep_desc;
  616. int i, err;
  617. if (!data->isoc)
  618. return -ENODEV;
  619. err = usb_set_interface(data->udev, 1, altsetting);
  620. if (err < 0) {
  621. BT_ERR("%s setting interface failed (%d)", hdev->name, -err);
  622. return err;
  623. }
  624. data->isoc_altsetting = altsetting;
  625. data->isoc_tx_ep = NULL;
  626. data->isoc_rx_ep = NULL;
  627. for (i = 0; i < intf->cur_altsetting->desc.bNumEndpoints; i++) {
  628. ep_desc = &intf->cur_altsetting->endpoint[i].desc;
  629. if (!data->isoc_tx_ep && usb_endpoint_is_isoc_out(ep_desc)) {
  630. data->isoc_tx_ep = ep_desc;
  631. continue;
  632. }
  633. if (!data->isoc_rx_ep && usb_endpoint_is_isoc_in(ep_desc)) {
  634. data->isoc_rx_ep = ep_desc;
  635. continue;
  636. }
  637. }
  638. if (!data->isoc_tx_ep || !data->isoc_rx_ep) {
  639. BT_ERR("%s invalid SCO descriptors", hdev->name);
  640. return -ENODEV;
  641. }
  642. return 0;
  643. }
  644. static void btusb_work(struct work_struct *work)
  645. {
  646. struct btusb_data *data = container_of(work, struct btusb_data, work);
  647. struct hci_dev *hdev = data->hdev;
  648. int new_alts;
  649. int err;
  650. if (hdev->conn_hash.sco_num > 0) {
  651. if (!test_bit(BTUSB_DID_ISO_RESUME, &data->flags)) {
  652. err = usb_autopm_get_interface(data->isoc ? data->isoc : data->intf);
  653. if (err < 0) {
  654. clear_bit(BTUSB_ISOC_RUNNING, &data->flags);
  655. usb_kill_anchored_urbs(&data->isoc_anchor);
  656. return;
  657. }
  658. set_bit(BTUSB_DID_ISO_RESUME, &data->flags);
  659. }
  660. if (hdev->voice_setting & 0x0020) {
  661. static const int alts[3] = { 2, 4, 5 };
  662. new_alts = alts[hdev->conn_hash.sco_num - 1];
  663. } else {
  664. new_alts = hdev->conn_hash.sco_num;
  665. }
  666. if (data->isoc_altsetting != new_alts) {
  667. clear_bit(BTUSB_ISOC_RUNNING, &data->flags);
  668. usb_kill_anchored_urbs(&data->isoc_anchor);
  669. if (__set_isoc_interface(hdev, new_alts) < 0)
  670. return;
  671. }
  672. if (!test_and_set_bit(BTUSB_ISOC_RUNNING, &data->flags)) {
  673. if (btusb_submit_isoc_urb(hdev, GFP_KERNEL) < 0)
  674. clear_bit(BTUSB_ISOC_RUNNING, &data->flags);
  675. else
  676. btusb_submit_isoc_urb(hdev, GFP_KERNEL);
  677. }
  678. } else {
  679. clear_bit(BTUSB_ISOC_RUNNING, &data->flags);
  680. usb_kill_anchored_urbs(&data->isoc_anchor);
  681. __set_isoc_interface(hdev, 0);
  682. if (test_and_clear_bit(BTUSB_DID_ISO_RESUME, &data->flags))
  683. usb_autopm_put_interface(data->isoc ? data->isoc : data->intf);
  684. }
  685. }
  686. static void btusb_waker(struct work_struct *work)
  687. {
  688. struct btusb_data *data = container_of(work, struct btusb_data, waker);
  689. int err;
  690. err = usb_autopm_get_interface(data->intf);
  691. if (err < 0)
  692. return;
  693. usb_autopm_put_interface(data->intf);
  694. }
  695. static int btusb_probe(struct usb_interface *intf,
  696. const struct usb_device_id *id)
  697. {
  698. struct usb_endpoint_descriptor *ep_desc;
  699. struct btusb_data *data;
  700. struct hci_dev *hdev;
  701. int i, err;
  702. BT_DBG("intf %p id %p", intf, id);
  703. /* interface numbers are hardcoded in the spec */
  704. if (intf->cur_altsetting->desc.bInterfaceNumber != 0)
  705. return -ENODEV;
  706. if (!id->driver_info) {
  707. const struct usb_device_id *match;
  708. match = usb_match_id(intf, blacklist_table);
  709. if (match)
  710. id = match;
  711. }
  712. if (id->driver_info == BTUSB_IGNORE)
  713. return -ENODEV;
  714. if (ignore_dga && id->driver_info & BTUSB_DIGIANSWER)
  715. return -ENODEV;
  716. if (ignore_csr && id->driver_info & BTUSB_CSR)
  717. return -ENODEV;
  718. if (ignore_sniffer && id->driver_info & BTUSB_SNIFFER)
  719. return -ENODEV;
  720. if (id->driver_info & BTUSB_ATH3012) {
  721. struct usb_device *udev = interface_to_usbdev(intf);
  722. /* Old firmware would otherwise let ath3k driver load
  723. * patch and sysconfig files */
  724. if (le16_to_cpu(udev->descriptor.bcdDevice) <= 0x0001)
  725. return -ENODEV;
  726. }
  727. data = devm_kzalloc(&intf->dev, sizeof(*data), GFP_KERNEL);
  728. if (!data)
  729. return -ENOMEM;
  730. for (i = 0; i < intf->cur_altsetting->desc.bNumEndpoints; i++) {
  731. ep_desc = &intf->cur_altsetting->endpoint[i].desc;
  732. if (!data->intr_ep && usb_endpoint_is_int_in(ep_desc)) {
  733. data->intr_ep = ep_desc;
  734. continue;
  735. }
  736. if (!data->bulk_tx_ep && usb_endpoint_is_bulk_out(ep_desc)) {
  737. data->bulk_tx_ep = ep_desc;
  738. continue;
  739. }
  740. if (!data->bulk_rx_ep && usb_endpoint_is_bulk_in(ep_desc)) {
  741. data->bulk_rx_ep = ep_desc;
  742. continue;
  743. }
  744. }
  745. if (!data->intr_ep || !data->bulk_tx_ep || !data->bulk_rx_ep)
  746. return -ENODEV;
  747. data->cmdreq_type = USB_TYPE_CLASS;
  748. data->udev = interface_to_usbdev(intf);
  749. data->intf = intf;
  750. spin_lock_init(&data->lock);
  751. INIT_WORK(&data->work, btusb_work);
  752. INIT_WORK(&data->waker, btusb_waker);
  753. spin_lock_init(&data->txlock);
  754. init_usb_anchor(&data->tx_anchor);
  755. init_usb_anchor(&data->intr_anchor);
  756. init_usb_anchor(&data->bulk_anchor);
  757. init_usb_anchor(&data->isoc_anchor);
  758. init_usb_anchor(&data->deferred);
  759. hdev = hci_alloc_dev();
  760. if (!hdev)
  761. return -ENOMEM;
  762. hdev->bus = HCI_USB;
  763. hci_set_drvdata(hdev, data);
  764. data->hdev = hdev;
  765. SET_HCIDEV_DEV(hdev, &intf->dev);
  766. hdev->open = btusb_open;
  767. hdev->close = btusb_close;
  768. hdev->flush = btusb_flush;
  769. hdev->send = btusb_send_frame;
  770. hdev->notify = btusb_notify;
  771. /* Interface numbers are hardcoded in the specification */
  772. data->isoc = usb_ifnum_to_if(data->udev, 1);
  773. if (!reset)
  774. set_bit(HCI_QUIRK_RESET_ON_CLOSE, &hdev->quirks);
  775. if (force_scofix || id->driver_info & BTUSB_WRONG_SCO_MTU) {
  776. if (!disable_scofix)
  777. set_bit(HCI_QUIRK_FIXUP_BUFFER_SIZE, &hdev->quirks);
  778. }
  779. if (id->driver_info & BTUSB_BROKEN_ISOC)
  780. data->isoc = NULL;
  781. if (id->driver_info & BTUSB_DIGIANSWER) {
  782. data->cmdreq_type = USB_TYPE_VENDOR;
  783. set_bit(HCI_QUIRK_RESET_ON_CLOSE, &hdev->quirks);
  784. }
  785. if (id->driver_info & BTUSB_CSR) {
  786. struct usb_device *udev = data->udev;
  787. /* Old firmware would otherwise execute USB reset */
  788. if (le16_to_cpu(udev->descriptor.bcdDevice) < 0x117)
  789. set_bit(HCI_QUIRK_RESET_ON_CLOSE, &hdev->quirks);
  790. }
  791. if (id->driver_info & BTUSB_SNIFFER) {
  792. struct usb_device *udev = data->udev;
  793. /* New sniffer firmware has crippled HCI interface */
  794. if (le16_to_cpu(udev->descriptor.bcdDevice) > 0x997)
  795. set_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks);
  796. data->isoc = NULL;
  797. }
  798. if (id->driver_info & BTUSB_BCM92035) {
  799. unsigned char cmd[] = { 0x3b, 0xfc, 0x01, 0x00 };
  800. struct sk_buff *skb;
  801. skb = bt_skb_alloc(sizeof(cmd), GFP_KERNEL);
  802. if (skb) {
  803. memcpy(skb_put(skb, sizeof(cmd)), cmd, sizeof(cmd));
  804. skb_queue_tail(&hdev->driver_init, skb);
  805. }
  806. }
  807. if (data->isoc) {
  808. err = usb_driver_claim_interface(&btusb_driver,
  809. data->isoc, data);
  810. if (err < 0) {
  811. hci_free_dev(hdev);
  812. return err;
  813. }
  814. }
  815. err = hci_register_dev(hdev);
  816. if (err < 0) {
  817. hci_free_dev(hdev);
  818. return err;
  819. }
  820. usb_set_intfdata(intf, data);
  821. return 0;
  822. }
  823. static void btusb_disconnect(struct usb_interface *intf)
  824. {
  825. struct btusb_data *data = usb_get_intfdata(intf);
  826. struct hci_dev *hdev;
  827. BT_DBG("intf %p", intf);
  828. if (!data)
  829. return;
  830. hdev = data->hdev;
  831. usb_set_intfdata(data->intf, NULL);
  832. if (data->isoc)
  833. usb_set_intfdata(data->isoc, NULL);
  834. hci_unregister_dev(hdev);
  835. if (intf == data->isoc)
  836. usb_driver_release_interface(&btusb_driver, data->intf);
  837. else if (data->isoc)
  838. usb_driver_release_interface(&btusb_driver, data->isoc);
  839. hci_free_dev(hdev);
  840. }
  841. #ifdef CONFIG_PM
  842. static int btusb_suspend(struct usb_interface *intf, pm_message_t message)
  843. {
  844. struct btusb_data *data = usb_get_intfdata(intf);
  845. BT_DBG("intf %p", intf);
  846. if (data->suspend_count++)
  847. return 0;
  848. spin_lock_irq(&data->txlock);
  849. if (!(PMSG_IS_AUTO(message) && data->tx_in_flight)) {
  850. set_bit(BTUSB_SUSPENDING, &data->flags);
  851. spin_unlock_irq(&data->txlock);
  852. } else {
  853. spin_unlock_irq(&data->txlock);
  854. data->suspend_count--;
  855. return -EBUSY;
  856. }
  857. cancel_work_sync(&data->work);
  858. btusb_stop_traffic(data);
  859. usb_kill_anchored_urbs(&data->tx_anchor);
  860. return 0;
  861. }
  862. static void play_deferred(struct btusb_data *data)
  863. {
  864. struct urb *urb;
  865. int err;
  866. while ((urb = usb_get_from_anchor(&data->deferred))) {
  867. err = usb_submit_urb(urb, GFP_ATOMIC);
  868. if (err < 0)
  869. break;
  870. data->tx_in_flight++;
  871. }
  872. usb_scuttle_anchored_urbs(&data->deferred);
  873. }
  874. static int btusb_resume(struct usb_interface *intf)
  875. {
  876. struct btusb_data *data = usb_get_intfdata(intf);
  877. struct hci_dev *hdev = data->hdev;
  878. int err = 0;
  879. BT_DBG("intf %p", intf);
  880. if (--data->suspend_count)
  881. return 0;
  882. if (!test_bit(HCI_RUNNING, &hdev->flags))
  883. goto done;
  884. if (test_bit(BTUSB_INTR_RUNNING, &data->flags)) {
  885. err = btusb_submit_intr_urb(hdev, GFP_NOIO);
  886. if (err < 0) {
  887. clear_bit(BTUSB_INTR_RUNNING, &data->flags);
  888. goto failed;
  889. }
  890. }
  891. if (test_bit(BTUSB_BULK_RUNNING, &data->flags)) {
  892. err = btusb_submit_bulk_urb(hdev, GFP_NOIO);
  893. if (err < 0) {
  894. clear_bit(BTUSB_BULK_RUNNING, &data->flags);
  895. goto failed;
  896. }
  897. btusb_submit_bulk_urb(hdev, GFP_NOIO);
  898. }
  899. if (test_bit(BTUSB_ISOC_RUNNING, &data->flags)) {
  900. if (btusb_submit_isoc_urb(hdev, GFP_NOIO) < 0)
  901. clear_bit(BTUSB_ISOC_RUNNING, &data->flags);
  902. else
  903. btusb_submit_isoc_urb(hdev, GFP_NOIO);
  904. }
  905. spin_lock_irq(&data->txlock);
  906. play_deferred(data);
  907. clear_bit(BTUSB_SUSPENDING, &data->flags);
  908. spin_unlock_irq(&data->txlock);
  909. schedule_work(&data->work);
  910. return 0;
  911. failed:
  912. usb_scuttle_anchored_urbs(&data->deferred);
  913. done:
  914. spin_lock_irq(&data->txlock);
  915. clear_bit(BTUSB_SUSPENDING, &data->flags);
  916. spin_unlock_irq(&data->txlock);
  917. return err;
  918. }
  919. #endif
  920. static struct usb_driver btusb_driver = {
  921. .name = "btusb",
  922. .probe = btusb_probe,
  923. .disconnect = btusb_disconnect,
  924. #ifdef CONFIG_PM
  925. .suspend = btusb_suspend,
  926. .resume = btusb_resume,
  927. #endif
  928. .id_table = btusb_table,
  929. .supports_autosuspend = 1,
  930. .disable_hub_initiated_lpm = 1,
  931. };
  932. module_usb_driver(btusb_driver);
  933. module_param(ignore_dga, bool, 0644);
  934. MODULE_PARM_DESC(ignore_dga, "Ignore devices with id 08fd:0001");
  935. module_param(ignore_csr, bool, 0644);
  936. MODULE_PARM_DESC(ignore_csr, "Ignore devices with id 0a12:0001");
  937. module_param(ignore_sniffer, bool, 0644);
  938. MODULE_PARM_DESC(ignore_sniffer, "Ignore devices with id 0a12:0002");
  939. module_param(disable_scofix, bool, 0644);
  940. MODULE_PARM_DESC(disable_scofix, "Disable fixup of wrong SCO buffer size");
  941. module_param(force_scofix, bool, 0644);
  942. MODULE_PARM_DESC(force_scofix, "Force fixup of wrong SCO buffers size");
  943. module_param(reset, bool, 0644);
  944. MODULE_PARM_DESC(reset, "Send HCI reset command on initialization");
  945. MODULE_AUTHOR("Marcel Holtmann <marcel@holtmann.org>");
  946. MODULE_DESCRIPTION("Generic Bluetooth USB driver ver " VERSION);
  947. MODULE_VERSION(VERSION);
  948. MODULE_LICENSE("GPL");