better shield portable hack

This commit is contained in:
fr500 2015-07-16 03:22:28 -04:00
parent b717828cf0
commit ca682d38eb
2 changed files with 19 additions and 12 deletions

View File

@ -629,6 +629,21 @@ static void handle_hotplug(android_input_t *android,
else if (strstr(device_name, "SideWinder"))
strlcpy(name_buf, "SideWinder Classic", sizeof(name_buf));
}
else if (strstr(device_name, "NVIDIA Corporation NVIDIA Controller v01.01"))
{
/* Built-in shield contrlleris 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.
*/
*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.01"))
{
/* If built-in shield controller is detected bind the virtual and gpio devices to the same port*/
*port = 0;
strlcpy(name_buf, "NVIDIA Corporation NVIDIA Controller v01.01", sizeof(name_buf));
}
else if (
strstr(device_name, "PLAYSTATION(R)3") ||
strstr(device_name, "Dualshock3") ||
@ -637,15 +652,6 @@ static void handle_hotplug(android_input_t *android,
strlcpy(name_buf, "PlayStation3", sizeof(name_buf));
else if (strstr(device_name, "MOGA"))
strlcpy(name_buf, "Moga IME", sizeof(name_buf));
else if (strstr(device_name, "NVIDIA Corporation NVIDIA Controller v01.01"))
{
/* Shield 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.
*/
*port = 0;
strlcpy(name_buf, device_name, sizeof(name_buf));
}
else if (device_name[0] != '\0')
strlcpy(name_buf, device_name, sizeof(name_buf));

View File

@ -120,7 +120,7 @@ static void input_autoconfigure_joypad_add(
/* This will be the case if input driver is reinitialized.
* No reason to spam autoconfigure messages every time. */
bool block_osd_spam = settings &&
settings->input.autoconfigured[params->idx] && *params->name;
settings->input.autoconfigured[params->idx] && *params->name;
if (!settings)
return;
@ -136,8 +136,9 @@ static void input_autoconfigure_joypad_add(
snprintf(msg, sizeof(msg), "%s configured in port #%u.",
params->name, params->idx);
if (!block_osd_spam)
rarch_main_msg_queue_push(msg, 0, 60, false);
if (!block_osd_spam)
rarch_main_msg_queue_push(msg, 0, 60, false);
RARCH_LOG("%s\n", msg);
}