Skip to contentSkip to conversation

Proper hexnum support for USB sysfs tree

PATCH In review Petr Baudis 2 participants 2 messages Mar 17, 2004 – Mar 26, 2004

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Proper hexnum support for USB sysfs tree

Hello,

the hotplug's default usb.agent doesn't handle properly hex numbers in the
USB sysfs tree, the trivial patch below should fix that. Otherwise each USB hotplug run produces few very annoying kind-of '[: 0a: integer expression expected' errors.

etc/hotplug/usb.agent +6 -6
@@ -187,9 +187,9 @@
         usb_bDeviceProtocol=$3
 	IFS="$DEFAULT_IFS"
     elif [ -r $SYSFS/$DEVPATH/bDeviceClass ]; then
-	usb_bDeviceClass=$(cat $SYSFS/$DEVPATH/bDeviceClass)
-	usb_bDeviceSubClass=$(cat $SYSFS/$DEVPATH/bDeviceSubClass)
-	usb_bDeviceProtocol=$(cat $SYSFS/$DEVPATH/bDeviceProtocol)
+	usb_bDeviceClass=$((0x$(cat $SYSFS/$DEVPATH/bDeviceClass)))
+	usb_bDeviceSubClass=$((0x$(cat $SYSFS/$DEVPATH/bDeviceSubClass)))
+	usb_bDeviceProtocol=$((0x$(cat $SYSFS/$DEVPATH/bDeviceProtocol)))
     else
 	# out-of-range values
 	usb_bDeviceClass00
@@ -205,9 +205,9 @@
     	usb_bInterfaceProtocol=$3
 	IFS="$DEFAULT_IFS"
     elif [ -r $SYSFS/$DEVPATH/bInterfaceClass ]; then
-	usb_bInterfaceClass=$(cat $SYSFS/$DEVPATH/bInterfaceClass)
-	usb_bInterfaceSubClass=$(cat $SYSFS/$DEVPATH/bInterfaceSubClass)
-	usb_bInterfaceProtocol=$(cat $SYSFS/$DEVPATH/bInterfaceProtocol)
+	usb_bInterfaceClass=$((0x$(cat $SYSFS/$DEVPATH/bInterfaceClass)))
+	usb_bInterfaceSubClass=$((0x$(cat $SYSFS/$DEVPATH/bInterfaceSubClass)))
+	usb_bInterfaceProtocol=$((0x$(cat $SYSFS/$DEVPATH/bInterfaceProtocol)))
     else
 	# out-of-range values
 	usb_bInterfaceClass00

Please apply.

Kind regards,

Signature · 16 lines
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
The reasonable man adapts himself to the world; the unreasonable one
persists in trying to adapt the world to himself. Therefore all
progress depends on the unreasonable man. -- George Bernard Shaw


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id70&alloc_id638&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 6 lines · Petr Baudis

Hello,

the hotplug's default usb.agent doesn't handle properly hex numbers in the
USB sysfs tree, the trivial patch below should fix that. Otherwise each USB hotplug run produces few very annoying kind-of '[: 0a: integer expression expected' errors.

Thanks, already fixed in the cvs tree.

greg k-h

-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id70&alloc_id638&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel