udev rule for matching USB class and subclass?

Petter Reinholdtsen pere at hungry.com
Mon Oct 10 14:26:21 BST 2016


Hi.

I've been trying to figure out if it is possible to write a udev rule
matching USB class and subclass, without any success so far.  My goal is
to write a rule matching any smart card reader, instead of individual
smart card readers.  But is it possible with udev?

With AppStream / isenkram I can match it using the modaliases from the
kernel.  The following oneliner will print the modalias for any smart
card reader installed in the system:

  for mod in $(cat $(find /sys/|grep modalias|grep usb)); do \
     case "$mod" in usb:*ic0Bisc00ip*) echo $mod; esac; \
  done

But the scdaemon udev rule list individual vendor/product IDs instead of
specifying class 0B and subclass 00.  It there any way around this?

<URL: http://www.usb.org/developers/defined_class/#BaseClass0Bh > list
the USB bus class for smart cards. :)

-- 
Happy hacking
Petter Reinholdtsen



More information about the Pkg-systemd-maintainers mailing list