Compare commits

...
Sign in to create a new pull request.

81 commits

Author SHA1 Message Date
Fedora Release Engineering
47080022c8 Rebuilt for https://fedoraproject.org/wiki/Fedora_45_Mass_Rebuild 2026-07-17 08:16:56 +00:00
Fedora Release Engineering
63dfef4e1e Rebuilt for https://fedoraproject.org/wiki/Fedora_44_Mass_Rebuild 2026-01-17 19:42:20 +00:00
Jan Macku
97d149ff9f Update to 019 2026-01-06 14:43:55 +01:00
Fedora Release Engineering
00e2a49eef Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild 2025-07-25 19:53:10 +00:00
Lukas Nykryn
93afe3bd89 add usbreset (but in Fedora only) 2025-03-14 09:48:43 +01:00
Fedora Release Engineering
2702e75256 Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild 2025-01-19 13:57:35 +00:00
Lukas Nykryn
97577a7158 Update to 018 2024-10-22 14:25:32 +02:00
Fedora Release Engineering
c5649c6860 Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild 2024-07-20 08:26:15 +00:00
Fedora Release Engineering
82ab0edfea Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild 2024-01-27 07:19:10 +00:00
Jan Macku
d73574bbac Update to 017 2024-01-17 16:02:05 +01:00
Peter Robinson
3d0e811abe Update to 016 2023-10-29 14:39:35 +00:00
Fedora Release Engineering
a3f959ad68 Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2023-07-22 17:17:37 +00:00
Lukáš Zaoral
702d4cf95c
migrate to SPDX license format 2023-04-11 17:29:18 +02:00
Fedora Release Engineering
e9296e71d9 Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2023-01-21 05:59:19 +00:00
Jan Macku
ac347d96db Update to usbutils-015
Resolves: #2150489
2023-01-13 13:15:44 +01:00
Matthew Miller
a3047582da Convert to rpmautospec 2022-12-06 08:22:58 -05:00
Fedora Release Engineering
11c9ed6a05 Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2022-07-23 11:33:53 +00:00
Fedora Release Engineering
ede58a2719 - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2022-01-22 03:40:54 +00:00
Peter Robinson
9f04bb3d30 014 2021-08-11 09:21:45 +01:00
Fedora Release Engineering
1f9a607b89 - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2021-07-23 20:11:44 +00:00
Fedora Release Engineering
8845d49195 - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2021-01-27 22:48:43 +00:00
Tom Stellard
b6b8d47c20 Add BuildRequires: make
https://fedoraproject.org/wiki/Changes/Remove_make_from_BuildRoot
2021-01-09 00:30:21 +00:00
Peter Robinson
39ca8a790a v013 2020-10-29 08:41:58 +00:00
Fedora Release Engineering
a8785b205e - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2020-07-29 13:26:48 +00:00
Fedora Release Engineering
632b85a3a0 - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2020-01-31 02:48:09 +00:00
Fedora Release Engineering
414d26dd0b - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2019-07-27 02:40:26 +00:00
Peter Robinson
57cc4e883b add changelog 2019-05-12 13:25:12 +01:00
Peter Robinson
4c669d0d41 0.12 2019-05-12 13:06:51 +01:00
Fedora Release Engineering
d58c1a9dc0 - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2019-02-03 10:58:16 +00:00
Lukas Nykryn
c3b9cd58d0 add build requirement to gcc 2018-07-13 11:02:56 +02:00
Lukas Nykryn
0e4a3c2646 add missing BuildRequires 2018-07-13 10:48:21 +02:00
Lukas Nykryn
7ef37e8db4 Merge remote-tracking branch 'fedora/master' into rhel-8.0 2018-06-08 14:32:40 +02:00
Lukas Nykryn
d6510e2b16 add v010 upstream fixes 2018-06-08 14:28:23 +02:00
Lukas Nykryn
e4226cecd8 v010 2018-05-16 09:33:44 +02:00
Troy Dawson
407f68e61d Fedora 28 Mass Merge into rhel-8.0 - fed_hash: 1aacd25679 2018-05-04 06:29:42 +00:00
Fedora Release Engineering
1aacd25679 - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2018-02-09 20:11:40 +00:00
Peter Robinson
c4935d9749 cleanup .gitignore 2017-12-04 03:08:20 +00:00
Peter Robinson
35592576d1 fix path 2017-12-04 02:59:45 +00:00
Peter Robinson
def3914d50 drop obsolete patches 2017-12-04 02:52:30 +00:00
Peter Robinson
3fb4ad2446 v009 2017-12-04 02:16:04 +00:00
Troy Dawson
19fb52973c - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild fed_hash: 5ea2f00f7d 2017-09-25 13:17:17 +00:00
Release Configuration Management
190e13361f New branch setup 2017-09-23 02:52:16 +00:00
Fedora Release Engineering
5ea2f00f7d - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild 2017-08-03 09:54:21 +00:00
Fedora Release Engineering
96504e4d20 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild 2017-07-27 21:05:50 +00:00
Fedora Release Engineering
f5b61b5167 - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild 2017-02-11 16:50:43 +00:00
Peter Robinson
8bd081531f Don't ship usbutils pkgconfig file 2016-08-29 11:11:38 +01:00
Fedora Release Engineering
96fb13a79a - Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild 2016-02-05 02:27:58 +00:00
Peter Robinson
ef3b1fb1cd Fix FTBFS, cleanup and modernise spec, use %%license 2015-07-19 12:42:35 +01:00
Dennis Gilmore
56bfd9828f - Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild 2015-06-19 01:42:35 +00:00
Till Maas
cf22eecf06 Rebuilt for Fedora 23 Change
https://fedoraproject.org/wiki/Changes/Harden_all_packages_with_position-independent_code
2015-02-21 22:21:10 +01:00
Lukas Nykryn
ac92498031 add new sources 2014-10-23 10:09:45 +02:00
Lukas Nykryn
5c8beef151 usbutils-008 2014-10-23 09:33:12 +02:00
df12b1ead9 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild 2014-08-18 07:16:05 +00:00
Dennis Gilmore
16b004734d - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild 2014-06-07 22:05:21 -05:00
Dennis Gilmore
8c94d1fa1c - Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild 2013-08-04 00:48:32 -05:00
Lukas Nykryn
fe14af939c usbutils-007 (#971757) 2013-06-17 12:33:30 +02:00
Lukas Nykryn
32eb76963e lsusb-t: make sure that interfaces are added to lists only once (#914929) 2013-02-26 15:03:01 +01:00
Dennis Gilmore
b0a0086593 - Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild 2013-02-14 20:34:26 -06:00
Dennis Gilmore
a4c66b6cee - Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild 2012-07-21 21:11:18 -05:00
Lukas Nykryn
d031ca28c9 add new upstream tarball 2012-07-16 12:59:42 +02:00
Lukas Nykryn
ad04d9ed32 update to new upstream 006 2012-07-16 12:49:16 +02:00
Lukas Nykryn
71a2faac06 update to new upstream 005 2012-04-19 10:57:27 +02:00
Lukas Nykryn
c409919b38 Ignore missing driver symlink (#808934) 2012-04-19 10:30:11 +02:00
Dennis Gilmore
3279803c12 - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild 2012-01-14 01:40:01 -06:00
Lukas Nykryn
afcded7a37 fixed paths to usb.ids 2011-09-20 10:23:41 +02:00
Jiri Moskovcak
cd05bb15cd updated to the latest upstream version 004 2011-08-13 18:56:33 +02:00
Jiri Moskovcak
19bd905180 fixed path to usb.ids in lsusb.py 2011-08-13 18:51:23 +02:00
Nils Philippsen
28db1fbb34 Merge branch 'f15' 2011-06-27 14:59:30 +02:00
Nils Philippsen
08ae144374 don't use invalid config descriptors (#707853) 2011-06-27 14:56:28 +02:00
Jiri Moskovcak
add39a2d5b update to usbutils-003 2011-06-16 15:44:45 +02:00
Jiri Moskovcak
b55d1689c3 update to usbutils-002 2011-04-26 19:03:10 +02:00
Jiri Moskovcak
9d88b84e83 update to usbutils-002 2011-04-26 18:53:37 +02:00
Dennis Gilmore
25d49a1c75 - Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild 2011-02-07 18:42:29 -06:00
Jiri Moskovcak
47a22113d9 rebuild against new libusb 2011-01-27 14:07:00 +01:00
Jiri Moskovcak
1194b02fa1 forgot to push new sources 2011-01-06 13:07:19 +01:00
Jiri Moskovcak
1706bea6d4 update to new upstream 001
- updated usbhid-dump subproject
- usbutils: Support UVC frame-based descriptors
- usbutils: Support UVC MPEG2-TS format descriptor
- lsusb: Fix getting BOS and DEVQUAL descriptors
- lsusb: Dump the Pipe Usage desciptor
- lsusb: Fix bMaxBurst reporting
- lsusb: install into /usr/bin
- usbmisc: pull in unistd.h for readlink()
- lsusb: pull in stdlib.h for exit()
- lsusb: constify!
- usbutils: convert to libusb-1.0
- Update usbhid-dump to release 1.2
- usbutils: Fix compile error on Ubuntu 9.04
- usbutils: Make lsusb -t show USB 3.0 devices
2011-01-06 12:47:24 +01:00
Jiri Moskovcak
ce5ca4cb49 bump release 2010-10-27 14:39:59 +02:00
Jiri Moskovcak
61a5e4c6aa added libusb1-devel to build requires 2010-10-27 13:19:50 +02:00
Jiri Moskovcak
967f7cade2 new upstream version 0.91
- ads usbhid-dump
2010-10-27 13:17:53 +02:00
Jiri Moskovcak
07674cb54f new version - 0.90 2010-08-30 13:50:38 +02:00
Jiri Moskovcak
0947edecbf removed unused patches 2010-08-30 13:33:50 +02:00
14 changed files with 157 additions and 1156 deletions

2
.gitignore vendored
View file

@ -1 +1 @@
usbutils-0.86.tar.gz
/usbutils-*.tar.xz

106
changelog Normal file
View file

@ -0,0 +1,106 @@
* Sat Jul 23 2022 Fedora Release Engineering <releng@fedoraproject.org> - 014-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Sat Jan 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 014-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Wed Aug 11 2021 Peter Robinson <pbrobinson@fedoraproject.org> - 014-1
- Update to 014
- Cleanup spec, licenses now shipped upstream
* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 013-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 013-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Thu Oct 29 2020 Peter Robinson <pbrobinson@fedoraproject.org> - 013-1
- Update to 013
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 012-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Fri Jan 31 2020 Fedora Release Engineering <releng@fedoraproject.org> - 012-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Sat Jul 27 2019 Fedora Release Engineering <releng@fedoraproject.org> - 012-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Sun May 12 2019 Peter Robinson <pbrobinson@fedoraproject.org> 012-2
- New 012 release
* Sun Feb 03 2019 Fedora Release Engineering <releng@fedoraproject.org> - 010-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Fri Jun 08 2018 Lukas Nykryn <lnykryn@redhat.com> - 010-2
- add upstream fixes
* Wed May 16 2018 Lukas Nykryn <lnykryn@redhat.com> - 010-1
- New 010 release
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 009-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Mon Dec 4 2017 Peter Robinson <pbrobinson@fedoraproject.org> 009-1
- New 009 release
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 008-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 008-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 008-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Mon Aug 29 2016 Peter Robinson <pbrobinson@fedoraproject.org> 008-6
- Don't ship usbutils pkgconfig file
* Fri Feb 05 2016 Fedora Release Engineering <releng@fedoraproject.org> - 008-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Sun Jul 19 2015 Peter Robinson <pbrobinson@fedoraproject.org> 008-4
- Fix FTBFS, cleanup and modernise spec, use %%license
* Fri Jun 19 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 008-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
* Sat Feb 21 2015 Till Maas <opensource@till.name> - 008-2
- Rebuilt for Fedora 23 Change
https://fedoraproject.org/wiki/Changes/Harden_all_packages_with_position-independent_code
* Wed Oct 22 2014 Lukáš Nykrýn <lnykryn@redhat.com> - 008-1
- new release
* Mon Aug 18 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 007-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
* Sun Jun 08 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 007-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 007-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
* Mon Jun 17 2013 Lukáš Nykrýn <lnykryn@redhat.com> - 007-1
- new upstream release
* Tue Feb 26 2013 Lukáš Nykrýn <lnykryn@redhat.com> - 006-4
- lsusb-t: make sure that interfaces are added to lists only once (#914929)
* Fri Feb 15 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 006-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
* Sun Jul 22 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 006-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
* Mon Jul 16 2012 Lukáš Nykrýn <lnykryn@redhat.com> - 006-1
- new upstream release
* Thu Apr 19 2012 Lukas Nykryn <lnykryn@redhat.com> 005-1
- new upstream release
* Thu Apr 19 2012 Lukas Nykryn <lnykryn@redhat.com> 004-4
- Ignore missing driver symlink (#808934)
* Sat Jan 14 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 004-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild

View file

@ -1 +1 @@
34979f675d2bcb3e1b45012fa830a53f usbutils-0.86.tar.gz
SHA512 (usbutils-019.tar.xz) = fb4acc570c2b71f90c51c2717dc80e844727c8fcfebb5d92c57145eb9d09cbd1f63cf405e07db76c3afaaf3fac87b90f3f512d0a7c4d50cb9e6f26438eca9390

22
usbreset.patch Normal file
View file

@ -0,0 +1,22 @@
diff --git a/meson.build b/meson.build
index c522283..f6bd530 100644
--- a/meson.build
+++ b/meson.build
@@ -76,7 +76,7 @@ add_project_arguments('-include', 'config.h', language : 'c')
#####################
# man page generation
#####################
-install_man(['man/lsusb.8', 'man/lsusb.py.1', 'man/usb-devices.1', 'man/usbhid-dump.8'])
+install_man(['man/lsusb.8', 'man/lsusb.py.1', 'man/usb-devices.1', 'man/usbhid-dump.8', 'man/usbreset.1'])
##########################
@@ -137,7 +137,7 @@ usbreset_sources = [
# By default, usbreset does not get installed as it could cause problems, it's
# in the repo for those that wish to try it out.
-executable('usbreset', usbreset_sources, install: false)
+executable('usbreset', usbreset_sources, install: true)
################################

View file

@ -1,60 +0,0 @@
--- usbutils-0.11/lsusb.c.endian 2005-01-20 08:14:23.234480568 +0000
+++ usbutils-0.11/lsusb.c 2005-01-20 08:14:34.742731048 +0000
@@ -35,6 +35,13 @@
#include <unistd.h>
#include <stdio.h>
#include <stdarg.h>
+#include <endian.h>
+
+#if __BYTE_ORDER == __BIG_ENDIAN
+#define BE 1
+#else
+#define BE 0
+#endif
#include <linux/types.h>
#ifdef HAVE_LINUX_USBDEVICE_FS_H
@@ -290,8 +297,8 @@ static void dump_device(int fd, unsigned
printf(" Warning: Invalid descriptor\n");
else if (buf[0] < 18)
printf(" Warning: Descriptor too short\n");
- vid = buf[8] | (buf[9] << 8);
- pid = buf[10] | (buf[11] << 8);
+ vid = *(u_int16_t *)(buf+8);
+ pid = *(u_int16_t *)(buf+10);
get_vendor_string(vendor, sizeof(vendor), vid);
get_product_string(product, sizeof(product), vid, pid);
get_class_string(cls, sizeof(cls), buf[4]);
@@ -315,8 +322,8 @@ static void dump_device(int fd, unsigned
" iProduct %5u %s\n"
" iSerial %5u %s\n"
" bNumConfigurations %5u\n",
- buf[0], buf[1], buf[3], buf[2], buf[4], cls, buf[5], subcls, buf[6], proto, buf[7],
- vid, vendor, pid, product, buf[13], buf[12], buf[14], mfg, buf[15], prod, buf[16], serial, buf[17]);
+ buf[0], buf[1], buf[3-BE], buf[2+BE], buf[4], cls, buf[5], subcls, buf[6], proto, buf[7],
+ vid, vendor, pid, product, buf[13-BE], buf[12+BE], buf[14], mfg, buf[15], prod, buf[16], serial, buf[17]);
dump_junk(buf, " ", 18);
}
@@ -1575,8 +1582,8 @@ static int dump_one_device(const char *p
fprintf(stderr, "cannot get config descriptor, %s (%d)\n", strerror(errno), errno);
goto err;
}
- vid = buf[8] | (buf[9] << 8);
- pid = buf[10] | (buf[11] << 8);
+ vid = *(u_int16_t *)(buf+8);
+ pid = *(u_int16_t *)(buf+10);
get_vendor_string(vendor, sizeof(vendor), vid);
get_product_string(product, sizeof(product), vid, pid);
printf("Device: ID %04x:%04x %s %s\n", vid, pid, vendor, product);
@@ -1628,8 +1635,8 @@ static int list_devices(int bus, int dev
fprintf(stderr, "cannot read device descriptor %s (%d)\n", strerror(errno), errno);
goto err;
}
- vid = buf[8] | (buf[9] << 8);
- pid = buf[10] | (buf[11] << 8);
+ vid = *(u_int16_t *)(buf+8);
+ pid = *(u_int16_t *)(buf+10);
if (buf[0] >= USB_DT_DEVICE_SIZE && ((vendorid != -1 && vendorid != vid) || (productid != -1 && productid != pid)))
goto err;
status=0;

View file

@ -1,86 +0,0 @@
--- 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",

View file

@ -1,21 +0,0 @@
--- usbutils-0.70/Makefile.in.hwdata 2005-04-14 18:12:45.000000000 +0200
+++ usbutils-0.70/Makefile.in 2005-04-14 18:12:59.000000000 +0200
@@ -180,7 +180,7 @@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
-AM_CPPFLAGS = -DUSBIDS_FILE='"@datadir@/usb.ids"'
+AM_CPPFLAGS = -DUSBIDS_FILE='"@datadir@/hwdata/usb.ids"'
AM_CFLAGS = -Wall -W -Wunused
lsusb_SOURCES = lsusb.c \
names.c names.h \
--- usbutils-0.70/Makefile.am.hwdata 2005-04-14 18:12:22.000000000 +0200
+++ usbutils-0.70/Makefile.am 2005-04-14 18:13:14.000000000 +0200
@@ -1,6 +1,6 @@
# Process this file with 'automake' to create 'Makefile.in'
-AM_CPPFLAGS = -DUSBIDS_FILE='"@datadir@/usb.ids"'
+AM_CPPFLAGS = -DUSBIDS_FILE='"@datadir@/hwdata/usb.ids"'
AM_CFLAGS = -Wall -W -Wunused

View file

@ -1,95 +0,0 @@
--- usbutils-0.71/names.c 2005-01-23 00:03:47.000000000 +0100
+++ usbutils-0.72/names.c 2005-10-22 07:59:50.000000000 +0200
@@ -79,6 +79,12 @@
char name[1];
};
+struct videoterminal {
+ struct videoterminal *next;
+ u_int16_t termt;
+ char name[1];
+};
+
struct genericstrtable {
struct genericstrtable *next;
unsigned int num;
@@ -109,6 +115,7 @@
static struct subclass *subclasses[HASHSZ] = { NULL, };
static struct protocol *protocols[HASHSZ] = { NULL, };
static struct audioterminal *audioterminals[HASHSZ] = { NULL, };
+static struct videoterminal *videoterminals[HASHSZ] = { NULL, };
static struct genericstrtable *hiddescriptors[HASHSZ] = { NULL, };
static struct genericstrtable *reports[HASHSZ] = { NULL, };
static struct genericstrtable *huts[HASHSZ] = { NULL, };
@@ -236,6 +243,17 @@
return NULL;
}
+const char *names_videoterminal(u_int16_t termt)
+{
+ struct videoterminal *vt;
+
+ vt = videoterminals[hashnum(termt)];
+ for (; vt; vt = vt->next)
+ if (vt->termt == termt)
+ return vt->name;
+ return NULL;
+}
+
/* ---------------------------------------------------------------------- */
static int new_vendor(const char *name, u_int16_t vendorid)
@@ -356,6 +374,25 @@
return 0;
}
+static int new_videoterminal(const char *name, u_int16_t termt)
+{
+ struct videoterminal *vt;
+ unsigned int h = hashnum(termt);
+
+ vt = videoterminals[h];
+ for (; vt; vt = vt->next)
+ if (vt->termt == termt)
+ return -1;
+ vt = malloc(sizeof(struct videoterminal) + strlen(name));
+ if (!vt)
+ return -1;
+ strcpy(vt->name, name);
+ vt->termt = termt;
+ vt->next = videoterminals[h];
+ videoterminals[h] = vt;
+ return 0;
+}
+
static int new_genericstrtable(struct genericstrtable *t[HASHSZ], const char *name, unsigned int index)
{
struct genericstrtable *g;
@@ -564,6 +601,27 @@
DBG(printf("line %5u audio terminal type %02x %s\n", linectr, u, cp));
continue;
}
+ if (buf[0] == 'V' && buf[1] == 'T' && isspace(buf[2])) {
+ /* video terminal type spec */
+ cp = buf+3;
+ while (isspace(*cp))
+ cp++;
+ if (!isxdigit(*cp)) {
+ fprintf(stderr, "Invalid video terminal type at line %u\n", linectr);
+ continue;
+ }
+ u = strtoul(cp, &cp, 16);
+ while (isspace(*cp))
+ cp++;
+ if (!*cp) {
+ fprintf(stderr, "Invalid video terminal type at line %u\n", linectr);
+ continue;
+ }
+ if (new_videoterminal(cp, u))
+ fprintf(stderr, "Duplicate video terminal type spec at line %u terminal type %04x %s\n", linectr, u, cp);
+ DBG(printf("line %5u video 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;

View file

@ -1,21 +0,0 @@
--- usbutils-0.73/Makefile.am_old 2008-01-17 16:28:55.000000000 +0100
+++ usbutils-0.73/Makefile.am 2008-01-17 16:29:08.000000000 +0100
@@ -1,6 +1,6 @@
# Process this file with 'automake' to create 'Makefile.in'
-AM_CPPFLAGS = -DUSBIDS_DIR='"@datadir@"'
+AM_CPPFLAGS = -DUSBIDS_DIR='"@datadir@/hwdata"'
AM_CFLAGS = -Wall -W -Wunused
--- usbutils-0.73/Makefile.in_old 2008-01-17 16:36:28.000000000 +0100
+++ usbutils-0.73/Makefile.in 2008-01-17 16:35:38.000000000 +0100
@@ -163,7 +163,7 @@ sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
-AM_CPPFLAGS = -DUSBIDS_DIR='"@datadir@"'
+AM_CPPFLAGS = -DUSBIDS_DIR='"@datadir@/hwdata"'
AM_CFLAGS = -Wall -W -Wunused
lsusb_SOURCES = lsusb.c \
names.c names.h \

View file

@ -1,59 +0,0 @@
--- usbutils-0.82/Makefile.am 2009-05-07 00:05:10.000000000 +0200
+++ usbutils-0.82_hwdata/Makefile.am 2009-07-01 13:05:11.000000000 +0200
@@ -1,18 +1,9 @@
AM_LDFLAGS = \
-Wl,--as-needed
-data_DATA = \
- usb.ids
-if HAVE_ZLIB
-data_DATA += usb.ids.gz
-endif
-
sbin_PROGRAMS = \
lsusb
-sbin_SCRIPTS = \
- update-usbids.sh
-
lsusb_SOURCES = \
lsusb.c \
lsusb-t.c \
@@ -23,7 +14,7 @@ lsusb_SOURCES = \
lsusb_CPPFLAGS = \
$(AM_CPPFLAGS) \
- -DDATADIR=\"$(datadir)\"
+ -DDATADIR=\"$(datadir)/hwdata\"
lsusb_LDADD = \
$(LIBUSB_LIBS)
@@ -32,18 +23,9 @@ man_MANS = \
lsusb.8
EXTRA_DIST = \
- usb.ids \
- update-usbids.sh.in \
lsusb.8.in \
usbutils.pc.in
-usb.ids.gz: $(srcdir)/usb.ids
- gzip -c -9 $< > $@
-
-update-usbids.sh: $(srcdir)/update-usbids.sh.in
- sed 's|@usbids@|$(datadir)/usb.ids|g' $< >$@
- chmod 755 $@
-
lsusb.8: $(srcdir)/lsusb.8.in
sed 's|@usbids@|$(datadir)/usb.ids|g' $< >$@
@@ -54,9 +36,7 @@ usbutils.pc: $(srcdir)/usbutils.pc.in
sed 's|@usbids@|$(datadir)/usb.ids|g;s|@VERSION[@]|$(VERSION)|g' $< >$@
DISTCLEANFILES = \
- usb.ids.gz \
lsusb.8 \
- update-usbids.sh \
usbutils.pc
distclean-local:

View file

@ -1,62 +0,0 @@
--- usbutils-0.86/Makefile.am_old 2009-09-16 11:56:26.000000000 +0200
+++ usbutils-0.86/Makefile.am 2009-09-16 11:57:40.000000000 +0200
@@ -1,18 +1,9 @@
AM_LDFLAGS = \
-Wl,--as-needed
-data_DATA = \
- usb.ids
-if HAVE_ZLIB
-data_DATA += usb.ids.gz
-endif
-
sbin_PROGRAMS = \
lsusb
-sbin_SCRIPTS = \
- update-usbids.sh
-
bin_SCRIPTS = \
usb-devices
@@ -26,7 +17,7 @@
lsusb_CPPFLAGS = \
$(AM_CPPFLAGS) \
- -DDATADIR=\"$(datadir)\"
+ -DDATADIR=\"$(datadir)/hwdata\"
lsusb_LDADD = \
$(LIBUSB_LIBS)
@@ -36,20 +27,11 @@
usb-devices.1
EXTRA_DIST = \
- usb.ids \
- update-usbids.sh.in \
lsusb.8.in \
usb-devices.1.in \
usb-devices \
usbutils.pc.in
-usb.ids.gz: $(srcdir)/usb.ids
- gzip -c -9 $< > $@
-
-update-usbids.sh: $(srcdir)/update-usbids.sh.in
- sed 's|@usbids@|$(datadir)/usb.ids|g' $< >$@
- chmod 755 $@
-
lsusb.8: $(srcdir)/lsusb.8.in
sed 's|VERSION|$(VERSION)|g;s|@usbids@|$(datadir)/usb.ids|g' $< >$@
@@ -63,10 +45,8 @@
sed 's|@usbids@|$(datadir)/usb.ids|g;s|@VERSION[@]|$(VERSION)|g' $< >$@
DISTCLEANFILES = \
- usb.ids.gz \
lsusb.8 \
usb-devices.1 \
- update-usbids.sh \
usbutils.pc
distclean-local:

View file

@ -1,59 +0,0 @@
--- usbutils-0.9/configure.hwdata Wed Jan 30 19:45:49 2002
+++ usbutils-0.9/configure Wed Jan 30 19:46:15 2002
@@ -1761,18 +1761,18 @@
if test "x${datadir}" = 'x${prefix}/share'; then
if test "x${prefix}" = "xNONE"; then
cat >> confdefs.h <<EOF
-#define USBIDS_FILE "${ac_default_prefix}/share/usb.ids"
+#define USBIDS_FILE "${ac_default_prefix}/share/hwdata/usb.ids"
EOF
else
cat >> confdefs.h <<EOF
-#define USBIDS_FILE "${prefix}/share/usb.ids"
+#define USBIDS_FILE "${prefix}/share/hwdata/usb.ids"
EOF
fi
else
cat >> confdefs.h <<EOF
-#define USBIDS_FILE "${datadir}/usb.ids"
+#define USBIDS_FILE "${datadir}/hwdata/usb.ids"
EOF
fi
--- usbutils-0.9/libusb/configure.hwdata Wed Jan 30 19:44:12 2002
+++ usbutils-0.9/libusb/configure Wed Jan 30 19:44:56 2002
@@ -2326,18 +2326,18 @@
if test "x${datadir}" = 'x${prefix}/share'; then
if test "x${prefix}" = "xNONE"; then
cat >> confdefs.h <<EOF
-#define USBIDS_FILE "${ac_default_prefix}/share/usb.ids"
+#define USBIDS_FILE "${ac_default_prefix}/share/hwdata/usb.ids"
EOF
else
cat >> confdefs.h <<EOF
-#define USBIDS_FILE "${prefix}/share/usb.ids"
+#define USBIDS_FILE "${prefix}/share/hwdata/usb.ids"
EOF
fi
else
cat >> confdefs.h <<EOF
-#define USBIDS_FILE "${datadir}/usb.ids"
+#define USBIDS_FILE "${datadir}/hwdata/usb.ids"
EOF
fi
--- usbutils-0.9/lsusb.8.hwdata Wed Jan 30 19:45:15 2002
+++ usbutils-0.9/lsusb.8 Wed Jan 30 19:45:23 2002
@@ -47,7 +47,7 @@
.SH FILES
.TP
-.B /usr/share/usb.ids
+.B /usr/share/hwdata/usb.ids
A list of all known USB ID's (vendors, products, classes, subclasses and protocols).
.TP
.B /proc/bus/usb

View file

@ -1,537 +0,0 @@
--- usbutils-0.11/lsusb.c 2002-08-05 23:35:21.000000000 -0700
+++ usbutils/lsusb.c 2004-02-14 13:00:41.531597608 -0800
@@ -58,8 +58,8 @@
#define _GNU_SOURCE
#include <getopt.h>
-#define CTRL_RETRIES 50
-#define CTRL_TIMEOUT 100 /* milliseconds */
+#define CTRL_RETRIES 2
+#define CTRL_TIMEOUT (5*1000) /* milliseconds */
#define USB_DT_CS_DEVICE 0x21
#define USB_DT_CS_CONFIG 0x22
@@ -106,7 +106,6 @@ static int usb_control_msg(int fd, u_int
ctrl.value = value;
ctrl.index = index;
ctrl.length = size;
- ctrl.timeout = 1000;
ctrl.data = data;
ctrl.timeout = CTRL_TIMEOUT;
try = 0;
@@ -119,10 +118,11 @@ static int usb_control_msg(int fd, u_int
/* ---------------------------------------------------------------------- */
+static int dev_has_strings;
+
static int get_string(int fd, char *buf, size_t size, u_int8_t id, u_int16_t lang)
{
unsigned char b[256];
- wchar_t w[128];
unsigned int i;
int ret;
@@ -133,17 +133,38 @@ static int get_string(int fd, char *buf,
if (!id || fd == -1)
return 0;
- 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);
+ b[0] = b[1] = 0;
+
+ /* try reading all at once ... some devices misbehave here */
+ ret = usb_control_msg(fd, USB_DIR_IN, USB_REQ_GET_DESCRIPTOR, (USB_DT_STRING << 8) | id, lang, sizeof(b), b);
+ if (ret > 0)
+ goto got_all;
+
+ /* read string length first ... most devices handle this ok */
+ ret = usb_control_msg(fd, USB_DIR_IN, USB_REQ_GET_DESCRIPTOR, (USB_DT_STRING << 8) | id, lang, 2, b);
+ if (ret < 0) {
+ if (open_mode == O_RDWR)
+ fprintf(stderr, "cannot peek 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);
+ return 0;
+ }
+
+ ret = usb_control_msg(fd, USB_DIR_IN, USB_REQ_GET_DESCRIPTOR, (USB_DT_STRING << 8) | id, lang, b[0], b);
if (ret < 0) {
if (open_mode == O_RDWR)
fprintf(stderr, "cannot get string descriptor %d, error = %s(%d)\n", id, strerror(errno), errno);
return 0;
}
+
+got_all:
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);
return 0;
}
+ dev_has_strings = 1;
#if 0
for (i = 0; i < ((b[0] - 2) / 2); i++)
w[i] = b[2+2*i] | (b[3+2*i] << 8);
@@ -151,7 +172,9 @@ static int get_string(int fd, char *buf,
return wcstombs(buf, w, size);
#else
for (i = 0; i < ((b[0] - 2) / 2); i++)
- buf[i] = b[2+2*i];
+ buf[i] = b[3+2*i]
+ ? '?' /* character's not available in iso-8859/1 */
+ : b[2+2*i];
buf[i] = 0;
return i;
#endif
@@ -297,21 +320,25 @@ static void dump_device(int fd, unsigned
dump_junk(buf, " ", 18);
}
-static void dump_config(int fd, unsigned char *buf)
+static void dump_config(int fd, unsigned char *buf, u_int16_t lang)
{
+ char str[128];
+
if (buf[1] != USB_DT_CONFIG)
printf(" Warning: Invalid descriptor\n");
else if (buf[0] < 9)
printf(" Warning: Descriptor too short\n");
+ get_string(fd, str, sizeof(str), buf[6], lang);
printf(" Configuration Descriptor:\n"
" bLength %5u\n"
" bDescriptorType %5u\n"
" wTotalLength %5u\n"
" bNumInterfaces %5u\n"
" bConfigurationValue %5u\n"
- " iConfiguration %5u\n"
+ " iConfiguration %5u %s\n"
" bmAttributes 0x%02x\n",
- buf[0], buf[1], buf[2] | (buf[3] << 8), buf[4], buf[5], buf[6], buf[7]);
+ buf[0], buf[1], buf[2] | (buf[3] << 8), buf[4], buf[5],
+ buf[6], str, buf[7]);
if (buf[7] & 0x40)
printf(" Self Powered\n");
if (buf[7] & 0x20)
@@ -352,6 +379,9 @@ static void dump_endpoint(int fd, unsign
{
static const char *typeattr[] = { "Control", "Isochronous", "Bulk", "Interrupt" };
static const char *syncattr[] = { "none", "Asynchronous", "Adaptive", "Synchronous" };
+ static const char *usage[] = { "Data", "Feedback", "Implicit feedback Data", "(reserved)" };
+ static const char *hb[] = { "once", "twice", "three times", "(?)" };
+ unsigned wMaxPacket = buf[4] | (buf[5] << 8);
if (buf[1] != USB_DT_ENDPOINT)
printf(" Warning: Invalid descriptor\n");
@@ -364,15 +394,19 @@ static void dump_endpoint(int fd, unsign
" bmAttributes %5u\n"
" Transfer Type %s\n"
" Synch Type %s\n"
- " wMaxPacketSize %5u\n"
+ " Usage Type %s\n"
+ " wMaxPacketSize 0x%04x bytes %d %s\n"
" bInterval %5u\n",
buf[0], buf[1], buf[2], buf[2] & 15, (buf[2] & 0x80) ? "IN" : "OUT",
buf[3], typeattr[buf[3] & 3], syncattr[(buf[3] >> 2) & 3],
- buf[4] | (buf[5] << 8), buf[6]);
+ usage[(buf[3] >> 4) & 3],
+ wMaxPacket, wMaxPacket & 0x3ff, hb [(wMaxPacket >> 11) & 3],
+ buf[6]);
if (buf[0] < 9) {
dump_junk(buf, " ", 7);
return;
}
+ /* only for audio endpoints */
printf(" bRefresh %5u\n"
" bSynchAddress %5u\n",
buf[7], buf[8]);
@@ -1017,23 +1051,53 @@ static void dump_midistreaming_endpoint(
dump_junk(buf, " ", 4+buf[3]);
}
-
-static void dump_hub(char *p)
+static void dump_hub(char *prefix, unsigned char *p, int has_tt)
{
unsigned int l, i, j;
+ unsigned wHubChar = (p[4] << 8) | p[3];
- printf(" Hub Descriptor:\n");
- printf(" bLength %3u\n",p[0]);
- printf(" bDesriptorType %3u\n",p[1]);
- printf(" nNbrPorts %3u\n",p[2]);
- printf(" wHubCharacteristic 0x%02x 0x%02x\n", p[3],p[4]);
- printf(" bPwrOn2PwrGood %3u * 2 milli seconds\n",p[5]);
- printf(" bHubContrCurrent %3u milli Ampere\n",p[6]);
+ printf("%sHub Descriptor:\n", prefix);
+ printf("%s bLength %3u\n", prefix, p[0]);
+ printf("%s bDescriptorType %3u\n", prefix, p[1]);
+ printf("%s nNbrPorts %3u\n", prefix, p[2]);
+ printf("%s wHubCharacteristic 0x%04x\n", prefix, wHubChar);
+ switch (wHubChar & 0x03) {
+ case 0:
+ printf("%s Ganged power switching\n", prefix);
+ break;
+ case 1:
+ printf("%s Per-port power switching\n", prefix);
+ break;
+ default:
+ printf("%s No power switching (usb 1.0)\n", prefix);
+ break;
+ }
+ if (wHubChar & 0x04)
+ printf("%s Compound device\n", prefix);
+ switch ((wHubChar >> 3) & 0x03) {
+ case 0:
+ printf("%s Ganged overcurrent protection\n", prefix);
+ break;
+ case 1:
+ printf("%s Per-port overcurrent protection\n", prefix);
+ break;
+ default:
+ printf("%s No overcurrent protection\n", prefix);
+ break;
+ }
+ if (has_tt) {
+ l = (wHubChar >> 5) & 0x03;
+ printf("%s TT think time %d FS bits\n", prefix, (l + 1) * 8);
+ }
+ if (wHubChar & (1<<7))
+ printf("%s Port indicators\n", prefix);
+ printf("%s bPwrOn2PwrGood %3u * 2 milli seconds\n", prefix, p[5]);
+ printf("%s bHubContrCurrent %3u milli Ampere\n", prefix, p[6]);
l= (p[2] >> 3) + 1; /* this determines the variable number of bytes following */
- printf(" DeviceRemovable ");
+ printf("%s DeviceRemovable ", prefix);
for(i = 0; i < l; i++)
printf(" 0x%02x", p[7+i]);
- printf("\n PortPwrCtrlMask ");
+ printf("\n%s PortPwrCtrlMask ", prefix);
for(j = 0; j < l; j++)
printf(" 0x%02x ", p[7+i+j]);
printf("\n");
@@ -1047,7 +1111,7 @@ static void dump_hub(char *p)
static void dump_report_desc(unsigned char *b, int l)
{
- unsigned int t, j, bsize, btag, btype, data, hut;
+ unsigned int t, j, bsize, btag, btype, data = 1000, hut = 1000;
int i;
char *types[4] = { "Main", "Global", "Local", "reserved" };
char indent[] = " ";
@@ -1168,21 +1232,131 @@ static void dump_hid_device(int fd, unsi
}
}
+static char *
+dump_comm_descriptor(int fd, unsigned char *buf, char *indent, u_int16_t lang)
+{
+ int tmp;
+ char str [128];
+
+ switch (buf[2]) {
+ case 0:
+ if (buf[0] != 5)
+ goto bad;
+ printf( "%sCDC Header:\n"
+ "%s bcdCDC %x.%02x\n",
+ indent,
+ indent, buf[4], buf[3]);
+ break;
+ case 0x01: /* call management functional desc */
+ if (buf [0] != 5)
+ goto bad;
+ printf( "%sCDC Call Management:\n"
+ "%s bmCapabilities 0x%02x\n",
+ indent,
+ indent, buf[3]);
+ if (buf[3] & 0x01)
+ printf( "%s call management\n", indent);
+ if (buf[3] & 0x02)
+ printf( "%s use DataInterface\n", indent);
+ printf("%s bDataInterface %d\n", indent, buf[4]);
+ break;
+ case 0x02: /* acm functional desc */
+ if (buf [0] != 4)
+ goto bad;
+ printf( "%sCDC ACM:\n"
+ "%s bmCapabilities %02x\n",
+ indent,
+ indent, buf[3]);
+ if (buf[3] & 0x08)
+ printf( "%s connection notifications\n", indent);
+ if (buf[3] & 0x04)
+ printf( "%s sends break\n", indent);
+ if (buf[3] & 0x02)
+ printf( "%s line coding and serial state\n", indent);
+ if (buf[3] & 0x01)
+ printf( "%s get/set/clear comm features\n", indent);
+ break;
+ case 0x06: /* union desc */
+ if (buf [0] < 5)
+ goto bad;
+ printf( "%sCDC Union:\n"
+ "%s bMasterInterface %d\n"
+ "%s bSlaveInterface ",
+ indent,
+ indent, buf [3],
+ indent);
+ for (tmp = 4; tmp < buf [0]; tmp++)
+ printf("%d ", buf [tmp]);
+ printf("\n");
+ break;
+ case 0x0f: /* ethernet functional desc */
+ if (buf [0] != 13)
+ goto bad;
+ get_string(fd, str, sizeof str, buf[3], lang);
+ tmp = buf [7] << 8;
+ tmp |= buf [6]; tmp <<= 8;
+ tmp |= buf [5]; tmp <<= 8;
+ tmp |= buf [4];
+ printf( "%sCDC Ethernet:\n"
+ "%s iMacAddress %d %s\n"
+ "%s bmEthernetStatistics 0x%08x\n",
+ indent,
+ indent, buf[3], (buf[3] && *str) ? str : "(?)",
+ indent, tmp);
+ /* FIXME dissect ALL 28 bits */
+ printf( "%s wMaxSegmentSize %d\n"
+ "%s wNumberMCFilters 0x%04x\n"
+ "%s bNumberPowerFilters %d\n",
+ indent, (buf[9]<<8)|buf[8],
+ indent, (buf[11]<<8)|buf[10],
+ indent, buf[12]);
+ break;
+ /* FIXME there are about a dozen more descriptor types */
+ default:
+ return "unsupported comm descriptor";
+ }
+ return 0;
+
+bad:
+ return "corrupt comm descriptor";
+}
+
/* ---------------------------------------------------------------------- */
+static void do_hub(int fd, int has_tt)
+{
+ unsigned char buf [7];
+ int ret;
+
+ ret = usb_control_msg(fd, USB_DIR_IN | USB_TYPE_CLASS,
+ USB_REQ_GET_DESCRIPTOR, 0x29 << 8, 0,
+ sizeof buf, buf);
+ if (ret != sizeof buf) {
+ perror ("can't get hub descriptor");
+ return;
+ }
+ dump_hub("", buf, has_tt);
+}
+
static void do_config(int fd, unsigned int nr, u_int16_t lang)
{
- unsigned char buf[1024],*p;
- unsigned int sz,curinterface;
- int l;
+ unsigned char buf[1024],*p, *err;
+ unsigned int sz,curinterface = 1000;
u_int8_t curclass = 0xff, cursubclass = 0xff;
+ unsigned retries = 0;
+ for (;;) {
if (usb_control_msg(fd, USB_DIR_IN, USB_REQ_GET_DESCRIPTOR, (USB_DT_CONFIG << 8) | nr,
0, USB_DT_CONFIG_SIZE, buf) < 0) {
+ if (retries++ >= 5) {
if (open_mode == O_RDWR)
fprintf(stdout, "cannot get config descriptor %d, %s (%d)\n", nr, strerror(errno), errno);
return;
+ }
+ continue;
+ } else break;
}
+
if (buf[0] < USB_DT_CONFIG_SIZE || buf[1] != USB_DT_CONFIG)
fprintf(stderr, "Warning: invalid config descriptor\n");
sz = buf[2] | buf[3] << 8;
@@ -1208,13 +1382,14 @@ static void do_config(int fd, unsigned i
}
switch (p[1]) {
case USB_DT_DEVICE:
+ /* NOTE: should NOT be found here! */
dump_device(fd, p, lang);
curclass = p[4];
cursubclass = p[5];
break;
case USB_DT_CONFIG:
- dump_config(fd, p);
+ dump_config(fd, p, lang);
break;
case USB_DT_INTERFACE:
@@ -1229,39 +1404,39 @@ static void do_config(int fd, unsigned i
break;
case USB_DT_CS_DEVICE:
- if (curclass == 3) {
+ if (curclass == USB_CLASS_HID) {
dump_hid_device(fd, p, curinterface);
break;
}
- printf(" unknown descriptor type:");
- dump_junk2(p, p[0]);
- break;
-
- case USB_DT_CS_CONFIG:
- printf(" unknown descriptor type:");
- dump_junk2(p, p[0]);
- break;
-
- case USB_DT_CS_STRING:
- printf(" unknown descriptor type:");
- dump_junk2(p, p[0]);
- break;
+ err = "unknown device class descriptor";
+ goto junk;
case USB_DT_CS_INTERFACE:
- if (curclass == 1 && cursubclass == 1) {
- dump_audiocontrol_interface(fd, p, lang);
+ err = "unknown interface class descriptor";
+ switch (curclass) {
+ case USB_CLASS_AUDIO:
+ switch (cursubclass) {
+ case 1:
+ dump_audiocontrol_interface(fd, p, lang);
+ break;
+ case 2:
+ dump_audiostreaming_interface(fd, p);
+ break;
+ case 3:
+ dump_midistreaming_interface(fd, p, lang);
+ break;
+ default:
+ goto junk;
+ }
break;
- }
- if (curclass == 1 && cursubclass == 2) {
- dump_audiostreaming_interface(fd, p);
- break;
- }
- if (curclass == 1 && cursubclass == 3) {
- dump_midistreaming_interface(fd, p, lang);
+ case USB_CLASS_COMM:
+ err = dump_comm_descriptor (fd, p, " ", lang);
+ if (err)
+ goto junk;
break;
+ default:
+ goto junk;
}
- printf(" unknown descriptor type:");
- dump_junk2(p, p[0]);
break;
case USB_DT_CS_ENDPOINT:
@@ -1273,16 +1448,20 @@ static void do_config(int fd, unsigned i
dump_midistreaming_endpoint(fd, p);
break;
}
- printf(" unknown descriptor type:");
- dump_junk2(p, p[0]);
- break;
+ err = "unknown endpoint class descriptor";
+ goto junk;
case USB_DT_HUB:
- dump_hub(p);
+ /* NOTE only rather ancient hubs will include
+ * this with the config descriptor.
+ */
+ dump_hub(" ", p, 0);
break;
default:
- printf(" unknown descriptor type:");
+ err = "unknown descriptor type";
+junk:
+ printf(" %s:", err);
dump_junk2(p, p[0]);
}
sz -= p[0];
@@ -1303,21 +1482,41 @@ static u_int16_t dump_langids(int fd, in
int i, l;
u_int16_t lang;
- b[0] = b[1] = 0xbf;
- l = usb_control_msg(fd, USB_DIR_IN, USB_REQ_GET_DESCRIPTOR, USB_DT_STRING << 8, 0, sizeof(b), b);
+ /* read string length first, like recent linuxes -- else some devices misbehave */
+ b[0] = b[1] = 0;
+ l = usb_control_msg(fd, USB_DIR_IN, USB_REQ_GET_DESCRIPTOR, USB_DT_STRING << 8, 0, 4, b);
+ if (l < 0 && errno == EPIPE)
+ l = 0;
if (l < 0) {
- if (open_mode == O_RDWR)
+ if (open_mode == O_RDWR && !quiet)
printf(" Language IDs: none (cannot get min. string descriptor; got len=%d, error=%d:%s)\n",
l, errno, strerror(errno));
return 0;
}
- if (l < 4 || b[0] != l) {
+ if (l == 0) {
+ if (!quiet)
+ printf(" Language IDs: none\n");
+ return 0;
+ }
+ if (l < 4) {
+ if (!quiet)
printf(" Language IDs: none (invalid length string descriptor %02x; len=%d)\n", b[0], l);
return 0;
}
/* save first language ID for further get_string_descriptors */
lang = b[2] | (b[3] << 8);
+
+ /* maybe there's more than one */
+ if (b[0] > 4) {
+ l = usb_control_msg(fd, USB_DIR_IN, USB_REQ_GET_DESCRIPTOR, USB_DT_STRING << 8, 0, b[0], b);
+ if (l < 4 || b[0] != l) {
+ fprintf(stderr, "string 0 broken re-read, l = %d, b[0] = %d \n", l, b[0]);
+ b[0] = 4;
+ b[2] = lang;
+ b[3] = lang >> 8;
+ }
+ }
#if 0
printf ("dump_langids: ret=%d:%d, lang=0x%x, length=%d\n", l, errno, lang, b[0]);
dump_junk2 (b, 32);
@@ -1342,11 +1541,17 @@ static void dumpdev(unsigned char *devde
maxcfg = devdesc[17];
if (devdesc[0] < 18 || devdesc[1] != USB_DT_DEVICE)
maxcfg = 1;
+ dev_has_strings = 0;
lang = dump_langids(fd, 1);
dump_device(fd, devdesc, lang);
for (i = 0; i < maxcfg; i++)
do_config(fd, i, lang);
- lang = dump_langids(fd, 0);
+ if (devdesc[4] == USB_CLASS_HUB)
+ do_hub(fd, devdesc [6]);
+ /* FIXME if it's usb 2.0 and there's a device qualifier,
+ * optionally dump it and the other-speed config data
+ */
+ lang = dump_langids(fd, !dev_has_strings);
}
/* ---------------------------------------------------------------------- */
@@ -1560,7 +1765,7 @@ int main(int argc, char *argv[])
exit(1);
}
if ((err = names_init("./usb.ids")) != 0)
- if(err = names_init(USBIDS_FILE)) {
+ if((err = names_init(USBIDS_FILE)) != 0) {
printf("Error, cannot open USBIDS File \"%s\", %s\n", USBIDS_FILE, strerror(err));
exit(1);
}

View file

@ -1,171 +1,44 @@
Name: usbutils
Version: 0.86
Release: 2%{?dist}
Source: http://downloads.sourceforge.net/linux-usb/%{name}-%{version}.tar.gz
URL: http://www.linux-usb.org/
License: GPLv2+
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Requires: hwdata
BuildRequires: autoconf, libtool, libusb-devel >= 0.1.8
Name: usbutils
Version: 019
Release: %autorelease
Summary: Linux USB utilities
Group: Applications/System
Conflicts: hotplug < 3:2002_01_14-2
Patch0: usbutils-0.86-hwdata.patch
URL: http://www.linux-usb.org/
License: GPL-2.0-or-later
%description
Source0: https://www.kernel.org/pub/linux/utils/usb/usbutils/%{name}-%{version}.tar.xz
# This adds usbreset binary to the package, but since upstream does not consider it stable,
# let's not include it in the ELN. https://github.com/gregkh/usbutils/issues/222#issuecomment-2715192013
%if 0%{?fedora}
Patch0: usbreset.patch
%endif
BuildRequires: meson
BuildRequires: gcc
BuildRequires: libusb1-devel
BuildRequires: systemd-devel
Requires: hwdata
%description
This package contains utilities for inspecting devices connected to a
USB bus.
%prep
%setup -q
%patch0 -p1
autoreconf
%autosetup -p1
%build
%configure --sbindir=%{_sbindir}
make %{?_smp_mflags}
%meson --sbindir=%{_sbindir} --datadir=%{_datadir}/hwdata
%meson_build
%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT INSTALL="install -p"
# usb.ids is shipped in hwdata; nuke and adjust .pc file
sed -i 's|usbids=/usr/share/usb.ids|usbids=/usr/share/hwdata/usb.ids|' $RPM_BUILD_ROOT%{_datadir}/pkgconfig/usbutils.pc
%meson_install
rm -rf %{buildroot}/%{_libdir}/pkgconfig/usbutils.pc
%files
%defattr(-,root,root,-)
%license LICENSES/GPL*
%doc NEWS
%{_mandir}/*/*
%{_sbindir}/*
%{_bindir}/*
%{_datadir}/pkgconfig/usbutils.pc
%doc AUTHORS COPYING ChangeLog NEWS README
%clean
rm -rf $RPM_BUILD_ROOT
%changelog
* Tue Sep 22 2009 Jiri Moskovcak <jmoskovc@redhat.com> 0.86-2
- spec file fixes - package should not own /usr/{bin,sbin} (rhbz#524005)
* Wed Sep 16 2009 Jiri Moskovcak <jmoskovc@redhat.com> 0.86-1
- new version
- spec file fixes as suggested in rhbz#466041 (info@owlriver.com)
* Mon Aug 24 2009 Karsten Hopp <karsten@redhat.com> 0.82-5
- drop ExcludeArch: s390 s390x as we need this package on s390x to be able to build
p.e. udev without any hacks
* Sun Jul 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.82-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
* Wed Jul 1 2009 Jiri Moskovcak <jmoskovc@rdhat.com> 0.82-3
- added autoconf to fix build in koji
* Wed Jul 1 2009 Jiri Moskovcak <jmoskovc@redhat.com> 0.82-2
- minor fix in Makefile.am to properly find usb.ids from hwdata
- Resolves: #506974
* Fri May 22 2009 David Zeuthen <davidz@redhat.com> 0.82-1
- Update to 0.82
* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.73-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
* Tue Feb 12 2008 Jiri Moskovcak <jmoskovc@redhat.com> 0.73-2
- spec file cleanup
* Thu Jan 17 2008 Jiri Moskovcak <jmoskovc@redhat.com> 0.73-1
- new version 0.73
* Mon Sep 18 2006 Thomas Woerner <twoerner@redhat.com> 0.72-1
- new version 0.72
- videoterminal (vt) patch is now upstream, dropped
* Wed Jul 12 2006 Jesse Keating <jkeating@redhat.com> - 0.71-2.1
- rebuild
* Wed Mar 01 2006 Karsten Hopp <karsten@redhat.de> 1.71-2
- add usbutils-0.71-VT.patch to fix warnings about unknown lines
(#176903)
* Fri Feb 10 2006 Jesse Keating <jkeating@redhat.com> - 0.71-1.2
- bump again for double-long bug on ppc(64)
* Tue Feb 07 2006 Jesse Keating <jkeating@redhat.com> - 0.71-1.1
- rebuilt for new gcc4.1 snapshot and glibc changes
* Tue Dec 13 2005 Thomas Woerner <twoerner@redhat.com> 0.71-1
- new version 0.71
* Fri Dec 09 2005 Jesse Keating <jkeating@redhat.com>
- rebuilt
* Fri Apr 15 2005 Thomas Woerner <twoerner@redhat.com> 0.70-1.1
- added fix from Robert Scheck to fix missing BuildRequires for libusb-devel
(#155006)
* Thu Apr 14 2005 Thomas Woerner <twoerner@redhat.com> 0.70-1
- new version 0.70
* Thu Jan 20 2005 David Woodhouse <dwmw2@redhat.com> 0.11-6.2
- Don't byteswap parts of device descriptor which kernel already swapped
* Mon Sep 13 2004 Thomas Woerner <twoerner@redhat.com> 0.11-6.1
- added missing BuildRequires for libtool (#132406)
* Wed Sep 1 2004 Thomas Woerner <twoerner@redhat.com> 0.11-6
- added patch from Aurelien Jarno for unknown HID Country Code entries in
usb.ids (#127415)
* Tue Jun 15 2004 Elliot Lee <sopwith@redhat.com>
- rebuilt
* Tue May 4 2004 Bill Nottingham <notting@redhat.com> 0.11-4
- add patch from USB maintainer to fix various brokenness (#115694, <david-b@pacbell.net>)
* Fri Feb 13 2004 Elliot Lee <sopwith@redhat.com>
- rebuilt
* Wed Jun 04 2003 Elliot Lee <sopwith@redhat.com>
- rebuilt
* Tue Jun 3 2003 Jeff Johnson <jbj@redhat.com>
- add explicit epoch's where needed.
* Mon May 19 2003 Bill Nottingham <notting@redhat.com> 0.11-1
- update to 0.11, fixes #90640
- add patch to fix some warnings (#78462, <d.binderman@virgin.net>)
* Wed Jan 22 2003 Tim Powers <timp@redhat.com>
- rebuilt
* Fri Nov 29 2002 Tim Powers <timp@redhat.com> 0.9-9
- remove unpackaged files from the buildroot
* Wed Nov 20 2002 Florian La Roche <Florian.LaRoche@redhat.de>
- exclude mainframe
* Fri Jun 21 2002 Tim Powers <timp@redhat.com>
- automated rebuild
* Thu May 23 2002 Tim Powers <timp@redhat.com>
- automated rebuild
* Thu Mar 21 2002 Trond Eivind Glomsrød <teg@redhat.com> 0.9-5
- Fix conflict check
* Mon Mar 18 2002 Trond Eivind Glomsrød <teg@redhat.com> 0.9-4
- Conflict with older versions of hotplug which contained
parts of this package (#60615)
* Fri Feb 22 2002 Trond Eivind Glomsrød <teg@redhat.com> 0.9-3
- Rebuild
* Wed Jan 30 2002 Bill Nottingham <notting@redhat.com> 0.9-2
- require hwdata
* Wed Jan 16 2002 Trond Eivind Glomsrød <teg@redhat.com> 0.9-1
- Initial RPM
- make it build on ia64
%autochangelog