From mboxrd@z Thu Jan 1 00:00:00 1970 From: Petr Baudis Date: Wed, 17 Mar 2004 22:46:29 +0000 Subject: [PATCH][hotplug] Proper hexnum support for USB sysfs tree Message-Id: <20040317224629.GC2267@pasky.ji.cz> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-hotplug@vger.kernel.org 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. --- hotplug-2004_03_11/etc/hotplug/usb.agent Wed Mar 17 23:24:28 2004 +++ hotplug-2004_03_11+pasky/etc/hotplug/usb.agent Wed Mar 17 23:34:36 2004 @@ -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, -- 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 Linux-hotplug-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel