From 786424b064cd44b7a1749e0136d1aa9e1109b213 Mon Sep 17 00:00:00 2001 From: radius Date: Fri, 7 Aug 2015 01:50:02 -0500 Subject: [PATCH] Shield Console hack --- input/drivers/android_input.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/input/drivers/android_input.c b/input/drivers/android_input.c index 880864d39a..a410077f39 100644 --- a/input/drivers/android_input.c +++ b/input/drivers/android_input.c @@ -641,7 +641,7 @@ static void handle_hotplug(android_input_t *android, } else if (strstr(device_name, "NVIDIA Corporation NVIDIA Controller v01.01")) { - /* Built-in shield contrlleris always user 1. FIXME: This is kinda ugly. + /* Built-in shield controller is always user 1. FIXME: This is kinda ugly. * We really need to find a way to detect useless input devices * like gpio-keys in a general way. */ @@ -655,6 +655,21 @@ static void handle_hotplug(android_input_t *android, *port = 0; strlcpy(name_buf, "Generic I/O Device", sizeof(name_buf)); } + else if (strstr(device_name, "NVIDIA Corporation NVIDIA Controller v01.03") && !strstr(android->pad_states[0].name,"NVIDIA Corporation NVIDIA Controller v01.03")) + { + /* Shield Controller is user 0 by default. FIXME: This is kinda ugly. + * this allows using the NVIDIA button as menu + */ + *port = 0; + strlcpy(name_buf, device_name, sizeof(name_buf)); + } + else if (strstr(device_name, "Virtual") || + (strstr(device_name, "gpio") && strstr(android->pad_states[0].name,"NVIDIA Corporation NVIDIA Controller v01.03"))) + { + /* If the shield controller is detected bind the virtual and gpio devices to the same port*/ + *port = 0; + strlcpy(name_buf, "Generic I/O Device", sizeof(name_buf)); + } else if (strstr(device_name, "Amazon Fire TV Remote") || strstr(device_name, "Nexus Remote") || strstr(device_name, "SHIELD Remote"))