| Summary: | joysticks without any buttons do not get recognized as such | ||
|---|---|---|---|
| Product: | SDL | Reporter: | zouhair.mahboubi |
| Component: | joystick | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | gabomdq |
| Version: | 2.0.1 | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Attachments: |
output of udevadm info for js1
output of udevadm info for js0 |
||
Do you still get this issue with udev enabled? (In reply to Gabriel Jacobo from comment #1) > Do you still get this issue with udev enabled? Can you elaborate on what you mean by udev enabled? I do have udev rules to make sure the joystick properties are properly set (i.e. readable with user and not root). But even with those I still needed the patch [makes sense to me, the if statement requires both a key AND an axis to consider it a joystick, and the rudder pedals don't have any buttons so it would never be recognized as such]) I mean compile SDL with udev support built in. On Ubuntu/Debian you make sure that support is available with:
sudo apt-get libudev-dev
Then configure;make;sudo make install
The IsJoystick function now trusts what comes from udev without checking it, so there's a good chance that if udev thinks your device is a joystick, it will be treated as such by SDL.
Also, this will only work with the HG version of SDL (not the precompiled 2.0.1 release).
just recompiled 2.0.1 and made sure I had libudev ( /usr/local/include/SDL2:/* #undef HAVE_LIBUDEV_H */) libsdl did not recognize the joystick without buttons (even when I put it my patch) I reverted back to the old build (left it in a separate folder). Except now I am worried that if I try to run configure again it'll use libudev. How can I make sure it does not? Use SDL from HG! *Not* the 2.0.1 release. You can use udevadm to verify that the system reports your joystick as such (look for the ID_JOYSTICK string). To disable udev entirely you configure with: configure --disable-libudev Created attachment 1423 [details]
output of udevadm info for js1
Created attachment 1424 [details]
output of udevadm info for js0
Alright, I checked out this Changeset: 7974 (5d12bfc720e1) Added a few notes from Ryan's email to README-linux.txt User: Gabriel Jacobo <gabomdq@gmail.com> Date: 2013-11-12 11:31:13 -0300 (7 hours) Parent: 7973 (96f2f61be1c6) Linux README explaining build vs runtime, and build deps for Ubuntu 13.04 Here is a snippet from the config log configure:20806: checking libudev.h usability configure:20806: gcc -c -g -O2 -Iinclude -I/home/zouhair/SDL2.0/include -Iinclude -I/home/zouhair/SDL2.0/include conftest.c >&5 configure:20806: $? = 0 configure:20806: result: yes configure:20806: checking libudev.h presence configure:20806: gcc -E -Iinclude -I/home/zouhair/SDL2.0/include conftest.c configure:20806: $? = 0 configure:20806: result: yes configure:20806: checking for libudev.h configure:20806: result: yes Still same problem; all my other devices show up except for the rudders. I've included the output of: udevadm info -a -p $(udevadm info -q path -n /dev/input/js0) > stick.txt udevadm info -a -p $(udevadm info -q path -n /dev/input/js1) > rudders.txt Try formatting the output like below...if ID_INPUT_JOYSTICK=1 is present, SDL will pick up the joystick. udevadm info --query=all --name=input/js0 P: /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2:1.0/input/input16/js0 N: input/js0 S: input/by-id/usb-©Microsoft_Xbox_360_Wireless_Receiver_for_Windows_FF3FFD30-joystick S: input/by-path/pci-0000:00:1a.0-usb-0:1.2:1.0-joystick E: DEVLINKS=/dev/input/by-id/usb-©Microsoft_Xbox_360_Wireless_Receiver_for_Windows_FF3FFD30-joystick /dev/input/by-path/pci-0000:00:1a.0-usb-0:1.2:1.0-joystick E: DEVNAME=/dev/input/js0 E: DEVPATH=/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2:1.0/input/input16/js0 E: ID_BUS=usb E: ID_FOR_SEAT=input-pci-0000_00_1a_0-usb-0_1_2_1_0 E: ID_INPUT=1 E: ID_INPUT_JOYSTICK=1 E: ID_MODEL=Xbox_360_Wireless_Receiver_for_Windows E: ID_MODEL_ENC=Xbox\x20360\x20Wireless\x20Receiver\x20for\x20Windows E: ID_MODEL_ID=0719 E: ID_PATH=pci-0000:00:1a.0-usb-0:1.2:1.0 E: ID_PATH_TAG=pci-0000_00_1a_0-usb-0_1_2_1_0 E: ID_REVISION=0100 E: ID_SERIAL=©Microsoft_Xbox_360_Wireless_Receiver_for_Windows_FF3FFD30 E: ID_SERIAL_SHORT=FF3FFD30 E: ID_TYPE=generic E: ID_USB_DRIVER=xpad E: ID_USB_INTERFACES=:ff5d81:ff5d82: E: ID_USB_INTERFACE_NUM=00 E: ID_VENDOR=©Microsoft E: ID_VENDOR_ENC=©Microsoft E: ID_VENDOR_ID=045e E: MAJOR=13 E: MINOR=0 E: SUBSYSTEM=input E: TAGS=:seat:uaccess: E: USEC_INITIALIZED=834746 looks like the Saitek Rudder pedals have ID_INPUT but no ID_INPUT_JOYSTICK.
I should point out that jstest-gtk does detect just fine.
Also I have this in my /etc/udev/rules.d/:
# Saitek Pro Flight Rudder Pedals
KERNEL=="event*", ATTRS{idProduct}=="0763", ATTRS{idVendor}=="06a3", MODE="0666"
KERNEL=="event*", ATTRS{idProduct}=="0764", ATTRS{idVendor}=="06a3", MODE="0666"
$udevadm info --query=all --name=input/js1
P: /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.5/1-1.5:1.0/input/input6/js1
N: input/js1
E: DEVNAME=/dev/input/js1
E: DEVPATH=/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.5/1-1.5:1.0/input/input6/js1
E: ID_BUS=usb
E: ID_INPUT=1
E: ID_MODEL=Saitek_Pro_Flight_Combat_Rudder_Pedals
E: ID_MODEL_ENC=Saitek\x20Pro\x20Flight\x20Combat\x20Rudder\x20Pedals
E: ID_MODEL_ID=0764
E: ID_PATH=pci-0000:00:1a.0-usb-0:1.5:1.0
E: ID_PATH_TAG=pci-0000_00_1a_0-usb-0_1_5_1_0
E: ID_REVISION=0201
E: ID_SERIAL=Saitek_Saitek_Pro_Flight_Combat_Rudder_Pedals
E: ID_TYPE=hid
E: ID_USB_DRIVER=usbhid
E: ID_USB_INTERFACES=:030000:
E: ID_USB_INTERFACE_NUM=00
E: ID_VENDOR=Saitek
E: ID_VENDOR_ENC=Saitek
E: ID_VENDOR_ID=06a3
E: MAJOR=13
E: MINOR=1
E: SUBSYSTEM=input
E: UDEV_LOG=3
E: USEC_INITIALIZED=9070173
So, the fix for this appears to be a udev rule to add the env variable ID_INPUT_JOYSTICK? Try with...
KERNEL=="event*", ATTRS{idProduct}=="0763", ATTRS{idVendor}=="06a3", MODE="0666", ENV{ID_INPUT_JOYSTICK}="1"
KERNEL=="event*", ATTRS{idProduct}=="0764", ATTRS{idVendor}=="06a3", MODE="0666", ENV{ID_INPUT_JOYSTICK}="1"
Let me know if this worked, I'd like to add a few notes to the README-linux.txt file if this is indeed the correct fix. Hey, `udevadm info --query=all --name=input/js1` now shows ID_INPUT_JOYSTICK=1 as per dev-rule (Initially it did not work but after `sudo udevadm trigger`) However, it actually broke my test program (I had a hard coded number of maximum joysticks). So I fell back to the testjoystick.c in the source tree. This is what I get when I compile it against 2.0.1 (without libudev and with my patch): INFO: There are 4 joysticks attached INFO: Joystick 0: Thustmaster Joystick - HOTAS Warthog INFO: axes: 2 INFO: balls: 0 INFO: hats: 1 INFO: buttons: 19 INFO: instance id: 0 INFO: guid: 030000004f0400000204000011010000 INFO: Joystick 1: Saitek Saitek Pro Flight Combat Rudder Pedals INFO: axes: 3 INFO: balls: 0 INFO: hats: 0 INFO: buttons: 0 INFO: instance id: 1 etc... When I do ./testjoystick 1 the rudder pedals work fine. And my test program as well as my end user application work just fine. Now if I compile testjoystick with the head of SDL on HG and with libudev; this is what I get as an output: INFO: There are 25 joysticks attached INFO: Joystick 0: Power Button INFO: axes: 0 INFO: balls: 0 INFO: hats: 0 INFO: buttons: 0 INFO: instance id: 0 INFO: guid: 19000000506f77657220427574746f00 INFO: Joystick 1: Video Bus INFO: axes: 0 INFO: balls: 0 INFO: hats: 0 INFO: buttons: 0 INFO: instance id: 1 INFO: guid: 19000000566964656f20427573000000 INFO: Joystick 2: Power Button ..... INFO: Joystick 8: Saitek Saitek Pro Flight Combat Rudder Pedals INFO: axes: 3 INFO: balls: 0 INFO: hats: 0 INFO: buttons: 0 INFO: instance id: 8 etc.... using ./testjoystick 8 shows working pedals; and although my test application is broken (fixed it now) my end user application is fine. Anyway, things are working again; but it's odd that I have "25" joysticks now. Could that be because of the udev rule? It looks like something in your udev rules is adding ID_INPUT_JOYSTICK to everything! And given the code in HG now trusts completely what comes from udev, you get that scenario where every device is a joystick. This is what's in my udev/rules.d/ related to INPUT_JOYSTICK
I thought the ATTRS with idProduct and idVendor would filter to only apply
to the rudder pedals?
# Saitek Pro Flight Rudder Pedals
KERNEL=="event*", ATTRS{idProduct}=="0763", ATTRS{idVendor}=="06a3",
MODE="0666", ENV{ID_INPUT_JOYSTICK}="1"
KERNEL=="event*", ATTRS{idProduct}=="0764", ATTRS{idVendor}=="06a3",
MODE="0666", ENV{ID_INPUT_JOYSTICK}="1"
I've added a few troubleshooting notes here: https://hg.libsdl.org/SDL/rev/3122e7af0bf5 That's as much as we can do on this, I think. |
SAITEK rudder pedals are such an example. The following patch seems to fix that --- a/src/joystick/linux/SDL_sysjoystick.c Fri Feb 22 10:44:44 2013 -0300 +++ b/src/joystick/linux/SDL_sysjoystick.c Fri Oct 25 15:43:42 2013 -0700 @@ -209,7 +209,7 @@ return (0); } - if (!(test_bit(EV_KEY, evbit) && test_bit(EV_ABS, evbit) && + if (!((test_bit(EV_KEY, evbit) || test_bit(EV_ABS, evbit)) && test_bit(ABS_X, absbit) && test_bit(ABS_Y, absbit))) { return 0; }