Skip to contentSkip to conversation

MODALIAS to stay

DISCUSSION Andreas Jellinghaus 3 participants 3 messages Jul 10, 2007

lore
Share & tools
lore
#0 lore raw

I have udev rules lines like this:
SYSFS{idVendor}="0973", SYSFS{idProduct}="0001", RUN+="/lib/udev/openct_usb" and
SYSFS{bInterfaceClass}="0b", SYSFS{bInterfaceSubClass}="00", SYSFS{bInterfaceProtocol}="00" RUN+="/lib/udev/openct_usb"

Now I see the kernel has a MODALIAS line that contains all the information I need. "usb:v0973p0001*" or "usb:*ic0Bisc00*" would match the same way as using sysfs.

So I wonder: can I match MODALIAS like this somehow in udev rules? and is there any reason not to use MODALIAS?

as far as I know the kernel creates the MODALIAS line in drivers/usb/core/driver.c so I guess it is always part of an event and thus shouldn't have any timing problem, right?

Thanks for your help.

Regards, Andreas

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
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 11 lines · Andreas Jellinghaus

I have udev rules lines like this:
SYSFS{idVendor}="0973", SYSFS{idProduct}="0001", RUN+="/lib/udev/openct_usb" and
SYSFS{bInterfaceClass}="0b", SYSFS{bInterfaceSubClass}="00", SYSFS{bInterfaceProtocol}="00" RUN+="/lib/udev/openct_usb"

Now I see the kernel has a MODALIAS line that contains all the information I need. "usb:v0973p0001*" or "usb:*ic0Bisc00*" would match the same way as using sysfs.

So I wonder: can I match MODALIAS like this somehow in udev rules?

ENV{MODALIAS}="usb:v0973p0001*|usb:*ic0Bisc00*" should match.

Quoted 1 line

and is there any reason not to use MODALIAS?

No, it should be fine.

Quoted 3 lines

as far as I know the kernel creates the MODALIAS line in drivers/usb/core/driver.c so I guess it is always part of an event and thus shouldn't have any timing problem, right?

It should always be in the environment, yes.

Kay

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
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 Andreas Jellinghaus
Quoted 3 lines · Kay Sievers
Quoted 1 line

So I wonder: can I match MODALIAS like this somehow in udev rules?

ENV{MODALIAS}="usb:v0973p0001*|usb:*ic0Bisc00*" should match.

ok, thanks.

Quoted 1 line

It should always be in the environment, yes.

thanks, will rewrite my rules file to use this instead of sysfs.

Regards, Andreas

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel