Notes Systemd udev

Source https://askubuntu.com/questions/25071/how-to-run-a-script-when-a-specific-flash-drive-is-mounted

Voir :

automount_montage_automatique_clef_usb

notes_ecran_tactile_touch_screen

Exemples :

https://github.com/ConsoleKit2/ConsoleKit2/blob/master/tools/70-udev-acl.rules.in

lsusb

0a81:0101

/etc/udev/rules.d/100-mount-videos.rules

ACTION=="add", ATTRS{idVendor}=="0a81", ATTRS{idProduct}=="0101", RUN+="/home/your_username/bin/mount_videos.sh"

Exemple :

lsusb |grep -i touch
Bus 001 Device 009: ID 04e7:00c0 Elo TouchSystems

/etc/udev/rules.d/100-touchscreen-calibr.rules

ACTION=="add", ATTRS{idVendor}=="04e7", ATTRS{idProduct}=="00c0", RUN+="/bin/bash -c 'echo /usr/local/bin/touchscreencfg.sh | at now'"

Je ruse en uilisant at car l'appel directe au script ne fonctionne pas ( le xinput list ne fionctione pas)

/usr/local/bin/touchscreencfg.sh

#! /bin/bash export DISPLAY=:0 NAME=$(xinput list --name-only | grep -i touch | grep -iv ' pen') ID=$(xinput list --id-only "$NAME") SCREEN=$(xrandr 2>&1 | grep ' connected primary' | awk '{print $1}') /usr/bin/xinput --map-to-output $ID $SCREEN ( sleep 5 ; /usr/bin/xinput --map-to-output $ID $SCREEN ) &

Pb

Pb 1

Pb xinput --list avec udev

Voir :

https://superuser.com/questions/924087/udev-rule-script-xinput-list-differs-in-terminal-versus-log

https://bbs.archlinux.org/viewtopic.php?pid=1626055#p1626055

Solution

Utiliser at