Udoo Neo Full not detecting any joysticks with SDL2 / UDOObuntu 2.1.2

Discussion in 'UDOO NEO' started by oxoocoffee, Feb 24, 2017.

Tags:
  1. oxoocoffee

    oxoocoffee Member

    Joined:
    Sep 13, 2016
    Messages:
    57
    Likes Received:
    6
    I have problem with udoo neo board detecting USB joysticks. I am using simple SDL2 test app that I have build and running minimal image UDOObuntu 2.1.2 with latest updates.

    Linux udooneo 3.14.56-udooneo-02048-geaaf16e #2 SMP PREEMPT Tue Feb 21 11:37:50 UTC 2017 armv7l armv7l armv7l GNU/Linux

    Here is sample sdl2 source to test it.

    Code:
    #include <SDL.h>
    
    int main()
    {
      SDL_Init(SDL_INIT_JOYSTICK);
    
      atexit(SDL_Quit);
    
      int num_joysticks = SDL_NumJoysticks();
    
      printf("Found: %d\n", num_joysticks);
    
      for(int i = 0; i < num_joysticks; ++i)
      {
        SDL_Joystick* js = SDL_JoystickOpen(i);
        if (js)
        {
          SDL_JoystickGUID guid = SDL_JoystickGetGUID(js);
          char guid_str[1024];
          SDL_JoystickGetGUIDString(guid, guid_str, sizeof(guid_str));
          const char* name = SDL_JoystickName(js);
    
          int num_axes = SDL_JoystickNumAxes(js);
          int num_buttons = SDL_JoystickNumButtons(js);
          int num_hats = SDL_JoystickNumHats(js);
          int num_balls = SDL_JoystickNumBalls(js);
    
          printf("%s \"%s\" axes:%d buttons:%d hats:%d balls:%d\n",
                 guid_str, name,
                 num_axes, num_buttons, num_hats, num_balls);
    
          SDL_JoystickClose(js);
        }
      }
      return 0;
    }
    Here is dmesg for one of the joysticks

    [ 361.994911] usb 1-1: new low-speed USB device number 2 using ci_hdrc
    [ 362.315421] usbcore: registered new interface driver usbhid
    [ 362.315444] usbhid: USB HID core driver
    [ 362.363228] input: Logitech Logitech Cordless RumblePad 2 as /devices/soc0/soc.0/2100000.aips-bus/2184200.usb/ci_hdrc.1/usb1/1-1/1-1:1.0/0003:046D:C219.0001/input/input4
    [ 362.363665] logitech 0003:046D:C219.0001: input: USB HID v1.10 Gamepad [Logitech Logitech Cordless RumblePad 2] on usb-ci_hdrc.1-1/input0
    [ 362.363684] hid_logitech: Force feedback for Logitech force feedback devices by Johann Deneux <johann.deneux@it.uu.se>

    Here is lsusb

    Bus 001 Device 002: ID 046d:c219 Logitech, Inc. Cordless RumblePad 2

    I did try to upgrade from SDL2.0.3 to 2.0.5 that did not fixed it. Anyone got joystick working on on this image and board?
     
  2. jas-mx

    jas-mx Active Member

    Joined:
    Dec 31, 2013
    Messages:
    407
    Likes Received:
    118
    You should check if a joystick device is present eg /dev/input/js0. If not try installing the 'joystick' package

    Code:
    sudo apt-get install joystick
    
     
    Last edited: Feb 24, 2017
  3. oxoocoffee

    oxoocoffee Member

    Joined:
    Sep 13, 2016
    Messages:
    57
    Likes Received:
    6
    I did not mentioned in my initial port that I did install joystick. But thenk you for trying to help out.
    But also I do not see jsX in /dev/input/ after I plug any joystick. Here is my current list

    udooer@udooneo:/dev/input$ ls -l
    total 0
    drwxr-xr-x 2 root root 60 Feb 24 14:44 by-id
    drwxr-xr-x 2 root root 80 Feb 24 14:44 by-path
    crw-r----- 1 root root 13, 64 Dec 31 1969 event0
    crw-r----- 1 root root 13, 65 Feb 24 14:16 event1
    crw-r----- 1 root root 13, 66 Feb 24 14:16 event2
    crw-r----- 1 root root 13, 67 Feb 24 14:16 event3
    crw-r----- 1 root root 13, 68 Feb 24 14:44 event4
    crw-r----- 1 root root 13, 63 Dec 31 1969 mice

    Any other ideas?
     
  4. jas-mx

    jas-mx Active Member

    Joined:
    Dec 31, 2013
    Messages:
    407
    Likes Received:
    118
    Is CONFIG_INPUT_JOYDEV set in the kernel config?

    Also whats in /dev/input/by-id and /dev/input/by-path ?
     
  5. oxoocoffee

    oxoocoffee Member

    Joined:
    Sep 13, 2016
    Messages:
    57
    Likes Received:
    6
    On fresh reboot without plugging in joystick I got this

    udooer@udooneo:/dev/input$ tree
    .
    |-- by-path
    | `-- platform-20cc000.snvs-pwrkey-event -> ../event0
    |-- event0
    |-- event1
    |-- event2
    |-- event3
    `-- mice

    After plugging joystick I get this

    udooer@udooneo:/dev/input$ tree
    .
    |-- by-id
    | `-- usb-Logitech_Logitech_Cordless_RumblePad_2-event-joystick -> ../event4
    |-- by-path
    | |-- platform-20cc000.snvs-pwrkey-event -> ../event0
    | `-- platform-ci_hdrc.1-usb-0:1:1.0-event-joystick -> ../event4
    |-- event0
    |-- event1
    |-- event2
    |-- event3
    |-- event4
    `-- mice

    I did not build the kernel. So I guess this is question to maintainers here about CONFIG_INPUT_JOYDEV. I am using
    UDOObuntu 2.1.2 Minimal (14.04 LTS)
     
  6. waltervl

    waltervl UDOOer

    Joined:
    Dec 12, 2015
    Messages:
    2,314
    Likes Received:
    580
    You can check it yourself in the file /boot/config -'uname -r` (command: cat /boot/config-`uname -r`| grep 'JOYSTICK' )
    For the normal Udoobuntu2 the answer is: # CONFIG_INPUT_JOYDEV is not set
    I suspect for the minimal Udoobuntu the answer will be no different.
     
  7. oxoocoffee

    oxoocoffee Member

    Joined:
    Sep 13, 2016
    Messages:
    57
    Likes Received:
    6
    Same on minimal

    udooer@udooneo:~$ cat /boot/config-`uname -r` | grep JOYSTICK
    # CONFIG_INPUT_JOYSTICK is not set
     
  8. oxoocoffee

    oxoocoffee Member

    Joined:
    Sep 13, 2016
    Messages:
    57
    Likes Received:
    6
    Does anyone know if latest kernel update supports it? Or anyone figured out how to build this module and add manually?
     
  9. oxoocoffee

    oxoocoffee Member

    Joined:
    Sep 13, 2016
    Messages:
    57
    Likes Received:
    6
    Ok so I cloned repo and followed instruction listed at https://www.udoo.org/docs-neo/Advanced_Topics/Compile_Linux_Kernel.html
    I got joydev.ko that now I placed to my sd card (oficial minimal image with latest updates) to /lib/modules/3.14.56-udooneo-02054-gc460cad/kernel/drivers/input/ followed with

    # depmod -a -v
    # modprobe joydev

    $ lsmod shows
    udooer@udooneo:/usr/local/lib$ lsmod
    Module Size Used by
    joydev 8531 0
    ......

    After plussing in joystick that work on my ubuntu desktop dmesg shows this on uddoNeo

    [ 435.787858] usb 1-1: new low-speed USB device number 2 using ci_hdrc
    [ 436.108437] usbcore: registered new interface driver usbhid
    [ 436.108459] usbhid: USB HID core driver
    [ 436.156282] input: Logitech Logitech Cordless RumblePad 2 as /devices/soc0/soc.0/2100000.aips-bus/2184200.usb/ci_hdrc.1/usb1/1-1/1-1:1.0/0003:046D:C219.0001/input/input4
    [ 436.157099] logitech 0003:046D:C219.0001: input: USB HID v1.10 Gamepad [Logitech Logitech Cordless RumblePad 2] on usb-ci_hdrc.1-1/input0
    [ 436.157118] hid_logitech: Force feedback for Logitech force feedback devices by Johann Deneux <johann.deneux@it.uu.se>

    On desktop dunning Ubuntu 16.04 I see this

    [604832.836985] usb 1-1.3: new low-speed USB device number 9 using ehci-pci
    [604832.996585] usb 1-1.3: New USB device found, idVendor=046d, idProduct=c219
    [604832.996592] usb 1-1.3: New USB device strings: Mfr=3, Product=1, SerialNumber=0
    [604832.996596] usb 1-1.3: Product: Logitech Cordless RumblePad 2
    [604832.996600] usb 1-1.3: Manufacturer: Logitech
    [604833.050067] input: Logitech Logitech Cordless RumblePad 2 as /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.3/1-1.3:1.0/0003:046D:C219.0006/input/input22
    [604833.050460] logitech 0003:046D:C219.0006: input,hidraw4: USB HID v1.10 Gamepad [Logitech Logitech Cordless RumblePad 2] on usb-0000:00:1a.0-1.3/input0
    [604833.050467] hid_logitech: Force feedback for Logitech force feedback devices by Johann Deneux <johann.deneux@it.uu.se>

    Now when when I run my SDL application that works on desktop and been cross compiled, application starts but it can't find joystick.

    Anyone seen this or have idea what is doing on?
     
  10. jas-mx

    jas-mx Active Member

    Joined:
    Dec 31, 2013
    Messages:
    407
    Likes Received:
    118
    I suggest you check if the following is created (I expect this is created on your desktop):

    Code:
    /dev/input/js0
    
     
  11. oxoocoffee

    oxoocoffee Member

    Joined:
    Sep 13, 2016
    Messages:
    57
    Likes Received:
    6
    Yes I do have it. Here is my full list

    drwxr-xr-x 2 root root 80 Dec 31 1969 by-id
    drwxr-xr-x 2 root root 100 Dec 31 1969 by-path
    crw-r----- 1 root root 13, 64 Dec 31 1969 event0
    crw------- 1 root root 13, 65 Dec 31 1969 event1
    crw------- 1 root root 13, 66 Dec 31 1969 event2
    crw------- 1 root root 13, 67 Dec 31 1969 event3
    crw-r----- 1 root root 13, 68 Dec 31 1969 event4
    crw-r--r-- 1 root root 13, 0 Jul 14 12:25 js0
    crw-r--r-- 1 root root 13, 1 Jul 14 12:25 js1
    crw-r--r-- 1 root root 13, 2 Jul 14 12:25 js2
    crw-r--r-- 1 root root 13, 3 Dec 31 1969 js3
    crw-r----- 1 root root 13, 63 Dec 31 1969 mice
     
  12. jas-mx

    jas-mx Active Member

    Joined:
    Dec 31, 2013
    Messages:
    407
    Likes Received:
    118
    Test your joystick is working by (need to determine the correct device jsX) :

    Code:
    sudo jstest --event /dev/input/js0
    
     
  13. oxoocoffee

    oxoocoffee Member

    Joined:
    Sep 13, 2016
    Messages:
    57
    Likes Received:
    6
    Thank you for such a swift response :)

    I get this output from above command if my USB joystick is plugged in to uddo board or now

    udooer@udooneo:/dev/input$ sudo jstest --event /dev/input/js0
    [sudo] password for udooer:
    Driver version is 2.1.0.
    Joystick (FreescaleAccelerometer) has 3 axes (X, Y, Z)
    and 0 buttons ().
    Testing ... (interrupt to exit)
    Event: type 130, time 1525630, number 0, value 0
    Event: type 130, time 1525640, number 1, value 0
    Event: type 130, time 1525640, number 2, value 0

    If my joystick is plugged in and jstest restarted pressing any buttons does not print anything to screen.

    But I did repeat this for js0, js1, js2 abd js3

    Strangely enough js3 works

    Now I noticed that removing physical joystick removes js3 but js0-2 always stays there? Any ideas why? Or how can this be fixed?

    EDIT:
    Also I see this with out any USB devices plugged in

    udooer@udooneo:~$ dmesg | grep js
    udooer@udooneo:~$ lsusb
    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
     
  14. oxoocoffee

    oxoocoffee Member

    Joined:
    Sep 13, 2016
    Messages:
    57
    Likes Received:
    6
    Also noticed by removing joydev module all j0-2 are removed. When doing modprobe -v joydev all three are added back
     
  15. jas-mx

    jas-mx Active Member

    Joined:
    Dec 31, 2013
    Messages:
    407
    Likes Received:
    118
    Looks like joydev is adding the on board accelerometer/gryoscope (FXOS8700CQ/FXAS21002) as a valid devices hence js0.

    I would try jtest-sdl to see if your joystick can be found.
     
  16. oxoocoffee

    oxoocoffee Member

    Joined:
    Sep 13, 2016
    Messages:
    57
    Likes Received:
    6
    Ok I build it and when running I get this

    udooer@udooneo:~/jstest-sdl$ ./jstest-sdl --list
    Unable to init SDL: Failed to connect to the Mir Server

    udooer@udooneo:~/jstest-sdl$ uname -a
    Linux udooneo 3.14.56-udooneo-02054-gc460cad #4 SMP PREEMPT Thu Jun 15 13:32:59 UTC 2017 armv7l armv7l armv7l GNU/Linux
     
  17. jas-mx

    jas-mx Active Member

    Joined:
    Dec 31, 2013
    Messages:
    407
    Likes Received:
    118
    Your SDL is configured to run with Mir which won't work on the Neo. You would need to rebuild SDL2 from sources with something like the following options to disable many of the video divers:

    Code:
    ../configure --disable-pulseaudio --disable-esd --disable-video-mir --disable-video-wayland --disable-video-x11 --disable-video-opengl
    
    Alternatively you can try forcing the video driver:

    Code:
    SDL_VIDEODRIVER=fbcon SDL_FBDEV=/dev/fb0 ./jstest-sdl --list
    
     
  18. oxoocoffee

    oxoocoffee Member

    Joined:
    Sep 13, 2016
    Messages:
    57
    Likes Received:
    6
    When you say my SDL is configured, I want to adde that it is SDL installed with apt-get. So if anything this is issue with deb package provided. But I will try to rebuild SDL2 later after trying SDL_VIDEODRIVER first :)
     
  19. oxoocoffee

    oxoocoffee Member

    Joined:
    Sep 13, 2016
    Messages:
    57
    Likes Received:
    6
    Ok I will try to build SDL. Forcing frame buffer did not work

    udooer@udooneo:~/jstest-sdl$ SDL_VIDEODRIVER=fbcon SDL_FBDEV=/dev/fb0 ./jstest-sdl --list
    Unable to init SDL: fbcon not available
    udooer@udooneo:~/jstest-sdl$ SDL_VIDEODRIVER=directfb SDL_FBDEV=/dev/fb0 ./jstest-sdl --list
    Unable to init SDL: directfb not available
    EDIT: I do see udooer@udooneo:/sys/devices/virtual/graphics/fbcon/

    -rw-r--r-- 1 root root 4096 Jul 15 15:20 cursor_blink
    drwxr-xr-x 2 root root 0 Jul 15 15:20 power
    -rw-r--r-- 1 root root 4096 Jul 15 15:20 rotate
    --w------- 1 root root 4096 Jul 15 15:20 rotate_all
    lrwxrwxrwx 1 root root 0 Jul 15 15:20 subsystem -> ../../../../class/graphics
    -rw-r--r-- 1 root root 4096 Jul 15 15:20 uevent
     
    Last edited: Jul 15, 2017
  20. oxoocoffee

    oxoocoffee Member

    Joined:
    Sep 13, 2016
    Messages:
    57
    Likes Received:
    6
    So here is configured output building SDL2-2.0.5. Build in progress

    SDL2 Configure Summary:
    Building Shared Libraries
    Building Static Libraries
    Enabled modules : atomic audio video render events joystick haptic power filesystem threads timers file loadso cpuinfo assembly
    Assembly Math :
    Audio drivers : disk dummy oss
    Video drivers : dummy
    Input drivers : linuxev linuxkd
    Using libudev : YES
    Using dbus : NO
    Using ime : YES
    Using ibus : NO
    Using fcitx : NO

    EDIT: After SDL2 build and install and ldconfig I did rebuild jstest-sdl and did run again

    udooer@udooneo:~/github/jstest-sdl$ ./jstest-sdl --list
    Unable to init SDL: No available video device
     
    Last edited: Jul 15, 2017

Share This Page