diff --git a/usbutils-0.11-hidcc.patch b/usbutils-0.11-hidcc.patch new file mode 100644 index 0000000..55c7d0d --- /dev/null +++ b/usbutils-0.11-hidcc.patch @@ -0,0 +1,86 @@ +--- 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", diff --git a/usbutils.spec b/usbutils.spec index dc10917..ef9514c 100644 --- a/usbutils.spec +++ b/usbutils.spec @@ -1,9 +1,10 @@ Name: usbutils Version: 0.11 -Release: 5 +Release: 6 Source: http://usb.cs.tum.edu/download/%{name}-%{version}.tar.gz Patch: usbutils-0.9-hwdata.patch Patch2: usbutils-0214.patch +Patch3: usbutils-0.11-hidcc.patch License: GPL BuildRoot: %{_tmppath}/%{name}-%{version}-root Requires: hwdata @@ -18,8 +19,9 @@ USB bus. %prep %setup -q -%patch -p1 -%patch2 -p1 +%patch -p1 -b .hwdata +%patch2 -p1 -b .0214 +%patch3 -p1 -b .hidcc %build cp /usr/share/libtool/config.{sub,guess} . @@ -47,6 +49,10 @@ rm -f $RPM_BUILD_ROOT%{_datadir}/usb.ids rm -rf $RPM_BUILD_ROOT %changelog +* Wed Sep 1 2004 Thomas Woerner 0.11-6 +- added patch from Aurelien Jarno for unknown HID Country Code entries in + usb.ids (#127415) + * Tue Jun 15 2004 Elliot Lee - rebuilt