The progress of the record, compiled this post provided by the program, Sensortile can be used as a Bluetooth keyboard or mouse, which let me have a deep understanding of Bluetooth hid.
Bluetooth more than 4.0 of the HID is based on Hid-over-gatt, if the Bluetooth IC support GATT, you can modify the firmware to achieve as a Bluetooth HID devices (such as the common mouse or keyboard, as well as uncommon touchscreen). The Bluetooth ICS on the sensortile are Bluenrg-ms, and the protocols that have been supported in the data manuals are:
Embedded Bluetooth Low Energy Protocol stack:gap, GATT, SM, L2cap, LL, rfphy
It does already contain the GATT.
When I ran the keyboard and mouse example, I began to delve into the HID reports descriptor knowledge, before I used the Android getevent to crawl the input events and use LSUSB-VVV to view the USB device descriptor. Feel that this is the lowest level, understand the HID reports descriptor, the bottom of the bottom layer, from the device to realize the way also understand.
About the capture HID device descriptor, this article USB and BT HID reports descriptor practice and capture analysis in more detail, taught me to get USB or BT hid by viewing/SYS/KERNEL/DEBUG/HID/XXX/RDESC Reports descriptor and view using Usbhid-dump and Hidrd-convert.
HID reports Descriptor descriptor more esoteric, found some Chinese data USB HID protocol Chinese version of the--usb interface hid device (English original data here), read it is more understandable, but still difficult to understand thoroughly. HID Usage Digitizer (0Dh)
The HID reports descriptor for a Hid-multitouch device saw some of the official usage, such as 47h, 51h, 54h, 55h, under Digitizer (0DH), had not been found, and the Linux kernel found , these have been used in advance by Windows and have become specifications. As shown below:
*
* As of May, 2009 the usages below are not yet in the official USB spec
* but are being pushed by microsft a s described in their paper "Digitizer
* Drivers to Windows touch and pen-based Computers" */
#define Hid_dg_c Onfidence 0x000d0047
#define HID_DG_WIDTH 0x000d0048
#define Hid_dg_height 0x000d0049
# Define Hid_dg_contactid 0x000d0051
#define Hid_dg_inputmode 0x000d0052
#define Hid_dg_ Deviceindex 0x000d0053
#define Hid_dg_contactcount 0x000d0054
#define HID_DG_CONTACTMAX 0x000d0055
Source: https://elixir.bootlin.com/linux/v4.4/source/include/linux/hid.h#L338
Each represents a different meaning. Android
Host choose Android, more open source and update fast, convenient debugging.
Android about Bluetooth hid, divided into two, Bluetooth by Bluedroid, hid and then through the Uhid back to the Linux kernel processing, so specific to Android on the Bluetooth HID, only need to dive into the core to see it, Bluedroid only realizes a Bluetooth device to the kernel channel, does not filter does not handle any specific HID event, gives full powers to the kernel HID subsystem processing. Linux kernel
The Linux kernel will eventually get the HID reports descriptor, the Linux kernel in the HID device divided into 4 categories, according to the HID Reports Descriptor Division, keyboard and mouse belong to the generic (corresponding usage Desktop), The recently popular touch pad touchscreen belongs to the multitouch device (corresponding to usage digitizer).
/*
HID device Groups
* *
Note:hid_group_any is declared in Linux/mod_devicetable.h
* and has a value of 0x0000
* * *
#define HID_GROUP_GENERIC 0x0001
#define Hid_group_multitouch 0x0002
#define Hid_group_sensor_hub 0x0003
#define HID_GROUP_MULTITOUCH_WIN_8 0x0004
There's no mapping here.