Add data type to hid_device_reply_to_report 10/231510/1
authorDeokhyun Kim <dukan.kim@samsung.com>
Tue, 21 Apr 2020 07:08:12 +0000 (16:08 +0900)
committerWootak Jung <wootak.jung@samsung.com>
Wed, 22 Apr 2020 07:27:38 +0000 (16:27 +0900)
Change-Id: I43b4ade45c96be75575b11406db1b680cb3d6c6d
Signed-off-by: Deokhyun Kim <dukan.kim@samsung.com>
Signed-off-by: Wootak Jung <wootak.jung@samsung.com>
bt-api/bt-hid-device.c

index e0e8a53..c9b851a 100644 (file)
@@ -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];