Compare commits
91 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
47080022c8 | ||
|
|
63dfef4e1e | ||
|
|
97d149ff9f | ||
|
|
00e2a49eef | ||
|
|
93afe3bd89 | ||
|
|
2702e75256 | ||
|
|
97577a7158 | ||
|
|
c5649c6860 | ||
|
|
82ab0edfea | ||
|
|
d73574bbac | ||
|
|
3d0e811abe | ||
|
|
a3f959ad68 | ||
|
|
702d4cf95c |
||
|
|
e9296e71d9 | ||
|
|
ac347d96db | ||
|
|
a3047582da | ||
|
|
11c9ed6a05 | ||
|
|
ede58a2719 | ||
|
|
9f04bb3d30 | ||
|
|
1f9a607b89 | ||
|
|
8845d49195 | ||
|
|
b6b8d47c20 | ||
|
|
39ca8a790a | ||
|
|
a8785b205e | ||
|
|
632b85a3a0 | ||
|
|
414d26dd0b | ||
|
|
57cc4e883b | ||
|
|
4c669d0d41 | ||
|
|
d58c1a9dc0 | ||
|
|
c3b9cd58d0 | ||
|
|
0e4a3c2646 | ||
|
|
7ef37e8db4 | ||
|
|
d6510e2b16 | ||
|
|
e4226cecd8 | ||
|
|
407f68e61d | ||
|
|
1aacd25679 | ||
|
|
c4935d9749 | ||
|
|
35592576d1 | ||
|
|
def3914d50 | ||
|
|
3fb4ad2446 | ||
|
|
19fb52973c | ||
|
|
190e13361f | ||
|
|
5ea2f00f7d | ||
|
|
96504e4d20 | ||
|
|
f5b61b5167 | ||
|
|
8bd081531f | ||
|
|
96fb13a79a | ||
|
|
ef3b1fb1cd | ||
|
|
56bfd9828f | ||
|
|
cf22eecf06 | ||
|
|
ac92498031 | ||
|
|
5c8beef151 | ||
| df12b1ead9 | |||
|
|
16b004734d | ||
|
|
8c94d1fa1c | ||
|
|
fe14af939c | ||
|
|
32eb76963e | ||
|
|
b0a0086593 | ||
|
|
a4c66b6cee | ||
|
|
d031ca28c9 | ||
|
|
ad04d9ed32 | ||
|
|
71a2faac06 | ||
|
|
c409919b38 | ||
|
|
3279803c12 | ||
|
|
afcded7a37 | ||
|
|
cd05bb15cd | ||
|
|
19bd905180 | ||
|
|
28db1fbb34 | ||
|
|
08ae144374 | ||
|
|
add39a2d5b | ||
|
|
b55d1689c3 | ||
|
|
9d88b84e83 | ||
|
|
25d49a1c75 | ||
|
|
47a22113d9 | ||
|
|
1194b02fa1 | ||
|
|
1706bea6d4 | ||
|
|
ce5ca4cb49 | ||
|
|
61a5e4c6aa | ||
|
|
967f7cade2 | ||
|
|
07674cb54f | ||
|
|
0947edecbf | ||
|
|
8c4641520e | ||
|
|
0a21c858a8 | ||
|
|
0f3d8de5fe | ||
|
|
484ca2a1ab | ||
| d94b597afa | |||
|
|
63e50f2409 | ||
|
|
fe7f7c5a7c | ||
|
|
3a351c870a | ||
|
|
97c9508164 | ||
|
|
01a09116c0 |
14 changed files with 158 additions and 1030 deletions
|
|
@ -1 +0,0 @@
|
|||
usbutils-0.73.tar.gz
|
||||
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
/usbutils-*.tar.xz
|
||||
21
Makefile
21
Makefile
|
|
@ -1,21 +0,0 @@
|
|||
# Makefile for source rpm: usbutils
|
||||
# $Id: Makefile,v 1.1 2004/09/09 13:49:38 cvsdist Exp $
|
||||
NAME := usbutils
|
||||
SPECFILE = $(firstword $(wildcard *.spec))
|
||||
|
||||
define find-makefile-common
|
||||
for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done
|
||||
endef
|
||||
|
||||
MAKEFILE_COMMON := $(shell $(find-makefile-common))
|
||||
|
||||
ifeq ($(MAKEFILE_COMMON),)
|
||||
# attempt a checkout
|
||||
define checkout-makefile-common
|
||||
test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2
|
||||
endef
|
||||
|
||||
MAKEFILE_COMMON := $(shell $(checkout-makefile-common))
|
||||
endif
|
||||
|
||||
include $(MAKEFILE_COMMON)
|
||||
106
changelog
Normal file
106
changelog
Normal 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
|
||||
2
sources
2
sources
|
|
@ -1 +1 @@
|
|||
88978b4ad891f610620b1b8e5e0f43eb usbutils-0.73.tar.gz
|
||||
SHA512 (usbutils-019.tar.xz) = fb4acc570c2b71f90c51c2717dc80e844727c8fcfebb5d92c57145eb9d09cbd1f63cf405e07db76c3afaaf3fac87b90f3f512d0a7c4d50cb9e6f26438eca9390
|
||||
|
|
|
|||
22
usbreset.patch
Normal file
22
usbreset.patch
Normal 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)
|
||||
|
||||
|
||||
################################
|
||||
|
|
@ -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;
|
||||
|
|
@ -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",
|
||||
|
|
@ -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
|
||||
|
||||
|
|
@ -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;
|
||||
|
|
@ -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 \
|
||||
|
|
@ -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
|
||||
|
|
@ -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);
|
||||
}
|
||||
158
usbutils.spec
158
usbutils.spec
|
|
@ -1,144 +1,44 @@
|
|||
Name: usbutils
|
||||
Version: 0.73
|
||||
Release: 2%{?dist}
|
||||
Source: http://downloads.sourceforge.net/linux-usb/%{name}-%{version}.tar.gz
|
||||
Patch1: usbutils-0.73-hwdata.patch
|
||||
URL: http://www.linux-usb.org/
|
||||
License: GPLv2+
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
|
||||
Requires: hwdata
|
||||
BuildRequires: 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
|
||||
ExcludeArch: s390 s390x
|
||||
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
|
||||
%patch1 -p1 -b .hwdata
|
||||
%autosetup -p1
|
||||
|
||||
%build
|
||||
%configure --sbindir=/sbin
|
||||
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"
|
||||
|
||||
# remove unpackaged files from the buildroot
|
||||
rm -rf $RPM_BUILD_ROOT%{_libdir}
|
||||
rm -rf $RPM_BUILD_ROOT%{_includedir}
|
||||
rm -f $RPM_BUILD_ROOT%{_datadir}/usb.ids*
|
||||
%meson_install
|
||||
rm -rf %{buildroot}/%{_libdir}/pkgconfig/usbutils.pc
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,-)
|
||||
%license LICENSES/GPL*
|
||||
%doc NEWS
|
||||
%{_mandir}/*/*
|
||||
/sbin/*
|
||||
%doc AUTHORS COPYING ChangeLog NEWS README
|
||||
|
||||
%clean
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
%{_bindir}/*
|
||||
|
||||
%changelog
|
||||
* 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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue