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

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

  • Subject: Re: [OCLUG-Tech] how to use udevadm to print *just* KERNEL and SUBSYSTEM?
  • From: Walt Sullivan <walts [ at ] magma [ dot ] ca>
  • Date: Mon, 18 Mar 2013 15:12:43 -0400
Append "| egrep 'looking at|KERNEL==|SUBSYSTEM=='" to your command.

On Sat, 2013-03-16 at 13:41 -0400, Robert P. J. Day wrote:
> 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
>