Diff between af6b7bef235f5d68897302b5b975c0611bb3de47 and 33c2a480a8bdeaf077d77bdc43bc660015b3edbe

Changed Files

File Additions Deletions Status
android/hal-hidhost.c +2 -13 modified
android/hidhost.c +10 -0 modified

Full Patch

diff --git a/android/hal-hidhost.c b/android/hal-hidhost.c
index b331145..371250a 100644
--- a/android/hal-hidhost.c
+++ b/android/hal-hidhost.c
@@ -268,19 +268,8 @@ static bt_status_t get_report(bt_bdaddr_t *bd_addr,
 	cmd.id = report_id;
 	cmd.buf_size = buffer_size;
 
-	switch (report_type) {
-	case BTHH_INPUT_REPORT:
-		cmd.type = HAL_HIDHOST_INPUT_REPORT;
-		break;
-	case BTHH_OUTPUT_REPORT:
-		cmd.type = HAL_HIDHOST_OUTPUT_REPORT;
-		break;
-	case BTHH_FEATURE_REPORT:
-		cmd.type = HAL_HIDHOST_FEATURE_REPORT;
-		break;
-	default:
-		return BT_STATUS_PARM_INVALID;
-	}
+	/* type match IPC type */
+	cmd.type = report_type;
 
 	return hal_ipc_cmd(HAL_SERVICE_ID_HIDHOST, HAL_OP_HIDHOST_GET_REPORT,
 			sizeof(cmd), &cmd, 0, NULL, NULL);
diff --git a/android/hidhost.c b/android/hidhost.c
index 76e65b8..1cf85b1 100644
--- a/android/hidhost.c
+++ b/android/hidhost.c
@@ -991,6 +991,16 @@ static void bt_hid_get_report(const void *buf, uint16_t len)
 
 	DBG("");
 
+	switch (cmd->type) {
+	case HAL_HIDHOST_INPUT_REPORT:
+	case HAL_HIDHOST_OUTPUT_REPORT:
+	case HAL_HIDHOST_FEATURE_REPORT:
+		break;
+	default:
+		status = HAL_STATUS_INVALID;
+		goto failed;
+	}
+
 	android2bdaddr(&cmd->bdaddr, &dst);
 
 	l = g_slist_find_custom(devices, &dst, device_cmp);