core: Kill usbi_os_backend structure definition madness

Prior to this commit, each backend provided its own uniquely named
usbi_os_backend structure and a massive pile of #ifdefs assigned the
global usbi_backend pointer to the correct one. This commit kills off
all this code and instead has each backend provide the usbi_backend
symbol directly. The linker can inform of any issues that might arise
with symbols.

Signed-off-by: Chris Dickens <[email protected]>
This commit is contained in:
Chris Dickens committed 2017-07-06 14:26:46 -07:00
1 parent ef8776ddea
commit cad7d0edd9
15 files changed
+73 -109

No files matched your search

+43 -69
View File
@@ -44,32 +44,6 @@
#include "libusbi.h"
#include "hotplug.h"
#if defined(OS_LINUX)
const struct usbi_os_backend * const usbi_backend = &linux_usbfs_backend;
#elif defined(OS_DARWIN)
const struct usbi_os_backend * const usbi_backend = &darwin_backend;
#elif defined(OS_OPENBSD)
const struct usbi_os_backend * const usbi_backend = &openbsd_backend;
#elif defined(OS_NETBSD)
const struct usbi_os_backend * const usbi_backend = &netbsd_backend;
#elif defined(OS_WINDOWS)
#if defined(USE_USBDK)
const struct usbi_os_backend * const usbi_backend = &usbdk_backend;
#else
const struct usbi_os_backend * const usbi_backend = &windows_backend;
#endif
#elif defined(OS_WINCE)
const struct usbi_os_backend * const usbi_backend = &wince_backend;
#elif defined(OS_HAIKU)
const struct usbi_os_backend * const usbi_backend = &haiku_usb_raw_backend;
#elif defined (OS_SUNOS)
const struct usbi_os_backend * const usbi_backend = &sunos_backend;
#else
#error "Unsupported OS"
#endif
struct libusb_context *usbi_default_context = NULL;
static const struct libusb_version libusb_version_internal =
{ LIBUSB_MAJOR, LIBUSB_MINOR, LIBUSB_MICRO, LIBUSB_NANO,
@@ -693,7 +667,7 @@ struct discovered_devs *discovered_devs_append(
struct libusb_device *usbi_alloc_device(struct libusb_context *ctx,
unsigned long session_id)
{
size_t priv_size = usbi_backend->device_priv_size;
size_t priv_size = usbi_backend.device_priv_size;
struct libusb_device *dev = calloc(1, sizeof(*dev) + priv_size);
int r;
@@ -837,8 +811,8 @@ ssize_t API_EXPORTED libusb_get_device_list(libusb_context *ctx,
/* backend provides hotplug support */
struct libusb_device *dev;
if (usbi_backend->hotplug_poll)
usbi_backend->hotplug_poll();
if (usbi_backend.hotplug_poll)
usbi_backend.hotplug_poll();
usbi_mutex_lock(&ctx->usb_devs_lock);
list_for_each_entry(dev, &ctx->usb_devs, list, struct libusb_device) {
@@ -852,7 +826,7 @@ ssize_t API_EXPORTED libusb_get_device_list(libusb_context *ctx,
usbi_mutex_unlock(&ctx->usb_devs_lock);
} else {
/* backend does not provide hotplug support */
r = usbi_backend->get_device_list(ctx, &discdevs);
r = usbi_backend.get_device_list(ctx, &discdevs);
}
if (r < 0) {
@@ -1180,8 +1154,8 @@ void API_EXPORTED libusb_unref_device(libusb_device *dev)
libusb_unref_device(dev->parent_dev);
if (usbi_backend->destroy_device)
usbi_backend->destroy_device(dev);
if (usbi_backend.destroy_device)
usbi_backend.destroy_device(dev);
if (!libusb_has_capability(LIBUSB_CAP_HAS_HOTPLUG)) {
/* backend does not support hotplug */
@@ -1255,7 +1229,7 @@ int API_EXPORTED libusb_open(libusb_device *dev,
{
struct libusb_context *ctx = DEVICE_CTX(dev);
struct libusb_device_handle *_dev_handle;
size_t priv_size = usbi_backend->device_handle_priv_size;
size_t priv_size = usbi_backend.device_handle_priv_size;
int r;
usbi_dbg("open %d.%d", dev->bus_number, dev->device_address);
@@ -1278,7 +1252,7 @@ int API_EXPORTED libusb_open(libusb_device *dev,
_dev_handle->claimed_interfaces = 0;
memset(&_dev_handle->os_priv, 0, priv_size);
r = usbi_backend->open(_dev_handle);
r = usbi_backend.open(_dev_handle);
if (r < 0) {
usbi_dbg("open %d.%d returns %d", dev->bus_number, dev->device_address, r);
libusb_unref_device(dev);
@@ -1395,7 +1369,7 @@ static void do_close(struct libusb_context *ctx,
list_del(&dev_handle->list);
usbi_mutex_unlock(&ctx->open_devs_lock);
usbi_backend->close(dev_handle);
usbi_backend.close(dev_handle);
libusb_unref_device(dev_handle->dev);
usbi_mutex_destroy(&dev_handle->lock);
free(dev_handle);
@@ -1504,8 +1478,8 @@ int API_EXPORTED libusb_get_configuration(libusb_device_handle *dev_handle,
int r = LIBUSB_ERROR_NOT_SUPPORTED;
usbi_dbg("");
if (usbi_backend->get_configuration)
r = usbi_backend->get_configuration(dev_handle, config);
if (usbi_backend.get_configuration)
r = usbi_backend.get_configuration(dev_handle, config);
if (r == LIBUSB_ERROR_NOT_SUPPORTED) {
uint8_t tmp = 0;
@@ -1580,7 +1554,7 @@ int API_EXPORTED libusb_set_configuration(libusb_device_handle *dev_handle,
int configuration)
{
usbi_dbg("configuration %d", configuration);
return usbi_backend->set_configuration(dev_handle, configuration);
return usbi_backend.set_configuration(dev_handle, configuration);
}
/** \ingroup libusb_dev
@@ -1627,7 +1601,7 @@ int API_EXPORTED libusb_claim_interface(libusb_device_handle *dev_handle,
if (dev_handle->claimed_interfaces & (1 << interface_number))
goto out;
r = usbi_backend->claim_interface(dev_handle, interface_number);
r = usbi_backend.claim_interface(dev_handle, interface_number);
if (r == 0)
dev_handle->claimed_interfaces |= 1 << interface_number;
@@ -1670,7 +1644,7 @@ int API_EXPORTED libusb_release_interface(libusb_device_handle *dev_handle,
goto out;
}
r = usbi_backend->release_interface(dev_handle, interface_number);
r = usbi_backend.release_interface(dev_handle, interface_number);
if (r == 0)
dev_handle->claimed_interfaces &= ~(1 << interface_number);
@@ -1720,7 +1694,7 @@ int API_EXPORTED libusb_set_interface_alt_setting(libusb_device_handle *dev_hand
}
usbi_mutex_unlock(&dev_handle->lock);
return usbi_backend->set_interface_altsetting(dev_handle, interface_number,
return usbi_backend.set_interface_altsetting(dev_handle, interface_number,
alternate_setting);
}
@@ -1747,7 +1721,7 @@ int API_EXPORTED libusb_clear_halt(libusb_device_handle *dev_handle,
if (!dev_handle->dev->attached)
return LIBUSB_ERROR_NO_DEVICE;
return usbi_backend->clear_halt(dev_handle, endpoint);
return usbi_backend.clear_halt(dev_handle, endpoint);
}
/** \ingroup libusb_dev
@@ -1775,7 +1749,7 @@ int API_EXPORTED libusb_reset_device(libusb_device_handle *dev_handle)
if (!dev_handle->dev->attached)
return LIBUSB_ERROR_NO_DEVICE;
return usbi_backend->reset_device(dev_handle);
return usbi_backend.reset_device(dev_handle);
}
/** \ingroup libusb_asyncio
@@ -1807,8 +1781,8 @@ int API_EXPORTED libusb_alloc_streams(libusb_device_handle *dev_handle,
if (!dev_handle->dev->attached)
return LIBUSB_ERROR_NO_DEVICE;
if (usbi_backend->alloc_streams)
return usbi_backend->alloc_streams(dev_handle, num_streams, endpoints,
if (usbi_backend.alloc_streams)
return usbi_backend.alloc_streams(dev_handle, num_streams, endpoints,
num_endpoints);
else
return LIBUSB_ERROR_NOT_SUPPORTED;
@@ -1834,8 +1808,8 @@ int API_EXPORTED libusb_free_streams(libusb_device_handle *dev_handle,
if (!dev_handle->dev->attached)
return LIBUSB_ERROR_NO_DEVICE;
if (usbi_backend->free_streams)
return usbi_backend->free_streams(dev_handle, endpoints,
if (usbi_backend.free_streams)
return usbi_backend.free_streams(dev_handle, endpoints,
num_endpoints);
else
return LIBUSB_ERROR_NOT_SUPPORTED;
@@ -1872,8 +1846,8 @@ unsigned char * LIBUSB_CALL libusb_dev_mem_alloc(libusb_device_handle *dev_handl
if (!dev_handle->dev->attached)
return NULL;
if (usbi_backend->dev_mem_alloc)
return usbi_backend->dev_mem_alloc(dev_handle, length);
if (usbi_backend.dev_mem_alloc)
return usbi_backend.dev_mem_alloc(dev_handle, length);
else
return NULL;
}
@@ -1889,8 +1863,8 @@ unsigned char * LIBUSB_CALL libusb_dev_mem_alloc(libusb_device_handle *dev_handl
int API_EXPORTED libusb_dev_mem_free(libusb_device_handle *dev_handle,
unsigned char *buffer, size_t length)
{
if (usbi_backend->dev_mem_free)
return usbi_backend->dev_mem_free(dev_handle, buffer, length);
if (usbi_backend.dev_mem_free)
return usbi_backend.dev_mem_free(dev_handle, buffer, length);
else
return LIBUSB_ERROR_NOT_SUPPORTED;
}
@@ -1920,8 +1894,8 @@ int API_EXPORTED libusb_kernel_driver_active(libusb_device_handle *dev_handle,
if (!dev_handle->dev->attached)
return LIBUSB_ERROR_NO_DEVICE;
if (usbi_backend->kernel_driver_active)
return usbi_backend->kernel_driver_active(dev_handle, interface_number);
if (usbi_backend.kernel_driver_active)
return usbi_backend.kernel_driver_active(dev_handle, interface_number);
else
return LIBUSB_ERROR_NOT_SUPPORTED;
}
@@ -1955,8 +1929,8 @@ int API_EXPORTED libusb_detach_kernel_driver(libusb_device_handle *dev_handle,
if (!dev_handle->dev->attached)
return LIBUSB_ERROR_NO_DEVICE;
if (usbi_backend->detach_kernel_driver)
return usbi_backend->detach_kernel_driver(dev_handle, interface_number);
if (usbi_backend.detach_kernel_driver)
return usbi_backend.detach_kernel_driver(dev_handle, interface_number);
else
return LIBUSB_ERROR_NOT_SUPPORTED;
}
@@ -1989,8 +1963,8 @@ int API_EXPORTED libusb_attach_kernel_driver(libusb_device_handle *dev_handle,
if (!dev_handle->dev->attached)
return LIBUSB_ERROR_NO_DEVICE;
if (usbi_backend->attach_kernel_driver)
return usbi_backend->attach_kernel_driver(dev_handle, interface_number);
if (usbi_backend.attach_kernel_driver)
return usbi_backend.attach_kernel_driver(dev_handle, interface_number);
else
return LIBUSB_ERROR_NOT_SUPPORTED;
}
@@ -2020,7 +1994,7 @@ int API_EXPORTED libusb_attach_kernel_driver(libusb_device_handle *dev_handle,
int API_EXPORTED libusb_set_auto_detach_kernel_driver(
libusb_device_handle *dev_handle, int enable)
{
if (!(usbi_backend->caps & USBI_CAP_SUPPORTS_DETACH_KERNEL_DRIVER))
if (!(usbi_backend.caps & USBI_CAP_SUPPORTS_DETACH_KERNEL_DRIVER))
return LIBUSB_ERROR_NOT_SUPPORTED;
dev_handle->auto_detach_kernel_driver = enable;
@@ -2083,7 +2057,7 @@ int API_EXPORTED libusb_init(libusb_context **context)
usbi_mutex_static_lock(&default_context_lock);
if (!timestamp_origin.tv_sec) {
usbi_backend->clock_gettime(USBI_CLOCK_REALTIME, &timestamp_origin);
usbi_backend.clock_gettime(USBI_CLOCK_REALTIME, &timestamp_origin);
}
if (!context && usbi_default_context) {
@@ -2134,8 +2108,8 @@ int API_EXPORTED libusb_init(libusb_context **context)
list_add (&ctx->list, &active_contexts_list);
usbi_mutex_static_unlock(&active_contexts_lock);
if (usbi_backend->init) {
r = usbi_backend->init(ctx);
if (usbi_backend.init) {
r = usbi_backend.init(ctx);
if (r)
goto err_free_ctx;
}
@@ -2152,8 +2126,8 @@ int API_EXPORTED libusb_init(libusb_context **context)
return 0;
err_backend_exit:
if (usbi_backend->exit)
usbi_backend->exit();
if (usbi_backend.exit)
usbi_backend.exit();
err_free_ctx:
if (ctx == usbi_default_context) {
usbi_default_context = NULL;
@@ -2243,8 +2217,8 @@ void API_EXPORTED libusb_exit(struct libusb_context *ctx)
usbi_warn(ctx, "application left some devices open");
usbi_io_exit(ctx);
if (usbi_backend->exit)
usbi_backend->exit();
if (usbi_backend.exit)
usbi_backend.exit();
usbi_mutex_destroy(&ctx->open_devs_lock);
usbi_mutex_destroy(&ctx->usb_devs_lock);
@@ -2266,11 +2240,11 @@ int API_EXPORTED libusb_has_capability(uint32_t capability)
case LIBUSB_CAP_HAS_CAPABILITY:
return 1;
case LIBUSB_CAP_HAS_HOTPLUG:
return !(usbi_backend->get_device_list);
return !(usbi_backend.get_device_list);
case LIBUSB_CAP_HAS_HID_ACCESS:
return (usbi_backend->caps & USBI_CAP_HAS_HID_ACCESS);
return (usbi_backend.caps & USBI_CAP_HAS_HID_ACCESS);
case LIBUSB_CAP_SUPPORTS_DETACH_KERNEL_DRIVER:
return (usbi_backend->caps & USBI_CAP_SUPPORTS_DETACH_KERNEL_DRIVER);
return (usbi_backend.caps & USBI_CAP_SUPPORTS_DETACH_KERNEL_DRIVER);
}
return 0;
}
@@ -2392,7 +2366,7 @@ void usbi_log_v(struct libusb_context *ctx, enum libusb_log_level level,
return;
#endif
usbi_backend->clock_gettime(USBI_CLOCK_REALTIME, &now);
usbi_backend.clock_gettime(USBI_CLOCK_REALTIME, &now);
if ((global_debug) && (!has_debug_header_been_displayed)) {
has_debug_header_been_displayed = 1;
usbi_log_str(ctx, LIBUSB_LOG_LEVEL_DEBUG, "[timestamp] [threadID] facility level [function call] <message>" USBI_LOG_LINE_END);
+8 -8
View File
@@ -513,7 +513,7 @@ int usbi_device_cache_descriptor(libusb_device *dev)
{
int r, host_endian = 0;
r = usbi_backend->get_device_descriptor(dev, (unsigned char *) &dev->device_descriptor,
r = usbi_backend.get_device_descriptor(dev, (unsigned char *) &dev->device_descriptor,
&host_endian);
if (r < 0)
return r;
@@ -572,7 +572,7 @@ int API_EXPORTED libusb_get_active_config_descriptor(libusb_device *dev,
int host_endian = 0;
int r;
r = usbi_backend->get_active_config_descriptor(dev, tmp,
r = usbi_backend.get_active_config_descriptor(dev, tmp,
LIBUSB_DT_CONFIG_SIZE, &host_endian);
if (r < 0)
return r;
@@ -587,7 +587,7 @@ int API_EXPORTED libusb_get_active_config_descriptor(libusb_device *dev,
if (!buf)
return LIBUSB_ERROR_NO_MEM;
r = usbi_backend->get_active_config_descriptor(dev, buf,
r = usbi_backend.get_active_config_descriptor(dev, buf,
_config.wTotalLength, &host_endian);
if (r >= 0)
r = raw_desc_to_config(dev->ctx, buf, r, host_endian, config);
@@ -625,7 +625,7 @@ int API_EXPORTED libusb_get_config_descriptor(libusb_device *dev,
if (config_index >= dev->num_configurations)
return LIBUSB_ERROR_NOT_FOUND;
r = usbi_backend->get_config_descriptor(dev, config_index, tmp,
r = usbi_backend.get_config_descriptor(dev, config_index, tmp,
LIBUSB_DT_CONFIG_SIZE, &host_endian);
if (r < 0)
return r;
@@ -640,7 +640,7 @@ int API_EXPORTED libusb_get_config_descriptor(libusb_device *dev,
if (!buf)
return LIBUSB_ERROR_NO_MEM;
r = usbi_backend->get_config_descriptor(dev, config_index, buf,
r = usbi_backend.get_config_descriptor(dev, config_index, buf,
_config.wTotalLength, &host_endian);
if (r >= 0)
r = raw_desc_to_config(dev->ctx, buf, r, host_endian, config);
@@ -663,7 +663,7 @@ int usbi_get_config_index_by_value(struct libusb_device *dev,
for (i = 0; i < dev->num_configurations; i++) {
unsigned char tmp[6];
int host_endian;
int r = usbi_backend->get_config_descriptor(dev, i, tmp, sizeof(tmp),
int r = usbi_backend.get_config_descriptor(dev, i, tmp, sizeof(tmp),
&host_endian);
if (r < 0) {
*idx = -1;
@@ -702,8 +702,8 @@ int API_EXPORTED libusb_get_config_descriptor_by_value(libusb_device *dev,
int r, idx, host_endian;
unsigned char *buf = NULL;
if (usbi_backend->get_config_descriptor_by_value) {
r = usbi_backend->get_config_descriptor_by_value(dev,
if (usbi_backend.get_config_descriptor_by_value) {
r = usbi_backend.get_config_descriptor_by_value(dev,
bConfigurationValue, &buf, &host_endian);
if (r < 0)
return r;
+10 -10
View File
@@ -1144,7 +1144,7 @@ int usbi_io_init(struct libusb_context *ctx)
goto err_close_pipe;
#ifdef USBI_TIMERFD_AVAILABLE
ctx->timerfd = timerfd_create(usbi_backend->get_timerfd_clockid(),
ctx->timerfd = timerfd_create(usbi_backend.get_timerfd_clockid(),
TFD_NONBLOCK | TFD_CLOEXEC);
if (ctx->timerfd >= 0) {
usbi_dbg("using timerfd for timeouts");
@@ -1208,7 +1208,7 @@ static int calculate_timeout(struct usbi_transfer *transfer)
if (!timeout)
return 0;
r = usbi_backend->clock_gettime(USBI_CLOCK_MONOTONIC, &current_time);
r = usbi_backend.clock_gettime(USBI_CLOCK_MONOTONIC, &current_time);
if (r < 0) {
usbi_err(ITRANSFER_CTX(transfer),
"failed to read monotonic clock, errno=%d", errno);
@@ -1255,7 +1255,7 @@ struct libusb_transfer * LIBUSB_CALL libusb_alloc_transfer(
int iso_packets)
{
struct libusb_transfer *transfer;
size_t os_alloc_size = usbi_backend->transfer_priv_size;
size_t os_alloc_size = usbi_backend.transfer_priv_size;
size_t alloc_size = sizeof(struct usbi_transfer)
+ sizeof(struct libusb_transfer)
+ (sizeof(struct libusb_iso_packet_descriptor) * iso_packets)
@@ -1526,7 +1526,7 @@ int API_EXPORTED libusb_submit_transfer(struct libusb_transfer *transfer)
*/
usbi_mutex_unlock(&ctx->flying_transfers_lock);
r = usbi_backend->submit_transfer(itransfer);
r = usbi_backend.submit_transfer(itransfer);
if (r == LIBUSB_SUCCESS) {
itransfer->state_flags |= USBI_TRANSFER_IN_FLIGHT;
/* keep a reference to this device */
@@ -1567,7 +1567,7 @@ int API_EXPORTED libusb_cancel_transfer(struct libusb_transfer *transfer)
r = LIBUSB_ERROR_NOT_FOUND;
goto out;
}
r = usbi_backend->cancel_transfer(itransfer);
r = usbi_backend.cancel_transfer(itransfer);
if (r < 0) {
if (r != LIBUSB_ERROR_NOT_FOUND &&
r != LIBUSB_ERROR_NO_DEVICE)
@@ -2004,7 +2004,7 @@ static int handle_timeouts_locked(struct libusb_context *ctx)
return 0;
/* get current time */
r = usbi_backend->clock_gettime(USBI_CLOCK_MONOTONIC, &systime_ts);
r = usbi_backend.clock_gettime(USBI_CLOCK_MONOTONIC, &systime_ts);
if (r < 0)
return r;
@@ -2197,7 +2197,7 @@ static int handle_events(struct libusb_context *ctx, struct timeval *tv)
itransfer = list_first_entry(&ctx->completed_transfers, struct usbi_transfer, completed_list);
list_del(&itransfer->completed_list);
usbi_mutex_unlock(&ctx->event_data_lock);
ret = usbi_backend->handle_transfer_completion(itransfer);
ret = usbi_backend.handle_transfer_completion(itransfer);
if (ret)
usbi_err(ctx, "backend handle_transfer_completion failed with error %d", ret);
usbi_mutex_lock(&ctx->event_data_lock);
@@ -2253,7 +2253,7 @@ static int handle_events(struct libusb_context *ctx, struct timeval *tv)
}
#endif
r = usbi_backend->handle_events(ctx, fds + internal_nfds, nfds - internal_nfds, r);
r = usbi_backend.handle_events(ctx, fds + internal_nfds, nfds - internal_nfds, r);
if (r)
usbi_err(ctx, "backend handle_events failed with error %d", r);
@@ -2574,7 +2574,7 @@ int API_EXPORTED libusb_get_next_timeout(libusb_context *ctx,
return 0;
}
r = usbi_backend->clock_gettime(USBI_CLOCK_MONOTONIC, &cur_ts);
r = usbi_backend.clock_gettime(USBI_CLOCK_MONOTONIC, &cur_ts);
if (r < 0) {
usbi_err(ctx, "failed to read monotonic clock, errno=%d", errno);
return 0;
@@ -2802,7 +2802,7 @@ void usbi_handle_disconnect(struct libusb_device_handle *dev_handle)
USBI_TRANSFER_TO_LIBUSB_TRANSFER(to_cancel));
usbi_mutex_lock(&to_cancel->lock);
usbi_backend->clear_transfer_priv(to_cancel);
usbi_backend.clear_transfer_priv(to_cancel);
usbi_mutex_unlock(&to_cancel->lock);
usbi_handle_transfer_completion(to_cancel, LIBUSB_TRANSFER_NO_DEVICE);
}
+1 -11
View File
@@ -1129,17 +1129,7 @@ struct usbi_os_backend {
size_t transfer_priv_size;
};
extern const struct usbi_os_backend * const usbi_backend;
extern const struct usbi_os_backend linux_usbfs_backend;
extern const struct usbi_os_backend darwin_backend;
extern const struct usbi_os_backend openbsd_backend;
extern const struct usbi_os_backend netbsd_backend;
extern const struct usbi_os_backend windows_backend;
extern const struct usbi_os_backend usbdk_backend;
extern const struct usbi_os_backend wince_backend;
extern const struct usbi_os_backend haiku_usb_raw_backend;
extern const struct usbi_os_backend sunos_backend;
extern const struct usbi_os_backend usbi_backend;
extern struct list_head active_contexts_list;
extern usbi_mutex_static_t active_contexts_lock;
+1 -1
View File
@@ -2079,7 +2079,7 @@ static int darwin_free_streams (struct libusb_device_handle *dev_handle, unsigne
}
#endif
const struct usbi_os_backend darwin_backend = {
const struct usbi_os_backend usbi_backend = {
.name = "Darwin",
.caps = 0,
.init = darwin_init,
+1 -1
View File
@@ -195,7 +195,7 @@ haiku_clock_gettime(int clkid, struct timespec *tp)
return LIBUSB_ERROR_INVALID_PARAM;
}
const struct usbi_os_backend haiku_usb_raw_backend = {
const struct usbi_os_backend usbi_backend = {
/*.name =*/ "Haiku usbfs",
/*.caps =*/ 0,
/*.init =*/ haiku_init,
+1 -1
View File
@@ -2715,7 +2715,7 @@ static clockid_t op_get_timerfd_clockid(void)
}
#endif
const struct usbi_os_backend linux_usbfs_backend = {
const struct usbi_os_backend usbi_backend = {
.name = "Linux usbfs",
.caps = USBI_CAP_HAS_HID_ACCESS|USBI_CAP_SUPPORTS_DETACH_KERNEL_DRIVER,
.init = op_init,
+1 -1
View File
@@ -86,7 +86,7 @@ static int _sync_control_transfer(struct usbi_transfer *);
static int _sync_gen_transfer(struct usbi_transfer *);
static int _access_endpoint(struct libusb_transfer *);
const struct usbi_os_backend netbsd_backend = {
const struct usbi_os_backend usbi_backend = {
"Synchronous NetBSD backend",
0,
NULL, /* init() */
+1 -1
View File
@@ -89,7 +89,7 @@ static int _access_endpoint(struct libusb_transfer *);
static int _bus_open(int);
const struct usbi_os_backend openbsd_backend = {
const struct usbi_os_backend usbi_backend = {
"Synchronous OpenBSD backend",
0,
NULL, /* init() */
+1 -1
View File
@@ -1254,7 +1254,7 @@ sunos_usb_get_status(int fd)
return (status);
}
const struct usbi_os_backend sunos_backend = {
const struct usbi_os_backend usbi_backend = {
.name = "Solaris",
.caps = 0,
.init = sunos_init,
+1 -1
View File
@@ -43,7 +43,7 @@ int usbi_cond_timedwait(pthread_cond_t *cond,
struct timespec timeout;
int r;
r = usbi_backend->clock_gettime(USBI_CLOCK_REALTIME, &timeout);
r = usbi_backend.clock_gettime(USBI_CLOCK_REALTIME, &timeout);
if (r < 0)
return r;
+1 -1
View File
@@ -848,7 +848,7 @@ static int wince_clock_gettime(int clk_id, struct timespec *tp)
}
}
const struct usbi_os_backend wince_backend = {
const struct usbi_os_backend usbi_backend = {
"Windows CE",
0,
wince_init,
+1 -1
View File
@@ -845,7 +845,7 @@ static int usbdk_clock_gettime(int clk_id, struct timespec *tp)
return windows_clock_gettime(clk_id, tp);
}
const struct usbi_os_backend usbdk_backend = {
const struct usbi_os_backend usbi_backend = {
"Windows",
USBI_CAP_HAS_HID_ACCESS,
usbdk_init,
+1 -1
View File
@@ -2047,7 +2047,7 @@ void windows_get_overlapped_result(struct usbi_transfer *transfer, struct winfd
}
// NB: MSVC6 does not support named initializers.
const struct usbi_os_backend windows_backend = {
const struct usbi_os_backend usbi_backend = {
"Windows",
USBI_CAP_HAS_HID_ACCESS,
windows_init,
+1 -1
View File
@@ -1 +1 @@
#define LIBUSB_NANO 11205
#define LIBUSB_NANO 11206