Coder Social home page Coder Social logo

evdevhook's Introduction

evdevhook - DSU server for motion from evdev compatible joysticks

Please see evdevhook2 for successor to this project.

This project uses evdev input system Linux provides to support motion input by devices whose drivers have exposed such functionality.

Its main goal is to reduce amount of motion providers, giving a unified solution for all devices whose drivers expose motion in standardized way.

Support status for devices

Below is the list of devices with their support status.

Please note that ability to support device does not really depend on us and it's up to driver to provide correct motion interface.

Supported out-of-box (example config provided)

  • hid-nintendo - Nintendo Switch's JoyCons and ProCon (Note: not in mainline kernel yet, needs dkms module as of now)
  • hid-sony - DualShock 3 and 4 controllers (DS3 lacks gyro)
  • hid-playstation - DualSense controller (Note: not in mainline kernel yet as of now)

Supported, but not tested (no example config, help very welcome)

  • hid-udraw-ps3, wacom_wac - THQ PS3 uDraw, Wacom 27QHD tablets (nobody was high enough to try and control games with motion from those devices yet, they also lack gyros)

Not supported (notably)

  • hid-wiimote - WiiMote's driver does not expose correctly marked device that can be used directly (check out linuxmotehook)

Dependences

This project depends on few common software packages. The following command can install build-time requirements on Ubuntu and derived distributives:

sudo apt install libevdev-dev libudev-dev libglibmm-2.4-dev nlohmann-json3-dev zlib1g-dev

You'll also need CMake and a C++ compiler (like gcc), but you probably already have them.

Usage

Basic usage is as follows:

evdevhook [config file]

Check out config_templates for useful configs and information on how to create your own if needed. Run without arguments to see what motion devices are connected to your system.

evdevhook's People

Contributors

qurious-pixel avatar v1993 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

evdevhook's Issues

Dolphin (probably) being an idiot

I'm not sure if it's on evdev, of on dolphin, but, it works just fine, even detects motion correctly, right up until I start literally any thing. Then it just stops working all together.

Does `evdevhook` need `joycond` to work?

Thank you for creating this wonderful application. I am using evdevhook with linux 5.16.12-arch1-1 and I am having some problems like disconnecting from my computer. I found that if I enable joycond it will disconnect after 15 minutes but if I just use evdevhook it will disconnect after 2 or 3 minutes so I was wondering if it is necessary to use joycond.

No Motion Controls on Switch Pro Controller

I've tried Ryujinx and Yuzu with evdevhook running:

./evdevhook ../config_templates/nintendo.json

Found motion device: Nintendo Switch Pro Controller IMU
Connecting... done!

But no motion controls work. I know they are functional because they work in Steam, and they work with joycond-cemuhook-git. It's just that joycond-cemuhook-git causes Steam to no longer be able to connect to the controller over BT, so I want to be able to use evdevhook instead.

DualSense support

Hey, thanks for this awesome piece of work!

What does the following mean?
hid-playstation - DualSense controller (Note: not in mainline kernel yet as of now)

Using Debian bookworm with kernel 5.16. The DualSense controller is working without problems, generally. I suppose DualSense support has been included in kernel 5.16, is this right? But when trying to use evdevhook:

$ ./evdevhook
Connected motion devices:
$

...shows no motion devices.

$ ./evdevhook ./config_templates/playstation.json
...stays here forever and does nothing.

After a little web searching I wondered if I should modprobe the playstation module (although the controller is working fine already), but I got this:

$ sudo modprobe hid-playstation
modprobe: FATAL: Module hid-playstation not found in directory /lib/modules/5.16.0-1-amd64

Any ideas?

DualSense mapping is wrong

Sadly, it seems that DualSense uses mapping that differs from DualShock. First gyro axis is inverted and accelerometer axles are mixed up.

Sadly, original reporter never contacted me again to fix up accelerometer issues, so I'm leaving this as a reminder to fix it.

DS3: Gyro not found?

Why do i get this? evtest gets motions data.

Found motion device: Sony PLAYSTATION(R)3 Controller Motion Sensors
Connecting...Gyro not found, only limited functional will be available
Accurate timestamping of motion unavailable, using fallback
 done!

Support for few devices of the same type

I don't have few devices of the same type and don't know how to support those (do their reported names differ?). If someone have two or more pairs of joycons, please write here. Your help will be greatly appreciated!

Doesn't work on Citra (3DS Emu)

Evdevhook works on Cemu and on the PadTest program (https://cemuhook.sshnuke.net/padudpserver.html), but it doesn't on Citra for some reason, the address and the port are correctly set.

It's easily reproducible, launch the evdevhook UDP server, open the Citra config menu, go to "Controls" settings, click on "Motion/Touch", set "CemuhookUDP" as the motion provider, test the config.

image

Some debug/troubleshooting output would be helpful

Verifying the solution to #3 took much more time than it should have, since evdevhook silently failed instead of telling me that it couldn't find a motion control device. After lots of trial and error, I figured out that my udev rules had correctly set up both of the DualSense's js devices and its main ev device, but not the motion control ev device that evdevhook needed. (The behavior was mystifying at first, since the main controls were working just fine in every game & utility I tested.)

I think evdevhook could use some diagnostic tooling. A mode (maybe a command line option?) for enumerating detected devices and printing received input would be great, but even just printing error messages when something is wrong would be helpful.

Compiling Errors

Hi, I am running into errors when attempting to actually build evdevhook.
I am running Ubuntu Bionic 18.04 L4T from switchroot on a nintendo switch.

All dependencies, except for nlohmann, were available through my native repos. nlohmann was added in via vcpkg to make the required version number, and the vcpkg toolchain was used to make the build files.

Build files were made without problem, but I am running into make errors immediately when compiling

here is a verbose dump

/usr/bin/cmake -S/home/phononenom/evdevhook -B/home/phononenom/evdevhook/build --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /home/phononenom/evdevhook/build/CMakeFiles /home/phononenom/evdevhook/build//CMakeFiles/progress.marks
make  -f CMakeFiles/Makefile2 all
make[1]: Entering directory '/home/phononenom/evdevhook/build'
make  -f CMakeFiles/evdevhook.dir/build.make CMakeFiles/evdevhook.dir/depend
make[2]: Entering directory '/home/phononenom/evdevhook/build'
cd /home/phononenom/evdevhook/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/phononenom/evdevhook /home/phononenom/evdevhook /home/phononenom/evdevhook/build /home/phononenom/evdevhook/build /home/phononenom/evdevhook/build/CMakeFiles/evdevhook.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/home/phononenom/evdevhook/build'
make  -f CMakeFiles/evdevhook.dir/build.make CMakeFiles/evdevhook.dir/build
make[2]: Entering directory '/home/phononenom/evdevhook/build'
[ 25%] Building CXX object CMakeFiles/evdevhook.dir/src/main.cpp.o
/usr/bin/c++ -DJSON_DIAGNOSTICS=0 -DJSON_USE_IMPLICIT_CONVERSIONS=1 -isystem /usr/include/libevdev-1.0 -isystem /usr/include/glibmm-2.4 -isystem /usr/lib/aarch64-linux-gnu/glibmm-2.4/include -isystem /usr/include/glib-2.0 -isystem /usr/lib/aarch64-linux-gnu/glib-2.0/include -isystem /usr/include/sigc++-2.0 -isystem /usr/lib/aarch64-linux-gnu/sigc++-2.0/include -isystem /usr/include/giomm-2.4 -isystem /usr/lib/aarch64-linux-gnu/giomm-2.4/include -isystem /home/phononenom/vcpkg/installed/arm64-linux/include -pthread -std=gnu++1z -MD -MT CMakeFiles/evdevhook.dir/src/main.cpp.o -MF CMakeFiles/evdevhook.dir/src/main.cpp.o.d -o CMakeFiles/evdevhook.dir/src/main.cpp.o -c /home/phononenom/evdevhook/src/main.cpp
/home/phononenom/evdevhook/src/main.cpp: In function ‘void {anonymous}::LoadConfig(std::istream&)’:
/home/phononenom/evdevhook/src/main.cpp:158:25: error: ‘class std::unordered_map<std::__cxx11::basic_string<char>, unsigned char>’ has no member named ‘contains’
    if (g_name_to_devidx.contains(name)) {
                         ^~~~~~~~
CMakeFiles/evdevhook.dir/build.make:75: recipe for target 'CMakeFiles/evdevhook.dir/src/main.cpp.o' failed
make[2]: *** [CMakeFiles/evdevhook.dir/src/main.cpp.o] Error 1
make[2]: Leaving directory '/home/phononenom/evdevhook/build'
CMakeFiles/Makefile2:82: recipe for target 'CMakeFiles/evdevhook.dir/all' failed
make[1]: *** [CMakeFiles/evdevhook.dir/all] Error 2
make[1]: Leaving directory '/home/phononenom/evdevhook/build'
Makefile:155: recipe for target 'all' failed
make: *** [all] Error 2

errors

Support for SteamDeck

Hi

Would it be possible to make this package as Flatpak or AppImage to make it accessible on SteamDeck without Dev Mode and make configuration for SteamDeck Controller? I could provide logs or try to make config myself but right now I cannot compile evdevhook because SteamOS is missing dependencies for it and at least for now I couldn't find a way to unlock the filesystem.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.