[Toybox] [TOY] lspci

Rob Landley rob at landley.net
Tue Aug 6 22:18:55 PDT 2013


On 08/02/2013 05:07:38 PM, Andre Renaud wrote:
> Hi Issac,
> 
> > to elements (one for each device) of an array of struct bar and the  
> ref fields
> > of the elements of this array should point back to the  
> corresponding list
> > element. Then, sort the array of struct bars according to  
> ref->vendor and
> > ref->device. Next, update ref->strs to point to the right element  
> in the
> > sorted array. Now we can start reading the (sorted) pci database  
> line by
> > line and fill out the other elements of the struct bar array. For  
> the
> > printing we iterate through the list of struct foo.
> 
> If this code gets written, it could be used equally well in the lsusb
> code, as the usb database is almost identical to the pci one:
> http://pci-ids.ucw.cz/pci.ids
> http://www.linux-usb.org/usb.ids

A nice thing about toybox is that when you statically link it the  
binary is completely portable, so when I looked at that myself (~3  
years ago) I wanted to covert the data to a C table at build time and  
link it into the binary. I didn't because I needed to track down what  
license that data was under.

I also want to do the "when including gunzip, compress the text data"  
trick on all the help text (if you've got a gunzip parser already you  
break even at a couple hundred bytes), and I was thinking this might  
also get worked in there somehow. But I haven't sat down and worked out  
the details.

I have many, many todo items. I haven't been handling them in an  
efficient order because I keep getting interrupted. I'm about halfway  
through caffeine withdrawl, but I'll probably go back on it mondayish  
and I expect to be noticeably less incoherent then. :)

Rob
 1375852735.0


More information about the Toybox mailing list