From: Andrey Borzenkov <arvidjaar@mail.ru>
To: linux-hotplug@vger.kernel.org
Subject: [PATCH] usb.agent - fix interpretation of hex values (PRODUCT and sysfs)
Date: Wed, 06 Aug 2003 19:09:12 +0000 [thread overview]
Message-ID: <marc-linux-hotplug-106019730516701@msgid-missing> (raw)
[-- 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
next reply other threads:[~2003-08-06 19:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-08-06 19:09 Andrey Borzenkov [this message]
2003-08-06 19:32 ` [PATCH] usb.agent - fix interpretation of hex values (PRODUCT and sysfs) Andrey Borzenkov
2003-10-13 23:45 ` Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=marc-linux-hotplug-106019730516701@msgid-missing \
--to=arvidjaar@mail.ru \
--cc=linux-hotplug@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.