| Both sides previous revision Previous revision Next revision | Previous revision |
| udev_rules [2022/09/23 03:26] – [Create your own udev rule] add command about listing it all atari | udev_rules [2025/02/19 20:07] (current) – [Run a script when a device is connected] nadenislamarre |
|---|
| |
| Batocera supports booting up and event udev rules like with any ordinary operating system. These can be manipulated in the usual ''/etc/udev/rules.d/'' directory. However, changes cannot be permanently stored there due to Batocera's filesystem ([[:modify_the_system_while_it_s_running|overlays]] can be used, but are forgotten between upgrades). | Batocera supports booting up and event udev rules like with any ordinary operating system. These can be manipulated in the usual ''/etc/udev/rules.d/'' directory. However, changes cannot be permanently stored there due to Batocera's filesystem ([[:modify_the_system_while_it_s_running|overlays]] can be used, but are forgotten between upgrades). |
| |
| But if you only need event udev rules, then the ''/userdata/system/udev/rules.d/'' path can be used instead. The path must be initially created manually. | |
| |
| For example, if you wanted to enable the [[https://wiki.dolphin-emu.org/index.php?title=Bluetooth_Passthrough|Bluetooth passthrough udev rule of Dolphin]] for your own Bluetooth dongle (list of compatible adapters **for Dolphin, not necessarily [[hardware:compatible_dongle_list|Batocera]]** is [[https://wiki.dolphin-emu.org/index.php?title=Bluetooth_Passthrough#Adapter_test_results|further down that page]]), you would use this file: | For example, if you wanted to enable the [[https://wiki.dolphin-emu.org/index.php?title=Bluetooth_Passthrough|Bluetooth passthrough udev rule of Dolphin]] for your own Bluetooth dongle (list of compatible adapters **for Dolphin, not necessarily [[hardware:compatible_dongle_list|Batocera]]** is [[https://wiki.dolphin-emu.org/index.php?title=Bluetooth_Passthrough#Adapter_test_results|further down that page]]), you would use this file: |
| <code - 52-dolphin.rules> | <code - 52-dolphin.rules> |
| SUBSYSTEM=="usb", ATTRS{idVendor}=="YOURVID", ATTRS{idProduct}=="YOURPID", TAG+="uaccess" | SUBSYSTEM=="usb", ATTRS{idVendor}=="YOURVID", ATTRS{idProduct}=="YOURPID", TAG+="uaccess" |
| | ACTION=="add", ENV{PRODUCT}=="57e/305/100", RUN+="/bin/sh -c 'echo -n $kernel > /sys/bus/usb/drivers/btusb/unbind'" |
| </code> | </code> |
| |
| Where the values ''YOURVID'' and ''YOURPID'' are replaced according to your specific device found in the list mentioned above. Then save it and copy it to ''/userdata/system/udev/rules.d/52-dolphin.rules'' and reboot Batocera. | Where the values ''YOURVID'' and ''YOURPID'' are replaced according to your specific device found in the list mentioned above. Then save it and copy it to ''/etc/udev/rules.d/52-dolphin.rules'', run batocera-save-overlay and reboot Batocera. |
| |
| <WRAP center round tip> | <WRAP center round tip> |
| - [[:access_the_batocera_via_ssh|Connect to Batocera via SSH]] | - [[:access_the_batocera_via_ssh|Connect to Batocera via SSH]] |
| - Run the list command for the device in question: | - Run the list command for the device in question: |
| * For input devices, this can be achieved with ''evtest'' | * For input devices, this can be achieved with ''evtest'' or for a more systematic approach, ''cat /proc/bus/input/devices'' |
| * For USB devices in general: ''lsusb'' | * For USB devices in general: ''lsusb'' |
| * For devices in general (or if you don't know what subsystem it uses), search through the ''/dev/'' folder in root: ''ls /dev'' and then ''ls /dev/<subsystem>'' | * For devices in general (or if you don't know what subsystem it uses), search through the ''/dev/'' folder in root: ''ls /dev'' and then ''ls /dev/<subsystem>'' |
| </file> | </file> |
| |
| Save the file to ''/userdata/system/udev/rules.d/''. | Save the file to ''/etc/udev/rules.d'' and run batocera-save-overlay. |
| |
| ==== Troubleshooting ==== | ==== Troubleshooting ==== |