Re: [linux-usb-devel] why was MODALIAS removed from usb kernelevents? [u]

From: Kay Sievers
Date: Tue Aug 21 2007 - 07:37:32 EST


On Tue, 2007-08-21 at 00:36 -0700, Greg KH wrote:
> On Fri, Aug 17, 2007 at 04:22:04PM +0200, Andreas Jellinghaus [c] wrote:
> > http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=9f8b17e643fe6aa505629658445849397bda4e4f
> >
> > removes MODALIAS from one of the events,
>
> Which event?
>
> If you enable CONFIG_USB_DEVICE_CLASS, does everything work the same
> again?
>
> > this breaks user space applications like openct - everything that
> > depends on getting an event that has both the DEVICE= path to the usb
> > device and any information on the interface, so it can check if the
> > device is something it supports (in case of openct: smart card reader,
> > i.e. bInterfaceClass 0b).
>
> What specific udev rule are you matching against here that is now
> broken?
>
> > The text does not mention MODALIAS nor the reason for it's removal.
>
> The reason is we don't need the usb_device class anymore, but we still
> provide for the compatibility if you have an old distro with old udev
> rules that is expecting it (only rule we ran into was the one for the
> usbfs /dev nodes, but there might be more.)
>
> confused,

Hmm, I'm a bit confused too. :)

The subject says MODALIAS was removed, but I don't think that it ever
was there for a usb-device event. And sure, it's still there for a
usb-interface event.

Andreas, do I read this right, you miss:
DEVICE, PRODUCT, TYPE
in the usb-interface event, and they only exist in the usb-device event?

And MODALIAS is not what you miss, and the subject of the mail is
misleading?

Note:
DEVICE only exists when USB_DEVICE_CLASS=y, because it unfortunately is
prefixed with the /proc mount path, which doesn't exist when the /proc
device node support is not compiled in, so nothing should depend on the
existence of DEVICE. Most of the recent distros don't mount or configure
usbfs anymore, but use /dev/bus/usb/ device nodes, which can handle
access control lists for local users.

Is this patch fixing your problem?


From: Kay Sievers <kay.sievers@xxxxxxxx>
Subject: usb: add PRODUCT, TYPE to usb-interface events

Signed-off-by: Kay Sievers <kay.sievers@xxxxxxxx>
---

message.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)

diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
index b6bd05e..3b57d53 100644
--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -1358,6 +1358,30 @@ static int usb_if_uevent(struct device *dev, char **envp, int num_envp,
usb_dev = interface_to_usbdev(intf);
alt = intf->cur_altsetting;

+#ifdef CONFIG_USB_DEVICEFS
+ if (add_uevent_var(envp, num_envp, &i,
+ buffer, buffer_size, &length,
+ "DEVICE=/proc/bus/usb/%03d/%03d",
+ usb_dev->bus->busnum, usb_dev->devnum))
+ return -ENOMEM;
+#endif
+
+ if (add_uevent_var(envp, num_envp, &i,
+ buffer, buffer_size, &length,
+ "PRODUCT=%x/%x/%x",
+ le16_to_cpu(usb_dev->descriptor.idVendor),
+ le16_to_cpu(usb_dev->descriptor.idProduct),
+ le16_to_cpu(usb_dev->descriptor.bcdDevice)))
+ return -ENOMEM;
+
+ if (add_uevent_var(envp, num_envp, &i,
+ buffer, buffer_size, &length,
+ "TYPE=%d/%d/%d",
+ usb_dev->descriptor.bDeviceClass,
+ usb_dev->descriptor.bDeviceSubClass,
+ usb_dev->descriptor.bDeviceProtocol))
+ return -ENOMEM;
+
if (add_uevent_var(envp, num_envp, &i,
buffer, buffer_size, &length,
"INTERFACE=%d/%d/%d",

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/