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 28 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.
  • 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

and apply this patch either with git apply Makefile.common.patch or patch -p1 < Makefile.common.patch

diff --git a/Makefile.common b/Makefile.common
index 4a872356bd..4212c5c6a4 100644
--- a/Makefile.common
+++ b/Makefile.common
@@ -1329,6 +1329,7 @@ ifeq ($(HAVE_DBUS), 1)
 endif
 
 ifeq ($(HAVE_UDEV), 1)
+   DEFINES += -DUDEV_TOUCH_SUPPORT
    DEF_FLAGS += $(UDEV_CFLAGS)
    LIBS += $(UDEV_LIBS)
    OBJ += input/drivers/udev_input.o \

@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 Apr 22, 2024

So someone on discord told me I should open the pull request at this state without the menu options. And then either future me or someone who knows their way around the menu code can implement it.

Right now it's functional in both udev and SDL but the axes aren't where the software expects them. So in Kirby: Tilt N Tumble for example requires you to hold the dualshock horizontally when the game boots and tilt backwards to move forwards.

However it does work and there are even menu options to adjust sensitivity and select which sensor device you want to use so I think it's adequate.

@oshaboy oshaboy marked this pull request as ready for review April 22, 2024 21:47
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.

None yet

4 participants