Newer versions of drivers such as libwacom (graphics tablets) or libfprint (fingerprint scanners) call g_usb_device_get_parent. This in turn calls libusb_get_parent on platforms which implement it, and returns NULL on platforms that don't. This patch implements this function on FreeBSD.
Details
Tried different combinations of different devices connected to different hubs and it all seems to work. Tried on the AMD Framework 13. Used an ad-hoc program to test this but I'd eventually like to add a tree view kind of thing to usbconfig like in lsusb.
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Passed - Unit
No Test Coverage - Build Status
Buildable 60396 Build 57280: arc lint + arc unit
Event Timeline
Implementation wise, this looks fine to me. Can you update libusb.3 as well and document this, maybe right around libusb_get_device, please?
lib/libusb/libusb.3 | ||
---|---|---|
227 | Boy Scout Rule - It seems many functions are all listed under "LIBRARY INITIALISATION / DEINITIALISATION" while they better be under their own section. I would say at least align them with libusb.h. |
lib/libusb/libusb10.c | ||
---|---|---|
6 | This one is just a question being curious, I see your name added here but not in the other header files. Is this intentional or a mistake ? |
lib/libusb/libusb10.h | ||
---|---|---|
129 ↗ | (On Diff #149003) | monwarez on Discord wrote: "this seems to change the ABI of the struct, does running without relinking work ?" but no specific text was indicated for what "this" is to refer to. So: I assume that is for the above addition to the middle of the libusb_device struct. It would appear to change the Binary Interface involved for at least all the functions that have a parameter like (for example): libusb_device * dev Note: I've not analyzed anything signficant. I'm just trying to make the monwarez note part of the review. |
lib/libusb/libusb10.h | ||
---|---|---|
129 ↗ | (On Diff #149003) | libusb_device is opaque to the application, the size/layout is never exposed. |