<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Feb 11, 2022 at 3:06 PM Rob Landley <<a href="mailto:rob@landley.net">rob@landley.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 2/11/22 1:29 PM, enh wrote:<br>
>     Heads up that there's another one in lsusb.c.<br>
> <br>
> thanks, but we may as well wait until someone has a specific use case. (although<br>
> it's unfortunate that there's no workaround with lsusb to specify a path like<br>
> there is with lspci.)<br>
<br>
Just noticed the discrepancy last email. :)<br>
<br>
>     (Android's not likely to want the gz<br>
>     version, Saving a megabyte is a rounding error there, it's probably on a<br>
>     compressed flash filesystem anyway, and keeping it be directly human readable<br>
>     may count as a slight win in that context. So it would check /etc and<br>
>     /usr/share/misc for pci.ids.gz before finding /vendor/pci.ids...)<br>
> <br>
> well, that's part of the background for why the patch says /vendor --- the<br>
> assumption is that no-one wants to pay to ship a pci id database, and even the<br>
> one user i have is for the virtualized cuttlefish stuff, not for an actual<br>
> device, and even they seem to just have a database with the pci ids they care<br>
> about, rather than a full database.<br>
<br>
Simple gzip brings them down to ~250k each. xz brings them down to 201 and 189<br>
but I learn towards just gzip because it's fast and cheap and I've got<br>
decompression code for that built-in already. I even already wrote most of the<br>
compressor but got derailed trying to make it match other gzip implementations'<br>
output for sha3sum reasons. (Mostly a question of when to do dictionary resets,<br>
and knowing when to use the builtin dictionary vs the calculated one. Alas, not<br>
things the RFC covers...)<br>
<br>
> in a sense you're right, that this is small (compared to, say, a sample<br>
> wallpaper or whatever), but the pressure in the other direction is that it's a<br>
> lot easier to justify space for user-visible stuff like wallpapers (even if most<br>
> users don't use most wallpapers) than it is for a database of debugging info.<br>
> <br>
> (i haven't yet checked, but i'm curious whether this database code actually<br>
> works? the cuttlefish folks seem to think it does, but that might be because<br>
> they have a cut down database? i did test this quickly on my laptop last night<br>
> but got seemingly nonsense results.<br>
<br>
Hmmm...<br>
<br>
$ toybox lspci<br>
00:1f.2 Class 0106: 02a  PCI Hotplug Controller A:1e03<br>
00:1c.0 Class 0604: 02a  PCI Hotplug Controller A:1e10<br>
00:1f.0 Class 0601: 02a  PCI Hotplug Controller A:1e55<br>
02:00.0 Class 0280: 02a  PCI Hotplug Controller A:0087<br>
0b:00.0 Class 0805: EN-1217 Ethernet Adapter:8221<br>
00:1c.5 Class 0604: 02a  PCI Hotplug Controller A:1e1a<br>
00:16.0 Class 0780: 02a  PCI Hotplug Controller A:1e3a<br>
00:1b.0 Class 0403: 02a  PCI Hotplug Controller A:1e20<br>
00:1c.3 Class 0604: 02a  PCI Hotplug Controller A:1e16<br>
00:19.0 Class 0200: 02a  PCI Hotplug Controller A:1502<br>
00:1f.3 Class 0c05: 02a  PCI Hotplug Controller A:1e22<br>
00:00.0 Class 0600: 02a  PCI Hotplug Controller A:0154<br>
00:1c.1 Class 0604: 02a  PCI Hotplug Controller A:1e12<br>
00:1a.0 Class 0c03: 02a  PCI Hotplug Controller A:1e2d<br>
00:1d.0 Class 0c03: 02a  PCI Hotplug Controller A:1e26<br>
00:02.0 Class 0300: 02a  PCI Hotplug Controller A:0166<br>
00:14.0 Class 0c03: 02a  PCI Hotplug Controller A:1e31<br>
00:1c.2 Class 0604: 02a  PCI Hotplug Controller A:1e14<br>
<br>
No, it does not. I'll have a go...<br>
<br>
> it wasn't obvious to me how the loop through<br>
> the file is actually taking into account the indentation level that's actually<br>
> meaningful for the database? at least for the full database i have on my<br>
> laptop... i might rewrite it one weekend, but i should probably find the time to<br>
> send you my gpiod.c and my strace fixes that have been lying around on my<br>
> raspberry pi for months first!)<br>
<br>
I have recently cleared more time to work on this, as you know. :)<br>
<br>
>     But if I do that I need to teach pci.ids to read the data into memory in one<br>
>     pass the way usb.ids does, or else it'll try to lseek() a pipe.<br>
> <br>
> (tbh, that was my first thought for rewriting this code anyway.)<br>
<br>
Indeed. I'd forgotten that lspci already had database reading code when I added<br>
it to lsusb. The two file formats actually look identical, except that pci.ids<br>
has a third indentation level. Should be easy to get them to share code...<br></blockquote><div><br></div><div>oh, that's convenient! TIL. i'll admit that the possibility _hadn't even occurred to me_ that two different linux things would actually have used the same format. maybe we'll have the year of linux on the desktop after all! :-)</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Rob<br>
</blockquote></div></div>