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

    raspberry 4 XBox One Bluetooth controller systemd entry

    Scheduled Pinned Locked Moved Help and Support
    systemdbluetoothraspberry pi 4xbox one controdisableertm
    7 Posts 2 Posters 750 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.
    • C
      chriej
      last edited by chriej

      To pair the controller I have to do this:

      root@raspberrypi:/etc/rc2.d# echo 1 > /sys/module/bluetooth/parameters/disable_ertm
      root@raspberrypi:/etc/rc2.d# cat /sys/module/bluetooth/parameters/disable_ertm
      Y
      

      After than I can pair and configure the controller in retropie. However after a reboot I have to fire the echo command again.
      So I tried to automate this.
      To add the line:
      echo 1 > /sys/module/bluetooth/parameters/disable_ertm
      in
      /etc/rc.local doesn't work. No change after a reboot in the config file

      The next idea was to create a systemctl entry:

      [Unit]
      After=bluetooth.target
      
      [Service]
      ExecStart=/usr/local/bin/myStartUp.sh
      User=root
      Group=root
      
      [Install]
      #WantedBy=default.target
      WantedBy = multi-user.target
      
      root@raspberrypi:~# cat /usr/local/bin/myStartUp.sh
      #!/bin/sh
      echo 1 > /sys/module/bluetooth/parameters/disable_ertm
      
      root@raspberrypi:~# ls -lha /usr/local/bin/myStartUp.sh
      -rwxr-xr-x 1 root root 65 Dec 21 15:30 /usr/local/bin/myStartUp.sh
      
       systemctl daemon-reload
       systemctl enable myStartUp.service
      

      But I get this error after a system reboot:

         Loaded: loaded (/etc/systemd/system/myStartUp.service; enabled; vendor preset: enabled)
         Active: failed (Result: exit-code) since Sat 2019-12-21 15:58:35 CET; 7min ago
        Process: 357 ExecStart=/usr/local/bin/myStartUp.sh (code=exited, status=2)
       Main PID: 357 (code=exited, status=2)
      
      Dec 21 15:58:35 raspberrypi systemd[1]: Started myStartUp.service.
      Dec 21 15:58:35 raspberrypi myStartUp.sh[357]: /usr/local/bin/myStartUp.sh: 2: /usr/local/bin/myStartUp.sh: cannot create /sys/module/bluetooth/parameters/disable_ertm: Directory nonexistent
      Dec 21 15:58:35 raspberrypi systemd[1]: myStartUp.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
      Dec 21 15:58:35 raspberrypi systemd[1]: myStartUp.service: Failed with result 'exit-code'.
      

      When I execute systemctl start myStartUp.service manual under the user pi and root the script works.

      pi@raspberrypi:~ $ systemctl start myStartUp.service
      ==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
      Authentication is required to start 'myStartUp.service'.
      Multiple identities can be used for authentication:
       1.  ,,, (pi)
       2.  root
      Choose identity to authenticate as (1-2): 1
      Password:
      ==== AUTHENTICATION COMPLETE ===
      pi@raspberrypi:~ $ systemctl status myStartUp.service
      ā— myStartUp.service
         Loaded: loaded (/etc/systemd/system/myStartUp.service; enabled; vendor preset: enabled)
         Active: inactive (dead) since Sat 2019-12-21 16:19:11 CET; 7s ago
        Process: 2553 ExecStart=/usr/local/bin/myStartUp.sh (code=exited, status=0/SUCCESS)
       Main PID: 2553 (code=exited, status=0/SUCCESS)
      
      Dec 21 16:19:11 raspberrypi systemd[1]: Started myStartUp.service.
      Dec 21 16:19:11 raspberrypi systemd[1]: myStartUp.service: Succeeded.
      
      1 Reply Last reply Reply Quote 0
      • mituM
        mitu Global Moderator
        last edited by

        Such complicated setup just to pass a parameter to a kernel module.
        Create a simple text file in /etc/modprobe.d/bluetooth.conf with the contents

        options bluetooth disable_etrm=y
        

        then reboot - you don't need any extra services.

        1 Reply Last reply Reply Quote 0
        • C
          chriej
          last edited by

          @mitu said in raspberry 4 XBox One Bluetooth controller systemd entry:

          options bluetooth disable_etrm=y

          I tried your suggestion. But it doesn't set the flag.

          1 Reply Last reply Reply Quote 0
          • mituM
            mitu Global Moderator
            last edited by

            Hm, try this instead - in the .conf file

            options bluetooth disable_ertm=1
            
            1 Reply Last reply Reply Quote 0
            • C
              chriej
              last edited by

              My /etc/modprobe.d# nano bluetooth.conf has this one line as content, but the flag doesn't get set.

              options bluetooth disable_etrm=1

              mituM 1 Reply Last reply Reply Quote 0
              • mituM
                mitu Global Moderator @chriej
                last edited by

                @chriej I tested this on a Pi4 and it works. Make sure you didn't mis-type anything and you reboot after you edit the file.

                pi@retropie ~ $ cat /sys/module/bluetooth/parameters/disable_ertm
                Y
                pi@retropie ~ $ cat /etc/modprobe.d/bluetooth.conf
                options bluetooth disable_ertm=1
                
                1 Reply Last reply Reply Quote 0
                • C
                  chriej
                  last edited by

                  THX!
                  It looks like there was a hidden sign (copy and paste failure)

                  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.