mirror of
https://github.com/RPCS3/libusb.git
synced 2024-11-27 04:00:57 +00:00
core: Preparation for handling backend-specific options
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
This commit is contained in:
parent
86b162c335
commit
468d864806
@ -2065,6 +2065,19 @@ int API_EXPORTED libusb_set_option(libusb_context *ctx,
|
||||
ctx->debug = (enum libusb_log_level)arg;
|
||||
#endif
|
||||
break;
|
||||
/* Handle all backend-specific options here */
|
||||
#if 0
|
||||
/* This code is compiled out until the first backend-specific option is
|
||||
* added to the library. When this time comes, remove the #if/#endif
|
||||
* lines and this comment, then replace the case statement with the
|
||||
* valid option name. */
|
||||
case LIBUSB_OPTION_<...>:
|
||||
if (usbi_backend.set_option)
|
||||
r = usbi_backend.set_option(ctx, option, ap);
|
||||
else
|
||||
r = LIBUSB_ERROR_NOT_SUPPORTED;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
r = LIBUSB_ERROR_INVALID_PARAM;
|
||||
}
|
||||
|
@ -616,6 +616,16 @@ struct usbi_os_backend {
|
||||
*/
|
||||
void (*exit)(struct libusb_contex *ctx);
|
||||
|
||||
/* Set a backend-specific option. Optional.
|
||||
*
|
||||
* This function is called when the user calls libusb_set_option() and
|
||||
* the option is not handled by the core library.
|
||||
*
|
||||
* Return 0 on success, or a LIBUSB_ERROR code on failure.
|
||||
*/
|
||||
int (*set_option)(struct libusb_context *ctx, enum libusb_option option,
|
||||
va_list args);
|
||||
|
||||
/* Enumerate all the USB devices on the system, returning them in a list
|
||||
* of discovered devices.
|
||||
*
|
||||
|
@ -201,6 +201,7 @@ const struct usbi_os_backend usbi_backend = {
|
||||
/*.caps =*/ 0,
|
||||
/*.init =*/ haiku_init,
|
||||
/*.exit =*/ haiku_exit,
|
||||
/*.set_option =*/ NULL,
|
||||
/*.get_device_list =*/ NULL,
|
||||
/*.hotplug_poll =*/ NULL,
|
||||
/*.open =*/ haiku_open,
|
||||
|
@ -91,6 +91,7 @@ const struct usbi_os_backend usbi_backend = {
|
||||
0,
|
||||
NULL, /* init() */
|
||||
NULL, /* exit() */
|
||||
NULL, /* set_option() */
|
||||
netbsd_get_device_list,
|
||||
NULL, /* hotplug_poll */
|
||||
netbsd_open,
|
||||
|
@ -94,6 +94,7 @@ const struct usbi_os_backend usbi_backend = {
|
||||
0,
|
||||
NULL, /* init() */
|
||||
NULL, /* exit() */
|
||||
NULL, /* set_option() */
|
||||
obsd_get_device_list,
|
||||
NULL, /* hotplug_poll */
|
||||
obsd_open,
|
||||
|
@ -854,6 +854,7 @@ const struct usbi_os_backend usbi_backend = {
|
||||
0,
|
||||
wince_init,
|
||||
wince_exit,
|
||||
NULL, /* set_option() */
|
||||
|
||||
wince_get_device_list,
|
||||
NULL, /* hotplug_poll */
|
||||
|
@ -851,6 +851,7 @@ const struct usbi_os_backend usbi_backend = {
|
||||
USBI_CAP_HAS_HID_ACCESS,
|
||||
usbdk_init,
|
||||
usbdk_exit,
|
||||
NULL, // set_option()
|
||||
|
||||
usbdk_get_device_list,
|
||||
NULL,
|
||||
|
@ -2047,6 +2047,7 @@ const struct usbi_os_backend usbi_backend = {
|
||||
USBI_CAP_HAS_HID_ACCESS,
|
||||
windows_init,
|
||||
windows_exit,
|
||||
NULL, /* set_option */
|
||||
|
||||
windows_get_device_list,
|
||||
NULL, /* hotplug_poll */
|
||||
|
@ -1 +1 @@
|
||||
#define LIBUSB_NANO 11212
|
||||
#define LIBUSB_NANO 11213
|
||||
|
Loading…
Reference in New Issue
Block a user