common: Make interface claim code available for other uses.

This commit is contained in:
Solomon Peachy 2019-01-11 07:54:34 -05:00
parent bb9493448e
commit 309d7c2706
2 changed files with 8 additions and 5 deletions

View File

@ -29,13 +29,11 @@
#include "backend_common.h"
#define BACKEND_VERSION "0.90"
#define BACKEND_VERSION "0.91"
#ifndef URI_PREFIX
#error "Must Define URI_PREFIX"
#endif
#define NUM_CLAIM_ATTEMPTS 10
#define URB_XFER_SIZE (64*1024)
#define XFER_TIMEOUT 15000
@ -59,8 +57,8 @@ static int max_xfer_size = URB_XFER_SIZE;
static int xfer_timeout = XFER_TIMEOUT;
/* Support Functions */
static int backend_claim_interface(struct libusb_device_handle *dev, int iface,
int num_claim_attempts)
int backend_claim_interface(struct libusb_device_handle *dev, int iface,
int num_claim_attempts)
{
int ret;
do {

View File

@ -199,6 +199,11 @@ void print_help(char *argv0, struct dyesub_backend *backend);
uint16_t uint16_to_packed_bcd(uint16_t val);
uint32_t packed_bcd_to_uint32(char *in, int len);
/* USB enumeration and attachment */
#define NUM_CLAIM_ATTEMPTS 10
int backend_claim_interface(struct libusb_device_handle *dev, int iface,
int num_claim_attempts);
/* Job list manipulation */
struct dyesub_joblist *dyesub_joblist_create(struct dyesub_backend *backend, void *ctx);
int dyesub_joblist_addjob(struct dyesub_joblist *list, const void *job);