Re: udev rules help

2016-08-31 Thread Jacek Konieczny

On 2016-08-31 09:51, Elan Ruusamäe wrote:

On 31.08.2016 10:47, Jacek Konieczny wrote:

# grep add /etc/udev/rules.d/80-idcard.rules
SUBSYSTEM=="usb", ACTION=="add", ENV{DEVTYPE}=="usb_device",
ENV{ID_MODEL}=="*Smart*Card*Reader*", RUN+="/sbin/service pcscd start"


What init do you use.


i mean the RUN+= part is never executed no matter what rules i write.
even only the ACTION="add" part


Is the rule actually matched?
Maybe there is some other rule later with RUN= instead of RUN+=?
Have you tried "change" instead of "add"? Handling "add" only often 
causes problems (the device is not fully set up, or the "add" was 
handled long before the rule become available (e.g. in initramfs)).


Jacek
___
pld-devel-en mailing list
pld-devel-en@lists.pld-linux.org
http://lists.pld-linux.org/mailman/listinfo/pld-devel-en


Re: udev rules help

2016-08-31 Thread Elan Ruusamäe

On 31.08.2016 10:47, Jacek Konieczny wrote:

# grep add /etc/udev/rules.d/80-idcard.rules
SUBSYSTEM=="usb", ACTION=="add", ENV{DEVTYPE}=="usb_device",
ENV{ID_MODEL}=="*Smart*Card*Reader*", RUN+="/sbin/service pcscd start"


What init do you use. 


i mean the RUN+= part is never executed no matter what rules i write. 
even only the ACTION="add" part


--
glen

___
pld-devel-en mailing list
pld-devel-en@lists.pld-linux.org
http://lists.pld-linux.org/mailman/listinfo/pld-devel-en


Re: udev rules help

2016-08-31 Thread Jacek Konieczny

On 2016-08-31 07:28, Elan Ruusamäe wrote:

i'm trying to write udev rule to start service when usb device is attached

here's what i got. yet it doesn't work

# grep add /etc/udev/rules.d/80-idcard.rules
SUBSYSTEM=="usb", ACTION=="add", ENV{DEVTYPE}=="usb_device",
ENV{ID_MODEL}=="*Smart*Card*Reader*", RUN+="/sbin/service pcscd start"


What init do you use. This _might_ work with systemd, as 'service' just 
shcedules a systemd job, but won't work with rc-scripts, as udev rules 
are not allowed to start long running processes.


udev rules are not a place for starting daemons, which is well 
documented thing.



i even tried something very simple:
ACTION=="add", RUN+="/sbin/service pcscd start"

that also didn't work (attaching device did not start the service), how
to debug this?


Just don't do this. Switch to systemd and use systemd device 
dependencies in the .service file to start the service.


If you want to stick with rc-scripts, then wait for the device in the 
init script.


Jacek
___
pld-devel-en mailing list
pld-devel-en@lists.pld-linux.org
http://lists.pld-linux.org/mailman/listinfo/pld-devel-en


udev rules help

2016-08-30 Thread Elan Ruusamäe

hi

i'm trying to write udev rule to start service when usb device is attached

here's what i got. yet it doesn't work

# grep add /etc/udev/rules.d/80-idcard.rules
SUBSYSTEM=="usb", ACTION=="add", ENV{DEVTYPE}=="usb_device", 
ENV{ID_MODEL}=="*Smart*Card*Reader*", RUN+="/sbin/service pcscd start"



# udevadm info -a -e
...
P: /devices/pci:00/:00:06.0/usb4/4-2
N: bus/usb/004/006
E: BUSNUM=004
E: DEVNAME=/dev/bus/usb/004/006
E: DEVNUM=006
E: DEVPATH=/devices/pci:00/:00:06.0/usb4/4-2
E: DEVTYPE=usb_device
E: DRIVER=usb
E: ID_BUS=usb
E: ID_MODEL=Smart_Card_Reader_USB
E: ID_MODEL_ENC=Smart\x20Card\x20Reader\x20USB
E: ID_MODEL_FROM_DATABASE=CardMan 1021
E: ID_MODEL_ID=1021
E: ID_REVISION=0100
E: ID_SERIAL=OMNIKEY_Smart_Card_Reader_USB
E: ID_USB_INTERFACES=:0b:
E: ID_VENDOR=OMNIKEY
E: ID_VENDOR_ENC=OMNIKEY
E: ID_VENDOR_FROM_DATABASE=OmniKey AG
E: ID_VENDOR_ID=076b
E: MAJOR=189
E: MINOR=389
E: PRODUCT=76b/1021/100
E: SUBSYSTEM=usb
E: TYPE=0/0/0
E: USEC_INITIALIZED=98884670622


i even tried something very simple:
ACTION=="add", RUN+="/sbin/service pcscd start"

that also didn't work (attaching device did not start the service), how 
to debug this?


--
glen

___
pld-devel-en mailing list
pld-devel-en@lists.pld-linux.org
http://lists.pld-linux.org/mailman/listinfo/pld-devel-en