Diff between 6f51c94e273aadadf9dad1acf795ec0a0b39e38c and 569685b75272b49264cbd2f6a10d1fa512672e06

Changed Files

File Additions Deletions Status
android/avctp.c +6 -3 modified

Full Patch

diff --git a/android/avctp.c b/android/avctp.c
index 9bfb191..8a0d6a1 100644
--- a/android/avctp.c
+++ b/android/avctp.c
@@ -284,9 +284,6 @@ static int send_event(int fd, uint16_t type, uint16_t code, int32_t value)
 
 static void send_key(int fd, uint16_t key, int pressed)
 {
-	if (fd < 0)
-		return;
-
 	send_event(fd, EV_KEY, key, pressed);
 	send_event(fd, EV_SYN, SYN_REPORT, 0);
 }
@@ -335,6 +332,12 @@ static size_t handle_panel_passthrough(struct avctp *session,
 			goto done;
 	}
 
+	if (session->uinput < 0) {
+		DBG("AV/C: uinput not initialized");
+		*code = AVC_CTYPE_NOT_IMPLEMENTED;
+		return 0;
+	}
+
 	for (i = 0; key_map[i].name != NULL; i++) {
 		uint8_t key_quirks;