From 33241abad2f8b827342f253427b67e2e7a82f218 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 31 Dec 2012 16:05:07 +0100 Subject: [PATCH] (Android) Pass source to setup_keycode_lut too --- android/native/jni/input_android.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/android/native/jni/input_android.c b/android/native/jni/input_android.c index 64a38c326a..3f59dbe36d 100644 --- a/android/native/jni/input_android.c +++ b/android/native/jni/input_android.c @@ -114,7 +114,7 @@ static void get_device_name(char *buf, size_t size, int id) (*vm)->DetachCurrentThread(vm); } -static void setup_keycode_lut(unsigned port, unsigned id) +static void setup_keycode_lut(unsigned port, unsigned id, int source) { char msg[128]; msg[0] = 0; @@ -388,13 +388,22 @@ static void setup_keycode_lut(unsigned port, unsigned id) RARCH_LOG("Device %d: %s, port: %d.\n", id, name_buf, port); + unsigned timeout_val = 30; + if (msg[0] == 0) { - snprintf(msg, sizeof(msg), "HID [%s] unbound.\n", name_buf); - msg_queue_push(g_extern.msg_queue, msg, 0, 120); + if (source == AINPUT_SOURCE_TOUCHSCREEN) + snprintf(msg, sizeof(msg), "RetroPad #%d is: Touchscreen.\n", port); + else if (source == AINPUT_SOURCE_MOUSE) + snprintf(msg, sizeof(msg), "RetroPad #%d is: Mouse.\n", port); + else if (source == AINPUT_SOURCE_KEYBOARD) + snprintf(msg, sizeof(msg), "RetroPad #%d is: Keyboard.\n", port); + else + snprintf(msg, sizeof(msg), "HID [%s] unbound.\n", name_buf); + timeout_val = 120; } - else - msg_queue_push(g_extern.msg_queue, msg, 0, 30); + + msg_queue_push(g_extern.msg_queue, msg, 0, timeout_val); } static void *android_input_init(void) @@ -470,7 +479,7 @@ static void android_input_poll(void *data) if(state_id == -1) { state_id = state_device_ids[id] = pads_connected++; - setup_keycode_lut(state_id, id); + setup_keycode_lut(state_id, id, source); } int action = 0;