You are not logged in.

#1 2017-05-17 21:24:00

xvzf
Member
Registered: 2014-05-18
Posts: 86

Execute script when dock is attached

Hi there,

I am currently using my ThinkPad toghether with an Thunderbolt-3 Dock from HP. A 4k Monitor, Keyboard & Mouse are connected to the Monitor.
As the internal screen has a 1080p resolution, I have to tweak some gnome settings so that I can use the external display without reaching for a magnifying glass. The scripts are ready and working - I now want to execute them whenever the dock is connected.

Currently I am trying to do this via an udev rule. But it does not seem to work... It's the first time I am writing udev rules so please be gentle ;)


The udev event I am looking for:

UDEV  [4587.334453] remove
/devices/pci0000:00/0000:00:1d.0/0000:06:00.0/0000:07:04.0/0000:3d:00.0/0000:3e:00.0/0     000:3f:00.0/usb3/3-2/32:1.0/sound/card1/controlC1(sound)
ACTION=remove
DEVLINKS=/dev/snd/by-path/pci-0000:3f:00.0-usb-0:2:1.0
/dev/snd/by-id/usb-HP_HP_Dock_Audio_FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF-00
DEVNAME=/dev/snd/controlC1
DEVPATH=/devices/pci0000:00/0000:00:1d.0/0000:06:00.0/0000:07:04.0/0000:3d:00.0/0000:3     e:00.0/0000:3f:00.0/usb3/3-2/32:1.0/sound/card1/controlC12337 ID_BUS=usb
ID_MODEL=HP_Dock_Audio
ID_MODEL_ENC=HP\x20Dock\x20Audio
ID_MODEL_ID=1804
ID_PATH=pci-0000:3f:00.0-usb-0:2:1.0
ID_PATH_TAG=pci-0000_3f_00_0-usb-0_2_1_0
ID_REVISION=0304
ID_SERIAL=HP_HP_Dock_Audio_FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
ID_SERIAL_SHORT=FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
ID_TYPE=audio
ID_USB_DRIVER=snd-usb-audio
ID_USB_INTERFACES=:010100:010200:030000:
ID_USB_INTERFACE_NUM=00
ID_VENDOR=HP
ID_VENDOR_ENC=HP
ID_VENDOR_ID=0572
MAJOR=116
MINOR=10
SEQNUM=3775
SUBSYSTEM=sound
TAGS=:uaccess:
USEC_INITIALIZED=782260542

My udev rule - not working:

ACTION=="remove", SUBSYSTEM=="sound", ENV{ID_MODEL}=="HP_Dock_Audio", RUN+="/home/xvzf/bin/setup_laptopmode.sh"

ACTION=="add", SUBSYSTEM=="sound", ENV{ID_MODEL}=="HP_Dock_Audio", RUN+="/home/xvzf/bin/setup_deskwork.sh"

Greetings,
Matthias

Offline

Board footer

Powered by FluxBB