Quoting Bj|rn Augustsson <[EMAIL PROTECTED]>:
> Hello!
Erm, here's the actual patch...
/August.
--
Wrong on most accounts. const Foo *foo; and Foo const *foo; mean the same: foo
being a pointer to const Foo. const Foo const *foo; would mean the same but is
illegal (double const). You are confusing this with Foo * const foo; and const
Foo * const foo; respectively. -David Kastrup, comp.os.linux.development.system
Binary files ../../usbutils-0.9/.usb.ids.swp and ../../usbutils-0.9-mod/.usb.ids.swp
differ
diff -urN ../../usbutils-0.9/lsusb.c ../../usbutils-0.9-mod/lsusb.c
--- ../../usbutils-0.9/lsusb.c Fri Nov 23 11:57:21 2001
+++ ../../usbutils-0.9-mod/lsusb.c Sat Jan 12 19:51:16 2002
@@ -100,7 +100,6 @@
ctrl.value = value;
ctrl.index = index;
ctrl.length = size;
- ctrl.timeout = 1000;
ctrl.data = data;
ctrl.timeout = CTRL_TIMEOUT;
try = 0;
@@ -130,11 +129,11 @@
b[0] = b[1] = 0xbf;
ret = usb_control_msg(fd, USB_DIR_IN, USB_REQ_GET_DESCRIPTOR, (USB_DT_STRING
<< 8) | id, 0, sizeof(b), b);
if (ret < 0) {
- fprintf(stderr, "cannot get string descriptor %d, error = %s(%d)\n",
id, strerror(errno), errno);
+ fprintf(stderr, "*** Cannot get string descriptor %d, error =
+%s(%d)\n", id, strerror(errno), errno);
return 0;
}
if (ret < 2 || b[0] < 2 || b[1] != USB_DT_STRING) {
- fprintf(stderr, "string descriptor %d invalid (%02x %02x; len=%d)\n",
id, b[0], b[1], ret);
+ fprintf(stderr, "*** String descriptor %d invalid (%02x %02x;
+len=%d)\n", id, b[0], b[1], ret);
return 0;
}
#if 0
@@ -888,6 +887,49 @@
printf("\n");
}
+static void dump_unit(unsigned int data, unsigned int len)
+{
+ char *systems[5] = { "None", "SI Linear", "SI Rotation", "English Linear",
+"English Rotation" };
+
+ char *units[5][8] = {
+ { "None", "None", "None", "None", "None", "None", "None", "None" },
+ { "None", "Centimeter", "Gram", "Seconds", "Kelvin", "Ampere",
+"Candela", "None" },
+ { "None", "Radians", "Gram", "Seconds", "Kelvin", "Ampere",
+"Candela", "None" },
+ { "None", "Inch", "Slug", "Seconds", "Fahrenheit", "Ampere",
+"Candela", "None" },
+ { "None", "Degrees", "Slug", "Seconds", "Fahrenheit", "Ampere",
+"Candela", "None" },
+ };
+
+ int i;
+ char sys;
+
+ /* First nibble tells us which system we're in. */
+ sys = data & 0xf;
+ data >>= 4;
+
+ if(sys > 4)
+ printf("System: Invalid, Unit: ");
+ else
+ printf("System: %s, Unit: ", systems[sys]);
+
+ for (i=1 ; i<len*2 ; i++) {
+ char nibble = data & 0xf;
+ data >>= 4;
+ if (nibble != 0) {
+ printf("%s", units[sys][i]);
+ if(nibble != 1) {
+ /* This is a _signed_ nibble(!) */
+
+ int val = nibble & 0x7;
+ if(nibble & 0x08)
+ val = ~val & 0xf -1;
+ printf("^%d", val);
+ }
+ printf(" ");
+ }
+ }
+ printf("\n");
+}
+
/* ---------------------------------------------------------------------- */
/*
@@ -933,6 +975,15 @@
printf("%s%s\n", indent, names_hutus((hut << 16) + data));
break;
+ case 0x54 : /* Unit Exponent */
+ printf("%sUnit Exponent: %i\n", indent, (signed char)data);
+ break;
+
+ case 0x64 : /* Unit */
+ printf("%s", indent);
+ dump_unit(data, bsize);
+ break;
+
case 0xa0 : /* Collection */
printf("%s", indent);
switch (data) {
@@ -948,9 +999,25 @@
printf("Logical\n");
break;
+ case 0x03:
+ printf("Report\n");
+ break;
+
+ case 0x04:
+ printf("Named Array\n");
+ break;
+
+ case 0x05:
+ printf("Usage Switch\n");
+ break;
+
+ case 0x06:
+ printf("Usage Modifier\n");
+ break;
+
default:
if(data & 0x80)
- printf("Vendor definened\n");
+ printf("Vendor defined\n");
else
printf("Reserved for future use.\n");
}
@@ -971,6 +1038,7 @@
data & 0x80 ? "Volatile": "Non_Volatile",
data &0x100 ? "Buffered Bytes": "Bitfield"
);
+ break;
}
i += 1 + bsize;
}
@@ -1005,11 +1073,11 @@
continue;
len = buf[7+3*i] | (buf[8+3*i] << 8);
if (len > sizeof(dbuf)) {
- printf("report descriptor too long\n");
+ printf("*** Report descriptor too long\n");
continue;
}
if ((n = usb_control_msg(fd, 0x81 , 0x06, 0x22<<8, interface_number,
len, dbuf)) < 0) {
- printf("cannot get report descriptor\n");
+ perror("*** Cannot get report descriptor");
continue;
}
dump_report_desc(dbuf, n);
@@ -1027,7 +1095,7 @@
if (usb_control_msg(fd, USB_DIR_IN, USB_REQ_GET_DESCRIPTOR, (USB_DT_CONFIG <<
8) | nr,
0, USB_DT_CONFIG_SIZE, buf) < 0) {
- fprintf(stdout, "cannot get config descriptor %d, %s (%d)\n", nr,
strerror(errno), errno);
+ fprintf(stderr, "*** Cannot get config descriptor %d, %s (%d)\n", nr,
+strerror(errno), errno);
return;
}
if (buf[0] < USB_DT_CONFIG_SIZE || buf[1] != USB_DT_CONFIG)
@@ -1039,7 +1107,7 @@
}
if (usb_control_msg(fd, USB_DIR_IN, USB_REQ_GET_DESCRIPTOR, (USB_DT_CONFIG <<
8) | nr,
0, sz, buf) < 0) {
- fprintf(stdout, "cannot get config descriptor %d, %s (%d)\n", nr,
strerror(errno), errno);
+ fprintf(stderr, "*** Cannot get config descriptor %d, %s (%d)\n", nr,
+strerror(errno), errno);
return;
}
p = buf;
@@ -1196,11 +1264,11 @@
int fd;
if ((fd = open(path, O_RDWR)) == -1) {
- fprintf(stderr, "cannot open %s, %s (%d)\n", path, strerror(errno),
errno);
+ fprintf(stderr, "*** Cannot open %s, %s (%d)\n", path,
+strerror(errno), errno);
return;
}
if (usb_control_msg(fd, USB_DIR_IN, USB_REQ_GET_DESCRIPTOR, (USB_DT_DEVICE <<
8), 0, USB_DT_DEVICE_SIZE, buf) < 0) {
- fprintf(stderr, "cannot get config descriptor, %s (%d)\n",
strerror(errno), errno);
+ fprintf(stderr, "*** Cannot get config descriptor, %s (%d)\n",
+strerror(errno), errno);
goto err;
}
vid = buf[8] | (buf[9] << 8);
@@ -1226,7 +1294,7 @@
d = opendir(procbususb);
if (!d) {
- fprintf(stderr, "cannot open %s, %s (%d)\n", procbususb,
strerror(errno), errno);
+ fprintf(stderr, "*** Cannot open %s, %s (%d)\n", procbususb,
+strerror(errno), errno);
return;
}
while ((de = readdir(d))) {
@@ -1244,11 +1312,11 @@
continue;
snprintf(buf, sizeof(buf), "%s/%s/%s", procbususb,
de->d_name, de2->d_name);
if ((fd = open(buf, O_RDWR)) == -1) {
- fprintf(stderr, "cannot open %s, %s (%d)\n", buf,
strerror(errno), errno);
+ fprintf(stderr, "*** Cannot open %s, %s (%d)\n", buf,
+strerror(errno), errno);
continue;
}
if (read(fd, buf, USB_DT_DEVICE_SIZE) != USB_DT_DEVICE_SIZE) {
- fprintf(stderr, "cannot read device descriptor %s
(%d)\n", strerror(errno), errno);
+ fprintf(stderr, "*** Cannot read device descriptor %s
+(%d)\n", strerror(errno), errno);
goto err;
}
vid = buf[8] | (buf[9] << 8);
@@ -1292,7 +1360,7 @@
snprintf(buf, sizeof(buf), "%s/devices", procbususb);
if ((fd = open(buf, O_RDONLY)) == -1) {
- fprintf(stderr, "cannot open %s, %s (%d)\n", buf, strerror(errno),
errno);
+ fprintf(stderr, "*** Cannot open %s, %s (%d)\n", buf,
+strerror(errno), errno);
return;
}
devtree_parsedevfile(fd);
@@ -1378,7 +1446,7 @@
}
if ((err = names_init("./usb.ids")) != 0)
if(err = names_init(USBIDS_FILE)) {
- printf("Error, cannot open USBIDS File \"%s\", %s\n",
USBIDS_FILE, strerror(err));
+ fprintf(stderr, "Error, cannot open USBIDS File \"%s\", %s\n",
+USBIDS_FILE, strerror(err));
exit(1);
}
if (treemode)
diff -urN ../../usbutils-0.9/usb.ids ../../usbutils-0.9-mod/usb.ids
--- ../../usbutils-0.9/usb.ids Thu Dec 21 12:31:32 2000
+++ ../../usbutils-0.9-mod/usb.ids Sat Jan 12 14:01:32 2002
@@ -210,6 +210,7 @@
001e IntelliMouse Explorer
001d Natural Keyboard Pro
001a SideWinder Precision Racing Wheel
+ 001b SideWinder Force Feedback 2 Joystick
0025 IntelliEye Mouse
0026 SideWinder GamePad Pro
0027 SideWinger PnP GamePad
@@ -2488,6 +2489,112 @@
045 Eraser
046 Tablet Pick
HUT 0f PID Page
+ 000 Undefined
+ 001 Physical Interface Device
+ 020 Normal
+ 021 Set Effect Report
+ 022 Effect Block Index
+ 023 Parameter Block Offset
+ 024 ROM Flag
+ 025 Effect Type
+ 026 ET Constant Force
+ 027 ET Ramp
+ 028 ET Custom Force Data
+ 030 ET Square
+ 031 ET Sine
+ 032 ET Triangle
+ 033 ET Sawtooth Up
+ 034 ET Sawtooth Down
+ 040 ET Spring
+ 041 ET Damper
+ 042 ET Inertia
+ 043 ET Friction
+ 050 Duration
+ 051 Sample Period
+ 052 Gain
+ 053 Trigger Button
+ 054 Trigger Repeat Interval
+ 055 Axes Enable
+ 056 Direction Enable
+ 057 Direction
+ 058 Type Specific Block Offset
+ 059 Block Type
+ 05A Set Envelope Report
+ 05B Attack Level
+ 05C Attack Time
+ 05D Fade Level
+ 05E Fade Time
+ 05F Set Condition Report
+ 060 CP Offset
+ 061 Positive Coefficient
+ 062 Negative Coefficient
+ 063 Positive Saturation
+ 064 Negative Saturation
+ 065 Dead Band
+ 066 Download Force Sample
+ 067 Isoch Custom Force Enable
+ 068 Custom Force Data Report
+ 069 Custom Force Data
+ 06A Custom Force Vendor Defined Data
+ 06B Set Custom Force Report
+ 06C Custom Force Data Offset
+ 06D Sample Count
+ 06E Set Periodic Report
+ 06F Offset
+ 070 Magnitude
+ 071 Phase
+ 072 Period
+ 073 Set Constant Force Report
+ 074 Set Ramp Force Report
+ 075 Ramp Start
+ 076 Ramp End
+ 077 Effect Operation Report
+ 078 Effect Operation
+ 079 Op Effect Start
+ 07A Op Effect Start Solo
+ 07B Op Effect Stop
+ 07C Loop Count
+ 07D Device Gain Report
+ 07E Device Gain
+ 07F PID Pool Report
+ 080 RAM Pool Size
+ 081 ROM Pool Size
+ 082 ROM Effect Block Count
+ 083 Simultaneous Effects Max
+ 084 Pool Alignment
+ 085 PID Pool Move Report
+ 086 Move Source
+ 087 Move Destination
+ 088 Move Length
+ 089 PID Block Load Report
+ 08B Block Load Status
+ 08C Block Load Success
+ 08D Block Load Full
+ 08E Block Load Error
+ 08F Block Handle
+ 090 PID Block Free Report
+ 091 Type Specific Block Handle
+ 092 PID State Report
+ 094 Effect Playing
+ 095 PID Device Control Report
+ 096 PID Device Control
+ 097 DC Enable Actuators
+ 098 DC Disable Actuators
+ 099 DC Stop All Effects
+ 09A DC Device Reset
+ 09B DC Device Pause
+ 09C DC Device Continue
+ 09F Device Paused
+ 0A0 Actuators Enabled
+ 0A4 Safety Switch
+ 0A5 Actuator Override Switch
+ 0A6 Actuator Power
+ 0A7 Start Delay
+ 0A8 Parameter Block Size
+ 0A9 Device Managed Pool
+ 0AA Shared Parameter Blocks
+ 0AB Create New Effect Report
+ 0AC RAM Pool Available
HUT 10 Unicode
HUT 14 Alphanumeric Display
000 Undefined