From 6704c41e411721d3a3005a74594cdbe19f3c2228 Mon Sep 17 00:00:00 2001 From: Deokhyun Kim Date: Tue, 21 Apr 2020 16:08:12 +0900 Subject: [PATCH] Add data type to hid_device_reply_to_report Change-Id: I43b4ade45c96be75575b11406db1b680cb3d6c6d Signed-off-by: Deokhyun Kim Signed-off-by: Wootak Jung --- bt-api/bt-hid-device.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/bt-api/bt-hid-device.c b/bt-api/bt-hid-device.c index e0e8a53..c9b851a 100644 --- a/bt-api/bt-hid-device.c +++ b/bt-api/bt-hid-device.c @@ -901,6 +901,10 @@ BT_EXPORT_API int bluetooth_hid_device_reply_to_report(const char *remote_addr, hid_connected_device_info_t *info = NULL; BT_CHECK_PARAMETER(remote_addr, return); + if (data_len > 20) { + BT_ERR("data(len:%d) overflow", data_len); + return BLUETOOTH_ERROR_INVALID_PARAM; + } info = __find_hid_info_with_address(remote_addr); if (info == NULL) { @@ -980,6 +984,14 @@ BT_EXPORT_API int bluetooth_hid_device_reply_to_report(const char *remote_addr, break; } + case HTYPE_TRANS_DATA: { + output_report.type = BT_HID_TRANS_DATA; + memcpy(output_report.rep_data, data, data_len); + bytes = write(info->ctrl_fd, &output_report.type, + data_len + 1); + break; + } + case HTYPE_TRANS_GET_IDLE: { output_report.type = BT_HID_TRANS_DATA | BT_HID_DATA_RTYPE_OUTPUT; output_report.rep_data[0] = data[0]; -- 2.7.4