libusb_wrapper.h 1.1 KB
#ifndef LIBUSB_WRAPPER_H_
#define LIBUSB_WRAPPER_H_

#include <libusb-1.0/libusb.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>

void usbinit(libusb_context **context_ptr);
void usbclose(libusb_context *context);

void interfaceclaim(libusb_device_handle *handle,
                    struct libusb_interface *interface);
void interfaceclose(libusb_device_handle *handle,
                    struct libusb_interface *interface);

ssize_t getListDevices(libusb_context *context, libusb_device ***list_ptr);
void getFromKernel(libusb_device_handle *handle, int interface);

void displayDevices(libusb_context *context);
void displayDevicesMore(libusb_context *context);

void getFirstDeviceFromID(libusb_context *context, int vid, int pid,
                          libusb_device **device);

void getOurInterfaces(libusb_device *device,
                      struct libusb_interface **int_hidjoy,
                      struct libusb_interface **int_leds,
                      struct libusb_interface **int_vibrators);

void displayDeviceEndpoints();

char getOnlyEndpoint(struct libusb_interface *interface);

#endif