libusb compat: merge libusb-compat-usbi.h into libusb-compat-usb.h
This commit is contained in:
parent
0d29ba2073
commit
7d076334a7
@ -28,7 +28,6 @@
|
|||||||
#include <libusb.h>
|
#include <libusb.h>
|
||||||
|
|
||||||
#include "libusb-compat-usb.h"
|
#include "libusb-compat-usb.h"
|
||||||
#include "libusb-compat-usbi.h"
|
|
||||||
|
|
||||||
static libusb_context *ctx = NULL;
|
static libusb_context *ctx = NULL;
|
||||||
static int usb_debug = 0;
|
static int usb_debug = 0;
|
||||||
|
|||||||
@ -32,6 +32,42 @@
|
|||||||
|
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
|
|
||||||
|
/* Some quick and generic macros for the simple kind of lists we use */
|
||||||
|
#define LIST_ADD(begin, ent) \
|
||||||
|
do { \
|
||||||
|
if (begin) { \
|
||||||
|
ent->next = begin; \
|
||||||
|
ent->next->prev = ent; \
|
||||||
|
} else \
|
||||||
|
ent->next = NULL; \
|
||||||
|
ent->prev = NULL; \
|
||||||
|
begin = ent; \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
#define LIST_DEL(begin, ent) \
|
||||||
|
do { \
|
||||||
|
if (ent->prev) \
|
||||||
|
ent->prev->next = ent->next; \
|
||||||
|
else \
|
||||||
|
begin = ent->next; \
|
||||||
|
if (ent->next) \
|
||||||
|
ent->next->prev = ent->prev; \
|
||||||
|
ent->prev = NULL; \
|
||||||
|
ent->next = NULL; \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
struct usbbus_dev_handle {
|
||||||
|
libusb_device_handle *handle;
|
||||||
|
struct usbbus_device *device;
|
||||||
|
|
||||||
|
/* libusb-0.1 is buggy w.r.t. interface claiming. it allows you to claim
|
||||||
|
* multiple interfaces but only tracks the most recently claimed one,
|
||||||
|
* which is used for usb_set_altinterface(). we clone the buggy behaviour
|
||||||
|
* here. */
|
||||||
|
int last_claimed_interface;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* USB spec information
|
* USB spec information
|
||||||
*
|
*
|
||||||
@ -191,9 +227,6 @@ struct usb_bus {
|
|||||||
struct usb_device *root_dev;
|
struct usb_device *root_dev;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct usb_dev_handle;
|
|
||||||
typedef struct usb_dev_handle usb_dev_handle;
|
|
||||||
|
|
||||||
/* Variables */
|
/* Variables */
|
||||||
extern struct usb_bus *usb_busses;
|
extern struct usb_bus *usb_busses;
|
||||||
|
|
||||||
|
|||||||
@ -1,71 +0,0 @@
|
|||||||
/*
|
|
||||||
* Internal header for libusb-compat-0.1
|
|
||||||
* Copyright (C) 2008 Daniel Drake <dsd@gentoo.org>
|
|
||||||
* Copyright (c) 2000-2003 Johannes Erdfelt <johannes@erdfelt.com>
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with this library; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __LIBUSB_USBI_H__
|
|
||||||
#define __LIBUSB_USBI_H__
|
|
||||||
|
|
||||||
/* Some quick and generic macros for the simple kind of lists we use */
|
|
||||||
#define LIST_ADD(begin, ent) \
|
|
||||||
do { \
|
|
||||||
if (begin) { \
|
|
||||||
ent->next = begin; \
|
|
||||||
ent->next->prev = ent; \
|
|
||||||
} else \
|
|
||||||
ent->next = NULL; \
|
|
||||||
ent->prev = NULL; \
|
|
||||||
begin = ent; \
|
|
||||||
} while(0)
|
|
||||||
|
|
||||||
#define LIST_DEL(begin, ent) \
|
|
||||||
do { \
|
|
||||||
if (ent->prev) \
|
|
||||||
ent->prev->next = ent->next; \
|
|
||||||
else \
|
|
||||||
begin = ent->next; \
|
|
||||||
if (ent->next) \
|
|
||||||
ent->next->prev = ent->prev; \
|
|
||||||
ent->prev = NULL; \
|
|
||||||
ent->next = NULL; \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
struct usb_dev_handle {
|
|
||||||
libusb_device_handle *handle;
|
|
||||||
struct usb_device *device;
|
|
||||||
|
|
||||||
/* libusb-0.1 is buggy w.r.t. interface claiming. it allows you to claim
|
|
||||||
* multiple interfaces but only tracks the most recently claimed one,
|
|
||||||
* which is used for usb_set_altinterface(). we clone the buggy behaviour
|
|
||||||
* here. */
|
|
||||||
int last_claimed_interface;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct usbbus_dev_handle {
|
|
||||||
libusb_device_handle *handle;
|
|
||||||
struct usbbus_device *device;
|
|
||||||
|
|
||||||
/* libusb-0.1 is buggy w.r.t. interface claiming. it allows you to claim
|
|
||||||
* multiple interfaces but only tracks the most recently claimed one,
|
|
||||||
* which is used for usb_set_altinterface(). we clone the buggy behaviour
|
|
||||||
* here. */
|
|
||||||
int last_claimed_interface;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
@ -38,7 +38,6 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <libusb.h>
|
#include <libusb.h>
|
||||||
#include "libusb-compat-usb.h"
|
#include "libusb-compat-usb.h"
|
||||||
#include "libusb-compat-usbi.h"
|
|
||||||
#include "usbbus.h"
|
#include "usbbus.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#define LOG_CATEGORY "libnfc.buses.usbbus"
|
#define LOG_CATEGORY "libnfc.buses.usbbus"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user