Logitech Buzz(tm) Controller is not recognized by SDL as a joystick or gamepad [solved]


#1

The Logitech Buzz™ Controller is not recognized by SDL as a joystick or gamepad on GNU/Linux Fedora 25 64bit. When plugging in the device, it does look like it is recognized as a proper joystick device in the kernel log:

[  122.757836] usb 3-2: USB disconnect, device number 3
[  125.101385] usb 3-2: new low-speed USB device number 4 using xhci_hcd
[  125.275730] usb 3-2: New USB device found, idVendor=054c, idProduct=0002
[  125.275735] usb 3-2: New USB device strings: Mfr=3, Product=1, SerialNumber=0
[  125.275737] usb 3-2: Product: Logitech Buzz(tm) Controller V1
[  125.275740] usb 3-2: Manufacturer: Logitech
[  125.282193] input: Logitech Logitech Buzz(tm) Controller V1 as /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/0003:054C:0002.0008/input/input24
[  125.283090] sony 0003:054C:0002.0008: input,hidraw3: USB HID v1.11 Joystick [Logitech Logitech Buzz(tm) Controller V1] on usb-0000:00:14.0-2/input0

However, with the following code I get the output “number of joysticks: 0”:

#include <SDL2/SDL.h>

int main(int argc, const char** argv) {
    printf("number of joysticks: %d\n",
        SDL_NumJoysticks());
}

The version of SDL2 I tried is 2.0.5-3.fc25 (as packaged by Fedora 25).

Can someone tell me how to find out if this a driver problem or some sort of SDL2 bug?

EDIT: TL;DR: it turned out to be a missing udev rule, see post(s) below


#2

You should init the joystick subsystem before using it with something like:

if (SDL_Init(SDL_INIT_JOYSTICK) != 0) {
    printf("Unable to initialize SDL: %s", SDL_GetError());
}

#3

Thanks, but still the printed number remains 0 using this modified code:

#include <SDL2/SDL.h>

int main(int argc, const char** argv) {
    if (SDL_Init(SDL_INIT_JOYSTICK) != 0) {
        printf("Unable to initialize SDL: %s", SDL_GetError());
    }
    printf("number of joysticks: %d\n",
        SDL_NumJoysticks());
}

#4

I’ve never actually used joysticks with SDL so I’m not able to help much more. There is a section about joystick issues in the SDL linux readme though: https://hg.libsdl.org/SDL/raw-file/8b902bfc616c/docs/README-linux.md


#5

I use the standard SDL2 as compiled by Fedora which definitely has joystick support: love2d as packaged by Fedora uses SDL2 as well and the xbox controller also works fine with it (and the logitech one doesn’t).

To make sure the device indeed works. I tried to run evtest now while pressing a button on the Logitech Buzz, and it seems to register events just fine:

$ sudo evtest
No device specified, trying to scan all of /dev/input/event*
Available devices:
/dev/input/event0:	Lid Switch
/dev/input/event1:	Sleep Button
/dev/input/event2:	Power Button
/dev/input/event3:	AT Translated Set 2 keyboard
/dev/input/event4:	Telink Wireless Receiver
/dev/input/event5:	Telink Wireless Receiver
/dev/input/event6:	SynPS/2 Synaptics TouchPad
/dev/input/event7:	Logitech Logitech Wireless Headset
/dev/input/event8:	Logitech Logitech Buzz(tm) Controller V1
/dev/input/event9:	Wacom Cintiq 21UX2 Pen
/dev/input/event10:	Wacom Cintiq 21UX2 Pad
/dev/input/event11:	Dell Dell USB Keyboard
/dev/input/event12:	USB Optical Mouse
/dev/input/event13:	TPPS/2 IBM TrackPoint
/dev/input/event14:	Video Bus
/dev/input/event15:	Video Bus
/dev/input/event16:	ThinkPad Extra Buttons
/dev/input/event17:	HDA Intel PCH Mic
/dev/input/event18:	HDA Intel PCH Dock Mic
/dev/input/event19:	HDA Intel PCH Headphone
/dev/input/event20:	HDA Intel PCH Dock Headphone
/dev/input/event21:	Integrated Camera
Select the device event number [0-21]: 8
Input driver version is 1.0.1
Input device ID: bus 0x3 vendor 0x54c product 0x2 version 0x111
Input device name: "Logitech Logitech Buzz(tm) Controller V1"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 704 (BTN_TRIGGER_HAPPY1)
    Event code 705 (BTN_TRIGGER_HAPPY2)
    Event code 706 (BTN_TRIGGER_HAPPY3)
    Event code 707 (BTN_TRIGGER_HAPPY4)
    Event code 708 (BTN_TRIGGER_HAPPY5)
    Event code 709 (BTN_TRIGGER_HAPPY6)
    Event code 710 (BTN_TRIGGER_HAPPY7)
    Event code 711 (BTN_TRIGGER_HAPPY8)
    Event code 712 (BTN_TRIGGER_HAPPY9)
    Event code 713 (BTN_TRIGGER_HAPPY10)
    Event code 714 (BTN_TRIGGER_HAPPY11)
    Event code 715 (BTN_TRIGGER_HAPPY12)
    Event code 716 (BTN_TRIGGER_HAPPY13)
    Event code 717 (BTN_TRIGGER_HAPPY14)
    Event code 718 (BTN_TRIGGER_HAPPY15)
    Event code 719 (BTN_TRIGGER_HAPPY16)
    Event code 720 (BTN_TRIGGER_HAPPY17)
    Event code 721 (BTN_TRIGGER_HAPPY18)
    Event code 722 (BTN_TRIGGER_HAPPY19)
    Event code 723 (BTN_TRIGGER_HAPPY20)
  Event type 4 (EV_MSC)
    Event code 4 (MSC_SCAN)
Properties:
Testing ... (interrupt to exit)
Event: time 1497619199.181344, type 4 (EV_MSC), code 4 (MSC_SCAN), value 9000f
Event: time 1497619199.181344, type 1 (EV_KEY), code 718 (BTN_TRIGGER_HAPPY15), value 1
Event: time 1497619199.181344, -------------- SYN_REPORT ------------
Event: time 1497619199.317336, type 4 (EV_MSC), code 4 (MSC_SCAN), value 9000f
Event: time 1497619199.317336, type 1 (EV_KEY), code 718 (BTN_TRIGGER_HAPPY15), value 0
Event: time 1497619199.317336, -------------- SYN_REPORT ------------

Does this mean that this is indeed an SDL2 bug that the device doesn’t show up as a joystick? I mean the events seem to work fine as evtest shows, and other gamepads work…

Edit: ok, actually there was just the according udev rule missing. Now it works fine, thanks for the hint with that Linux joystick README!