jlhonora / lsusb

lsusb command for Mac OS X
MIT License
368 stars 49 forks source link

Fix issue #8 #9

Closed dardo82 closed 9 years ago

dardo82 commented 9 years ago

Add manufacturer's name to the "tree" option, optionally using parenthesis.

jlhonora commented 9 years ago

Looks well. I'll check it with a linux device and let you know.

dardo82 commented 9 years ago

It's more congruent internally with this change, even if maybe it's slightly different from the Linux version.

dardo82 commented 9 years ago

How long will it take to let me know? -_-

jlhonora commented 9 years ago

Sorry, totally forgot about this.

I think it needs a lot of rework to be merged. Once again, the spirit of this command is to emulate it as close as possible to the Linux one, but for OS X. Why is this? Some programs or scripts that were ported from Linux to OS X need the exact same behavior.

So:

  1. The options for lsusb -h are now printed in different order. -m should be just above --version
  2. Spelling corrections in lsusb -h don't apply, they're actually that way in Linux. As a reference:

    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
     -t
         Dump the physical USB device hierarchy as a tree
     -V, --version
         Show version of program
  3. Missing collon after -s is not an error, current behavior works as expected
  4. Hub speed rename isn't appropriate either.

If you want to review these and submit a new PR I'd gladly take a look again. This time won't take long, I promise :)

dardo82 commented 9 years ago

Can you also give me the output of lsusb on a Linux system as opposed to lsusb -h for reference ?

jlhonora commented 9 years ago

On linux:

$ lsusb -h
lsusb: invalid option -- 'h'
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
  -t
      Dump the physical USB device hierarchy as a tree
  -V, --version
      Show version of program
$ lsusb
Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. 
Bus 001 Device 004: ID 0bda:8176 Realtek Semiconductor Corp. RTL8188CUS 802.11n WLAN Adapter
dardo82 commented 9 years ago

I don't have any script or program that needs this, i was doing this just for fun, but if i'm so limited in the ways i can improve it, i think that i will just alias system_profiler SPUSBDataType to lsusb and that will suit my tastes, at least for now.