RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login
    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

    Anyone Familiar with UDEV rules?

    Scheduled Pinned Locked Moved Help and Support
    15 Posts 4 Posters 5.1k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • B
      bazmonkey @mediamogul
      last edited by

      @mediamogul can we see the script? What are you trying to do?

      mediamogulM 1 Reply Last reply Reply Quote 0
      • mediamogulM
        mediamogul Global Moderator @bazmonkey
        last edited by mediamogul

        @bazmonkey

        I'm at a loss. I've tested the script that the udev rule will launch and it runs fine on it's own. Also, because udev is no longer throwing up an error that it can't launch anything, I am left with a squeaky clean system log that doesn't tell me anything about why it's not working. Is there any other way to troubleshoot a problem like this?

        Edit:

        can we see the script? What are you trying to do?

        Sure, the script is as afollows:

        #!/bin/sh
        
        sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \
        	--evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.2:1.0-event-joystick \
        	--detach-kernel-driver \
        	--force-feedback \
        	--dpad-as-button \
        	--trigger-as-button \
        	--deadzone-trigger 15% \
        	--deadzone 4000 \
        	--device-name "Logitech Rumblepad 2 (xboxdrv)" \
        	--silent \
        	--axismap -Y1=Y1,-Y2=Y2 \
        	--evdev-absmap ABS_X=x1,ABS_Y=y1,ABS_Z=x2,ABS_RZ=y2,ABS_HAT0X=dpad_x,ABS_HAT0Y=dpad_y \
        	--evdev-keymap BTN_THUMB2=a,BTN_THUMB=b,BTN_TOP=x,BTN_TRIGGER=y,BTN_BASE3=back,BTN_BASE4=start,BTN_TOP2=lb,BTN_PINKIE=rb,BTN_BASE5=tl,BTN_BASE6=tr,BTN_BASE=lt,BTN_BASE2=rt \
        	--ui-axismap lt+x1=REL_X:10,lt+y1=REL_Y:10 \
        	--ui-buttonmap guide=void,lt+lb=BTN_LEFT,lt+rb=BTN_RIGHT \
        	&
        

        RetroPie v4.5 • RPi3 Model B • 5.1V 2.5A PSU • 16GB SanDisk microSD • 512GB External Drive

        1 Reply Last reply Reply Quote 0
        • mediamogulM
          mediamogul Global Moderator @bazmonkey
          last edited by

          @bazmonkey

          The idea is of course that when the RumblePad is plugged in, the script will launch and map the controller. If I can ever get it to work, I will also have an almost identical script that breaks xboxdrv down when the controller is removed.

          RetroPie v4.5 • RPi3 Model B • 5.1V 2.5A PSU • 16GB SanDisk microSD • 512GB External Drive

          1 Reply Last reply Reply Quote 0
          • mediamogulM
            mediamogul Global Moderator
            last edited by

            I can't even get it to launch simple scripts or executables. If I intentionally get the path the wrong to the script or executable, I get a systemd-udevd[1472]: failed to execute... No such file or directory warning during startup every time. I guess that means the rule is working and the item is trying to launch, but when the path is correct, nothing launches and I can't seem to track down an error explaining why.

            RetroPie v4.5 • RPi3 Model B • 5.1V 2.5A PSU • 16GB SanDisk microSD • 512GB External Drive

            P 1 Reply Last reply Reply Quote 0
            • P
              PaulCheffus @mediamogul
              last edited by

              @mediamogul

              Hi

              What happens if you remove the --silent line from the script? This is usually used to prevent messages being displayed so could be suppressing your error(s).

              Cheers

              Paul

              mediamogulM 1 Reply Last reply Reply Quote 1
              • gizmo98G
                gizmo98 Global Moderator
                last edited by

                I had problems with raspbian jessie, udev rules and scripts. It seems file system is not ready when the udev rule is triggered. The only way to solve this problem was to run this script with a daemon, rc.local or bashrc.

                If you add your device at runtime the script runs because file system is ready.

                1 Reply Last reply Reply Quote 1
                • mediamogulM
                  mediamogul Global Moderator @PaulCheffus
                  last edited by mediamogul

                  @PaulCheffus

                  That particular instance silences xboxdrv while it's running and unfortunately it never actually gets that far. I might still give it a try to see if it manages to briefly launch and sputter something out.

                  @gizmo98

                  I was afraid it might be something like that. I half-way ruled it out because I was under the impression that I could at least plug my controller in after the system fully boots and see results. Shouldn't the rule operate at that point?

                  RetroPie v4.5 • RPi3 Model B • 5.1V 2.5A PSU • 16GB SanDisk microSD • 512GB External Drive

                  1 Reply Last reply Reply Quote 0
                  • gizmo98G
                    gizmo98 Global Moderator
                    last edited by

                    After the system is started the rule should work.

                    mediamogulM 1 Reply Last reply Reply Quote 0
                    • mediamogulM
                      mediamogul Global Moderator @gizmo98
                      last edited by mediamogul

                      @gizmo98

                      That's what everyone seems to think. I've tried reformatting the rule a hundred different ways and I can't get it to launch anything at any time under any circumstances. Perhaps this function is simply broken on Raspbian.

                      RetroPie v4.5 • RPi3 Model B • 5.1V 2.5A PSU • 16GB SanDisk microSD • 512GB External Drive

                      1 Reply Last reply Reply Quote 0
                      • mediamogulM
                        mediamogul Global Moderator
                        last edited by mediamogul

                        @gizmo98

                        OK, despite numerous current postings to the contrary on this subject, the udevRUN+="/path/to/executable" function has been deprecated at some point in favor of other, more reliable methods.

                        http://blog.fraggod.net/2012/06/16/proper-ish-way-to-start-long-running-systemd-service-on-udev-event-device-hotplug.html

                        http://blog.fraggod.net/2015/01/12/starting-systemd-service-instance-for-device-from-udev.html

                        Both techniques make use of a daemon as you mentioned, but they can still be controlled with a modified udev rule that will launch the daemon when a specified device is added or removed. They require a little more work, but hopefully at least one of them will bear fruit.

                        RetroPie v4.5 • RPi3 Model B • 5.1V 2.5A PSU • 16GB SanDisk microSD • 512GB External Drive

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post

                        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.