Skip to contentSkip to conversation

Problem with hotplug-2001_01_16 + quick solution

PATCH Martin Volf 2 participants 2 messages Jan 22, 2001 – Jan 23, 2001

lore
Share & tools
lore
#0 lore raw

There is one column missing in usb.distmap. I don't know which one.

My USB mouse (Genius Netmouse Pro) has PRODUCTE8/2/0.0 (DEVICE=/proc/bus/usb/001/002, INTERFACE=3/1/2, TYPE not set) in kernel 2.2.19pre6, so usb.agent aborts its execution in usb_convert_vars function. In the kernel 2.4.0 it is OK. I don't have other USB devices yet.

With modutils 2.4.1 the file /lib/modules/uname -r/modules.usbmap exists even in the 2.2 kernel, but contains only one line, so usb.distmap is not used.

Here's patch to usb.agent, which worked for me both in 2.2 and 2.4 kernel:

= cut here =

usb.agent renamed from usb.agent.original +1 -1
@@ -103,7 +103,7 @@
     fi
 
     local XPROD
-    XPROD=`echo $PRODUCT | $AWK -F/ '{print "0x" $1, "0x" $2, "0x" $3 }'`
+    XPROD=`echo $PRODUCT | $AWK -F/ '{print "0x" $1, "0x" $2, "0x" $3 }'

| $AWK -F. '{print $1 }'`
read usb_idVendor usb_idProduct usb_bcdDevice << EOT
$XPROD
EOT
@@ -232,11 +232,14 @@
LABEL="USB product $PRODUCT"

# on 2.4 systems, modutils maintains MAP_CURRENT
- # ... but on 2.2 systems, it can't; use MAP_DISTRIB
+ # ... but on 2.2 systems, it can't; use MAP_DISTMAP
if [ -r $MAP_CURRENT ]; then
load_drivers usb $MAP_CURRENT "$LABEL"

-    elif [ -r $MAP_DISTRIB ]; then
-    	load_drivers usb $MAP_DISTRIB "$LABEL"
+    fi
+    if [ "$DRIVERS" != "" ]; then
+	FOUND=true
+    elif [ -r $MAP_DISTMAP ]; then
+    	load_drivers usb $MAP_DISTMAP "$LABEL"
     fi
     if [ "$DRIVERS" != "" ]; then

FOUND=true
= cut here =

Martin Volf

_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
http://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#1 lore raw

Martin --

Thanks for that problem report for 2.2 hotplugging!

Quoted 1 line

My USB mouse (Genius Netmouse Pro) has PRODUCTE8/2/0.0

                                                       ^^^
Quoted 3 lines

(DEVICE=/proc/bus/usb/001/002, INTERFACE=3/1/2, TYPE not set) in kernel 2.2.19pre6, so usb.agent aborts its execution in usb_convert_vars function. In the kernel 2.4.0 it is OK.

Greg, that looks like hotplug in 2.2.* needs to get a bugfix from a few months back -- changing the product version code to be straight hex, not a BCD-ized string. Can you get that fix to Alan? (A case of ripping out ugly to_bcd code ... :-)

Quoted 3 lines

With modutils 2.4.1 the file /lib/modules/uname -r/modules.usbmap exists even in the 2.2 kernel, but contains only one line, so usb.distmap is not used.

Looks like modutils is not going to ensure that file only exists on kernels that support MODULE_DEVICE_TABLE sections in dynamically linked modules. I'll check in a fix (this AM) that will test the kernel version.

(So Keith, that means you needn't bother tweaking modutils to avoid generating empty "modules.usbmap" files.)

For the record, I hate testing software version stamps, because that's known to be a fragile scheme. Feature tests are reliable, but we don't seem to have a way to test "do modules on this system support MODULE_DEVICE_TABLE" -- so "is kernel version 2.4/2.5/..." is the best heuristic I can identify.

- Dave

_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
http://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel