On Mon, May 6, 2019 at 3:32 PM Greg KH <gregkh@xxxxxxxxxxxxxxxxxxx> wrote: > > On Mon, May 06, 2019 at 12:02:07PM +0300, Mantas Mikulėnas wrote: > > Hi, > > > > I accidentally ended up hacking on the lsusb.py script and now have an > > assorted collection of patches: > > > > - Output (controllers, hubs, etc.) sorted numerically. > > - Color enabled by default when on a tty. > > - Added --long-options. > > - Replaced hand-rolled binary search with ordinary dict lookups; > > lost the -w (--warn-if-unsorted) option in the process. > > - Cosmetic changes to make it look more like Python and less like C. > > - Some changes to the output formatting that I liked to have in my own > > local version. > > > > > > I've applied all of these patches now, except for the usb.ids error > message that I responded to. Note, I do not know python well, if at > all, so I just had to take your word for most of these :) > > I don't like the usb.ids error message that happens here, it's not > essential that that file be found, especially given that most distros do > not ship it anymore as they have switched over to the hw database > format. So maybe we can just drop the "error" as the tool does work > without it, or look for the hwids data instead? Yeah, it's probably fine to drop it (especially because the v010 parser bugs that prompted the change had already received fixes in master). I do want to make the tool use hwdb (I suppose the dependency is fine given that lsusb.c already uses it), but as the only existing parser for hwdb.bin is the C library with cpp macros sprinkled on top, I suspect doing it from python will hurt a bit. -- Mantas Mikulėnas