Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Add -t option to listdevs example

Open
#1,927 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
55/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Quiet
Tech stack
c
Domain
cli

Research direction

Start with the examples/listdevs example mentioned in the issue and compare its current output with the device paths shown. Add a -t option that displays the device topology; done when the example accepts that option and presents the connected devices in a tree-style view.

Written by the indexing model from the issue text.

Description

Examples

I need to use alternative lsusb utility pretty often under macOS since lsusb -t from usbutils does not work out of Linux.

mcuee in ~/build/libusb/libusb on master % lsusb
Bus 000 Device 001: ID 05ac:8015  
Bus 000 Device 002: ID 05e3:0625  
Bus 000 Device 003: ID 05e3:0610  
Bus 000 Device 004: ID 16c0:05dc  
Bus 000 Device 006: ID 0bda:8156  
Bus 000 Device 007: ID 05e3:0747  
Bus 000 Device 008: ID 04b4:8613  

mcuee in ~/build/libusb/libusb on master % lsusb -t
Usage: lsusb [options]...
List USB devices
  -v, --verbose
      Increase verbosity (show descriptors)
  -s [[bus]:][devnum]
      Show only devices with specified device and/or
      bus numbers (in decimal)
  -d vendor:[product]
      Show only devices with the specified vendor and
      product ID numbers (in hexadecimal)
  -D device
      Selects which device lsusb will examine
  -V, --version
      Show version of program
  -h, --help
      Show usage and help

mcuee in ~/build/libusb/libusb on master % ./build_git/examples/listdevs 
04b4:8613 (bus 0, device 8) path: 1.2.2
05e3:0747 (bus 0, device 7) path: 2.4
0bda:8156 (bus 0, device 6) path: 2.3
05e3:0625 (bus 0, device 2) path: 2
16c0:05dc (bus 0, device 4) path: 1.2.1
05e3:0610 (bus 0, device 3) path: 1.2
05ac:8015 (bus 0, device 1) path: 1
mcuee in ~/build/libusb/libusb on master % ./build_git/examples/testlibusb 
Dev (bus 0, device 8): 04B4 - 8613 speed: 480M
Dev (bus 0, device 7): 05E3 - 0747 speed: 5G
  Manufacturer:              Generic
  Product:                   USB Storage
Dev (bus 0, device 6): 0BDA - 8156 speed: 5G
  Manufacturer:              Realtek
  Product:                   USB 10/100/1G/2.5G LAN
Dev (bus 0, device 2): 05E3 - 0625 speed: 10G
  Manufacturer:              GenesysLogic
  Product:                   USB3.2 Hub
Dev (bus 0, device 4): 16C0 - 05DC speed: 1.5M
  Manufacturer:              www.fischl.de
  Product:                   USBasp
Dev (bus 0, device 3): 05E3 - 0610 speed: 480M
  Manufacturer:              GenesysLogic
  Product:                   USB2.1 Hub
Dev (bus 0, device 1): 05AC - 8015 speed: 480M
  Manufacturer:              Apple
  Product:                   USB2.0 Hub```

It would be good to add `-t` option to libusb example listdev example.
Dominant language
C
Stars
6.2k
Forks
2.1k
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from libusb/libusb

All issues in libusb/libusb

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.