Page MenuHomeFreeBSD

libusb: hotplug, use events instead of a timer when possible
Needs ReviewPublic

Authored by bapt on Fri, Jan 3, 1:34 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Jan 6, 2:20 PM
Unknown Object (File)
Mon, Jan 6, 10:59 AM
Unknown Object (File)
Mon, Jan 6, 9:17 AM
Unknown Object (File)
Mon, Jan 6, 9:14 AM
Unknown Object (File)
Mon, Jan 6, 7:46 AM
Unknown Object (File)
Mon, Jan 6, 7:41 AM
Unknown Object (File)
Mon, Jan 6, 3:12 AM
Unknown Object (File)
Mon, Jan 6, 2:01 AM

Details

Reviewers
emaste
kevans
Group Reviewers
USB
Summary

Try to fetch events from nlsysevent or devd to determine when
to scan the usb bus for devices addition or removal.
if none are available fallback on the regular timer based (4s)
scanner

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 61478
Build 58362: arc lint + arc unit

Event Timeline

bapt requested review of this revision.Fri, Jan 3, 1:34 PM
lib/libusb/libusb10_hotplug.c
57

Hi @bapt,

According to devd(8) '/var/run/devd.pipe' is deprecated in favor for '/var/run/devd.seqpacket.pipe', any reason for still using it here ?

Looks fine in principle

lib/libusb/libusb10_hotplug.c
178–179

This doesn't seem like it would work?

194

IMO "ignore any error" should just be a (void) cast for the return vaule, but I don't feel strongly about it.

194

Where is timeout coming from here? With this and the above, kinda seems like something went wrong with the patch.

lib/libusb/libusb10_hotplug.c
194

Yeah not a huge issue but I agree (void)poll(...) is both a programmer-readable and machine-readable way to indicate that errors are intentionally ignored.

fix bad rebase
switch from sock_stream to sock_seqpacket for devd's pipe

bapt marked 4 inline comments as done.Tue, Jan 7, 7:55 AM
bapt added inline comments.
lib/libusb/libusb10_hotplug.c
178–179

sorry bad rebase

194

bad rebase as well