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

* Re: [PATCH] usb.agent - fix interpretation of hex values (PRODUCT and sysfs)
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Andrey Borzenkov @ 2003-08-06 19:32 UTC (permalink / raw)
  To: linux-hotplug

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

On Wednesday 06 August 2003 23:09, Andrey Borzenkov wrote:
> Both PRODUCT and all values in sysfs are passed as hex while bash attempts
> to evaluate them as decimal by default.
>

oops, it sneaked in by mistake from some unrelated experiments. PRODUCT is 
already OK of course, sorry.

updated patch attached

-andrey

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

--- hotplug-2003_08_05/etc/hotplug/usb.agent.sysfs_is_hex	2003-08-06 23:04:43.000000000 +0400
+++ hotplug-2003_08_05/etc/hotplug/usb.agent	2003-08-06 23:24:40.000000000 +0400
@@ -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

* Re: [PATCH] usb.agent - fix interpretation of hex values (PRODUCT and sysfs)
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Greg KH @ 2003-10-13 23:45 UTC (permalink / raw)
  To: linux-hotplug

On Wed, Aug 06, 2003 at 11:32:23PM +0400, Andrey Borzenkov wrote:
> On Wednesday 06 August 2003 23:09, Andrey Borzenkov wrote:
> > Both PRODUCT and all values in sysfs are passed as hex while bash attempts
> > to evaluate them as decimal by default.
> >
> 
> oops, it sneaked in by mistake from some unrelated experiments. PRODUCT is 
> already OK of course, sorry.
> 
> updated patch attached

Sorry for the very long delay.

I've applied the patch, thanks.

greg k-h


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
SourceForge.net hosts over 70,000 Open Source Projects.
See the people who have HELPED US provide better services:
Click here: http://sourceforge.net/supporters.php
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ 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).