[Toybox] new toy: lsusb

Rob Landley rob at landley.net
Tue May 14 22:08:42 PDT 2013


On 05/14/2013 06:27:24 PM, Andre Renaud wrote:
> Hi Rob,
> 
> On 15 May 2013 11:06, Rob Landley <rob at landley.net> wrote:
> > Is there something special about the entries that have DEVTYPE= as  
> the first
> > line? Depending on the ordering seems darn subtle here. I did a  
> quick:
> 
> You're right, relying on the order is a terrible idea (although it is
> what busybox does). I'm also not too keen on using a filename wildcard
> (although it's better than the ordering). However attached is a patch
> that instead only lists DEVTYPE=usb_device entries.

I fixed this while offline by only using entries that had all three of  
the lines of interest. It's currently producing the correct result on  
my test system, although that doesn't mean much...

> Looking at the Linux code, these DEVTYPE entries appear as a result of
> calling device_initialize with something that has it's 'type' set,
> which only happens twice in the USB subsystem - once for 'usb_device'
> and once for 'usb_interface'. I haven't looked closely, but I assume
> that if they shuffle the order of the code within there, the
> first-line assumption will be invalid. So it's better this way.

If DEVTYPE=usb_device is the correct check for this, I'm happy to  
change the code again. I'm just not hugely familiar with the domain  
here, I'm not sure what the code is trying to accomplish. (What are the  
usb_interface entries for? I should plug in some random devices and see  
what I can get, but )

Also, the human readable text part of this comes from  
http://www.linux-usb.org/usb.ids so in theory we could add a config  
option to either look for that in /etc/usb.ids or include a digested  
version of it in the binary, and output human readable info. (I dunno  
what license the file has though.)

Not a huge deal, just potential future expansion...

> As a separate aside - what is the story with toys like this that are
> strictly Linux only - is toybox a linux-only project, or are they just
> tagged separately?

Linux and android are the systems I'm targeting. I'm not purposely  
excluding others, but I'm not really paying attention to them either. I  
did a video at ELC back in February explaining my goals and rationale.  
It's linked from the most recent news entry on landley.net/toybox

As for menuconfig, the Posix and LSB directories are because there are  
relevant standards which the commands in there may not fully adhere to,  
but are least written after looking at those standards. This lets me  
check at a glance which commands out of each group I've implemented and  
which are left to do.

The "other" directory is stuff I haven't got a standard for. (I might  
split "net" out once I've got enough of those.)

The "pending" directory is stuff I need to review/cleanup and move to  
one of the other directories. That should go away by 1.0.

Rob
 1368594522.0


More information about the Toybox mailing list