Diff between 98921e1bd50814e781de9e6c7274d2231dd1bb0f and 81617ffdfc851210d2b554b99a5c502a0d2dd1b8

Changed Files

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

Full Patch

diff --git a/android/hal-hidhost.c b/android/hal-hidhost.c
index 6a6b682..5d05f9b 100644
--- a/android/hal-hidhost.c
+++ b/android/hal-hidhost.c
@@ -218,16 +218,8 @@ static bt_status_t get_protocol(bt_bdaddr_t *bd_addr,
 
 	memcpy(cmd.bdaddr, bd_addr, sizeof(cmd.bdaddr));
 
-	switch (protocol_mode) {
-	case BTHH_REPORT_MODE:
-		cmd.mode = HAL_HIDHOST_REPORT_PROTOCOL;
-		break;
-	case BTHH_BOOT_MODE:
-		cmd.mode = HAL_HIDHOST_BOOT_PROTOCOL;
-		break;
-	default:
-		return BT_STATUS_PARM_INVALID;
-	}
+	/* type match IPC type */
+	cmd.mode = protocol_mode;
 
 	return hal_ipc_cmd(HAL_SERVICE_ID_HIDHOST,
 				HAL_OP_HIDHOST_GET_PROTOCOL,
diff --git a/android/hidhost.c b/android/hidhost.c
index 0e0391a..4635e53 100644
--- a/android/hidhost.c
+++ b/android/hidhost.c
@@ -880,6 +880,15 @@ static void bt_hid_get_protocol(const void *buf, uint16_t len)
 
 	DBG("");
 
+	switch (cmd->mode) {
+	case HAL_HIDHOST_REPORT_PROTOCOL:
+	case HAL_HIDHOST_BOOT_PROTOCOL:
+		break;
+	default:
+		status = HAL_STATUS_INVALID;
+		goto failed;
+	}
+
 	android2bdaddr(&cmd->bdaddr, &dst);
 
 	l = g_slist_find_custom(devices, &dst, device_cmp);