[Toybox] lspci
Isaac
idunham at lavabit.com
Mon Jul 22 20:57:38 PDT 2013
On Tue, Jul 23, 2013 at 11:40:46AM +1000, scsijon wrote:
> Can I take it that even though you've not mentioned them to date
> that you are including the three double character switches. They are
> absolutely magic when debugging a build with a device problem.
>
> -vv for very verbose
> -nn Show both textual and numeric ID's (names & numbers)
> -qq Query the PCI ID database for unknown ID's via DNS, but
> re-query with the locally cached entries
>
> Pretty please with fresh honey on the crumpets.
Not included, all of them presume functionality I haven't included,
and I haven't a clue how to implement much of it.
I don't know if toybox has support for double-character switches
(--longopts and -s are supported).
What I wrote is just a little better than busybox:
busybox has -m and -k, and outputs only numeric ID's (like lspci-FULL -n).
I added a do-nothing -n since that's what I output already,
and -e for the full class width.
-v and -q are not supported.
-v displays all the textual information in sysfs, including an expanded
version of any magic numbers. But what's a little trickier than that is
displaying "Kernel modules:". It means looking up the modalias (find
all modules containing "alias=%s",modalias); this could be done via a
search of the tree, a search of modules.alias, or of bb.modules.alias.
Which to do depends on your modprobe/depmod. And to look through the tree
may mean supporting any type of compression.
But really, find_modalias() would be useful for modinfo, modprobe, and I
guess lspci.
Textual ID's require parsing the database (/usr/share/misc/pci.ids{,gz}),
which I have hardly looked at.
But it looks like it's search for ^vendor, then while line[0] == '\t'
look for ^\tdevice.
If support is conditional, looking this up seems reasonable...
As far as query via DNS goes, I have not done any netwrk programming,
and if I had I would still want to say "that doesn't belong in lspci -
update your local database!" ;)
Sorry I couldn't be of more help.
Isaac Dunham
> thanks and regards
> jon
More information about the Toybox
mailing list