Re: usb/150546: commit references a PR
The following reply was made to PR usb/150546; it has been noted by GNATS. From: dfil...@freebsd.org (dfilter service) To: bug-follo...@freebsd.org Cc: Subject: Re: usb/150546: commit references a PR Date: Fri, 19 Nov 2010 21:04:24 + (UTC) Author: thompsa Date: Fri Nov 19 21:04:18 2010 New Revision: 215546 URL: http://svn.freebsd.org/changeset/base/215546 Log: MFC r213853 - Add missing LibUSB API functions: * libusb_strerror() * libusb_get_driver[_np]() * libusb_detach_kernel_driver[_np]() - Factor out setting of non-blocking flag inside libusb. - Add missing NULL check after libusb_get_device() call. - Correct some wrong error codes due to copy and paste error. PR: usb/150546 Submitted by: Robert Jenssen, Alexander Leidinger Modified: stable/8/lib/libusb/libusb.3 stable/8/lib/libusb/libusb.h stable/8/lib/libusb/libusb10.c stable/8/lib/libusb/libusb20.3 Directory Properties: stable/8/lib/libusb/ (props changed) stable/8/lib/libusb/usb.h (props changed) Modified: stable/8/lib/libusb/libusb.3 == --- stable/8/lib/libusb/libusb.3 Fri Nov 19 20:23:01 2010 (r215545) +++ stable/8/lib/libusb/libusb.3 Fri Nov 19 21:04:18 2010 (r215546) @@ -26,7 +26,7 @@ .\ .\ $FreeBSD$ .\ -.Dd June 22, 2009 +.Dd October 14, 2010 .Dt LIBUSB 3 .Os .Sh NAME @@ -72,6 +72,15 @@ Deinitialise libusb. Must be called at t . .Pp . +.Ft const char * +.Fn libusb_strerror int code +Get ASCII representation of the error given by the +.Fa code +argument. +. +. +.Pp +. .Ft void .Fn libusb_set_debug libusb_context *ctx int level Set debug to the @@ -239,12 +248,37 @@ if the device has been disconnected and .Pp . .Ft int +.Fn libusb_get_driver libusb_device_handle *devh int interface char *name int namelen +or +.Ft int +.Fn libusb_get_driver_np libusb_device_handle *devh int interface char *name int namelen +Gets the name of the driver attached to the given +.Fa device +and +.Fa interface +into the buffer given by +.Fa name +and +.Fa namelen . +Returns 0 on success, LIBUSB_ERROR_NOT_FOUND if no kernel driver is attached +to the given interface and LIBUSB_ERROR_INVALID_PARAM if the interface does +not exist. +This function is non-portable. +The buffer pointed to by +.Fa name +is only zero terminated on success. +. +.Pp +. +.Ft int .Fn libusb_detach_kernel_driver libusb_device_handle *devh int interface -Detach a kernel driver from an interface. This is needed to claim an interface -required by a kernel driver. Returns 0 on success, LIBUSB_ERROR_NOT_FOUND if -no kernel driver was active, LIBUSB_ERROR_INVALID_PARAM if the interface does not -exist, LIBUSB_ERROR_NO_DEVICE if the device has been disconnected and a -LIBUSB_ERROR code on failure. +or +.Ft int +.Fn libusb_detach_kernel_driver_np libusb_device_handle *devh int interface +Detach a kernel driver from an interface. +This is needed to claim an interface required by a kernel driver. +Returns 0 on success, LIBUSB_ERROR_NOT_FOUND if no kernel driver was active, +LIBUSB_ERROR_INVALID_PARAM if the interface does not exist, LIBUSB_ERROR_NO_DEVICE if the device has been disconnected and a LIBUSB_ERROR code on failure. This function is non-portable. . .Pp . @@ -271,7 +305,7 @@ failure. . .Pp .Ft int -.Fn libsub_get_active_config_descriptor libusb_device *dev libusb_device_descriptor **config +.Fn libsub_get_active_config_descriptor libusb_device *dev struct libusb_config_descriptor **config Get the USB configuration descriptor for the active configuration. Returns 0 on success, returns LIBUSB_ERROR_NOT_FOUND if the device is in unconfigured state and return another LIBUSB_ERROR code on error. @@ -337,7 +371,7 @@ LIBUSB_ERROR code on failure. . .Pp .Ft int -.Fn libusb_control_transfer libusb_device_handle *devh uint8_t bmRequestType uint16_t wIndex unsigned char *data uint16_t wLength unsigned int timeout +.Fn libusb_control_transfer libusb_device_handle *devh uint8_t bmRequestType uint8_t bRequest uint16_t wValue uint16_t wIndex unsigned char *data uint16_t wLength unsigned int timeout Perform a USB control transfer. Returns 0 on success, LIBUSB_ERROR_TIMEOUT if the transfer timeout, LIBUSB_ERROR_PIPE if the control request was not supported, LIBUSB_ERROR_NO_DEVICE if the device has been disconnected and Modified: stable/8/lib/libusb/libusb.h == --- stable/8/lib/libusb/libusb.h Fri Nov 19 20:23:01 2010 (r215545) +++ stable/8/lib/libusb/libusb.h Fri Nov 19 21:04:18 2010 (r215546) @@ -294,6 +294,7 @@ typedef struct libusb_transfer { /* Library initialisation */ void libusb_set_debug(libusb_context * ctx, int level); +const char
Re: usb/150546: commit references a PR
The following reply was made to PR usb/150546; it has been noted by GNATS. From: dfil...@freebsd.org (dfilter service) To: bug-follo...@freebsd.org Cc: Subject: Re: usb/150546: commit references a PR Date: Thu, 14 Oct 2010 20:50:41 + (UTC) Author: hselasky Date: Thu Oct 14 20:50:33 2010 New Revision: 213853 URL: http://svn.freebsd.org/changeset/base/213853 Log: - Add missing LibUSB API functions: * libusb_strerror() * libusb_get_driver[_np]() * libusb_detach_kernel_driver[_np]() - Factor out setting of non-blocking flag inside libusb. - Add missing NULL check after libusb_get_device() call. - Correct some wrong error codes due to copy and paste error. PR: usb/150546 Submitted by:Robert Jenssen, Alexander Leidinger Approved by:thompsa (mentor) Modified: head/lib/libusb/libusb.3 head/lib/libusb/libusb.h head/lib/libusb/libusb10.c head/lib/libusb/libusb20.3 Modified: head/lib/libusb/libusb.3 == --- head/lib/libusb/libusb.3 Thu Oct 14 20:38:18 2010(r213852) +++ head/lib/libusb/libusb.3 Thu Oct 14 20:50:33 2010(r213853) @@ -26,7 +26,7 @@ .\ .\ $FreeBSD$ .\ -.Dd June 22, 2009 +.Dd October 14, 2010 .Dt LIBUSB 3 .Os .Sh NAME @@ -72,6 +72,15 @@ Deinitialise libusb. Must be called at t . .Pp . +.Ft const char * +.Fn libusb_strerror int code +Get ASCII representation of the error given by the +.Fa code +argument. +. +. +.Pp +. .Ft void .Fn libusb_set_debug libusb_context *ctx int level Set debug to the @@ -247,12 +256,37 @@ if the device has been disconnected and .Pp . .Ft int +.Fn libusb_get_driver libusb_device_handle *devh int interface char *name int namelen +or +.Ft int +.Fn libusb_get_driver_np libusb_device_handle *devh int interface char *name int namelen +Gets the name of the driver attached to the given +.Fa device +and +.Fa interface +into the buffer given by +.Fa name +and +.Fa namelen . +Returns 0 on success, LIBUSB_ERROR_NOT_FOUND if no kernel driver is attached +to the given interface and LIBUSB_ERROR_INVALID_PARAM if the interface does +not exist. +This function is non-portable. +The buffer pointed to by +.Fa name +is only zero terminated on success. +. +.Pp +. +.Ft int .Fn libusb_detach_kernel_driver libusb_device_handle *devh int interface -Detach a kernel driver from an interface. This is needed to claim an interface -required by a kernel driver. Returns 0 on success, LIBUSB_ERROR_NOT_FOUND if -no kernel driver was active, LIBUSB_ERROR_INVALID_PARAM if the interface does not -exist, LIBUSB_ERROR_NO_DEVICE if the device has been disconnected and a -LIBUSB_ERROR code on failure. +or +.Ft int +.Fn libusb_detach_kernel_driver_np libusb_device_handle *devh int interface +Detach a kernel driver from an interface. +This is needed to claim an interface required by a kernel driver. +Returns 0 on success, LIBUSB_ERROR_NOT_FOUND if no kernel driver was active, +LIBUSB_ERROR_INVALID_PARAM if the interface does not exist, LIBUSB_ERROR_NO_DEVICE if the device has been disconnected and a LIBUSB_ERROR code on failure. This function is non-portable. . .Pp . @@ -279,7 +313,7 @@ failure. . .Pp .Ft int -.Fn libsub_get_active_config_descriptor libusb_device *dev libusb_device_descriptor **config +.Fn libsub_get_active_config_descriptor libusb_device *dev struct libusb_config_descriptor **config Get the USB configuration descriptor for the active configuration. Returns 0 on success, returns LIBUSB_ERROR_NOT_FOUND if the device is in unconfigured state and return another LIBUSB_ERROR code on error. @@ -345,7 +379,7 @@ LIBUSB_ERROR code on failure. . .Pp .Ft int -.Fn libusb_control_transfer libusb_device_handle *devh uint8_t bmRequestType uint16_t wIndex unsigned char *data uint16_t wLength unsigned int timeout +.Fn libusb_control_transfer libusb_device_handle *devh uint8_t bmRequestType uint8_t bRequest uint16_t wValue uint16_t wIndex unsigned char *data uint16_t wLength unsigned int timeout Perform a USB control transfer. Returns 0 on success, LIBUSB_ERROR_TIMEOUT if the transfer timeout, LIBUSB_ERROR_PIPE if the control request was not supported, LIBUSB_ERROR_NO_DEVICE if the device has been disconnected and Modified: head/lib/libusb/libusb.h == --- head/lib/libusb/libusb.h Thu Oct 14 20:38:18 2010(r213852) +++ head/lib/libusb/libusb.h Thu Oct 14 20:50:33 2010(r213853) @@ -294,6 +294,7 @@ typedef struct libusb_transfer { /* Library initialisation */ void libusb_set_debug(libusb_context * ctx, int level); +const char *libusb_strerror(int code); int libusb_init(libusb_context ** context); void libusb_exit(struct libusb_context *ctx); @@ -318,6 +319,9 @@ int