linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb.agent - fix interpretation of hex values (PRODUCT and sysfs)
@ 2003-08-06 19:09 Andrey Borzenkov
  2003-08-06 19:32 ` Andrey Borzenkov
  2003-10-13 23:45 ` Greg KH
  0 siblings, 2 replies; 3+ messages in thread
From: Andrey Borzenkov @ 2003-08-06 19:09 UTC (permalink / raw)
  To: linux-hotplug

[-- Attachment #1: Type: text/plain, Size: 133 bytes --]

Both PRODUCT and all values in sysfs are passed as hex while bash attempts to 
evaluate them as decimal by default.

regards

-andrey

[-- Attachment #2: hotplug-2003_08_05-hex.patch --]
[-- Type: text/x-diff, Size: 1713 bytes --]

--- hotplug-2003_08_05/etc/hotplug/usb.agent.sysfs_is_hex	2003-08-06 22:59:43.000000000 +0400
+++ hotplug-2003_08_05/etc/hotplug/usb.agent	2003-08-06 23:03:32.000000000 +0400
@@ -183,9 +183,9 @@
                                   -e "s+/\([0-9]\)\.\([0-9][0-9]\)+/0\1\2+" \
 			  -e "s+/\([0-9][0-9]\)\.\([0-9][0-9]\)+/\1\2+"`
     set `echo $PRODUCT | $AWK -F/ '{print "0x" $1, "0x" $2, "0x" $3 }'` ''
-    usb_idVendor=$1
-    usb_idProduct=$2
-    usb_bcdDevice=$3
+    usb_idVendor=0x$1
+    usb_idProduct=0x$2
+    usb_bcdDevice=0x$3
 
     if [ "$TYPE" != "" ]; then
     	IFS=/
@@ -195,9 +195,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_bDeviceClass=1000
@@ -213,9 +213,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_bInterfaceClass=1000

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-10-13 23:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-08-06 19:09 [PATCH] usb.agent - fix interpretation of hex values (PRODUCT and sysfs) Andrey Borzenkov
2003-08-06 19:32 ` Andrey Borzenkov
2003-10-13 23:45 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).