LINUX.ORG.RU

Правило для udev: запуск скрипта в включении USB устройства

 ,


0

1

Всем привет!

Имеется: планшет USB (ака большой тачпад) wacom. Что нужно: при подключении планшета чтобы автоматом запускался скрипт. Сейчас скрипт я запускаю вручную при каждом логине или переподключении планшета. Хочется сделать через udev.

Скрипт: /usr/local/bin/wacom_set.sh

Описания планшета:

$ lsusb | grep -i wacom
Bus 002 Device 004: ID 056a:0302 Wacom Co., Ltd

Содержимое /lib/udev/rules.d/65-libwacom.rules: http://pastebin.com/DDnSZXr2

Кстати, кто-то мне объяснит как с помощью указанного выше набора правил создается

/dev/input/event[345]
/dev/input/mouse[012]
/dev/input/by-id/usb-Wacom_Co._Ltd._Intuos_PTS-event-mouse -> ../event3
/dev/input/by-id/usb-Wacom_Co._Ltd._Intuos_PTS-if01-event-mouse -> ../event4
/dev/input/by-id/usb-Wacom_Co._Ltd._Intuos_PTS-if01-mouse -> ../mouse1
/dev/input/by-id/usb-Wacom_Co._Ltd._Intuos_PTS-if02-event-mouse -> ../event5
/dev/input/by-id/usb-Wacom_Co._Ltd._Intuos_PTS-if02-mouse -> ../mouse2
/dev/input/by-id/usb-Wacom_Co._Ltd._Intuos_PTS-mouse -> ../mouse0
, при условии что, как я понял из вывода lsusb, ENV{ID_MODEL_ID}==«0302», которого в наборе правил нет? Или чего я не понимаю?

При включении планшета в USB, вот лог:

Nov 29 23:39:41 localhost kernel: [ 8129.136141] hub 2-6:1.0: state 7 ports 4 chg 0000 evt 0010
Nov 29 23:39:41 localhost kernel: [ 8129.136382] hub 2-6:1.0: port 4, status 0101, change 0001, 12 Mb/s
Nov 29 23:39:41 localhost kernel: [ 8129.240143] hub 2-6:1.0: debounce: port 4: total 100ms stable 100ms status 0x101
Nov 29 23:39:41 localhost kernel: [ 8129.254162] hub 2-6:1.0: port 4 not reset yet, waiting 10ms
Nov 29 23:39:41 localhost kernel: [ 8129.316150] usb 2-6.4: new full-speed USB device number 6 using ehci-pci
Nov 29 23:39:41 localhost kernel: [ 8129.327141] hub 2-6:1.0: port 4 not reset yet, waiting 10ms
Nov 29 23:39:41 localhost kernel: [ 8129.404397] usb 2-6.4: skipped 1 descriptor after interface
Nov 29 23:39:41 localhost kernel: [ 8129.404402] usb 2-6.4: skipped 1 descriptor after interface
Nov 29 23:39:41 localhost kernel: [ 8129.404405] usb 2-6.4: skipped 1 descriptor after interface
Nov 29 23:39:41 localhost kernel: [ 8129.404640] usb 2-6.4: default language 0x0409
Nov 29 23:39:41 localhost kernel: [ 8129.405767] usb 2-6.4: udev 6, busnum 2, minor = 133
Nov 29 23:39:41 localhost kernel: [ 8129.405770] usb 2-6.4: New USB device found, idVendor=056a, idProduct=0302
Nov 29 23:39:41 localhost kernel: [ 8129.405773] usb 2-6.4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
Nov 29 23:39:41 localhost kernel: [ 8129.405775] usb 2-6.4: Product: Intuos PTS
Nov 29 23:39:41 localhost kernel: [ 8129.405778] usb 2-6.4: Manufacturer: Wacom Co.,Ltd.
Nov 29 23:39:41 localhost kernel: [ 8129.405860] usb 2-6.4: usb_probe_device
Nov 29 23:39:41 localhost kernel: [ 8129.405864] usb 2-6.4: configuration #1 chosen from 1 choice
Nov 29 23:39:41 localhost kernel: [ 8129.406173] usb 2-6.4: adding 2-6.4:1.0 (config #1, interface 0)
Nov 29 23:39:41 localhost kernel: [ 8129.406206] usbhid 2-6.4:1.0: usb_probe_interface
Nov 29 23:39:41 localhost kernel: [ 8129.406209] usbhid 2-6.4:1.0: usb_probe_interface - got id
Nov 29 23:39:41 localhost kernel: [ 8129.406228] wacom 2-6.4:1.0: usb_probe_interface
Nov 29 23:39:41 localhost kernel: [ 8129.406232] wacom 2-6.4:1.0: usb_probe_interface - got id
Nov 29 23:39:41 localhost kernel: [ 8129.406279] input: Wacom Intuos PT S Pen as /devices/pci0000:00/0000:00:1d.7/usb2/2-6/2-6.4/2-6.4:1.0/input/input13
Nov 29 23:39:41 localhost kernel: [ 8129.406385] usb 2-6.4: link qh2-0601/d3b30d00 start 0 [1/2 us]
Nov 29 23:39:41 localhost kernel: [ 8129.407156] usb 2-6.4: adding 2-6.4:1.1 (config #1, interface 1)
Nov 29 23:39:41 localhost kernel: [ 8129.407186] usbhid 2-6.4:1.1: usb_probe_interface
Nov 29 23:39:41 localhost kernel: [ 8129.407189] usbhid 2-6.4:1.1: usb_probe_interface - got id
Nov 29 23:39:41 localhost kernel: [ 8129.407204] wacom 2-6.4:1.1: usb_probe_interface
Nov 29 23:39:41 localhost kernel: [ 8129.407207] wacom 2-6.4:1.1: usb_probe_interface - got id
Nov 29 23:39:41 localhost kernel: [ 8129.407252] input: Wacom Intuos PT S Finger as /devices/pci0000:00/0000:00:1d.7/usb2/2-6/2-6.4/2-6.4:1.1/input/input14
Nov 29 23:39:41 localhost kernel: [ 8129.407406] usb 2-6.4: adding 2-6.4:1.2 (config #1, interface 2)
Nov 29 23:39:41 localhost kernel: [ 8129.407431] usbhid 2-6.4:1.2: usb_probe_interface
Nov 29 23:39:41 localhost kernel: [ 8129.407434] usbhid 2-6.4:1.2: usb_probe_interface - got id
Nov 29 23:39:41 localhost kernel: [ 8129.407447] wacom 2-6.4:1.2: usb_probe_interface
Nov 29 23:39:41 localhost kernel: [ 8129.407450] wacom 2-6.4:1.2: usb_probe_interface - got id
Nov 29 23:39:41 localhost kernel: [ 8129.407493] input: Wacom Intuos PT S Finger as /devices/pci0000:00/0000:00:1d.7/usb2/2-6/2-6.4/2-6.4:1.2/input/input15
Nov 29 23:39:41 localhost mtp-probe: checking bus 2, device 6: "/sys/devices/pci0000:00/0000:00:1d.7/usb2/2-6/2-6.4"
Nov 29 23:39:41 localhost mtp-probe: bus: 2, device: 6 was not an MTP device
Nov 29 23:39:41 localhost kernel: [ 8129.410023] usb 2-6.4: unlink qh2-0601/d3b30d00 start 0 [1/2 us]
Nov 29 23:39:41 localhost kernel: [ 8129.420076] ehci-pci 0000:00:1d.7: reused qh d3b30d00 schedule
Nov 29 23:39:41 localhost kernel: [ 8129.420082] usb 2-6.4: link qh2-0601/d3b30d00 start 0 [1/2 us]
Nov 29 23:39:41 localhost kernel: [ 8129.422778] usb 2-6.4: link qh2-0601/d3adc0c0 start 1 [1/3 us]
Nov 29 23:39:41 localhost kernel: [ 8129.424123] usb 2-6.4: unlink qh2-0601/d3b30d00 start 0 [1/2 us]
Nov 29 23:39:41 localhost kernel: [ 8129.426103] usb 2-6.4: unlink qh2-0601/d3adc0c0 start 1 [1/3 us]
Nov 29 23:39:41 localhost kernel: [ 8129.432496] ehci-pci 0000:00:1d.7: reused qh d3adc0c0 schedule
Nov 29 23:39:41 localhost kernel: [ 8129.432501] usb 2-6.4: link qh2-0601/d3adc0c0 start 1 [1/3 us]
Nov 29 23:39:41 localhost kernel: [ 8129.439031] usb 2-6.4: link qh2-0601/d3adc840 start 0 [1/3 us]
Nov 29 23:39:41 localhost kernel: [ 8129.444021] usb 2-6.4: unlink qh2-0601/d3adc840 start 0 [1/3 us]
Nov 29 23:39:41 localhost kernel: [ 8129.450483] ehci-pci 0000:00:1d.7: reused qh d3adc840 schedule
Nov 29 23:39:41 localhost kernel: [ 8129.450488] usb 2-6.4: link qh2-0601/d3adc840 start 0 [1/3 us]
Nov 29 23:39:41 localhost kernel: [ 8129.456707] usb 2-6.4: link qh2-3008/d3b30d00 start 1 [1/2 us]
Nov 29 23:39:41 localhost kernel: [ 8129.463013] usb 2-6.4: unlink qh2-3008/d3b30d00 start 1 [1/2 us]
Nov 29 23:39:41 localhost kernel: [ 8129.470433] ehci-pci 0000:00:1d.7: reused qh d3b30d00 schedule
Nov 29 23:39:41 localhost kernel: [ 8129.470438] usb 2-6.4: link qh2-3008/d3b30d00 start 1 [1/2 us]

Еще раз повторю вопрос: как сделать чтобы, при втыкании планшета в USB, автоматом запускался /usr/local/bin/wacom_set.sh ?

Заранее спасибо откликнувшимся!

★★★★★

еще раз повторяю, еще раз :)

KERNEL=="sd[b-z]", SUBSYSTEM=="usb", ATTRS{serial}=="372041756775"
ACTION=="add", ATTRS{serial}=="372041756775"
ACTION=="add", KERNEL=="sd[b-z]", ATTRS{serial}=="372041756775", RUN+="/bin/mkdir -p /media/%k"
ACTION=="add", KERNEL=="sd[b-z]", ATTRS{serial}=="372041756775", RUN+="/bin/mount -o rw,quiet,noauto,nodev,nosuid,noexec,noatime,utf8,uid=1000 /dev/%k /media/%k"
ACTION=="remove", RUN+="/bin/umount -l /media/%k"
ACTION=="remove", RUN+="/bin/rmdir /media/%k"
anonymous ()
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.