Escreveu a regra do udev para executar o script, mas nada acontece

2

Aqui está o meu arquivo 81-arduino.rules:

KERNEL=="ttyACM*", ATTRS{idVendor}=="2341", ATTRS{idProduct}=="0043",  ATTRS{serial}=="754393133373519132C0", RUN+="/home/z37/screenrun.sh"

Então, quando eu plug-in script Arduino deve começar, mas nada acontece.

$ sudo unbuffer udevadm monitor --environment

custom logging function 0x7f5296f7e250 registered
selinux=0
runtime dir '/run/udev'
calling: monitor
monitor will print the received events for:
UDEV - the event which udev sends out after rule processing
KERNEL - the kernel uevent

KERNEL[16618.840108] add      /devices/pci0000:00/0000:00:12.0/usb3/3-1 (usb)
ACTION=add
BUSNUM=003
DEVNAME=bus/usb/003/007
DEVNUM=007
DEVPATH=/devices/pci0000:00/0000:00:12.0/usb3/3-1
DEVTYPE=usb_device
MAJOR=189
MINOR=262
PRODUCT=2341/43/1
SEQNUM=2737
SUBSYSTEM=usb
TYPE=2/0/0
UDEV_LOG=6

KERNEL[16618.844515] add      /devices/pci0000:00/0000:00:12.0/usb3/3-1/3-1:1.0 (usb)
ACTION=add
DEVPATH=/devices/pci0000:00/0000:00:12.0/usb3/3-1/3-1:1.0
DEVTYPE=usb_interface
INTERFACE=2/2/1
MODALIAS=usb:v2341p0043d0001dc02dsc00dp00ic02isc02ip01in00
PRODUCT=2341/43/1
SEQNUM=2738
SUBSYSTEM=usb
TYPE=2/0/0
UDEV_LOG=6

KERNEL[16618.848853] add      /devices/pci0000:00/0000:00:12.0/usb3/3-1/3-1:1.0/tty/ttyACM0 (tty)
ACTION=add
DEVNAME=ttyACM0
DEVPATH=/devices/pci0000:00/0000:00:12.0/usb3/3-1/3-1:1.0/tty/ttyACM0
MAJOR=166
MINOR=0
SEQNUM=2739
SUBSYSTEM=tty
UDEV_LOG=6

KERNEL[16618.848971] add      /devices/pci0000:00/0000:00:12.0/usb3/3-1/3-1:1.1 (usb)
ACTION=add
DEVPATH=/devices/pci0000:00/0000:00:12.0/usb3/3-1/3-1:1.1
DEVTYPE=usb_interface
DRIVER=cdc_acm
INTERFACE=10/0/0
MODALIAS=usb:v2341p0043d0001dc02dsc00dp00ic0Aisc00ip00in01
PRODUCT=2341/43/1
SEQNUM=2740
SUBSYSTEM=usb
TYPE=2/0/0
UDEV_LOG=6

UDEV  [16619.510808] add      /devices/pci0000:00/0000:00:12.0/usb3/3-1 (usb)
ACTION=add
BUSNUM=003
DEVNAME=/dev/bus/usb/003/007
DEVNUM=007
DEVPATH=/devices/pci0000:00/0000:00:12.0/usb3/3-1
DEVTYPE=usb_device
ID_BUS=usb
ID_MM_DEVICE_IGNORE=1
ID_MODEL=0043
ID_MODEL_ENC=0043
ID_MODEL_ID=0043
ID_REVISION=0001
ID_SERIAL=Arduino__www.arduino.cc__0043_754393133373519132C0
ID_SERIAL_SHORT=754393133373519132C0
ID_USB_INTERFACES=:020201:0a0000:
ID_VENDOR=Arduino__www.arduino.cc_
ID_VENDOR_ENC=Arduino\x20\x28www.arduino.cc\x29
ID_VENDOR_ID=2341
MAJOR=189
MINOR=262
PRODUCT=2341/43/1
SEQNUM=2737
SUBSYSTEM=usb
TYPE=2/0/0
UDEV_LOG=6
USEC_INITIALIZED=16618911419

UDEV  [16619.516472] add      /devices/pci0000:00/0000:00:12.0/usb3/3-1/3-1:1.1 (usb)
ACTION=add
DEVPATH=/devices/pci0000:00/0000:00:12.0/usb3/3-1/3-1:1.1
DEVTYPE=usb_interface
DRIVER=cdc_acm
INTERFACE=10/0/0
MODALIAS=usb:v2341p0043d0001dc02dsc00dp00ic0Aisc00ip00in01
PRODUCT=2341/43/1
SEQNUM=2740
SUBSYSTEM=usb
TYPE=2/0/0
UDEV_LOG=6
USEC_INITIALIZED=16619516339

UDEV  [16619.516920] add      /devices/pci0000:00/0000:00:12.0/usb3/3-1/3-1:1.0 (usb)
ACTION=add
DEVPATH=/devices/pci0000:00/0000:00:12.0/usb3/3-1/3-1:1.0
DEVTYPE=usb_interface
INTERFACE=2/2/1
MODALIAS=usb:v2341p0043d0001dc02dsc00dp00ic02isc02ip01in00
PRODUCT=2341/43/1
SEQNUM=2738
SUBSYSTEM=usb
TYPE=2/0/0
UDEV_LOG=6
USEC_INITIALIZED=16619516552

UDEV  [16619.666198] add      /devices/pci0000:00/0000:00:12.0/usb3/3-1/3-1:1.0/tty/ttyACM0 (tty)
ACTION=add
DEVLINKS=/dev/serial/by-id/usb-Arduino__www.arduino.cc__0043_754393133373519132C0-if00 /dev/serial/by-path/pci-0000:00:12.0-usb-0:1:1.0
DEVNAME=/dev/ttyACM0
DEVPATH=/devices/pci0000:00/0000:00:12.0/usb3/3-1/3-1:1.0/tty/ttyACM0
ID_BUS=usb
ID_MM_CANDIDATE=1
ID_MODEL=0043
ID_MODEL_ENC=0043
ID_MODEL_ID=0043
ID_PATH=pci-0000:00:12.0-usb-0:1:1.0
ID_PATH_TAG=pci-0000_00_12_0-usb-0_1_1_0
ID_REVISION=0001
ID_SERIAL=Arduino__www.arduino.cc__0043_754393133373519132C0
ID_SERIAL_SHORT=754393133373519132C0
ID_TYPE=generic
ID_USB_DRIVER=cdc_acm
ID_USB_INTERFACES=:020201:0a0000:
ID_USB_INTERFACE_NUM=00
ID_VENDOR=Arduino__www.arduino.cc_
ID_VENDOR_ENC=Arduino\x20\x28www.arduino.cc\x29
ID_VENDOR_ID=2341
MAJOR=166
MINOR=0
SEQNUM=2739
SUBSYSTEM=tty
UDEV_LOG=6
USEC_INITIALIZED=16619561894

Meu script:

#!/bin/bash gnome-terminal -x sh -c "sudo screen /dev/ttyACM* 115200; bash"

    
por stsdc 15.01.2015 / 13:04

1 resposta

0

Algumas coisas para testar:

  • O seu script está em execução, mas está apenas fazendo algo errado? As pessoas acidentalmente fazem todo tipo de pressupostos de ambiente, então apenas certifique-se de que há algo à prova de balas no script no início, por exemplo:

    echo running >> /home/z37/screenrun.log
    

    Se estiver funcionando, é algo que você pode consertar. Use caminhos completos. Nunca use substituições como ~ . O script será executado a partir de um contexto muito simples.

  • A sua regra UDEV está correta? Assista ao log enquanto você o conecta:

    sudo apt-get install expect-dev
    sudo unbuffer udevadm monitor --environment
    

    Verifique seu fornecedor, produto e publicações em série.

  • Tente uma pesquisa um pouco mais solta, ignorando KERNEL e SERIAL:

    SUBSYSTEM=="usb", ATTRS{idVendor}=="2341", ATTRS{idProduct}=="0043", RUN+="/home/z37/screenrun.sh
    
por Oli 15.01.2015 / 13:28

Tags