Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Linux] [udev] incorrect order when devices > 9 #9071

Closed
DSkywalk opened this issue Jul 7, 2019 · 0 comments · Fixed by #9074
Closed

[Linux] [udev] incorrect order when devices > 9 #9071

DSkywalk opened this issue Jul 7, 2019 · 0 comments · Fixed by #9074

Comments

@DSkywalk
Copy link

DSkywalk commented Jul 7, 2019

Description

If the linux system have more than 9 event devices the order is incorrect, because linux doesn't use zero-leading to number devices and the algorithm expects them (or maybe isn't tested using a lots of devices).

I made some test and I think you dont need qsort in udev_joypad.c if you use the udev foreach: udev_list_entry_foreach. I get the correct order and i don't need sort anything.

just this simple code works:

   ...
   udev_enumerate_scan_devices(enumerate);
   devs = udev_enumerate_get_list_entry(enumerate);

   udev_list_entry_foreach(item, devs)
   {
      const char         *name = udev_list_entry_get_name(item);
      struct udev_device  *dev = udev_device_new_from_syspath(udev_joypad_fd, name);
      const char      *devnode = udev_device_get_devnode(dev);

      if (devnode != NULL)
         udev_check_device(dev, devnode);
      udev_device_unref(dev);
   }
   ....

thanks!

Actual behavior

Actually this is the order show in ra:
imagen

Then event device 10 is used as #0 device and device 9 is used as #1 device.

Expected behavior

imagen

Steps to reproduce the bug

  1. init ra with enough devices, active logs and you get
[INFO] [udev]: Plugged pad: DragonRise Inc.   Generic   USB  Joystick   (121:6) on port #0.
[INFO] [udev]: Pad #0 (/dev/input/event10) supports force feedback.
[INFO] [udev]: Pad #0 (/dev/input/event10) supports 16 force feedback effects.
[INFO] [Autoconf]: 49 profiles found.
[INFO] [Autoconf]: selected configuration: /opt/retroarch/autoconfig/DragonRise Inc.   Generic   USB  Joystick  .cfg
[INFO] [udev]: Plugged pad: DragonRise Inc.   Generic   USB  Joystick   (121:6) on port #1.
[INFO] [udev]: Pad #1 (/dev/input/event9) supports force feedback.
[INFO] [udev]: Pad #1 (/dev/input/event9) supports 16 force feedback effects.
[INFO] [Autoconf]: 49 profiles found.
[INFO] [Autoconf]: selected configuration: /opt/retroarch/autoconfig/DragonRise Inc.   Generic   USB  Joystick  .cfg

Version/Commit

  • RetroArch: 1.7.7

Environment information

  • OS: Ubuntu 18.04.2
  • Compiler: gcc 7.4.0 (Ubuntu 7.4.0-1ubuntu1~18.04)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant