J'essaie de lancer un script lorsque je connecte mon téléphone en bluetooth.
J'ai donc créé une règle udev
Code : Tout sélectionner
KERNEL=="hci0", ACTION=="add", SUBSYSTEM=="bluetooth", RUN+="/bin/sh /home/lobor/Documents/PERSO/test.sh"
J'ai donc essayé
Code : Tout sélectionner
[code]KERNEL=="hci0", ACTION=="add", SUBSYSTEM=="bluetooth", RUN+="/usr/bin/echo \"toto\" /home/lobor/Documents/test.txt"
Pour tester j'utilise (sudo ou non)
Code : Tout sélectionner
udevadm test /sys/class/bluetooth/hci0
Code : Tout sélectionner
rules contain 196608 bytes tokens (16384 * 12 bytes), 26743 bytes strings
17363 strings (142430 bytes), 14990 de-duplicated (118061 bytes), 2374 trie nodes used
RUN '/bin/sh ~/Documents/PERSO/test.sh' /etc/udev/rules.d/10-bluetooth.rules:1
ACTION=add
DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.0/bluetooth/hci0
DEVTYPE=host
SUBSYSTEM=bluetooth
SYSTEMD_ALIAS=/sys/subsystem/bluetooth/devices/hci0
SYSTEMD_WANTS=bluetooth.target
TAGS=:systemd:
USEC_INITIALIZED=3466517
run: '/bin/sh ~/Documents/PERSO/test.sh'
Unload module index
Unloaded link configuration context.