The disconnect task now clears the device name

This commit is contained in:
twinaphex 2016-12-16 12:20:31 +01:00
parent 5c522c643c
commit 62f5b2d3c3
2 changed files with 7 additions and 3 deletions

View File

@ -247,8 +247,6 @@ static void iohidmanager_hid_device_remove(void *data,
{
input_autoconfigure_disconnect(adapter->slot, adapter->name);
settings->input.device_names[adapter->slot][0] = '\0';
hid->buttons[adapter->slot] = 0;
memset(hid->axes[adapter->slot], 0, sizeof(hid->axes));

View File

@ -34,6 +34,7 @@
typedef struct autoconfig_disconnect
{
unsigned idx;
char msg[255];
} autoconfig_disconnect_t;
@ -334,10 +335,13 @@ static void input_autoconfigure_connect_handler(retro_task_t *task)
static void input_autoconfigure_disconnect_handler(retro_task_t *task)
{
autoconfig_disconnect_t *params = (autoconfig_disconnect_t*)task->state;
settings_t *settings = config_get_ptr();
task->title = strdup(params->msg);
task->finished = true;
settings->input.device_names[params->idx][0] = '\0';
RARCH_LOG("%s: %s\n", msg_hash_to_str(MSG_AUTODETECT), params->msg);
free(params);
@ -349,7 +353,9 @@ bool input_autoconfigure_disconnect(unsigned i, const char *ident)
retro_task_t *task = (retro_task_t*)calloc(1, sizeof(*task));
autoconfig_disconnect_t *state = (autoconfig_disconnect_t*)calloc(1, sizeof(*state));
msg[0] = '\0';
msg[0] = '\0';
state->idx = i;
snprintf(msg, sizeof(msg), "%s #%u (%s).",
msg_hash_to_str(MSG_DEVICE_DISCONNECTED_FROM_PORT),