darwin: use the IO registry to detect if a kernel driver is attached to an interface
authorNathan Hjelm <hjelmn@google.com>
Wed, 21 Jul 2021 17:49:37 +0000 (11:49 -0600)
committerNathan Hjelm <hjelmn@cs.unm.edu>
Thu, 22 Jul 2021 05:07:17 +0000 (23:07 -0600)
commitf8dc6af91607d5d2202c47b3b62e107df9197184
treef5b2069045b6329f405df9d09cc517cb5213aaf3
parent42f9c3b43f49f22a3b10ed452f500f6f50c093df
darwin: use the IO registry to detect if a kernel driver is attached to an interface

The implementation of libusb_kernel_driver_active was attempting to open the interface to
check if a driver is attached. This may have side effects (like configuring the device)
that may be unexpected to the user. This commit updates the code to find the interface's
IO registry entry (either IOUSBHostInterface or the legacy IOUSBInterface) and check if
the entry has a child entry. A child entry indicates that a driver is currently attached.

Signed-off-by: Nathan Hjelm <hjelmn@google.com>
configure.ac
libusb/os/darwin_usb.c
libusb/os/darwin_usb.h
libusb/version_nano.h