87 lines
3.5 KiB
Diff
87 lines
3.5 KiB
Diff
|
--- usbutils-0.11/names.c.hidcc 2002-06-17 11:13:47.000000000 +0200
|
||
|
+++ usbutils-0.11/names.c 2004-09-01 10:53:12.716443518 +0200
|
||
|
@@ -116,6 +116,7 @@
|
||
|
static struct genericstrtable *physdess[HASHSZ] = { NULL, };
|
||
|
static struct genericstrtable *hutus[HASHSZ] = { NULL, };
|
||
|
static struct genericstrtable *langids[HASHSZ] = { NULL, };
|
||
|
+static struct genericstrtable *countrycodes[HASHSZ] = { NULL, };
|
||
|
|
||
|
/* ---------------------------------------------------------------------- */
|
||
|
|
||
|
@@ -164,6 +165,11 @@
|
||
|
return names_genericstrtable(biass, b);
|
||
|
}
|
||
|
|
||
|
+const char *names_countrycode(unsigned int countrycode)
|
||
|
+{
|
||
|
+ return names_genericstrtable(countrycodes, countrycode);
|
||
|
+}
|
||
|
+
|
||
|
const char *names_vendor(u_int16_t vendorid)
|
||
|
{
|
||
|
struct vendor *v;
|
||
|
@@ -402,6 +408,11 @@
|
||
|
return new_genericstrtable(biass, name, b);
|
||
|
}
|
||
|
|
||
|
+static int new_countrycode(const char *name, unsigned int countrycode)
|
||
|
+{
|
||
|
+ return new_genericstrtable(countrycodes, name, countrycode);
|
||
|
+}
|
||
|
+
|
||
|
/* ---------------------------------------------------------------------- */
|
||
|
|
||
|
#define DBG(x)
|
||
|
@@ -553,6 +564,27 @@
|
||
|
DBG(printf("line %5u audio terminal type %02x %s\n", linectr, u, cp));
|
||
|
continue;
|
||
|
}
|
||
|
+ if (buf[0] == 'H' && buf[1] == 'C' && buf[2] == 'C' && isspace(buf[3])) {
|
||
|
+ /* HID Descriptor bCountryCode */
|
||
|
+ cp = buf+3;
|
||
|
+ while (isspace(*cp))
|
||
|
+ cp++;
|
||
|
+ if (!isxdigit(*cp)) {
|
||
|
+ fprintf(stderr, "Invalid HID country code at line %u\n", linectr);
|
||
|
+ continue;
|
||
|
+ }
|
||
|
+ u = strtoul(cp, &cp, 10);
|
||
|
+ while (isspace(*cp))
|
||
|
+ cp++;
|
||
|
+ if (!*cp) {
|
||
|
+ fprintf(stderr, "Invalid HID country code at line %u\n", linectr);
|
||
|
+ continue;
|
||
|
+ }
|
||
|
+ if (new_countrycode(cp, u))
|
||
|
+ fprintf(stderr, "Duplicate HID country code at line %u country %02u %s\n", linectr, u, cp);
|
||
|
+ DBG(printf("line %5u keyboard country code %02u %s\n", linectr, u, cp));
|
||
|
+ continue;
|
||
|
+ }
|
||
|
if (isxdigit(*cp)) {
|
||
|
/* vendor */
|
||
|
u = strtoul(cp, &cp, 16);
|
||
|
--- usbutils-0.11/names.h.hidcc 2000-11-06 16:00:06.000000000 +0100
|
||
|
+++ usbutils-0.11/names.h 2004-09-01 10:53:14.097253193 +0200
|
||
|
@@ -44,6 +44,7 @@
|
||
|
extern const char *names_langid(u_int16_t langid);
|
||
|
extern const char *names_physdes(u_int8_t ph);
|
||
|
extern const char *names_bias(u_int8_t b);
|
||
|
+extern const char *names_countrycode(unsigned int countrycode);
|
||
|
extern int names_init(char *n);
|
||
|
|
||
|
/* ---------------------------------------------------------------------- */
|
||
|
--- usbutils-0.11/lsusb.c.hidcc 2004-08-30 17:57:04.000000000 +0200
|
||
|
+++ usbutils-0.11/lsusb.c 2004-09-01 11:03:48.208861173 +0200
|
||
|
@@ -1205,9 +1205,9 @@
|
||
|
" bLength %5u\n"
|
||
|
" bDescriptorType %5u\n"
|
||
|
" bcdHID %2x.%02x\n"
|
||
|
- " bCountryCode %5u\n"
|
||
|
+ " bCountryCode %5u %s\n"
|
||
|
" bNumDescriptors %5u\n",
|
||
|
- buf[0], buf[1], buf[3], buf[2], buf[4], buf[5]);
|
||
|
+ buf[0], buf[1], buf[3], buf[2], buf[4], names_countrycode(buf[4]) ? : "Unknown", buf[5]);
|
||
|
for (i = 0; i < buf[5]; i++)
|
||
|
printf(" bDescriptorType %5u %s\n"
|
||
|
" wDescriptorLength %5u\n",
|