libusb compat: merge libusb-compat-usbi.h into libusb-compat-usb.h

This commit is contained in:
Philippe Teuwen 2013-10-14 00:37:17 +02:00
parent 0d29ba2073
commit 7d076334a7
4 changed files with 36 additions and 76 deletions

View File

@ -28,7 +28,6 @@
#include <libusb.h>
#include "libusb-compat-usb.h"
#include "libusb-compat-usbi.h"
static libusb_context *ctx = NULL;
static int usb_debug = 0;

View File

@ -32,6 +32,42 @@
#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
*
@ -191,9 +227,6 @@ struct usb_bus {
struct usb_device *root_dev;
};
struct usb_dev_handle;
typedef struct usb_dev_handle usb_dev_handle;
/* Variables */
extern struct usb_bus *usb_busses;

View File

@ -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

View File

@ -38,7 +38,6 @@
#include <errno.h>
#include <libusb.h>
#include "libusb-compat-usb.h"
#include "libusb-compat-usbi.h"
#include "usbbus.h"
#include "log.h"
#define LOG_CATEGORY "libnfc.buses.usbbus"