Lines 35-40
Link Here
|
35 |
#include <unistd.h> |
35 |
#include <unistd.h> |
36 |
#include <stdio.h> |
36 |
#include <stdio.h> |
37 |
#include <stdarg.h> |
37 |
#include <stdarg.h> |
|
|
38 |
#include <endian.h> |
38 |
|
39 |
|
39 |
#include <linux/types.h> |
40 |
#include <linux/types.h> |
40 |
#ifdef HAVE_LINUX_USBDEVICE_FS_H |
41 |
#ifdef HAVE_LINUX_USBDEVICE_FS_H |
Lines 76-81
Link Here
|
76 |
|
77 |
|
77 |
static void dump_junk2(unsigned char *, unsigned int); |
78 |
static void dump_junk2(unsigned char *, unsigned int); |
78 |
|
79 |
|
|
|
80 |
static int to_me(int x) |
81 |
{ |
82 |
#ifndef __BIG_ENDIAN__ |
83 |
return x; |
84 |
#else |
85 |
return (((x) & 0x00ff) << 8 | ((x) & 0xff00) >> 8); |
86 |
#endif |
87 |
} |
88 |
|
79 |
/* ---------------------------------------------------------------------- */ |
89 |
/* ---------------------------------------------------------------------- */ |
80 |
|
90 |
|
81 |
int lprintf(unsigned int vl, const char *format, ...) |
91 |
int lprintf(unsigned int vl, const char *format, ...) |
Lines 293-299
Link Here
|
293 |
" iSerial %5u %s\n" |
303 |
" iSerial %5u %s\n" |
294 |
" bNumConfigurations %5u\n", |
304 |
" bNumConfigurations %5u\n", |
295 |
buf[0], buf[1], buf[3], buf[2], buf[4], cls, buf[5], subcls, buf[6], proto, buf[7], |
305 |
buf[0], buf[1], buf[3], buf[2], buf[4], cls, buf[5], subcls, buf[6], proto, buf[7], |
296 |
vid, vendor, pid, product, buf[13], buf[12], buf[14], mfg, buf[15], prod, buf[16], serial, buf[17]); |
306 |
to_me(vid), vendor, to_me(pid), product, buf[13], buf[12], buf[14], mfg, buf[15], prod, buf[16], serial, buf[17]); |
297 |
dump_junk(buf, " ", 18); |
307 |
dump_junk(buf, " ", 18); |
298 |
} |
308 |
} |
299 |
|
309 |
|
Lines 1374-1380
Link Here
|
1374 |
pid = buf[10] | (buf[11] << 8); |
1384 |
pid = buf[10] | (buf[11] << 8); |
1375 |
get_vendor_string(vendor, sizeof(vendor), vid); |
1385 |
get_vendor_string(vendor, sizeof(vendor), vid); |
1376 |
get_product_string(product, sizeof(product), vid, pid); |
1386 |
get_product_string(product, sizeof(product), vid, pid); |
1377 |
printf("Device: ID %04x:%04x %s %s\n", vid, pid, vendor, product); |
1387 |
printf("Device: ID %04x:%04x %s %s\n", to_me(vid), to_me(pid), vendor, product); |
1378 |
dumpdev(buf, fd, flags); |
1388 |
dumpdev(buf, fd, flags); |
1379 |
status=0; |
1389 |
status=0; |
1380 |
err: |
1390 |
err: |
Lines 1432-1438
Link Here
|
1432 |
get_product_string(product, sizeof(product), vid, pid); |
1442 |
get_product_string(product, sizeof(product), vid, pid); |
1433 |
if (verblevel > 0) |
1443 |
if (verblevel > 0) |
1434 |
printf("\n"); |
1444 |
printf("\n"); |
1435 |
printf("Bus %s Device %s: ID %04x:%04x %s %s\n", de->d_name, de2->d_name, vid, pid, vendor, product); |
1445 |
printf("Bus %s Device %s: ID %04x:%04x %s %s\n", de->d_name, de2->d_name, to_me(vid), to_me(pid), vendor, product); |
1436 |
if (verblevel > 0) |
1446 |
if (verblevel > 0) |
1437 |
dumpdev(buf, fd, flags); |
1447 |
dumpdev(buf, fd, flags); |
1438 |
err: |
1448 |
err: |