btusb.c 30 KB

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