Page MenuHomeFreeBSD

usbconfig: allow to get usb vendors and products from the usb.ids database
ClosedPublic

Authored by bapt on Aug 15 2015, 10:22 PM.
Tags
None
Referenced Files
F84310901: D3392.id135153.diff
Wed, May 22, 4:21 AM
F84275733: D3392.id135073.diff
Tue, May 21, 6:19 PM
F84275366: D3392.id135152.diff
Tue, May 21, 6:13 PM
F84255170: D3392.diff
Tue, May 21, 12:46 PM
Unknown Object (File)
Sun, May 19, 9:36 AM
Unknown Object (File)
Sun, May 19, 9:36 AM
Unknown Object (File)
Sun, May 19, 9:36 AM
Unknown Object (File)
Fri, May 17, 12:51 AM
Subscribers

Details

Summary

Allow to get usb vendors and products from the usb.ids databse.

I plan to add a share/misc/usb_vendors like we do for pciconf

Prefer port version as updated more often

The code is strongly based on pciconf one

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

bapt retitled this revision from to Allow to get usb vendors and products from the usb.ids databse..
bapt updated this object.
bapt edited the test plan for this revision. (Show Details)
bapt added a reviewer: hselasky.

Forgot to say:

before

ugen0.1: <XHCI root HUB 0x8086> at usbus0, cfg=0 md=HOST spd=SUPER (5.0Gbps) pwr=SAVE (0mA)
ugen0.2: <Lenovo EasyCamera Generic> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (500mA)
ugen0.3: <USB2.0 Hub vendor 0x05e3> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (100mA)
ugen0.4: <product 0x3004 vendor 0x0cf3> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (100mA)
ugen0.5: <USB2.0-CRW Generic> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (500mA)

After:

ugen0.1: <XHCI root HUB 0x8086> at usbus0, cfg=0 md=HOST spd=SUPER (5.0Gbps) pwr=SAVE (0mA)
ugen0.2: <Lenovo EasyCamera Acer, Inc> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (500mA)
ugen0.3: <4-port hub Genesys Logic, Inc.> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (100mA)
ugen0.4: <AR3012 Bluetooth 4.0 Atheros Communications, Inc.> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (100mA)
ugen0.5: <RTS5129 Card Reader Controller Realtek Semiconductor Corp.> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (500mA)
lib/libusb/libusb20_ugen20.c
53 ↗(On Diff #7969)

Maybe putting the vendor info only is enough?

How about using STAILQ_XXX() instead of TAILQ_XXX() to save a pointer per entry?

406 ↗(On Diff #7969)

Hi,

Use this way:

while ((vi = TAILQ_FIRST(uvendors) ) != NULL) {
TAILQ_REMOVE(...);

}

430 ↗(On Diff #7969)

Loading the product and vendors for every USB access would be overkill. The table is quite big. I would make it a utility function:

int
libusb20_str_vendor(uint16_t, const char **);

int
libusb20_str_product(uint16_t, const char **);

And only load when those two functions are called.

--HPS

imp added a reviewer: imp.

I generally like it. TAILQ vs STAILQ I'm agnostic on, though I don't see a need to traverse the list backwards ever...

This revision is now accepted and ready to land.Aug 21 2015, 9:32 PM
bapt retitled this revision from Allow to get usb vendors and products from the usb.ids databse. to usbconfig: allow to get usb vendors and products from the usb.ids database..
bapt edited the summary of this revision. (Show Details)
bapt retitled this revision from usbconfig: allow to get usb vendors and products from the usb.ids database. to usbconfig: allow to get usb vendors and products from the usb.ids database.
This revision is now accepted and ready to land.Feb 27 2024, 5:13 PM

rework entirely to not clutter libusb and only be in the frontend

This revision now requires review to proceed.Feb 27 2024, 5:14 PM
This revision is now accepted and ready to land.Feb 27 2024, 5:32 PM

Just the one question... otherwise it looks good

usr.sbin/usbconfig/dump.c
349

Is conputing the address 1 before the buf well defined?

usr.sbin/usbconfig/dump.c
331–337

the priority is slightly odd e.g. if you don't set USB_VENDOR_DATABASE you get the /usr/local/file (assuming it exists), but if you set USB_VENDOR_DATABASE to a nonexistent file you get the non-ports version. In practice it probably doesn't matter too much, but it is a little odd.

This revision now requires review to proceed.Feb 28 2024, 8:34 AM
bapt marked 2 inline comments as done.
This revision is now accepted and ready to land.Feb 28 2024, 9:46 AM
This revision now requires review to proceed.Feb 28 2024, 2:10 PM

provided the last messages looks scary I am not giving up on this, just I don't want to be my own reviewer

This revision is now accepted and ready to land.Feb 28 2024, 7:00 PM