usb-devices: use 'local' variable type to handle recursion

When recursing into a long USB tree, the local variables in the
print_device() function would get confused and take on the value of the
previous device it printed.  This caused devices to not get printed out
at all, the exact opposite of what we wanted.

Resolve this by using the non-POSIX 'local' variable declaration.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 file changed
tree: 981b4814d8656bd9972d6a7d75c1fd65ed45de51
  1. LICENSES/
  2. usbhid-dump/
  3. .gitignore
  4. .gitmodules
  5. .travis.yml
  6. autogen.sh
  7. configure.ac
  8. desc-defs.c
  9. desc-defs.h
  10. desc-dump.c
  11. desc-dump.h
  12. list.h
  13. lsusb-t.c
  14. lsusb.8.in
  15. lsusb.c
  16. lsusb.h
  17. lsusb.py.in
  18. Makefile.am
  19. names.c
  20. names.h
  21. NEWS
  22. README.md
  23. sysfs.c
  24. sysfs.h
  25. travis-autogen.sh
  26. usb-devices
  27. usb-devices.1.in
  28. usb-spec.h
  29. usbhid-dump.8.in
  30. usbmisc.c
  31. usbmisc.h
  32. usbreset.c
  33. usbutils.spdx
README.md

usbutils

This is a collection of USB tools for use on Linux and BSD systems to query what type of USB devices are connected to the system. This is to be run on a USB host (i.e. a machine you plug USB devices into), not on a USB device (i.e. a device you plug into a USB host.)

Building and installing

Note, usbutils depends on libusb, be sure that library is properly installed first.

To work with the “raw” repo, after cloning it just do:

./autogen.sh

Or if you like doing things “by hand” you can try the following:

Get the usbhid-dump git submodule:

git submodule init
git submodule update

Initialize autobuild with:

autoreconf --install --symlink

Configure the project with:

./configure

Build everything with:

make

Install it, if you really want to, with:

make install