Bluetooth keyboard communication method and Bluetooth keyboard
By adding the IN and OUT report descriptors of the HID protocol to the report descriptor of the Bluetooth keyboard, the problem that existing Bluetooth keyboards cannot communicate with the host through HID requests is solved, and a richer user-defined configuration and personalized functions are achieved.
Patent Information
- Application Number
- CN202011344620.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-11-26
- Publication Date
- 2025-03-25
- Estimated Expiration
- 2040-11-26
AI Technical Summary
Existing Bluetooth keyboards cannot communicate with the host through HID requests, limiting the implementation of user-defined configurations and personalized needs.
Adding IN and OUT report descriptors based on the HID protocol in the keyboard's report descriptor allows the Bluetooth module to receive and parse the host's HID-class requests and provide feedback in the form of IN or OUT reports.
It realizes free data transmission between the Bluetooth keyboard and the host, meeting users' personalized needs for keyboard functions, such as setting keyboard parameters and displaying lighting effects.
Smart Images

Figure CN114089839B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of keyboards, and in particular to a Bluetooth keyboard communication method and a Bluetooth keyboard. Background Art
[0002] The keyboard is a common human-computer interaction input device. The keyboard transmits data to the host in the form of reports. The reports include input reports and output reports. The input report is sent by the keyboard to the host, and the output report is sent by the host to the keyboard. The report is a data packet that contains the data to be transmitted, and the report descriptor describes a report and the function of the data in the report. The host can analyze the meaning of the data in the report through the report descriptor.
[0003] The report descriptor of existing keyboards, especially Bluetooth keyboards, specifies the communication format between the keyboard and the host, and can only transmit data in the specified format. However, with the advancement of technology and the increase in user personalized needs, the functional requirements of keyboards are becoming increasingly rich. By transmitting data through reports in a specified format, the host cannot communicate with the Bluetooth keyboard through HID requests, thus failing to meet the user's personalized needs for custom configuration of the keyboard. Summary of the invention
[0004] The present invention aims to solve at least one of the technical problems existing in the prior art. To this end, the present invention provides a Bluetooth keyboard communication method and a Bluetooth keyboard, so that the Bluetooth keyboard can receive and respond to the HID class request of the host.
[0005] In a first aspect, a Bluetooth keyboard communication method according to an embodiment of the present invention is applied to communication between a keyboard and a host, wherein the keyboard has a built-in or external Bluetooth module, and comprises:
[0006] Add an IN (input) report descriptor and an OUT (output) report descriptor based on the HID protocol to the keyboard report descriptor, wherein the IN report descriptor is used to describe the IN report, and the OUT report descriptor is used to describe the OUT report;
[0007] The host sends a HID class request to the Bluetooth module in the form of the OUT report;
[0008] The Bluetooth module receives and parses the HID class request according to the OUT report descriptor;
[0009] The Bluetooth module responds to the HID class request and feeds back to the host in the form of the IN report.
[0010] The Bluetooth keyboard communication method according to the embodiment of the present invention has at least the following beneficial effects:
[0011] The IN report descriptor and OUT report descriptor based on the HID protocol can notify the host to transmit data in the form of an IN report or an OUT report, so that the host can communicate with the keyboard and the keyboard can receive and respond to HID class requests from the host.
[0012] According to some embodiments of the present invention, the logical minimum value of the IN report and the OUT report is 0x00, and the logical maximum value is 0xFF.
[0013] According to some embodiments of the present invention, the IN report and the OUT report each include at least 7 bytes, each byte includes 8 bits.
[0014] According to some embodiments of the present invention, the Bluetooth module responds to the HID class request and provides feedback to the host in the form of the IN report, including:
[0015] When the HID class request is a read request, the Bluetooth module fills the data to be communicated into the cache after receiving the read request;
[0016] The host sends a secondary read request to the Bluetooth module;
[0017] After receiving the secondary read request, the Bluetooth module fills the data to be communicated into a response packet in the form of an IN report and sends it to the host.
[0018] According to some embodiments of the present invention, the Bluetooth module responds to the HID class request and provides feedback to the host in the form of the IN report, including:
[0019] When the HID class request is a write request, after receiving the write request, the Bluetooth module sends the write request to the processor of the keyboard for response;
[0020] After the response is completed, the Bluetooth module feeds back to the host in the form of the IN report.
[0021] According to some embodiments of the present invention, the Bluetooth keyboard communication method further includes:
[0022] When the keyboard writes data to the host, the Bluetooth module sends a notification to the host;
[0023] After receiving the notification, the host sends a read request to the Bluetooth module;
[0024] The Bluetooth module fills the data to be sent into a response packet and returns it to the host.
[0025] In a second aspect, a Bluetooth keyboard communication method according to an embodiment of the present invention is applied to communication between a keyboard and a host, wherein the keyboard has a built-in or external Bluetooth module, and includes:
[0026] Add a FEATURE report descriptor with read and write properties based on the HID protocol to the keyboard report descriptor, wherein the FEATURE report descriptor is used to describe the FEATURE report;
[0027] The host sends a HID class request to the Bluetooth module in the form of the FEATURE report;
[0028] The Bluetooth module receives and parses the HID class request according to the FEATURE report descriptor;
[0029] The Bluetooth module responds to the HID class request and feeds back to the host in the form of the FEATURE report.
[0030] The Bluetooth keyboard communication method according to the embodiment of the present invention has at least the following beneficial effects:
[0031] The feature report descriptor with read and write properties based on the HID protocol can notify the host to transmit data in the form of a feature report, so that the host can communicate with the keyboard and the keyboard can receive and respond to HID class requests from the host.
[0032] According to some embodiments of the present invention, the logical minimum value of the FEATURE report is 0x00, and the logical maximum value is 0xFF.
[0033] According to some embodiments of the present invention, the FEATURE reports each include at least 7 bytes, and each byte includes 8 bits.
[0034] In a third aspect, a Bluetooth keyboard according to an embodiment of the present invention includes a processor, and the processor is used to execute the above method steps.
[0035] Additional aspects and advantages of the present invention will be given in part in the following description and in part will be obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] The above and / or additional aspects and advantages of the present invention will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which:
[0037] Figure 1 This is a flow chart of a Bluetooth keyboard communication method according to Embodiment 1 of the present invention;
[0038] Figure 2This is a schematic diagram of communication between a Bluetooth keyboard and a host according to Embodiment 1 of the present invention;
[0039] Figure 3 Schematic diagram of communication between the Bluetooth keyboard and the host according to Embodiment 2 of the present invention. DETAILED DESCRIPTION
[0040] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and cannot be understood as limiting the present invention.
[0041] In the description of the present invention, the consecutive numbering of the method steps is for the convenience of review and understanding. Combined with the overall technical scheme of the present invention and the logical relationship between the various steps, adjusting the implementation order between the steps will not affect the technical effect achieved by the technical scheme of the present invention.
[0042] Example 1
[0043] Please refer to Figure 1 and Figure 2 This embodiment discloses a Bluetooth keyboard communication method, including a method for communication between a keyboard and a host, wherein the keyboard has a built-in or external Bluetooth module, including:
[0044] IN report descriptor and OUT report descriptor based on HID protocol are added to the keyboard report descriptor. IN report descriptor is used to describe IN report, and OUT report descriptor is used to describe OUT report. The newly added OUT report descriptor can make the data format transmitted between the host and the keyboard more flexible, avoiding the format limitation of the original report. The host sends HID class request to the Bluetooth module in the form of OUT report, and the Bluetooth module receives and parses the HID class request according to the OUT report descriptor, so that the Bluetooth module responds to the HID class request and feeds back to the host in the form of IN report, which can meet more personalized needs, such as setting keyboard parameters, defining key values, displaying lighting effects and even sending information.
[0045] In this embodiment, the IN report descriptor and the OUT report descriptor are based on the HID protocol, which is compatible with the existing protocol, and is conducive to reducing the difficulty of design. The IN report descriptor and the OUT report descriptor of this embodiment can refer to the following examples:
[0046] 1) The following is an example of an IN report descriptor:
[0047] 0x06,0x00,0xFF, / / USAGE_PAGE(Vendor Defined)
[0048] 0x09, 0x80, / / USAGE(System Control)
[0049] 0xA1, 0x01, / / COLLECTION(Application)
[0050] 0x06, 0x00, 0xFF, / / USAGE_PAGE(Vendor Defined)
[0051] 0x09, 0x01, / / USAGE(Vendor Usage 1)
[0052] 0x85, 0x02, / / REPORT_ID(2)
[0053] 0x15, 0x00, / / LOGICAL_MINIMUM(0x00)
[0054] 0x26, 0xFF, 0x00, / / LOGICAL_MAXIMUM(0xFF)
[0055] 0x75, 0x08, / / REPORT_SIZE(8)
[0056] 0x95, 0x07, / / REPORT_COUNT(7)
[0057] 0x81, 0x02, / / INPUT(Data,Var,Abs)
[0058] 0xC0, / / END_COLLECTION
[0059] 2) The following is an example of the OUT report descriptor:
[0060] 0x06, 0x00, 0xFF, / / USAGE_PAGE(Vendor Defined)
[0061] 0x09, 0x80, / / USAGE(System Control)
[0062] 0xA1, 0x01, / / COLLECTION(Application)
[0063] 0x06, 0x00, 0xFF, / / USAGE_PAGE(Vendor Defined)
[0064] 0x09, 0x01, / / USAGE(Vendor Usage 1)
[0065] 0x85,0x02, / / REPORT_ID(2)
[0066] 0x15,0x00, / / LOGICAL_MINIMUM(0x00)
[0067] 0x26,0xFF,0x00, / / LOGICAL_MAXIMUM(0xFF)
[0068] 0x75,0x08, / / REPORT_SIZE(8)
[0069] 0x95,0x07, / / REPORT_COUNT(7)
[0070] 0x91,0x02, / / OUTPUT(Data,Var,Abs)
[0071] 0xC0, / / END_COLLECTION
[0072] From the above report descriptors, we can know that the logical minimum value of IN report and OUT report is 0x00, and the logical maximum value is 0xFF, and any data with a logical value between 0 and 256 can be transmitted. For example, the host can request the keyboard to return the keyboard's firmware version number, where the firmware version number is "S1234V10" and its HEX format is 0x52 0x31 0x32 0x33 0x340x56 0x31 0x30. The keyboard returns data to the host in the form of IN report, without being limited to the original report format, that is, only key code data can be sent to the host.
[0073] From the above report descriptor, it can be seen that both the IN report and the OUT report include at least 7 bytes, each byte includes 8 bits. In the above embodiment, the HEX format of the firmware version number is 0x53 0x31 0x32 0x33 0x34 0x560x31 0x30, so the example of transmitting data is as follows:
[0074] 0x53 0x31 0x32 0x33 0x34 0x56 0x31
[0075] 0x30 0x00 0x00 0x00 0x00 0x00 0x00
[0076] The report has multiple bytes, each byte has 8 bits, which makes data transmission more free and efficient and can meet more command transmission requirements.
[0077] In the above embodiment, the Bluetooth module responds to the HID class request and provides feedback to the host in the form of an IN report, including:
[0078] S110, when the HID class request is a read request, the Bluetooth module fills the data to be communicated into the cache after receiving the read request (the first time), and waits for the host to send a read request again;
[0079] S120, the host sends a secondary read request (second time) to the Bluetooth module, wherein the secondary read request is sent by the host to the Bluetooth module in the form of an OUT report;
[0080] S130. After receiving the secondary read request, the Bluetooth module fills the data to be communicated into a response packet in the form of an IN report and sends it to the host.
[0081] In the above embodiment, the Bluetooth module responds to the HID class request and provides feedback to the host in the form of an IN report, including:
[0082] S210, when the HID class request is a write request, after receiving the write request, the Bluetooth module sends the write request to the keyboard processor for response;
[0083] S220. After the response is completed, the Bluetooth module feeds back to the host in the form of an IN report.
[0084] The Bluetooth keyboard communication method also includes:
[0085] S310, when the keyboard writes data to the host, the Bluetooth module sends a notification to the host;
[0086] S320, after receiving the notification, the host sends a read request to the Bluetooth module;
[0087] S330: The Bluetooth module fills the data to be sent into a response packet and returns it to the host.
[0088] When writing data to the host, the keyboard of this embodiment first sends a notification to the host, and then transmits data after the host responds, which can reduce the energy consumption of the keyboard and is beneficial to improving the battery life of the keyboard.
[0089] Example 2
[0090] Please refer to Figure 3 The embodiment of the present invention provides a Bluetooth keyboard communication method, which is applied to the communication between a keyboard and a host, wherein the keyboard has a built-in or external Bluetooth module, and comprises:
[0091] A FEATURE report descriptor with read and write properties based on the HID protocol is added to the keyboard report descriptor. The FEATURE report descriptor is used to describe the FEATURE report. The host sends a HID class request to the Bluetooth module in the form of a FEATURE report. The Bluetooth module receives and parses the HID class request according to the FEATURE report descriptor. The Bluetooth module responds to the HID class request and gives feedback to the host in the form of a FEATURE report, which can meet more personalized needs, such as setting keyboard parameters, defining key values, displaying lighting effects, and even sending information.
[0092] Different from Example 1, this embodiment replaces the IN report descriptor and the OUT report descriptor with a FEATURE report descriptor with read and write attributes. Since the FEATURE report descriptor has read and write attributes, the host can send a HID class request to the Bluetooth module in the form of a FEATURE report, and the Bluetooth module can also send or return data to the host in the form of a FEATURE report.
[0093] The following is an example of a FEATURE report descriptor for this embodiment:
[0094] 0x06,0x00,0xFF, / / USAGE_PAGE(Vendor Defined)
[0095] 0x09,0x80, / / USAGE(System Control)
[0096] 0xA1,0x01, / / COLLECTION(Application)
[0097] 0x06,0x00,0xFF, / / USAGE_PAGE(Vendor Defined)
[0098] 0x09,0x01, / / USAGE(Vendor Usage 1)
[0099] 0x85,0x02, / / REPORT_ID(2)
[0100] 0x15,0x00, / / LOGICAL_MINIMUM(0x00)
[0101] 0x26,0xFF,0x00, / / LOGICAL_MAXIMUM(0xFF)
[0102] 0x75,0x08, / / REPORT_SIZE(8)
[0103] 0x95,0x07, / / REPORT_COUNT(7)
[0104] 0xB1,0x00, / / FEATURE(Data,Ary,Abs)
[0105] 0xC0, / / END_COLLECTION
[0106] From the above report descriptor, we can see that the logical minimum value of the FEATURE report is 0x00, the logical maximum value is 0xFF, and any data with a logical value between 0 and 256 can be transmitted.
[0107] From the above report descriptor, it can be seen that the FEATURE report includes at least 7 bytes, each byte includes 8 bits. The report has multiple bytes, each byte has 8 bits, which makes the data transmission more free and efficient, and can meet more command transmission requirements.
[0108] It should be noted that the contents involved in this embodiment can refer to Example 1.
[0109] Example 3
[0110] An embodiment of the present invention discloses a Bluetooth keyboard, including a processor, and the processor is used to execute the method steps of the above-mentioned embodiment 1 or embodiment 2.
[0111] The embodiments of the present invention are described in detail above with reference to the accompanying drawings, but the present invention is not limited to the above embodiments, and various changes can be made within the knowledge scope of ordinary technicians in the relevant technical field without departing from the purpose of the present invention.
Claims
1. A Bluetooth keyboard communication method, applied to the communication between a keyboard and a host, wherein the keyboard has a built-in or external Bluetooth module, characterized in that: include: Add an IN report descriptor and an OUT report descriptor based on the HID protocol to the keyboard report descriptor, wherein the IN report descriptor is used to describe the IN report and the OUT report descriptor is used to describe the OUT report; The host sends a HID class request to the Bluetooth module in the form of the OUT report; The Bluetooth module receives and parses the HID class request according to the OUT report descriptor; The Bluetooth module responds to the HID class request and provides feedback to the host in the form of the IN report; When the keyboard writes data to the host, the Bluetooth module sends a notification to the host; After receiving the notification, the host sends a read request to the Bluetooth module; The Bluetooth module fills the data to be sent into a response packet and returns it to the host; Among them, the IN report descriptor is: 0x06, 0x00, 0xFF, / / USAGE_PAGE(Vendor Defined) 0x09, 0x80, / / USAGE(System Control) 0xA1, 0x01, / / COLLECTION(Application) 0x06, 0x00, 0xFF, / / USAGE_PAGE(Vendor Defined) 0x09, 0x01, / / USAGE(Vendor Usage 1) 0x85, 0x02, / / REPORT_ID(2) 0x15, 0x00, / / LOGICAL_MINIMUM(0x00) 0x26, 0xFF, 0x00, / / LOGICAL_MAXIMUM(0xFF) 0x75, 0x08, / / REPORT_SIZE(8) 0x95, 0x07, / / REPORT_COUNT(7) 0x81, 0x02, / / INPUT (Data,Var,Abs) 0xC0, / / END_COLLECTION; Among them, the OUT report descriptor is: 0x06, 0x00, 0xFF, / / USAGE_PAGE(Vendor Defined) 0x09, 0x80, / / USAGE(System Control) 0xA1, 0x01, / / COLLECTION(Application) 0x06, 0x00, 0xFF, / / USAGE_PAGE(Vendor Defined) 0x09, 0x01, / / USAGE(Vendor Usage 1) 0x85, 0x02, / / REPORT_ID(2) 0x15, 0x00, / / LOGICAL_MINIMUM(0x00) 0x26, 0xFF, 0x00, / / LOGICAL_MAXIMUM(0xFF) 0x75, 0x08, / / REPORT_SIZE(8) 0x95, 0x07, / / REPORT_COUNT(7) 0x91, 0x02, / / OUTPUT(Data,Var,Abs) 0xC0, / / END_COLLECTION.
2. The Bluetooth keyboard communication method according to claim 1, characterized in that: The logical minimum value of the IN report and the OUT report is 0x00, and the logical maximum value is 0xFF.
3. The Bluetooth keyboard communication method according to claim 1 or 2, characterized in that: The IN report and the OUT report each include at least 7 bytes, each byte includes 8 bits.
4. The Bluetooth keyboard communication method according to claim 1, characterized in that: The Bluetooth module responds to the HID class request and provides feedback to the host in the form of the IN report, including: When the HID class request is a read request, the Bluetooth module fills the data to be communicated into the cache after receiving the read request; The host sends a secondary read request to the Bluetooth module; After receiving the secondary read request, the Bluetooth module fills the data to be communicated into a response packet in the form of an IN report and sends it to the host.
5. The Bluetooth keyboard communication method according to claim 1 or 4, characterized in that: The Bluetooth module responds to the HID class request and provides feedback to the host in the form of the IN report, including: When the HID class request is a write request, after receiving the write request, the Bluetooth module sends the write request to the processor of the keyboard for response; After the response is completed, the Bluetooth module feeds back to the host in the form of the IN report.
6. A Bluetooth keyboard communication method, applied to the communication between a keyboard and a host, wherein the keyboard has a built-in or external Bluetooth module, characterized in that: include: Add a FEATURE report descriptor with read and write properties based on the HID protocol to the keyboard report descriptor, wherein the FEATURE report descriptor is used to describe the FEATURE report; The host sends a HID class request to the Bluetooth module in the form of the FEATURE report; The Bluetooth module receives and parses the HID class request according to the FEATURE report descriptor; The Bluetooth module responds to the HID class request and provides feedback to the host in the form of the FEATURE report; When the keyboard writes data to the host, the Bluetooth module sends a notification to the host; After receiving the notification, the host sends a read request to the Bluetooth module; The Bluetooth module fills the data to be sent into a response packet and returns it to the host.
7. The Bluetooth keyboard communication method according to claim 6, characterized in that: The logical minimum value reported by the FEATURE is 0x00, and the logical maximum value is 0xFF.
8. The Bluetooth keyboard communication method according to claim 6 or 7, characterized in that: The FEATURE report includes at least 7 bytes, and each byte includes 8 bits.
9. A Bluetooth keyboard, comprising a processor, characterized in that: The processor is used to execute the method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Method for delivering user input, and device using same
US20130246665A1