2 * Copyright © 2019 Pino Toscano <toscano.pino@tiscali.it>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 null_get_device_list(struct libusb_context * ctx,
23 struct discovered_devs **discdevs)
25 return LIBUSB_SUCCESS;
29 null_open(struct libusb_device_handle *handle)
31 return LIBUSB_ERROR_NOT_SUPPORTED;
35 null_close(struct libusb_device_handle *handle)
40 null_get_device_descriptor(struct libusb_device *dev, unsigned char *buf,
43 return LIBUSB_ERROR_NOT_SUPPORTED;
47 null_get_active_config_descriptor(struct libusb_device *dev,
48 unsigned char *buf, size_t len, int *host_endian)
50 return LIBUSB_ERROR_NOT_SUPPORTED;
54 null_get_config_descriptor(struct libusb_device *dev, uint8_t idx,
55 unsigned char *buf, size_t len, int *host_endian)
57 return LIBUSB_ERROR_NOT_SUPPORTED;
61 null_set_configuration(struct libusb_device_handle *handle, int config)
63 return LIBUSB_ERROR_NOT_SUPPORTED;
67 null_claim_interface(struct libusb_device_handle *handle, int iface)
69 return LIBUSB_ERROR_NOT_SUPPORTED;
73 null_release_interface(struct libusb_device_handle *handle, int iface)
75 return LIBUSB_ERROR_NOT_SUPPORTED;
79 null_set_interface_altsetting(struct libusb_device_handle *handle, int iface,
82 return LIBUSB_ERROR_NOT_SUPPORTED;
86 null_clear_halt(struct libusb_device_handle *handle, unsigned char endpoint)
88 return LIBUSB_ERROR_NOT_SUPPORTED;
92 null_reset_device(struct libusb_device_handle *handle)
94 return LIBUSB_ERROR_NOT_SUPPORTED;
98 null_submit_transfer(struct usbi_transfer *itransfer)
100 return LIBUSB_ERROR_NOT_SUPPORTED;
104 null_cancel_transfer(struct usbi_transfer *itransfer)
106 return LIBUSB_ERROR_NOT_SUPPORTED;
110 null_clear_transfer_priv(struct usbi_transfer *itransfer)
115 null_handle_transfer_completion(struct usbi_transfer *itransfer)
117 return LIBUSB_ERROR_NOT_SUPPORTED;
121 null_clock_gettime(int clkid, struct timespec *tp)
124 case USBI_CLOCK_MONOTONIC:
125 return clock_gettime(CLOCK_REALTIME, tp);
126 case USBI_CLOCK_REALTIME:
127 return clock_gettime(CLOCK_REALTIME, tp);
129 return LIBUSB_ERROR_INVALID_PARAM;
133 const struct usbi_os_backend usbi_backend = {
134 .name = "Null backend",
139 .get_device_list = null_get_device_list,
140 .hotplug_poll = NULL,
141 .wrap_sys_device = NULL,
144 .get_device_descriptor = null_get_device_descriptor,
145 .get_active_config_descriptor = null_get_active_config_descriptor,
146 .get_config_descriptor = null_get_config_descriptor,
147 .get_config_descriptor_by_value = NULL,
148 .get_configuration = NULL,
149 .set_configuration = null_set_configuration,
150 .claim_interface = null_claim_interface,
151 .release_interface = null_release_interface,
152 .set_interface_altsetting = null_set_interface_altsetting,
153 .clear_halt = null_clear_halt,
154 .reset_device = null_reset_device,
155 .alloc_streams = NULL,
156 .free_streams = NULL,
157 .dev_mem_alloc = NULL,
158 .dev_mem_free = NULL,
159 .kernel_driver_active = NULL,
160 .detach_kernel_driver = NULL,
161 .attach_kernel_driver = NULL,
162 .destroy_device = NULL,
163 .submit_transfer = null_submit_transfer,
164 .cancel_transfer = null_cancel_transfer,
165 .clear_transfer_priv = null_clear_transfer_priv,
166 .handle_events = NULL,
167 .handle_transfer_completion = null_handle_transfer_completion,
168 .clock_gettime = null_clock_gettime,
169 #ifdef USBI_TIMERFD_AVAILABLE
170 .get_timerfd_clockid = NULL,
172 .context_priv_size = 0,
173 .device_priv_size = 0,
174 .device_handle_priv_size = 0,
175 .transfer_priv_size = 0,