Fix 64bit build error
[platform/core/connectivity/bluetooth-frwk.git] / bt-api / bt-hid-device.c
index 803996f..806fc31 100644 (file)
@@ -120,7 +120,7 @@ static hid_connected_device_info_t *__find_hid_info_with_address(const char *rem
 
        for (l = device_list; l != NULL; l = l->next) {
                hid_connected_device_info_t *info = l->data;
-               if (g_strcmp0((const char *)info->address, (const char *)remote_addr) == 0)
+               if (strcasecmp((const char *)info->address, (const char *)remote_addr) == 0)
                        return info;
        }
        return NULL;
@@ -626,7 +626,8 @@ BT_EXPORT_API int bluetooth_hid_device_activate(void)
                BT_ERR("Error returned in method call");
                if (err) {
                        BT_ERR("Error = %s", err->message);
-                       if (strcmp(err->message, BT_ERROR_ALREADY_EXIST) == 0)
+                       g_dbus_error_strip_remote_error(err);
+                       if (g_strrstr(err->message, BT_ERROR_ALREADY_EXIST))
                                ret = BLUETOOTH_ERROR_IN_PROGRESS;
                        else
                                ret = BLUETOOTH_ERROR_INTERNAL;
@@ -662,7 +663,8 @@ BT_EXPORT_API int bluetooth_hid_device_deactivate(void)
                BT_ERR("Error returned in method call");
                if (err) {
                        BT_ERR("Error = %s", err->message);
-                       if (strcmp(err->message, BT_ERROR_NOT_AVAILABLE) == 0)
+                       g_dbus_error_strip_remote_error(err);
+                       if (g_strrstr(err->message, BT_ERROR_NOT_AVAILABLE))
                                ret = BLUETOOTH_ERROR_NOT_IN_OPERATION;
                        else
                                ret = BLUETOOTH_ERROR_INTERNAL;
@@ -901,6 +903,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 +986,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];