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

Standardizing naming for controllers (affects input_device value and file name) #1157

Closed
davidhedlund opened this issue Jul 29, 2024 · 4 comments

Comments

@davidhedlund
Copy link
Contributor

davidhedlund commented Jul 29, 2024

To address the inconsistencies in input_device naming across different Linux distributions, we will establish and document a standardized naming policy for controllers in our controller autoconfiguration guide at https://github.com/libretro/docs/blob/master/docs/guides/controller-autoconfiguration.md to ensure clarity and consistency for both users and developers.

Standardizing input_device Values in Autoconfig Files

We need to decide on a consistent approach for the input_device value in RetroArch's autoconfig files. Currently, these values vary significantly across different GNU/Linux distributions and kernel versions, making it challenging to maintain up-to-date configurations.

Current Situation

The input_device value for the Nintendo Switch Pro Controller varies across different Ubuntu-based distributions and their derivatives:

Kernel Version Distribution Generated controller name[1]
Linux 5.15 Ubuntu MATE 20.04.6 Pro Controller
Linux 5.15 Trisquel 11.0 Pro Controller
Linux 5.19 Ubuntu MATE 22.04.2 Nintendo Switch Pro Controller
Linux 6.2.0 Ubuntu MATE 23.04 Nintendo Switch Pro Controller
Linux 6.8.0 Ubuntu MATE 24.04 Nintendo Co., Ltd. Pro Controller

1: The controller name is used in RetroArch under Settings -> Input -> RetroPad Binds -> Port 1 Controls -> Save Controller Profile, generating a .cfg file (e.g., "udev/Foo.cfg") that includes an input_device entry with the controller name (e.g., input_device = Foo), which remains identical across all controller drivers (udev, sdl2, linuxraw) as specified in Settings -> Drivers -> Controller.

Problem

Updating the input_device value each time it changes in popular distributions is inconvenient and potentially error-prone. However, there might be benefits to keeping these values current. The situation is further complicated by the fact that distributions based on the same version (like Trisquel 11.0 based on Ubuntu 22.04) may have different input_device values, possibly due to different package versions or distribution-specific modifications.

Proposed Solutions

  1. Use the earliest known value: Stick with "Pro Controller" as it appears in Ubuntu MATE 20.04.6 and Trisquel 11.0.

  2. Use the latest known value: Adopt "Nintendo Co., Ltd. Pro Controller" from Ubuntu MATE 24.04.

  3. Use a generic value: Choose a common denominator like "Nintendo Switch Pro Controller".

  4. Implement a fallback system: Allow multiple input_device values per controller, checking them in order.

  5. Differentiate between HID and non-HID variants:

    • For Nintendo Switch Pro Controller.cfg (HID supported): Use the latest name (e.g., "Nintendo Co., Ltd. Pro Controller" or "Nintendo Switch Pro Controller")
    • For Nintendo Switch Pro Controller (default-off).cfg (not HID supported): Use "Pro Controller"

    This approach accounts for both variants and supports older distributions like Ubuntu MATE 20.04.6 and Trisquel 11.0. However, it may disrupt alphabetical sorting of the files.

For HID-supported devices, using "Nintendo Co., Ltd. Pro Controller" may be preferable as it reflects the most current naming convention in the latest distributions. This approach reduces the likelihood of users with updated systems uploading new autoconfig files, thinking the existing ones are outdated. For non-HID devices, "Pro Controller" remains the best choice to maintain compatibility with older systems. This dual naming strategy balances accuracy for modern systems with backward compatibility for older ones.

Questions to Consider

  1. Are there technical reasons to prefer newer or older input_device values?
  2. How does this variation affect users across different distributions and their derivatives?
  3. What impact would standardization have on RetroArch's compatibility and user experience?
  4. Is the potential disruption to alphabetical file sorting in solution 5 acceptable given the improved compatibility?
  5. How can we best balance supporting older systems with accommodating newer, more descriptive device names?
  6. Should we consider the base distribution when determining the input_device value, given the differences observed between Ubuntu-based distributions?

Related Pull Requests

We need to decide on the best approach moving forward to ensure consistent and reliable controller autoconfig across various GNU/Linux distributions and their derivatives while considering both HID and non-HID variants of the Nintendo Switch Pro Controller.

Additional Considerations

  • The impact of these changes on other controller types and brands.
  • The feasibility of implementing a more dynamic system for device recognition.
  • The potential for creating a mapping system that can handle multiple device names for the same controller.
  • The influence of base distributions on input_device values in derivative distributions.

Your input and discussion on these points are crucial for determining the most effective solution for the RetroArch community.

davidhedlund added a commit to davidhedlund/retroarch-joypad-autoconfig that referenced this issue Jul 30, 2024
… Pro Controller (default-off).cfg

"Pro Controller" not "Nintendo Switch Pro Controller"

Just re-evaluated the settings from scratch and updated libretro#1157
@davidhedlund davidhedlund changed the title Standardizing input_device naming for controllers in autoconfig files Standardizing naming for controllers (affects input_device value and file name) Jul 30, 2024
@m4xw
Copy link

m4xw commented Jul 30, 2024

Did you check if its even using the same input driver for the varying configurations?

@davidhedlund
Copy link
Contributor Author

Did you check if its even using the same input driver for the varying configurations?

Same output for all controller drivers.

@m4xw
Copy link

m4xw commented Jul 30, 2024

lsusb output and your udev rules?

@davidhedlund
Copy link
Contributor Author

lsusb output and your udev rules?

Sorry if I was not clear enough when I said "same output for all controller drivers." so I added this to the top post:

The controller name is used in RetroArch under Settings -> Input -> RetroPad Binds -> Port 1 Controls -> Save Controller Profile, generating a .cfg file (e.g., "udev/Foo.cfg") that includes an input_device entry with the controller name (e.g., input_device = Foo), which remains identical across all controller drivers (udev, sdl2, linuxraw) as specified in Settings -> Drivers -> Controller.

I am currently documenting a standard naming scheme in this guide that aligns with the "Differentiate between HID and non-HID variants" suggestion from the top post of this issue. This ensures that the controller name in older systems matches the controller name generated by RetroArch in these systems.

This issue can always be re-opened if the developers want to discuss the naming scheme further.

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

No branches or pull requests

2 participants