home | list info | list archive | date index | thread index

[OCLUG-Tech] how to use udevadm to print *just* KERNEL and SUBSYSTEM?

  • Subject: [OCLUG-Tech] how to use udevadm to print *just* KERNEL and SUBSYSTEM?
  • From: "Robert P. J. Day" <rpjday [ at ] crashcourse [ dot ] ca>
  • Date: Sat, 16 Mar 2013 13:41:17 -0400 (EDT)
  currently writing a tutorial on udev and i'm drawing a blank on
something that should be simple -- what variation of udevadm can i use
to print just the KERNEL and SUBSYSTEM values corresponding to a
device?

  here's the tutorial:

http://www.crashcourse.ca/wiki/index.php/Udev

it's still *very* incomplete but, partway down, you can see how to do
an attribute walk on (in my case, using the example of a usb-serial
cable) /dev/ttyUSB0:

 $ udevadm info -a -p $(udevadm info -q path -n /dev/ttyUSB0)

that command generates a pile of output, and what i care about is at
the very beginning:

  looking at device '/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.4/2-1.4:1.0/ttyUSB0/tty/ttyUSB0':
    KERNEL=="ttyUSB0"
    SUBSYSTEM=="tty"
    DRIVER==""

all i want are the values of KERNEL and SUBSYSTEM since it's those
values that are used by the rules file that's eventually consulted. so
for the sake of brevity, i want to figure out what command and options
will print just that, and i just can't find it.

  am i missing something obvious?

rday

-- 

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================