Linux Bluetooth driver detailed __linux

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.