mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 21:32:45 +00:00
Set device name when autoconfig connect task fails for all
other input drivers too
This commit is contained in:
parent
455c3f35c9
commit
ea3dd6a95b
@ -888,13 +888,14 @@ static void handle_hotplug(android_input_data_t *android_data,
|
||||
if (*port < 0)
|
||||
*port = android_data->pads_connected;
|
||||
|
||||
input_autoconfigure_connect(
|
||||
if (!input_autoconfigure_connect(
|
||||
name_buf,
|
||||
NULL,
|
||||
android_joypad.ident,
|
||||
*port,
|
||||
vendorId,
|
||||
productId);
|
||||
productId))
|
||||
input_config_set_device_name(*port, name_buf);
|
||||
|
||||
if (!string_is_empty(name_buf))
|
||||
{
|
||||
|
@ -23,10 +23,12 @@
|
||||
|
||||
#include <retro_miscellaneous.h>
|
||||
|
||||
#include "../connect/joypad_connection.h"
|
||||
#include "../input_config.h"
|
||||
#include "../input_defines.h"
|
||||
#include "../../tasks/tasks_internal.h"
|
||||
#include "../input_hid_driver.h"
|
||||
|
||||
#include "../connect/joypad_connection.h"
|
||||
#include "../../tasks/tasks_internal.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
typedef struct apple_hid
|
||||
@ -298,14 +300,15 @@ static void iohidmanager_hid_device_add_autodetect(unsigned idx,
|
||||
const char *device_name, const char *driver_name,
|
||||
uint16_t dev_vid, uint16_t dev_pid)
|
||||
{
|
||||
input_autoconfigure_connect(
|
||||
if (!input_autoconfigure_connect(
|
||||
device_name,
|
||||
NULL,
|
||||
driver_name,
|
||||
idx,
|
||||
dev_vid,
|
||||
dev_pid
|
||||
);
|
||||
))
|
||||
input_config_set_device_name(idx, device_name);
|
||||
|
||||
RARCH_LOG("Port %d: %s.\n", idx, device_name);
|
||||
}
|
||||
|
@ -141,14 +141,15 @@ static void libusb_hid_device_add_autodetect(unsigned idx,
|
||||
const char *device_name, const char *driver_name,
|
||||
uint16_t dev_vid, uint16_t dev_pid)
|
||||
{
|
||||
input_autoconfigure_connect(
|
||||
if (!input_autoconfigure_connect(
|
||||
device_name,
|
||||
NULL,
|
||||
driver_name,
|
||||
idx,
|
||||
dev_vid,
|
||||
dev_pid
|
||||
);
|
||||
))
|
||||
input_config_set_device_name(idx, device_name);
|
||||
}
|
||||
|
||||
static void libusb_get_description(struct libusb_device *device,
|
||||
|
@ -18,10 +18,13 @@
|
||||
#include <gccore.h>
|
||||
#include <rthreads/rthreads.h>
|
||||
|
||||
#include "../input_config.h"
|
||||
#include "../input_defines.h"
|
||||
#include "../connect/joypad_connection.h"
|
||||
#include "../../tasks/tasks_internal.h"
|
||||
#include "../input_hid_driver.h"
|
||||
|
||||
#include "../connect/joypad_connection.h"
|
||||
|
||||
#include "../../tasks/tasks_internal.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
#define WIIUSB_SC_NONE 0
|
||||
@ -140,13 +143,14 @@ static void wiiusb_hid_device_add_autodetect(unsigned idx,
|
||||
const char *device_name, const char *driver_name,
|
||||
uint16_t dev_vid, uint16_t dev_pid)
|
||||
{
|
||||
input_autoconfigure_connect(
|
||||
if (!input_autoconfigure_connect(
|
||||
device_name,
|
||||
NULL,
|
||||
driver_name,
|
||||
idx,
|
||||
dev_vid,
|
||||
dev_pid);
|
||||
dev_pid))
|
||||
input_config_set_device_name(idx, device_name);
|
||||
}
|
||||
|
||||
static void wiiusb_get_description(usb_device_entry *device,
|
||||
|
@ -43,14 +43,15 @@ static const char *ctr_joypad_name(unsigned pad)
|
||||
|
||||
static void ctr_joypad_autodetect_add(unsigned autoconf_pad)
|
||||
{
|
||||
input_autoconfigure_connect(
|
||||
if (!input_autoconfigure_connect(
|
||||
ctr_joypad_name(autoconf_pad),
|
||||
NULL,
|
||||
ctr_joypad.ident,
|
||||
autoconf_pad,
|
||||
0,
|
||||
0
|
||||
);
|
||||
))
|
||||
input_config_set_device_name(autoconf_pad, ctr_joypad_name(autoconf_pad));
|
||||
}
|
||||
|
||||
static bool ctr_joypad_init(void *data)
|
||||
|
@ -142,14 +142,17 @@ static void handle_hotplug(unsigned port, uint32_t ptype)
|
||||
pad_type[port] = ptype;
|
||||
|
||||
if (ptype != WPAD_EXP_NOCONTROLLER)
|
||||
input_autoconfigure_connect(
|
||||
{
|
||||
if (!input_autoconfigure_connect(
|
||||
gx_joypad_name(port),
|
||||
NULL,
|
||||
gx_joypad.ident,
|
||||
port,
|
||||
0,
|
||||
0
|
||||
);
|
||||
))
|
||||
input_config_set_device_name(port, gx_joypad_name(port));
|
||||
}
|
||||
}
|
||||
|
||||
static bool gx_joypad_button(unsigned port, uint16_t key)
|
||||
|
@ -30,8 +30,10 @@
|
||||
#include <compat/strl.h>
|
||||
#include <string/stdstring.h>
|
||||
|
||||
#include "../common/epoll_common.h"
|
||||
#include "../input_config.h"
|
||||
#include "../input_driver.h"
|
||||
|
||||
#include "../common/epoll_common.h"
|
||||
#include "../../configuration.h"
|
||||
#include "../../verbosity.h"
|
||||
#include "../../tasks/tasks_internal.h"
|
||||
@ -167,13 +169,14 @@ static void handle_plugged_pad(void)
|
||||
linuxraw_pads[idx].fd = -1;
|
||||
*linuxraw_pads[idx].ident = '\0';
|
||||
|
||||
input_autoconfigure_connect(
|
||||
if (!input_autoconfigure_connect(
|
||||
NULL,
|
||||
NULL,
|
||||
linuxraw_joypad_name(idx),
|
||||
idx,
|
||||
0,
|
||||
0);
|
||||
0))
|
||||
input_config_set_device_name(idx, NULL);
|
||||
}
|
||||
}
|
||||
/* Sometimes, device will be created before access to it is established. */
|
||||
@ -188,13 +191,14 @@ static void handle_plugged_pad(void)
|
||||
if ( !string_is_empty(linuxraw_pads[idx].ident)
|
||||
&& linuxraw_joypad_init_pad(path, &linuxraw_pads[idx]))
|
||||
{
|
||||
input_autoconfigure_connect(
|
||||
if (!input_autoconfigure_connect(
|
||||
linuxraw_pads[idx].ident,
|
||||
NULL,
|
||||
linuxraw_joypad.ident,
|
||||
idx,
|
||||
0,
|
||||
0);
|
||||
0))
|
||||
input_config_set_device_name(idx, linuxraw_joypad_name(idx));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -245,13 +249,14 @@ static bool linuxraw_joypad_init(void *data)
|
||||
|
||||
snprintf(path, sizeof(path), "/dev/input/js%u", i);
|
||||
|
||||
input_autoconfigure_connect(
|
||||
if (!input_autoconfigure_connect(
|
||||
pad->ident,
|
||||
NULL,
|
||||
"linuxraw",
|
||||
i,
|
||||
0,
|
||||
0);
|
||||
0))
|
||||
input_config_set_device_name(i, pad->ident);
|
||||
|
||||
if (linuxraw_joypad_init_pad(path, pad))
|
||||
linuxraw_poll_pad(pad);
|
||||
|
@ -302,14 +302,15 @@ static bool parport_joypad_init(void *data)
|
||||
}
|
||||
}
|
||||
|
||||
input_autoconfigure_connect(
|
||||
if (!input_autoconfigure_connect(
|
||||
"Generic Parallel Port device",
|
||||
NULL,
|
||||
"parport",
|
||||
i,
|
||||
0,
|
||||
0
|
||||
);
|
||||
))
|
||||
input_config_set_device_name(i, "Generic Parallel Port device");
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -40,14 +40,15 @@ static const char *ps3_joypad_name(unsigned pad)
|
||||
|
||||
static void ps3_joypad_autodetect_add(unsigned autoconf_pad)
|
||||
{
|
||||
input_autoconfigure_connect(
|
||||
ps3_joypad_name(autoconf_pad),
|
||||
NULL,
|
||||
ps3_joypad.ident,
|
||||
autoconf_pad,
|
||||
0,
|
||||
0
|
||||
);
|
||||
if (!input_autoconfigure_connect(
|
||||
ps3_joypad_name(autoconf_pad),
|
||||
NULL,
|
||||
ps3_joypad.ident,
|
||||
autoconf_pad,
|
||||
0,
|
||||
0
|
||||
))
|
||||
input_config_set_device_name(autoconf_pad, ps3_joypad_name(autoconf_pad));
|
||||
}
|
||||
|
||||
static bool ps3_joypad_init(void *data)
|
||||
|
@ -72,14 +72,15 @@ static const char *psp_joypad_name(unsigned pad)
|
||||
|
||||
static void psp_joypad_autodetect_add(unsigned autoconf_pad)
|
||||
{
|
||||
input_autoconfigure_connect(
|
||||
if (!input_autoconfigure_connect(
|
||||
psp_joypad_name(autoconf_pad),
|
||||
NULL,
|
||||
psp_joypad.ident,
|
||||
autoconf_pad,
|
||||
0,
|
||||
0
|
||||
);
|
||||
))
|
||||
input_config_set_device_name(autoconf_pad, psp_joypad_name(autoconf_pad));
|
||||
}
|
||||
|
||||
static bool psp_joypad_init(void *data)
|
||||
|
@ -31,14 +31,17 @@ static bool qnx_joypad_init(void *data)
|
||||
(void)data;
|
||||
|
||||
for (autoconf_pad = 0; autoconf_pad < MAX_USERS; autoconf_pad++)
|
||||
input_autoconfigure_connect(
|
||||
{
|
||||
if (!input_autoconfigure_connect(
|
||||
qnx_joypad_name(autoconf_pad),
|
||||
NULL,
|
||||
qnx_joypad.ident,
|
||||
autoconf_pad,
|
||||
0,
|
||||
0
|
||||
);
|
||||
))
|
||||
input_config_set_device_name(autoconf_pad, qnx_joypad_name(autoconf_pad));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -20,7 +20,9 @@
|
||||
|
||||
#include "SDL.h"
|
||||
|
||||
#include "../input_config.h"
|
||||
#include "../input_driver.h"
|
||||
|
||||
#include "../../tasks/tasks_internal.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
@ -51,14 +53,17 @@ static sdl_joypad_t sdl_pads[MAX_USERS];
|
||||
static bool g_has_haptic;
|
||||
#endif
|
||||
|
||||
static const char* sdl_pad_name(unsigned id)
|
||||
static const char *sdl_joypad_name(unsigned pad)
|
||||
{
|
||||
if (pad >= MAX_USERS)
|
||||
return NULL;
|
||||
|
||||
#ifdef HAVE_SDL2
|
||||
if (sdl_pads[id].controller)
|
||||
return SDL_GameControllerNameForIndex(id);
|
||||
return SDL_JoystickNameForIndex(id);
|
||||
if (sdl_pads[pad].controller)
|
||||
return SDL_GameControllerNameForIndex(pad);
|
||||
return SDL_JoystickNameForIndex(pad);
|
||||
#else
|
||||
return SDL_JoystickName(id);
|
||||
return SDL_JoystickName(pad);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -140,16 +145,17 @@ static void sdl_pad_connect(unsigned id)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
input_autoconfigure_connect(
|
||||
sdl_pad_name(id),
|
||||
if (!input_autoconfigure_connect(
|
||||
sdl_joypad_name(id),
|
||||
NULL,
|
||||
sdl_joypad.ident,
|
||||
id,
|
||||
vendor,
|
||||
product);
|
||||
product))
|
||||
input_config_set_device_name(id, sdl_joypad_name(id));
|
||||
|
||||
RARCH_LOG("[SDL]: Device #%u (%04x:%04x) connected: %s.\n", id, vendor,
|
||||
product, sdl_pad_name(id));
|
||||
product, sdl_joypad_name(id));
|
||||
|
||||
#ifdef HAVE_SDL2
|
||||
|
||||
@ -438,14 +444,6 @@ static bool sdl_joypad_query_pad(unsigned pad)
|
||||
return pad < MAX_USERS && sdl_pads[pad].joypad;
|
||||
}
|
||||
|
||||
static const char *sdl_joypad_name(unsigned pad)
|
||||
{
|
||||
if (pad >= MAX_USERS)
|
||||
return NULL;
|
||||
|
||||
return sdl_pad_name(pad);
|
||||
}
|
||||
|
||||
input_device_driver_t sdl_joypad = {
|
||||
sdl_joypad_init,
|
||||
sdl_joypad_query_pad,
|
||||
|
@ -31,9 +31,11 @@
|
||||
#include <compat/strl.h>
|
||||
#include <string/stdstring.h>
|
||||
|
||||
#include "../../tasks/tasks_internal.h"
|
||||
#include "../input_config.h"
|
||||
#include "../input_driver.h"
|
||||
|
||||
#include "../../tasks/tasks_internal.h"
|
||||
|
||||
#include "../common/udev_common.h"
|
||||
|
||||
#include "../../configuration.h"
|
||||
@ -280,13 +282,14 @@ static int udev_add_pad(struct udev_device *dev, unsigned p, int fd, const char
|
||||
|
||||
if (!string_is_empty(pad->ident))
|
||||
{
|
||||
input_autoconfigure_connect(
|
||||
pad->ident,
|
||||
NULL,
|
||||
udev_joypad.ident,
|
||||
p,
|
||||
pad->vid,
|
||||
pad->pid);
|
||||
if (!input_autoconfigure_connect(
|
||||
pad->ident,
|
||||
NULL,
|
||||
udev_joypad.ident,
|
||||
p,
|
||||
pad->vid,
|
||||
pad->pid))
|
||||
input_config_set_device_name(p, pad->ident);
|
||||
|
||||
ret = 1;
|
||||
}
|
||||
|
@ -45,14 +45,15 @@ static const char *wiiu_joypad_name(unsigned pad)
|
||||
|
||||
static void wiiu_joypad_autodetect_add(unsigned autoconf_pad)
|
||||
{
|
||||
input_autoconfigure_connect(
|
||||
if (!input_autoconfigure_connect(
|
||||
wiiu_joypad_name(autoconf_pad),
|
||||
NULL,
|
||||
wiiu_joypad.ident,
|
||||
autoconf_pad,
|
||||
0,
|
||||
0
|
||||
);
|
||||
))
|
||||
input_config_set_device_name(autoconf_pad, wiiu_joypad_name(autoconf_pad));
|
||||
}
|
||||
|
||||
static bool wiiu_joypad_button(unsigned port_num, uint16_t key)
|
||||
|
@ -44,13 +44,14 @@ static const char *xdk_joypad_name(unsigned pad)
|
||||
|
||||
static void xdk_joypad_autodetect_add(unsigned autoconf_pad)
|
||||
{
|
||||
input_autoconfigure_connect(
|
||||
if (!input_autoconfigure_connect(
|
||||
xdk_joypad_name(autoconf_pad),
|
||||
NULL,
|
||||
xdk_joypad.ident,
|
||||
autoconf_pad,
|
||||
0,
|
||||
0);
|
||||
0))
|
||||
input_config_set_device_name(autoconf_pad, xdk_joypad_name(autoconf_pad));
|
||||
}
|
||||
|
||||
static bool xdk_joypad_init(void *data)
|
||||
|
Loading…
x
Reference in New Issue
Block a user