mirror of
https://github.com/libretro/RetroArch
synced 2025-04-10 15:45:19 +00:00
(udev) Simplify udev_joypad_handle_hotplug
This commit is contained in:
parent
bd53c33069
commit
eee077fe31
@ -420,18 +420,11 @@ static void udev_joypad_destroy(void)
|
|||||||
g_udev = NULL;
|
g_udev = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void udev_joypad_handle_hotplug(void)
|
static void udev_joypad_handle_hotplug(struct udev_device *dev)
|
||||||
{
|
{
|
||||||
struct udev_device *dev = udev_monitor_receive_device(g_udev_mon);
|
const char *val = udev_device_get_property_value(dev, "ID_INPUT_JOYSTICK");
|
||||||
const char *val;
|
const char *action = udev_device_get_action(dev);
|
||||||
const char *action;
|
const char *devnode = udev_device_get_devnode(dev);
|
||||||
const char *devnode;
|
|
||||||
if (!dev)
|
|
||||||
return;
|
|
||||||
|
|
||||||
val = udev_device_get_property_value(dev, "ID_INPUT_JOYSTICK");
|
|
||||||
action = udev_device_get_action(dev);
|
|
||||||
devnode = udev_device_get_devnode(dev);
|
|
||||||
|
|
||||||
if (!val || !string_is_equal(val, "1") || !devnode)
|
if (!val || !string_is_equal(val, "1") || !devnode)
|
||||||
goto end;
|
goto end;
|
||||||
@ -523,8 +516,13 @@ static bool udev_set_rumble(unsigned i, enum retro_rumble_effect effect, uint16_
|
|||||||
static void udev_joypad_poll(void)
|
static void udev_joypad_poll(void)
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
while (udev_hotplug_available())
|
while (udev_hotplug_available())
|
||||||
udev_joypad_handle_hotplug();
|
{
|
||||||
|
struct udev_device *dev = udev_monitor_receive_device(g_udev_mon);
|
||||||
|
if (dev)
|
||||||
|
udev_joypad_handle_hotplug(dev);
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < MAX_USERS; i++)
|
for (i = 0; i < MAX_USERS; i++)
|
||||||
udev_poll_pad(&udev_pads[i], i);
|
udev_poll_pad(&udev_pads[i], i);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user