Skip to contentSkip to conversation

usblp attributes split in udevinfo

DISCUSSION Arne Ahrend 3 participants 6 messages Feb 13, 2007 – Feb 14, 2007

lore
Share & tools
lore
#0 lore raw

Hi,

lately the relevant attributes for my USB printer udev rule are split over two device groups in udevinfo output (running udev-103):

looking at device '/class/usb/lp0':

    KERNEL="lp0"
    SUBSYSTEM="usb"
    DRIVER=""
    ATTR{dev}="180:0"

looking at parent device '/devices/pci0000:00/0000:00:10.1/usb2/2-2/2-2:1.0':

    KERNELS="2-2:1.0"
    SUBSYSTEMS="usb"
    DRIVERS="usblp"
    ATTRS{ieee1284_id}="MFG:Brother_CMD:PCL5,PJL,PCLXL_MDL:HL-1050 series_CLS:PRINTER_"
    ATTRS{modalias}="usb:v04F9p0002d0100dc00dsc00dp00ic07isc01ip02"
    ATTRS{bInterfaceProtocol}="02"
    ATTRS{bInterfaceSubClass}="01"
    ATTRS{bInterfaceClass}="07"
    ATTRS{bNumEndpoints}="02"
    ATTRS{bAlternateSetting}=" 0"
    ATTRS{bInterfaceNumber}="00"

[....]

It is not clear to me if this intended (but it does make writing rules for persistent printer symlinks much harder than it used to be around 2.6.12 or so), or something that should be fixed in udev or the kernel (I am running 2.6.20 now).

In particular the DRIVER="" for /class/usb/lp0 seems awkward, should it not be usblp? The next group has DRIVERS="usblp", but a device which is not suitable for printing. Using its ATTRS{modalias} for my udev printer rules I get symlinks to device nodes like

	crw-rw---- 1 root root 254, 14 2007-02-13 18:53 /dev/usbdev2.3_ep82

and not to /dev/usb/lp0.

Can anyone shed some light on this?

Cheers,

Arne

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier. Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0709&bid&3057&dat1642
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#1 lore raw
Quoted 22 lines · Arne Ahrend

lately the relevant attributes for my USB printer udev rule are split over two device groups in udevinfo output (running udev-103):

looking at device '/class/usb/lp0':

    KERNEL="lp0"
    SUBSYSTEM="usb"
    DRIVER=""
    ATTR{dev}="180:0"

looking at parent device '/devices/pci0000:00/0000:00:10.1/usb2/2-2/2-2:1.0':

    KERNELS="2-2:1.0"
    SUBSYSTEMS="usb"
    DRIVERS="usblp"
    ATTRS{ieee1284_id}="MFG:Brother_CMD:PCL5,PJL,PCLXL_MDL:HL-1050 series_CLS:PRINTER_"
    ATTRS{modalias}="usb:v04F9p0002d0100dc00dsc00dp00ic07isc01ip02"
    ATTRS{bInterfaceProtocol}="02"
    ATTRS{bInterfaceSubClass}="01"
    ATTRS{bInterfaceClass}="07"
    ATTRS{bNumEndpoints}="02"
    ATTRS{bAlternateSetting}=" 0"
    ATTRS{bInterfaceNumber}="00"
Quoted 5 lines

[....]

It is not clear to me if this intended (but it does make writing rules for persistent printer symlinks much harder than it used to be around 2.6.12 or so), or something that should be fixed in udev or the kernel (I am running 2.6.20 now).

This all looks fine.

Quoted 1 line

In particular the DRIVER="" for /class/usb/lp0 seems awkward, should it not be usblp?

The lp0 device has no driver, that is correct.

The next group has

Quoted 6 lines

DRIVERS="usblp", but a device which is not suitable for printing. Using its ATTRS{modalias} for my udev printer rules I get symlinks to device nodes like

        crw-rw---- 1 root root 254, 14 2007-02-13 18:53 /dev/usbdev2.3_ep82

and not to /dev/usb/lp0.

Can anyone shed some light on this?

What are you trying to do?

Kay

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier. Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0709&bid&3057&dat1642
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#2 lore raw
In reply to Arne Ahrend
Quoted 9 lines · On Tue, 13 Feb 2007 23:10:25 +0100 "Kay Sievers" <[email protected]> wrote:

The next group has

Quoted 6 lines

DRIVERS="usblp", but a device which is not suitable for printing. Using its ATTRS{modalias} for my udev printer rules I get symlinks to device nodes like

        crw-rw---- 1 root root 254, 14 2007-02-13 18:53 /dev/usbdev2.3_ep82

and not to /dev/usb/lp0.

Can anyone shed some light on this?

What are you trying to do?

Thanks for replying. I am trying to create a persistent symlink (e.g. HL-1050) to the lp0 device.

The modalias or ieee1284_id attributes are in one group, but KERNEL="lp0" is in another. So what is the best way to have a symlink /dev/HL-1050 -> /dev/usb/lp0 created automatically?

It used to be as easy as

	SUBSYSTEM="usb", sysfs{modalias}="usb:v04F9p0002d0100dc00dsc00dp00ic07isc01ip02", SYMLINK="HL-1050"

but that now gives a link to device nodes like /dev/usbdev2.3_ep82 instead of /dev/usb/lp0.

Arne

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier. Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0709&bid&3057&dat1642
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#3 lore raw
In reply to Arne Ahrend
Quoted 7 lines · Arne Ahrend

Thanks for replying. I am trying to create a persistent symlink (e.g. HL-1050) to the lp0 device.

The modalias or ieee1284_id attributes are in one group, but KERNEL="lp0" is in another. So what is the best way to have a symlink /dev/HL-1050 -> /dev/usb/lp0 created automatically?

Quoted 6 lines

It used to be as easy as

SUBSYSTEM="usb",
sysfs{modalias}="usb:v04F9p0002d0100dc00dsc00dp00ic07isc01ip02", SYMLINK="HL-1050"

Why not change that minimally to:

SUBSYSTEM="usb", \
ATTRS{modalias}="usb:v04F9p0002d0100dc00dsc00dp00ic07isc01ip02", \
SYMLINK="HL-1050"

(like output of udevinfo suggests)
and perhaps add a KERNEL="lp*"

Signature · 11 lines
Matthias Schwarzott (zzam)

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0709&bid&3057&dat1642
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
#4 lore raw
In reply to Arne Ahrend
Quoted 9 lines · Arne Ahrend
Quoted 6 lines · On Tue, 13 Feb 2007 23:10:25 +0100 "Kay Sievers" <[email protected]> wrote:

The next group has

Quoted 5 lines

DRIVERS="usblp", but a device which is not suitable for printing. Using its ATTRS{modalias} for my udev printer rules I get symlinks to device nodes like

        crw-rw---- 1 root root 254, 14 2007-02-13 18:53 /dev/usbdev2.3_ep82

and not to /dev/usb/lp0.

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

Can anyone shed some light on this?

What are you trying to do?

Thanks for replying. I am trying to create a persistent symlink (e.g. HL-1050) to the lp0 device.

The modalias or ieee1284_id attributes are in one group, but KERNEL="lp0" is in another.

Udev can match on _all_ parent devices, the attributes don't need to be at the device itself. ATTRS walk up all parent devices to match, ATTR looks only at the device itself.

Quoted 7 lines

So what is the best way to have a symlink /dev/HL-1050 -> /dev/usb/lp0 created automatically?

It used to be as easy as

	SUBSYSTEM="usb", sysfs{modalias}="usb:v04F9p0002d0100dc00dsc00dp00ic07isc01ip02", SYMLINK="HL-1050"

but that now gives a link to device nodes like /dev/usbdev2.3_ep82 instead of /dev/usb/lp0.

You are matching the "usb_device" event.

Try:
KERNEL="lp*", ATTRS{ieee1284_id}="*HL-1050*", SYMLINK+="HL-1050"

Kay

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CIDÞVDEV
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#5 lore raw
In reply to Arne Ahrend
Quoted 2 lines · On Wed, 14 Feb 2007 08:18:49 +0100 Kay Sievers <[email protected]> wrote:

Try:
KERNEL="lp*", ATTRS{ieee1284_id}="*HL-1050*", SYMLINK+="HL-1050"

Many thanks -- that solves my problem!

Arne

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CIDÞVDEV
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel