Skip to contentSkip to conversation

drivers/usb/core/usb.c: add MODNAME env var to hotplug

PATCH In review Roman Kagan 3 participants 6 messages Mar 4, 2005 – Mar 27, 2005 USB

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers/usb/core/usb.c: add MODNAME env var to hotplug

Hi,

The patch below adds MODNAME environment variable to usb hotplug callout, allowing for its straightforward use with modprobe.

The patch expects a matching change in scripts/mod/file2alias.c I sent to linux-hotplug-devel list a few days ago (i.e. puts bcdDevice in MODNAME as dXXXX, rather that dlXXXXdhXXXX).

Please consider applying.

Roman.

 drivers/usb/core/usb.c |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+)
drivers/usb/core/usb.c renamed from drivers/usb/core/usb.c.modname +25 -0
@@ -615,7 +615,32 @@
 					alt->desc.bInterfaceSubClass,
 					alt->desc.bInterfaceProtocol))
 			return -ENOMEM;
+
+		if (add_hotplug_env_var(envp, num_envp, &i,
+					buffer, buffer_size, &length,
+					"MODNAME=usb:v%04Xp%04Xd%04Xdc%02Xdsc%02Xdp%02Xic%02Xisc%02Xip%02X",
+					le16_to_cpu(usb_dev->descriptor.idVendor),
+					le16_to_cpu(usb_dev->descriptor.idProduct),
+					le16_to_cpu(usb_dev->descriptor.bcdDevice),
+					usb_dev->descriptor.bDeviceClass,
+					usb_dev->descriptor.bDeviceSubClass,
+					usb_dev->descriptor.bDeviceProtocol,
+					alt->desc.bInterfaceClass,
+					alt->desc.bInterfaceSubClass,
+					alt->desc.bInterfaceProtocol))
+			return -ENOMEM;
 	}
+	else
+		if (add_hotplug_env_var(envp, num_envp, &i,
+					buffer, buffer_size, &length,
+					"MODNAME=usb:v%04Xp%04Xd%04Xdc%02Xdsc%02Xdp%02Xic*isc*ip*",
+					le16_to_cpu(usb_dev->descriptor.idVendor),
+					le16_to_cpu(usb_dev->descriptor.idProduct),
+					le16_to_cpu(usb_dev->descriptor.bcdDevice),
+					usb_dev->descriptor.bDeviceClass,
+					usb_dev->descriptor.bDeviceSubClass,
+					usb_dev->descriptor.bDeviceProtocol))
+			return -ENOMEM;
 
 	envp[i] = NULL;
 

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
_______________________________________________
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 4 lines · Roman Kagan

Hi,

The patch below adds MODNAME environment variable to usb hotplug callout, allowing for its straightforward use with modprobe.

Sorry for the delay, but I've now added this. I changed the variable name to MODALIAS to make it match up with what it really is referring to.

Quoted 3 lines

The patch expects a matching change in scripts/mod/file2alias.c I sent to linux-hotplug-devel list a few days ago (i.e. puts bcdDevice in MODNAME as dXXXX, rather that dlXXXXdhXXXX).

I changed this back, as this change doesn't seem to have gone anywhere.

thanks,

greg k-h

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
_______________________________________________
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 Roman Kagan
Quoted 7 lines · Greg KH
Quoted 2 lines · Roman Kagan

The patch below adds MODNAME environment variable to usb hotplug callout, allowing for its straightforward use with modprobe.

Sorry for the delay, but I've now added this. I changed the variable name to MODALIAS to make it match up with what it really is referring to.

OK.

Quoted 5 lines
Quoted 3 lines

The patch expects a matching change in scripts/mod/file2alias.c I sent to linux-hotplug-devel list a few days ago (i.e. puts bcdDevice in MODNAME as dXXXX, rather that dlXXXXdhXXXX).

I changed this back, as this change doesn't seem to have gone anywhere.

It was sent to linux-hotplug-devel and cc to you on Feb. 26, as I thought it was up to you to include it. Has it got lost and should I resend it, or should I better send it to another list? I think it's worth merging as the current scheme bites everybody with nontrivial bcdDevice range.

Roman.

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
_______________________________________________
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 Roman Kagan
Quoted 11 lines · Roman Kagan
Quoted 5 lines
Quoted 3 lines

The patch expects a matching change in scripts/mod/file2alias.c I sent to linux-hotplug-devel list a few days ago (i.e. puts bcdDevice in MODNAME as dXXXX, rather that dlXXXXdhXXXX).

I changed this back, as this change doesn't seem to have gone anywhere.

It was sent to linux-hotplug-devel and cc to you on Feb. 26, as I thought it was up to you to include it. Has it got lost and should I resend it, or should I better send it to another list? I think it's worth merging as the current scheme bites everybody with nontrivial bcdDevice range.

Ok, care to resend it? I saw a lot of different patches floating around, and didn't know which one was the decided apon best fix.

thanks,

greg k-h

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#4 lore raw

Re: [linux-usb-devel] Re: [PATCH] drivers/usb/core/usb.c: add MODNAME

In reply to Roman Kagan
Quoted 5 lines · Greg KH
Quoted 3 lines · Roman Kagan
Quoted 3 lines
Quoted 3 lines

The patch expects a matching change in scripts/mod/file2alias.c I sent to linux-hotplug-devel list a few days ago (i.e. puts bcdDevice in MODNAME as dXXXX, rather that dlXXXXdhXXXX).

Speaking of breaking modules.alias compatibility (as current hotplug scripts will not work anymore)...

Why not change PCI IDs from %08X to %04X ?

/mjt

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
_______________________________________________
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 Roman Kagan
Quoted 9 lines · Michael Tokarev
Quoted 5 lines · Greg KH
Quoted 3 lines · Roman Kagan
Quoted 3 lines
Quoted 3 lines

The patch expects a matching change in scripts/mod/file2alias.c I sent to linux-hotplug-devel list a few days ago (i.e. puts bcdDevice in MODNAME as dXXXX, rather that dlXXXXdhXXXX).

Speaking of breaking modules.alias compatibility (as current hotplug scripts will not work anymore)...

Mind explaining how they did? I cooked up this patch exactly because I couldn't think of a way to make hotplug scripts work with module aliases for a non-trivial bcdDevice range. Moreover, for the most common trivial one of no bcdDevice matching, the name constructed to match against the old pattern dl*dh* will match against the new one d*.

So I think that it is not exactly similar to

Quoted 1 line

Why not change PCI IDs from %08X to %04X ?

which is going to break the setups which did work.

Cheers,
Roman.

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel