Using Logitech Gamepad F310 on apalis-imx8

Hi,

We started to use apalis-imx8 to run our software, in the software we use sdl2 library to get events from a gamepad controller (logitech f310).
The issue is that the gamepad is not working as I can’t see any device under /dev/input
the same usb ports are working fine for other devices (keyboard, mouse etc.)
I have libsdl2 installed, and these are the related kconfigs:

CONFIG_INPUT_JOYDEV=y
CONFIG_INPUT_EVDEV=y
CONFIG_INPUT_JOYSTICK=y
CONFIG_HID_LOGITECH=y
CONFIG_USB_HID=y
CONFIG_USB_HIDDEV=y

This is the only kernal log I get when I unplug and plug the gamepad

[ 1046.999408] usb 1-1: USB disconnect, device number 2
[ 1049.887891] usb 1-1: new full-speed USB device number 3 using xhci-hcd
[ 1050.046333] imx-hdmi sound-hdmi: snd_soc_register_card failed (-517)

Am I missing anything?

edit: I add usbutils to rin lsusb and I got this output
Bus 003 Device 010: ID 046d:c21d Logitech, Inc. F310 Gamepad [XInput Mode]

I tried to test with evtest, and jstest

evtest /dev/bus/usb/003/010

evtest: can't get version: Operation not permitted

jstest /dev/bus/usb/003/010

Driver version is 0.8.0.
jstest is not fully compatible with your kernel. Unable to retrieve button map!
Joystick (Unknown) has 2 axes and 2 buttons.
Testing ... (interrupt to exit)
Axes: X:58787079 Y:117702688 Buttons: A:off B:on fn 
jstest: error reading: Operation not permitted

thanks.

Hi, I’m the Toradex AI Assistant. I’m in early beta, and I would appreciate your feedback.
The Toradex Support team will follow up with you shortly!

Did you like my answer?

:+1: :-1:


Based on the provided context, it seems you have the necessary kernel configurations enabled for joystick and HID support. However, the gamepad is not being recognized under /dev/input. Here are a few steps you can take to troubleshoot and potentially resolve the issue:

  1. Check USB Subsystem:
    Ensure that the USB subsystem is correctly recognizing the gamepad. You can use the lsusb command to list USB devices and verify if the gamepad appears there.

    lsusb
    
  2. Check Kernel Modules:
    Verify that the necessary kernel modules are loaded. You can use the lsmod command to list loaded modules and ensure that modules like joydev, evdev, and usbhid are loaded.

    lsmod | grep -E 'joydev|evdev|usbhid'
    

    If any of these modules are not loaded, you can manually load them using modprobe:

    modprobe joydev
    modprobe evdev
    modprobe usbhid
    
  3. Check Device Nodes:
    Sometimes, the device nodes under /dev/input might not be created automatically. You can manually check and create them if necessary.

    ls -l /dev/input
    
  4. Check dmesg Logs:
    The kernel log you provided shows a USB disconnect and reconnect event but does not indicate the creation of an input device. Check the dmesg logs for any additional information that might help diagnose the issue.

    dmesg | grep -i usb
    dmesg | grep -i input
    
  5. Update Device Tree:
    Ensure that the device tree configuration for your Apalis iMX8 is correctly set up to support USB devices. Sometimes, the device tree might need adjustments to properly initialize USB ports.

  6. Test on Another System:
    To rule out hardware issues, test the Logitech F310 gamepad on another system (e.g., a PC) to ensure it is functioning correctly.

  7. Check SDL2 Configuration:
    Ensure that SDL2 is correctly configured to detect and handle gamepad input. You might need to check SDL2 documentation or forums for any specific configurations required for gamepad support.

Best regards,

Toradex AI

Hi @Hasan ,

Just a suggestion here, but I suspect that alongside the configs you enabled, you also need to enable the xpad driver (CONFIG_JOYSTICK_XPAD):

I think SDL2 auto-detects xpad supported controllers, and the controller you mentioned should be supported by the driver as can be seen here:

Best Regards,
Lucas Akira

Yes excatly, that is the issue, I didn’t enable xpad. I was about to update the ticket with the solution :smiley:

Thanks Lucas!

1 Like