From 4f9cea1a24a61aa392b876cac203b4addeacc97c Mon Sep 17 00:00:00 2001 From: hselasky Date: Wed, 12 Oct 2011 06:40:49 +0000 Subject: [PATCH] MFC r226220 Fix libusb compliance. git-svn-id: svn://svn.freebsd.org/base/stable/8@226282 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- lib/libusb/libusb.3 | 4 ++-- lib/libusb/libusb10.c | 7 ++++--- lib/libusb/libusb20.3 | 5 ++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/libusb/libusb.3 b/lib/libusb/libusb.3 index b69922e71..7255f2b4d 100644 --- a/lib/libusb/libusb.3 +++ b/lib/libusb/libusb.3 @@ -223,8 +223,8 @@ code on failure. .Ft int .Fn libusb_kernel_driver_active "libusb_device_handle *devh" "int interface" Determine if a driver is active on a interface. -Returns 0 if no kernel driver -is active, 1 if a kernel driver is active, LIBUSB_ERROR_NO_DEVICE +Returns 0 if no kernel driver is active +and 1 if a kernel driver is active, LIBUSB_ERROR_NO_DEVICE if the device has been disconnected and a LIBUSB_ERROR code on failure. .Pp .Ft int diff --git a/lib/libusb/libusb10.c b/lib/libusb/libusb10.c index e02b90af9..0a7c1e6b1 100644 --- a/lib/libusb/libusb10.c +++ b/lib/libusb/libusb10.c @@ -216,7 +216,6 @@ libusb_get_device_list(libusb_context *ctx, libusb_device ***list) libusb20_be_free(usb_backend); return (LIBUSB_ERROR_NO_MEM); } - /* get device into libUSB v1.0 list */ libusb20_be_dequeue_device(usb_backend, pdev); @@ -718,8 +717,10 @@ libusb_kernel_driver_active(struct libusb20_device *pdev, int interface) if (pdev == NULL) return (LIBUSB_ERROR_INVALID_PARAM); - return (libusb20_dev_kernel_driver_active( - pdev, interface)); + if (libusb20_dev_kernel_driver_active(pdev, interface)) + return (0); /* no kernel driver is active */ + else + return (1); /* kernel driver is active */ } int diff --git a/lib/libusb/libusb20.3 b/lib/libusb/libusb20.3 index b41bec150..bd167b239 100644 --- a/lib/libusb/libusb20.3 +++ b/lib/libusb/libusb20.3 @@ -614,10 +614,9 @@ The file descriptor can be used for polling purposes. .Pp . .Fn libusb20_dev_kernel_driver_active -returns a non-zero value if a kernel driver is active on -the given USB interface. +returns zero if a kernel driver is active on the given USB interface. . -Else zero is returned. +Else a LIBUSB20_ERROR value is returned. . .Pp . -- 2.45.0