| 1 |
/* |
| 2 |
* This file is part of the flashrom project. |
| 3 |
* |
| 4 |
* Copyright 2022 Google LLC |
| 5 |
* |
| 6 |
* This program is free software; you can redistribute it and/or modify |
| 7 |
* it under the terms of the GNU General Public License as published by |
| 8 |
* the Free Software Foundation; version 2 of the License. |
| 9 |
* |
| 10 |
* This program is distributed in the hope that it will be useful, |
| 11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
* GNU General Public License for more details. |
| 14 |
*/ |
| 15 |
|
| 16 |
#ifndef LIBUSB_WRAPS_H |
| 17 |
#define LIBUSB_WRAPS_H |
| 18 |
|
| 19 |
#include "usb_unittests.h" |
| 20 |
|
| 21 |
void *__wrap_usb_dev_get_by_vid_pid_number( |
| 22 |
libusb_context *usb_ctx, uint16_t vid, uint16_t pid, unsigned int num); |
| 23 |
int __wrap_libusb_init(libusb_context **ctx); |
| 24 |
void __wrap_libusb_set_debug(libusb_context *ctx, int level); |
| 25 |
int __wrap_libusb_set_option(libusb_context *ctx, int option, ...); |
| 26 |
int __wrap_libusb_open(libusb_device *dev, libusb_device_handle **devh); |
| 27 |
int __wrap_libusb_set_auto_detach_kernel_driver(libusb_device_handle *devh, int enable); |
| 28 |
int __wrap_libusb_detach_kernel_driver(libusb_device_handle *dev_handle, int interface_number); |
| 29 |
int __wrap_libusb_attach_kernel_driver(libusb_device_handle *dev_handle, int interface_number); |
| 30 |
struct libusb_device_handle *__wrap_libusb_open_device_with_vid_pid( |
| 31 |
libusb_context *ctx, uint16_t vendor_id, uint16_t product_id); |
| 32 |
libusb_device *__wrap_libusb_get_device(libusb_device_handle *dev_handle); |
| 33 |
ssize_t __wrap_libusb_get_device_list(libusb_context *ctx, libusb_device ***list); |
| 34 |
void __wrap_libusb_free_device_list(libusb_device **list, int unref_devices); |
| 35 |
uint8_t __wrap_libusb_get_bus_number(libusb_device *dev); |
| 36 |
uint8_t __wrap_libusb_get_device_address(libusb_device *dev); |
| 37 |
int __wrap_libusb_get_device_descriptor(libusb_device *dev, struct libusb_device_descriptor *desc); |
| 38 |
int __wrap_libusb_get_config_descriptor( |
| 39 |
libusb_device *dev, uint8_t config_index, struct libusb_config_descriptor **config); |
| 40 |
void __wrap_libusb_free_config_descriptor(struct libusb_config_descriptor *config); |
| 41 |
int __wrap_libusb_get_configuration(libusb_device_handle *devh, int *config); |
| 42 |
int __wrap_libusb_set_configuration(libusb_device_handle *devh, int config); |
| 43 |
int __wrap_libusb_claim_interface(libusb_device_handle *devh, int interface_number); |
| 44 |
int __wrap_libusb_control_transfer(libusb_device_handle *devh, uint8_t bmRequestType, |
| 45 |
uint8_t bRequest, uint16_t wValue, uint16_t wIndex, unsigned char *data, |
| 46 |
uint16_t wLength, unsigned int timeout); |
| 47 |
int __wrap_libusb_release_interface(libusb_device_handle *devh, int interface_number); |
| 48 |
void __wrap_libusb_close(libusb_device_handle *devh); |
| 49 |
libusb_device *__wrap_libusb_ref_device(libusb_device *dev); |
| 50 |
void __wrap_libusb_unref_device(libusb_device *dev); |
| 51 |
struct libusb_transfer *__wrap_libusb_alloc_transfer(int iso_packets); |
| 52 |
int __wrap_libusb_submit_transfer(struct libusb_transfer *transfer); |
| 53 |
void __wrap_libusb_free_transfer(struct libusb_transfer *transfer); |
| 54 |
int __wrap_libusb_handle_events_timeout(libusb_context *ctx, struct timeval *tv); |
| 55 |
void __wrap_libusb_exit(libusb_context *ctx); |
| 56 |
|
| 57 |
#endif /* LIBUSB_WRAPS_H */ |