mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-03 23:47:08 +00:00
hid_host: omit Report ID in Set/Get Report and send report for report id == HID_REPORT_ID_UNDEFINED
This commit is contained in:
parent
b4c9695082
commit
14618ebfef
@ -29,6 +29,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
||||
- PBAP Client: fix PBAP_SUBEVENT_OPERATION_COMPLETED with OBEX_DISCONNECTED for pbap_disconnect
|
||||
- HFP HF: send HF Indicator update only if enabled by AG
|
||||
- HFP AG: always initiate codec connection setup before establishing audio
|
||||
- HID Host: omit Report ID in Set/Get Report and send report for report id == HID_REPORT_ID_UNDEFINED
|
||||
- POSIX: clear run loop exit flag
|
||||
|
||||
### Changed
|
||||
|
@ -1118,10 +1118,15 @@ static void hid_host_packet_handler(uint8_t packet_type, uint16_t channel, uint8
|
||||
|
||||
case HID_HOST_W2_SEND_GET_REPORT:{
|
||||
uint8_t header = (HID_MESSAGE_TYPE_GET_REPORT << 4) | connection->report_type;
|
||||
uint8_t report[] = {header, connection->report_id};
|
||||
uint8_t report[2];
|
||||
uint16_t pos = 0;
|
||||
report[pos++] = header;
|
||||
if (connection->report_id != HID_REPORT_ID_UNDEFINED){
|
||||
report[pos++] = (uint8_t) connection->report_id;
|
||||
}
|
||||
|
||||
connection->state = HID_HOST_W4_GET_REPORT_RESPONSE;
|
||||
l2cap_send(connection->control_cid, (uint8_t*) report, sizeof(report));
|
||||
l2cap_send(connection->control_cid, (uint8_t*) report, pos);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1131,10 +1136,14 @@ static void hid_host_packet_handler(uint8_t packet_type, uint16_t channel, uint8
|
||||
|
||||
l2cap_reserve_packet_buffer();
|
||||
uint8_t * out_buffer = l2cap_get_outgoing_buffer();
|
||||
out_buffer[0] = header;
|
||||
out_buffer[1] = connection->report_id;
|
||||
(void)memcpy(out_buffer + 2, connection->report, connection->report_len);
|
||||
l2cap_send_prepared(connection->control_cid, connection->report_len + 2);
|
||||
uint16_t pos = 0;
|
||||
out_buffer[pos++] = header;
|
||||
if (connection->report_id != HID_REPORT_ID_UNDEFINED){
|
||||
out_buffer[pos++] = (uint8_t) connection->report_id;
|
||||
}
|
||||
(void)memcpy(&out_buffer[pos], connection->report, connection->report_len);
|
||||
pos += connection->report_len;
|
||||
l2cap_send_prepared(connection->control_cid, pos);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1158,10 +1167,14 @@ static void hid_host_packet_handler(uint8_t packet_type, uint16_t channel, uint8
|
||||
|
||||
l2cap_reserve_packet_buffer();
|
||||
uint8_t * out_buffer = l2cap_get_outgoing_buffer();
|
||||
out_buffer[0] = header;
|
||||
out_buffer[1] = connection->report_id;
|
||||
(void)memcpy(out_buffer + 2, connection->report, connection->report_len);
|
||||
l2cap_send_prepared(connection->interrupt_cid, connection->report_len + 2);
|
||||
uint16_t pos = 0;
|
||||
out_buffer[pos++] = header;
|
||||
if (connection->report_id != HID_REPORT_ID_UNDEFINED){
|
||||
out_buffer[pos++] = (uint8_t) connection->report_id;
|
||||
}
|
||||
(void)memcpy(&out_buffer[pos], connection->report, connection->report_len);
|
||||
pos += connection->report_len;
|
||||
l2cap_send_prepared(connection->interrupt_cid, pos);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1344,7 +1357,7 @@ uint8_t hid_host_send_virtual_cable_unplug(uint16_t hid_cid){
|
||||
return hid_host_send_control_message(hid_cid, CONTROL_MESSAGE_BITMASK_VIRTUAL_CABLE_UNPLUG);
|
||||
}
|
||||
|
||||
uint8_t hid_host_send_get_report(uint16_t hid_cid, hid_report_type_t report_type, uint8_t report_id){
|
||||
uint8_t hid_host_send_get_report(uint16_t hid_cid, hid_report_type_t report_type, uint16_t report_id){
|
||||
hid_host_connection_t * connection = hid_host_get_connection_for_hid_cid(hid_cid);
|
||||
|
||||
if (!connection || !connection->control_cid){
|
||||
@ -1362,7 +1375,7 @@ uint8_t hid_host_send_get_report(uint16_t hid_cid, hid_report_type_t report_typ
|
||||
return ERROR_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
uint8_t hid_host_send_set_report(uint16_t hid_cid, hid_report_type_t report_type, uint8_t report_id, const uint8_t * report, uint8_t report_len){
|
||||
uint8_t hid_host_send_set_report(uint16_t hid_cid, hid_report_type_t report_type, uint16_t report_id, const uint8_t * report, uint8_t report_len){
|
||||
hid_host_connection_t * connection = hid_host_get_connection_for_hid_cid(hid_cid);
|
||||
|
||||
if (!connection || !connection->control_cid){
|
||||
@ -1418,7 +1431,7 @@ uint8_t hid_host_send_set_protocol_mode(uint16_t hid_cid, hid_protocol_mode_t pr
|
||||
}
|
||||
|
||||
|
||||
uint8_t hid_host_send_report(uint16_t hid_cid, uint8_t report_id, const uint8_t * report, uint8_t report_len){
|
||||
uint8_t hid_host_send_report(uint16_t hid_cid, uint16_t report_id, const uint8_t * report, uint8_t report_len){
|
||||
hid_host_connection_t * connection = hid_host_get_connection_for_hid_cid(hid_cid);
|
||||
if (!connection || !connection->control_cid || !connection->interrupt_cid) {
|
||||
return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER;
|
||||
|
@ -116,7 +116,7 @@ typedef struct {
|
||||
|
||||
// get report
|
||||
hid_report_type_t report_type;
|
||||
uint8_t report_id;
|
||||
uint16_t report_id;
|
||||
|
||||
// control message, bit mask:
|
||||
// SUSSPEND 1
|
||||
@ -231,12 +231,12 @@ uint8_t hid_host_send_get_protocol(uint16_t hid_cid);
|
||||
* @brief Send report to a Bluetooth HID Device and emit HID_SUBEVENT_SET_REPORT_RESPONSE with handshake_status, see hid_handshake_param_type_t. The Bluetooth HID Host shall send complete reports.
|
||||
* @param hid_cid
|
||||
* @param report_type see hid_report_type_t in btstack_hid.h
|
||||
* @param report_id
|
||||
* @param report_id or HID_REPORT_ID_UNDEFINED
|
||||
* @param report
|
||||
* @param report_len
|
||||
* @result status ERROR_CODE_SUCCESS on success, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER, ERROR_CODE_COMMAND_DISALLOWED
|
||||
*/
|
||||
uint8_t hid_host_send_set_report(uint16_t hid_cid, hid_report_type_t report_type, uint8_t report_id, const uint8_t * report, uint8_t report_len);
|
||||
uint8_t hid_host_send_set_report(uint16_t hid_cid, hid_report_type_t report_type, uint16_t report_id, const uint8_t * report, uint8_t report_len);
|
||||
|
||||
/**
|
||||
* @brief Request a HID report from the Bluetooth HID Device and emit HID_SUBEVENT_GET_REPORT_RESPONSE event with with handshake_status, see hid_handshake_param_type_t.
|
||||
@ -246,20 +246,20 @@ uint8_t hid_host_send_set_report(uint16_t hid_cid, hid_report_type_t report_type
|
||||
* then the report should be reported over the more efficient Interrupt channel, see hid_host_send_report.
|
||||
* @param hid_cid
|
||||
* @param report_type see hid_report_type_t in btstack_hid.h
|
||||
* @param report_id
|
||||
* @param report_id or HID_REPORT_ID_UNDEFINED
|
||||
* @result status ERROR_CODE_SUCCESS on success, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER, ERROR_CODE_COMMAND_DISALLOWED
|
||||
*/
|
||||
uint8_t hid_host_send_get_report(uint16_t hid_cid, hid_report_type_t report_type, uint8_t report_id);
|
||||
uint8_t hid_host_send_get_report(uint16_t hid_cid, hid_report_type_t report_type, uint16_t report_id);
|
||||
|
||||
/**
|
||||
* @brief Send HID output report on interrupt channel.
|
||||
* @param hid_cid
|
||||
* @param report_id
|
||||
* @param report_id or HID_REPORT_ID_UNDEFINED
|
||||
* @param report
|
||||
* @param report_len
|
||||
* @result status ERROR_CODE_SUCCESS on success, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER, ERROR_CODE_COMMAND_DISALLOWED
|
||||
*/
|
||||
uint8_t hid_host_send_report(uint16_t hid_cid, uint8_t report_id, const uint8_t * report, uint8_t report_len);
|
||||
uint8_t hid_host_send_report(uint16_t hid_cid, uint16_t report_id, const uint8_t * report, uint8_t report_len);
|
||||
|
||||
/**
|
||||
* @brief Get descriptor data
|
||||
|
Loading…
Reference in New Issue
Block a user