http://blog.csdn.net/gotowu/article/details/46687633
1, the first to do BlueZ protocol stack transplant, so in the Development Board can be used Hciconfig, Hcitool and other commands. About the BlueZ protocol stack porting steps online a lot.
2, the drive is USB Bluetooth device driver, analysis according to the sequence of Bluetooth-driven write. Because only to do the transmission of data, so speak for the voice of the other part of the transmission removed.
First, define a struct body
[CPP] View Plain copy struct bcm_data ={ struct usb_ endpoint_descriptor *intr_ep; struct usb_endpoint_descriptor *bulk_tx_ep; //Bulk Transfer End struct usb_ endpoint_descriptor *bulk_rx_ep; //Bulk Transmission Endpoint struct usb_anchor tx_anchor; //for blocking operations struct usb_anchor intr_anchor; struct usb_anchor bulk_anchor; struct usb_device *udev; struct usb_interface *intf; unsigned long flags;  &NBSp; __u8 cmdreq_type; }
Next comes the entry function and the Exit function.
[CPP] view plain copy static int __init bcm_driver_init (void) {usb_register (&bcm_driver); return 0; } static void __exit bcm_driver_exit (void) {usb_deregister (&bcm_driver); } module_init (Bcm_driver_init); Module_exit (Bcm_driver_exit); Module_license ("GPL"); Module_author ("Willwwu")
The entry function and Exit function are the operations that register and unregister the USB device.
The struct usb_driver is then defined and populated with its members.
[CPP] view plain copy static struct Usb_driver bcm_driver={. Name = "BCMT",. Probe = Bcm_probe,//probe function. Disconnect = Bcm_disconnect,. id_table = bcm_table,//Supported USB device table . Supports_autosuspend = 1,//support auto suspend, if set to 0 does not support. DISABLE_HUB_INITIATED_LPM = 1,//Allow low power transfer};
Supported USB Device Tables
[CPP] View plain copy static usb_d