Please do not post a support request without first reading and following the advice in https://retropie.org.uk/forum/topic/3/read-this-first

mouse as a Zapper lr-fceumm RPi 3 b+



  • @sexbeer yes it doesn't matter in which order event devices are detected (gamepad, mouse, keyboard etc). But for me it is weird that retroarch reports and error and the description being "Success". Checking the source code of RetroArch for the error string leads to this:

                if (!udev_input_add_device(udev, type, devnode, cb))
                   RARCH_ERR("[udev] Failed to open device: %s (%s).\n",
                         devnode, strerror(errno));
    

    The udev_input_add_device function is returning false but not because of a system error (errno = 0, which is "success"). Checking further what that function does I found that it checks some things but do not report the actual error, unfortunately, so it's hard to spot what is happening exactly. An alternative would be to add more verbosity and re-compile retroarch.

    Interestingly, for example I found that it checks if mouse/touchpad devices have absolute coordinates, and fail if the absolute axes min/max are inconsistent:

    /* Touchpads report in absolute coords. */
       if (type == UDEV_INPUT_TOUCHPAD)
       {
          if (ioctl(fd, EVIOCGABS(ABS_X), &absinfo) < 0 ||
                absinfo.minimum >= absinfo.maximum)
             goto error;
    
          device->mouse.x_min = absinfo.minimum;
          device->mouse.x_max = absinfo.maximum;
    
          if (ioctl(fd, EVIOCGABS(ABS_Y), &absinfo) < 0 ||
              absinfo.minimum >= absinfo.maximum)
             goto error;
    
          device->mouse.y_min = absinfo.minimum;
          device->mouse.y_max = absinfo.maximum;
       }
       /* UDEV_INPUT_MOUSE may report in absolute coords too */
       else if (type == UDEV_INPUT_MOUSE && ioctl(fd, EVIOCGABS(ABS_X), &absinfo) >= 0)
       {
          if (absinfo.minimum >= absinfo.maximum)
             goto error;
    
          device->mouse.x_min = absinfo.minimum;
          device->mouse.x_max = absinfo.maximum;
    
          if (ioctl(fd, EVIOCGABS(ABS_Y), &absinfo) < 0 ||
              absinfo.minimum >= absinfo.maximum)
             goto error;
    
          device->mouse.y_min = absinfo.minimum;
          device->mouse.y_max = absinfo.maximum;
       }
    

    Which may be causing the initialisation to return false without being a device error itself. You said you tried different types of mice, so I wonder myself what are the odds for all of them to fall in this case.

    Can you paste the full output of evtest while testing your mouse device? in particular the capabilities it shows for your mouse device before testing moving and buttons?

    I'm sorry of not being able to help you more directly with your problem, but I thought it might shed some light.



  • @hhromic ok! I connected only one optical mouse and one gamepad. This is log:

    [ERROR] [udev] Failed to open device: /dev/input/event1 (Success).
    [INFO] [udev]: Mouse #0 (/dev/input/mouse0).
    [INFO] [udev]: Plugged pad: Microsoft X-Box 360 pad (1118:654) on port #0.
    [INFO] [udev]: Pad #0 (/dev/input/event0) supports force feedback.
    [INFO] [udev]: Pad #0 (/dev/input/event0) supports 16 force feedback effects.
    [INFO] [Autoconf]: 1 profiles found.
    [INFO] [autoconf]: selected configuration: /home/pi/.config/retroarch/autoconfig/Microsoft X-Box 360 pad.cfg
    [INFO] [Joypad]: Found joypad driver: "udev".
    [WARN] [udev]: Full-screen pointer won't be available.
    

    that's what the evtest says:

    pi@retropie:~ $ evtest
    No device specified, trying to scan all of /dev/input/event*
    Not running as root, no devices may be available.
    Available devices:
    /dev/input/event0:      Microsoft X-Box 360 pad
    /dev/input/event1:      USB Optical Mouse
    Select the device event number [0-1]: 1
    Input driver version is 1.0.1
    Input device ID: bus 0x3 vendor 0x1bcf product 0x7 version 0x110
    Input device name: "USB Optical Mouse"
    Supported events:
      Event type 0 (EV_SYN)
      Event type 1 (EV_KEY)
        Event code 272 (BTN_LEFT)
        Event code 273 (BTN_RIGHT)
        Event code 274 (BTN_MIDDLE)
      Event type 2 (EV_REL)
        Event code 0 (REL_X)
        Event code 1 (REL_Y)
        Event code 6 (REL_HWHEEL)
        Event code 8 (REL_WHEEL)
      Event type 3 (EV_ABS)
        Event code 40 (ABS_MISC)
          Value      0
          Min        0
          Max      255
      Event type 4 (EV_MSC)
        Event code 4 (MSC_SCAN)
    Properties:
    Testing ... (interrupt to exit)
    Event: time 1542985009.001711, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90001
    Event: time 1542985009.001711, type 1 (EV_KEY), code 272 (BTN_LEFT), value 1
    Event: time 1542985009.001711, -------------- SYN_REPORT ------------
    Event: time 1542985009.289681, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90001
    Event: time 1542985009.289681, type 1 (EV_KEY), code 272 (BTN_LEFT), value 0
    Event: time 1542985009.289681, -------------- SYN_REPORT ------------
    Event: time 1542985010.697590, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90002
    Event: time 1542985010.697590, type 1 (EV_KEY), code 273 (BTN_RIGHT), value 1
    Event: time 1542985010.697590, -------------- SYN_REPORT ------------
    Event: time 1542985010.857576, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90002
    Event: time 1542985010.857576, type 1 (EV_KEY), code 273 (BTN_RIGHT), value 0
    Event: time 1542985010.857576, -------------- SYN_REPORT ------------
    Event: time 1542985011.993503, type 2 (EV_REL), code 0 (REL_X), value 1
    Event: time 1542985011.993503, -------------- SYN_REPORT ------------
    Event: time 1542985012.009492, type 2 (EV_REL), code 0 (REL_X), value 1
    Event: time 1542985012.009492, -------------- SYN_REPORT ------------
    Event: time 1542985013.417412, type 2 (EV_REL), code 1 (REL_Y), value 1
    Event: time 1542985013.417412, -------------- SYN_REPORT ------------
    Event: time 1542985013.433401, type 2 (EV_REL), code 0 (REL_X), value -6
    Event: time 1542985013.433401, type 2 (EV_REL), code 1 (REL_Y), value 2
    Event: time 1542985013.433401, -------------- SYN_REPORT ------------
    Event: time 1542985013.449407, type 2 (EV_REL), code 0 (REL_X), value -5
    Event: time 1542985013.449407, type 2 (EV_REL), code 1 (REL_Y), value 4
    Event: time 1542985013.449407, -------------- SYN_REPORT ------------
    Event: time 1542985013.465396, type 2 (EV_REL), code 0 (REL_X), value -1
    Event: time 1542985013.465396, type 2 (EV_REL), code 1 (REL_Y), value 3
    Event: time 1542985013.465396, -------------- SYN_REPORT ------------
    Event: time 1542985013.561400, type 2 (EV_REL), code 1 (REL_Y), value 1
    Event: time 1542985013.561400, -------------- SYN_REPORT ------------
    Event: time 1542985014.969317, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90003
    Event: time 1542985014.969317, type 1 (EV_KEY), code 274 (BTN_MIDDLE), value 1
    Event: time 1542985014.969317, -------------- SYN_REPORT ------------
    Event: time 1542985015.193300, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90003
    Event: time 1542985015.193300, type 1 (EV_KEY), code 274 (BTN_MIDDLE), value 0
    Event: time 1542985015.193300, -------------- SYN_REPORT ------------
    Event: time 1542985017.001189, type 2 (EV_REL), code 1 (REL_Y), value -1
    Event: time 1542985017.001189, -------------- SYN_REPORT ------------
    Event: time 1542985017.017184, type 2 (EV_REL), code 1 (REL_Y), value -1
    Event: time 1542985017.017184, -------------- SYN_REPORT ------------
    Event: time 1542985017.033177, type 2 (EV_REL), code 0 (REL_X), value -2
    Event: time 1542985017.033177, type 2 (EV_REL), code 1 (REL_Y), value -7
    Event: time 1542985017.033177, -------------- SYN_REPORT ------------
    Event: time 1542985017.049176, type 2 (EV_REL), code 0 (REL_X), value -2
    Event: time 1542985017.049176, type 2 (EV_REL), code 1 (REL_Y), value -3
    Event: time 1542985017.049176, -------------- SYN_REPORT ------------
    Event: time 1542985017.065173, type 2 (EV_REL), code 1 (REL_Y), value -4
    Event: time 1542985017.065173, -------------- SYN_REPORT ------------
    Event: time 1542985017.081172, type 2 (EV_REL), code 0 (REL_X), value -2
    Event: time 1542985017.081172, type 2 (EV_REL), code 1 (REL_Y), value -4
    Event: time 1542985017.081172, -------------- SYN_REPORT ------------
    


  • @sexbeer ok so your mouse is being detected as relative coordinates type.
    Can you paste the output of ls -la /dev/input/ just to confirm device permissions?



  • @hhromic after reboot mouse is event0

    pi@retropie:~ $ ls -la /dev/input/
    total 0
    drwxr-xr-x   4 root root     180 Nov 23 15:01 .
    drwxr-xr-x  15 root root    3320 Nov 23 15:01 ..
    drwxr-xr-x   2 root root     120 Nov 23 15:01 by-id
    drwxr-xr-x   2 root root     120 Nov 23 15:01 by-path
    crw-rw----   1 root input 13, 64 Nov 23 15:01 event0
    crw-rw----+  1 root input 13, 65 Nov 23 15:01 event1
    crw-rw----+  1 root input 13,  0 Nov 23 15:01 js0
    crw-rw----   1 root input 13, 63 Nov 23 15:01 mice
    crw-rw----   1 root input 13, 32 Nov 23 15:01 mouse0
    pi@retropie:~ $ evtest
    No device specified, trying to scan all of /dev/input/event*
    Not running as root, no devices may be available.
    Available devices:
    /dev/input/event0:      USB Optical Mouse
    /dev/input/event1:      Microsoft X-Box 360 pad
    Select the device event number [0-1]:
    
    

  • Global Moderator

    @sexbeer Can you try replacing your nes system's retroarch.cfg file with the default one

    input_remapping_directory = "/opt/retropie/configs/nes/"
    
    #include "/opt/retropie/configs/all/retroarch.cfg"
    

    and re-try to see if mouse input works.



  • @mitu all recent tests were on a clean updated image. no system files changed



  • @sexbeer I am intrigued why your gamepad input device files have ACL permissions on them (the + next to the permissions in the file listing).

    It seems you are using an Xbox pad that is using the xpad driver. It might sound dumb but can you try without that pad connected? can you just connect the mouse and a keyboard and see how it goes?



  • @hhromic It did not help

    [INFO] [udev]: Keyboard #0 (/dev/input/event0).
    [ERROR] [udev] Failed to open device: /dev/input/event1 (Success).
    [INFO] [udev]: Mouse #0 (/dev/input/mouse0).
    [INFO] [Joypad]: Found joypad driver: "udev".
    [WARN] [udev]: Full-screen pointer won't be available.
    
    pi@retropie:~ $ ls -la /dev/input/
    total 0
    drwxr-xr-x  4 root root     160 Nov 24 04:34 .
    drwxr-xr-x 15 root root    3340 Nov 24 04:34 ..
    drwxr-xr-x  2 root root     100 Nov 24 04:34 by-id
    drwxr-xr-x  2 root root     100 Nov 24 04:34 by-path
    crw-rw----  1 root input 13, 64 Nov 24 04:34 event0
    crw-rw----  1 root input 13, 65 Nov 24 04:34 event1
    crw-rw----  1 root input 13, 63 Nov 24 04:34 mice
    crw-rw----  1 root input 13, 32 Nov 24 04:34 mouse0
    pi@retropie:~ $ evtest
    No device specified, trying to scan all of /dev/input/event*
    Not running as root, no devices may be available.
    Available devices:
    /dev/input/event0:      MOSART Semi. Rapoo 2.4G Wireless Touch Desktop
    /dev/input/event1:      MOSART Semi. Rapoo 2.4G Wireless Touch Desktop
    Select the device event number [0-1]:
    

    mouse is event1now
    interestingly, the mouse works in the terminal via SSH even when the emulator is running



  • @sexbeer finally the issue was identified in RA's side.

    @grant2258 sent a pull request to RetroArch to fix this issue here: https://github.com/libretro/RetroArch/pull/7730
    Once merged your problem should be fixed, keep an eye on that PR @sexbeer ;)



  • @sexbeer if you feel like trying the patch from @grant2258 , you can do the following while the PRs are in the process of being reviewed/merged:

    cd $HOME/RetroPie-Setup  # go to the RetroPie Setup directory
    sudo ./retropie_packages.sh retroarch clean  # clean the build
    sudo ./retropie_packages.sh retroarch sources  # download the sources
    sudo patch -p1 -d tmp/build/retroarch < <(wget -qO- https://github.com/libretro/RetroArch/pull/7730.diff)  # patch retroarch with PR #7730
    sudo patch -p1 -d tmp/build/retroarch < <(wget -qO- https://github.com/libretro/RetroArch/pull/7759.diff)  # patch retroarch with PR #7759
    sudo ./retropie_packages.sh retroarch build  # build the patched retroarch
    sudo ./retropie_packages.sh retroarch install  # install the patched retroarch
    sudo ./retropie_packages.sh retroarch clean  # to leave all clean again
    

    Afterwards, just launch your game and test if the mouse is now working for you. In particular check that you are not getting this error anymore:

    [ERROR] [udev] Failed to open device: /dev/input/event1 (Success).
    

    Your feedback is highly appreciated! Thanks!



  • @hhromic sudo: ./retropie_packages.sh: command not found


  • Banned

    type

     cd /home/pi/RetroPie-Setup/
    

    then follow the instructions



  • @grant2258 goddammit it works! Hallelujah!



  • no errors detected

    [INFO] [udev]: Keyboard #0 (/dev/input/event1).
    [INFO] [udev]: Mouse #0 (/dev/input/event2).
    [INFO] [udev]: Mouse #1 (/dev/input/mouse0).
    [INFO] [udev]: Plugged pad: Microsoft X-Box 360 pad (1118:654) on port #0.
    [INFO] [udev]: Pad #0 (/dev/input/event0) supports force feedback.
    [INFO] [udev]: Pad #0 (/dev/input/event0) supports 16 force feedback effects.
    


  • @sexbeer yes indeed I forgot to mention that you need to go to the RetroPie directory first! apologies! luckily @grant2258 gave you the hint.

    and I'm glad your mouse is now working! more points for this patch! thanks for testing. I guess now you can go enjoy some Zapper shooting ;)


  • Banned

    nice to see hear it working good fot you thanks for posting the results appreciated :)



  • @grant2258 @hhromic Thanks guys, I'm really happy now :) I hope that this fix will be included in one of the following updates


  • Banned

    @hhromic good news is the patch is in retroarch now however they asked me to change something which broke it. So i applied another patch to sort it. in your instructions can you add this after the first patch.

    sudo patch -p1 -d tmp/build/retroarch < <(wget -qO- https://patch-diff.githubusercontent.com/raw/libretro/RetroArch/pull/7759.diff)  # patch retroarch with the PR1
    


  • @grant2258 great news indeed! I updated my original comment now. I used the same URL formatting as the other PR for consistency.

    I'm thinking on opening a new topic to direct users to your patch and these instructions, so we can collect more positive feedback and easily direct users having the same issue.


  • Banned

    @hhromic sounds like a plan something will need to be in place until retropie decides what to do.



Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.

Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.