Hello,
I don't know if this is a bug, but it seems so...
The two fields "bcdUSB" and "bcdDevice" in the struct
"usb_device_descriptor" are, as the name indicates, BCD - Binary-Coded
Decimal. According to the "Universal Serial Bus Specification - Revision
1.1" pages 197 and 198:
Table 9-7. Standard Device Descriptor
Offset Field Size Value Description
-------------------------------------------------------------------------
2 bcdUSB 2 BCD USB Specification Release Number
in Binary-Coded Decimal (i.e.,
2.10 is 210H). This field
identifies the release of the USB
Specification with which the
device and its descriptors are
compliant.
12 bcdDevice 2 BCD Device release number in
binary-coded decimal
Also, both values are in 0xJJMN format, where JJ is the major version
number, M is the minor version number and N the sub minor version number.
The problem is when any of those versions are greater then 9, and
/proc/bus/usb/devices shows them as hexadecimal values, as in:
P: Vendor=04cb ProdID=0108 Rev=10.00
Where bcdDevice is 0x1000 and I think the correct representation would be
16.00, in other words, print the values in decimal.
bcdUSB also have the same problem, but because there are only 3 possible
values (0x0200, 0x0110 and 0x0100) and all versions bellow 9, it is hidden.
Rui Saraiva
Possible patch follows (Apply to 2.5.50):
--------------------------------------------------------------------------------
diff -Nru linux-2.5.50/drivers/usb/core/devices.c
linux-current/drivers/usb/core/devices.c
--- linux-2.5.50/drivers/usb/core/devices.c 2002-11-27 22:36:22.000000000 +0000
+++ linux-current/drivers/usb/core/devices.c 2002-12-09 03:02:35.000000000 +0000
@@ -89,12 +89,12 @@
"B: Alloc=%3d/%3d us (%2d%%), #Int=%3d, #Iso=%3d\n";
static char *format_device1 =
-/* D: Ver=xx.xx Cls=xx(sssss) Sub=xx Prot=xx MxPS=dd #Cfgs=dd */
- "D: Ver=%2x.%02x Cls=%02x(%-5s) Sub=%02x Prot=%02x MxPS=%2d #Cfgs=%3d\n";
+/* D: Ver=dd.dd Cls=xx(sssss) Sub=xx Prot=xx MxPS=dd #Cfgs=dd */
+ "D: Ver=%2d.%d%d Cls=%02x(%-5s) Sub=%02x Prot=%02x MxPS=%2d #Cfgs=%3d\n";
static char *format_device2 =
-/* P: Vendor=xxxx ProdID=xxxx Rev=xx.xx */
- "P: Vendor=%04x ProdID=%04x Rev=%2x.%02x\n";
+/* P: Vendor=xxxx ProdID=xxxx Rev=dd.dd */
+ "P: Vendor=%04x ProdID=%04x Rev=%2d.%d%d\n";
static char *format_config =
/* C: #Ifs=dd Cfg#=dd Atr=xx MPwr=dddmA */
@@ -330,7 +330,8 @@
if (start > end)
return start;
start += sprintf (start, format_device1,
- desc->bcdUSB >> 8, desc->bcdUSB & 0xff,
+ USB_MAJOR_VERSION(desc->bcdUSB),
+ USB_MINOR_VERSION(desc->bcdUSB),
+USB_SUB_VERSION(desc->bcdUSB),
desc->bDeviceClass,
class_decode (desc->bDeviceClass),
desc->bDeviceSubClass,
@@ -341,7 +342,8 @@
return start;
start += sprintf(start, format_device2,
desc->idVendor, desc->idProduct,
- desc->bcdDevice >> 8, desc->bcdDevice & 0xff);
+ USB_MAJOR_VERSION(desc->bcdDevice),
+ USB_MINOR_VERSION(desc->bcdDevice),
+USB_SUB_VERSION(desc->bcdDevice));
return start;
}
diff -Nru linux-2.5.50/include/linux/usb_ch9.h linux-current/include/linux/usb_ch9.h
--- linux-2.5.50/include/linux/usb_ch9.h 2002-11-27 22:35:59.000000000 +0000
+++ linux-current/include/linux/usb_ch9.h 2002-12-09 03:18:48.000000000 +0000
@@ -126,6 +126,13 @@
/*-------------------------------------------------------------------------*/
+/*
+ * BCD versions, for bcdUSB and bcdDevice fields
+ */
+#define USB_MAJOR_VERSION(version) ((version & 0xFF00) >> 8)
+#define USB_MINOR_VERSION(version) ((version & 0x00F0) >> 4)
+#define USB_SUB_VERSION(version) (version & 0x000F)
+
/* USB_DT_DEVICE: Device descriptor */
struct usb_device_descriptor {
__u8 bLength;
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel