btusb.c 30 KB

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