Page MenuHomeFreeBSD

libusb: add option
Needs ReviewPublic

Authored by aokblast on Thu, Jun 12, 4:08 PM.
Tags
None
Referenced Files
F120624953: D50818.diff
Thu, Jun 19, 5:12 PM
F120595541: D50818.diff
Thu, Jun 19, 10:56 AM
F120533661: D50818.id156935.diff
Wed, Jun 18, 9:11 PM
Unknown Object (File)
Wed, Jun 18, 6:21 PM
Unknown Object (File)
Tue, Jun 17, 7:47 PM
Unknown Object (File)
Fri, Jun 13, 9:56 PM
Unknown Object (File)
Fri, Jun 13, 4:07 PM
Unknown Object (File)
Fri, Jun 13, 9:16 AM
Subscribers

Details

Reviewers
bapt
Group Reviewers
USB
Summary

Implement libusb_set_option for API compatibility of libusb upstream
The implementation status of each option is as following:

LIBUSB_OPTION_LOG_LEVEL: just like libusb_set_debug
LIBUSB_OPTION_LOG_CB: add callback support for DPRINTF
LIBUSB_OPTION_NO_DEVICE_DISCOVERY: disable initialization of devd and
netlink when register. Also, create no thread when registration of
callback happens.
LIBUSB_OPTION_USE_USBDK: no needed as USBDK is for Windows

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 64893
Build 61776: arc lint + arc unit

Event Timeline

The change about DEBUG_LEVEL to LOG_LEVEL is required to allow set_debug and debug callback works. So add that patch as a parent.

kevans added inline comments.
lib/libusb/libusb10.c
246

log_level seems to be unused in this final version, can it be removed?

1812

style(9) dictates explicit comparison against NULL here

lib/libusb/libusb10_hotplug.c
382

Is there some implication here for no_discovery? Should this be reachable at all if it's set?

lib/libusb/libusb10_hotplug.c
382

The no_discovery in upstream libusb is utilized when init the context. It will not start any hotplug scan thread if this option is true on the upstream libusb. That means this option is useless after libusb_init is called.

However, our implementation on the hotplug scan thread starts when the hotplug register is called instead of the libusb_init. I think the time point of no_discovery on upstream libusb is tighter because after init it will not work. So our implementation to do check on hotplug handler won't break any usecase of this option as it is expected to be set before init the context and actually hotplug register should be called after init.

lib/libusb/libusb10.c
246

It is a miss. Sorry, I will update a newer version later.