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

udev and SDL Sensor and Touchpad #16188

Open
wants to merge 59 commits into
base: master
Choose a base branch
from
Open

Conversation

oshaboy
Copy link

@oshaboy oshaboy commented Feb 2, 2024

Description

Implemented Sensor and Touchpad Support for SDL and udev.

Related Issues

#16162

Reviewers

@gouchi @warmenhoven

Known Issues with the pull request

  • No Wiimote support yet.
  • Everything is hardcoded and not adjustable by the user. Which causes problems if an unrelated device such as a mouse takes device 0. Also if you swap the gamepads
    • Only the axes are hardcoded now.
    • SDL Device selection doesn't work.
    • Axes are no longer hardcoded but they aren't saved for some reason
  • Requires UDEV_TOUCH_SUPPORT to be enabled.
  • Untested with multiple Dualshock 4s/Dualsenses

@oshaboy
Copy link
Author

oshaboy commented Feb 2, 2024

The checks failed due to the UDEV_TOUCH_SUPPORT not being defined.

I'm not really sure what to do should I add a UDEV_SENSOR_SUPPORT macro for the sensor code?

@gouchi
Copy link
Member

gouchi commented Feb 2, 2024

To make some test

git clone https://github.com/libretro/RetroArch.git
cd RetroArch
git fetch origin pull/16188/head:pr16188
git checkout pr16188
./configure && make -j$(nproc)

@LibretroAdmin
Copy link
Contributor

You need to fix the failing CI tasks

@oshaboy
Copy link
Author

oshaboy commented Feb 2, 2024

Will do

@LibretroAdmin
Copy link
Contributor

Linux x86 pipeline still failing.

@gouchi
Copy link
Member

gouchi commented Feb 3, 2024

Linux x86 pipeline still failing.

It seems that sensor API has been introduced in SDL version 2.0.9. And we are using SDL 2.0.4 for the CI as we are building under Xenial.

@oshaboy
Copy link
Author

oshaboy commented Feb 3, 2024

Even if the build succeeds I don't want the pull request merged yet.

It works adequately now for testing but to be usable I need to add a lot of options to adjust sensitivity and mapping. The problem is RN the retropad stack assumes there's only one set of sensors... safe assumption to make on mobile. Not so much with sensor enabled controllers.

An example is that on the dualsense is the way it's set up by default you have to point the shoulder buttons up. Most people play games with the face buttons pointing up so it makes playing extremely unintuitive.

I only made the pull request so people will be aware that I am working on it and maybe get some more testing on it. Please don't merge it until it's complete.

@warmenhoven
Copy link
Contributor

You can tell GitHub to mark the PR as a draft, which will prevent it from being merged until you tell it that it's ready for review.

@oshaboy oshaboy marked this pull request as draft February 3, 2024 15:36
Cleanup
Sensitivity settings and Sensor Retropad selection implemented including menu options
@gouchi
Copy link
Member

gouchi commented Feb 3, 2024

I confirm DS4 is working with udev driver.

  1. Enable Auxiliary Sensor Input in Settings Tab > Input.
    auxiliary-sensor-input

  2. Select correct Sensor in Settings Tab > input > RetroPad Binds > Port 1 Controls > Sensor Index

sensor-index

If needed, you can adjust Sensivity in Settings Tab > Input > Gyroscope Sensitivity

sensivity

@LibretroAdmin
Copy link
Contributor

CI Linux (i686) still fails. Is SDL_Sensor only available on specific SDL versions? Can we have a compile-time ifdefs for this?

@gouchi
Copy link
Member

gouchi commented Feb 4, 2024

It seems there is a macro SDL_VERSION_ATLEAST so we could use SDL_VERSION_ATLEAST(2,0,9).

@oshaboy
Copy link
Author

oshaboy commented Feb 4, 2024

I was going to say that maybe we should drop support for ancient versions of SDL2, but turns out SDL 2.0.9 released in 2018 so it isn't that old.

@gouchi
Copy link
Member

gouchi commented Feb 4, 2024

but turns out SDL 2.0.9 released in 2018 so it isn't that old.

I am confused the release date indicates May 24, 2022 ?

Source

@oshaboy
Copy link
Author

oshaboy commented Feb 5, 2024

Idk the tags tab says 2018. But when you click on it it says 2022.

Maybe they have been pushing commits to it until then.

https://github.com/libsdl-org/SDL/tags?after=release-2.0.18

Edit: I found https://www.phoronix.com/news/SDL-2.0.9-Released confirming it's from 2018.

@oshaboy
Copy link
Author

oshaboy commented Jan 12, 2025

I solved the conflicts

Copy link
Contributor

@JesseTG JesseTG left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes broadly look good, but there are some things I'd like you to fix. Additionally, there's a decision to be made that I'd like your input on.

As I mentioned on Discord last night, the autoconfig system is probably a better fit for configuring sensor indexes than the UI, since mappings for a given device are likely to be the same across the board -- I wish somebody (possibly including me) had thought of that when you first submitted this PR, as it could've saved you a lot of aggravation.

On the other hand, the UI would be a good fallback for devices whose autoconfig profiles haven't been updated. But I think it would have to be updated to override (or ignore?) settings for profiles that do have sensor mappings.

What do you think? Which direction do you want to proceed in? Autoconfig + no mapping UI, or autoconfig + additional work on UI?

libretro-common/include/libretro.h Outdated Show resolved Hide resolved
configuration.c Outdated Show resolved Hide resolved
configuration.c Outdated Show resolved Hide resolved
input/drivers/sdl_input.c Outdated Show resolved Hide resolved
input/drivers/sdl_input.c Outdated Show resolved Hide resolved
input/input_defines.h Outdated Show resolved Hide resolved
input/drivers/udev_input.c Outdated Show resolved Hide resolved
input/drivers/udev_input.c Outdated Show resolved Hide resolved
input/drivers/sdl_input.c Outdated Show resolved Hide resolved
menu/menu_setting.c Outdated Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What did I get wrong when I wrote this documentation?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That the axes aren't really mapped to any specific direction, they are kinda arbitrary.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After the axis remapping is implemented this might be true.

@oshaboy oshaboy marked this pull request as draft January 16, 2025 03:18
@oshaboy oshaboy marked this pull request as ready for review January 19, 2025 23:56
@oshaboy
Copy link
Author

oshaboy commented Jan 19, 2025

Yalla it's done. Kirby Tilt and Tumble works flawlessly now.

@oshaboy oshaboy marked this pull request as draft January 20, 2025 00:13
@oshaboy
Copy link
Author

oshaboy commented Jan 20, 2025

Actually there's still a design problem

@oshaboy oshaboy marked this pull request as ready for review January 20, 2025 02:41
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 this pull request may close these issues.

7 participants