Fix build when no libusb-LA is compiled.

Until now the build would break if the user doesn't enable at least one
of the libusb1.0-based LAs. I.e., you could not compile only OLS, or
only the demo driver.
This commit is contained in:
Uwe Hermann 2011-02-02 10:25:52 +01:00
parent cddd1c5f47
commit 22b0238344
10 changed files with 29 additions and 7 deletions

View File

@ -23,11 +23,11 @@
* ASIX Sigma Logic Analyzer Driver
*/
#include "config.h"
#include <ftdi.h>
#include <string.h>
#include <zlib.h>
#include <sigrok.h>
#include <config.h>
#include "asix-sigma.h"
#define USB_VENDOR 0xa600

View File

@ -17,11 +17,16 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <stdint.h>
#include <glib.h>
#ifdef HAVE_LIBUSB_1_0
#include <libusb.h>
#endif
#include <sigrok.h>
#ifdef HAVE_LIBUSB_1_0
int opendev2(int device_index, struct sr_device_instance **sdi,
libusb_device *dev, struct libusb_device_descriptor *des,
int *skip, uint16_t vid, uint16_t pid, int interface)
@ -90,3 +95,5 @@ int opendev3(struct sr_device_instance **sdi, libusb_device *dev,
return 0;
}
#endif

View File

@ -17,6 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
@ -25,7 +26,6 @@
#include <libusb.h>
#include <sigrok.h>
#include <sigrok-internal.h>
#include "config.h"
#define USB_VENDOR 0x0925
#define USB_PRODUCT 0x3881

View File

@ -17,6 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
@ -24,7 +25,6 @@
#include <glib.h>
#include <libusb.h>
#include <sigrok.h>
#include "config.h"
#include "analyzer.h"
#define USB_VENDOR 0x0c12

View File

@ -17,6 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
@ -24,7 +25,6 @@
#include <string.h>
#include <glib.h>
#include <sigrok.h>
#include "config.h"
/* The list of loaded plugins lives here. */
GSList *plugins;
@ -138,9 +138,11 @@ struct sr_device_instance *sr_get_device_instance(GSList *device_instances,
void sr_device_instance_free(struct sr_device_instance *sdi)
{
switch (sdi->instance_type) {
#ifdef HAVE_LIBUSB_1_0
case SR_USB_INSTANCE:
sr_usb_device_instance_free(sdi->usb);
break;
#endif
case SR_SERIAL_INSTANCE:
sr_serial_device_instance_free(sdi->serial);
break;
@ -155,6 +157,8 @@ void sr_device_instance_free(struct sr_device_instance *sdi)
free(sdi);
}
#ifdef HAVE_LIBUSB_1_0
struct sr_usb_device_instance *sr_usb_device_instance_new(uint8_t bus,
uint8_t address, struct libusb_device_handle *hdl)
{
@ -178,6 +182,8 @@ void sr_usb_device_instance_free(struct sr_usb_device_instance *usb)
/* Nothing to do for this device instance type. */
}
#endif
struct sr_serial_device_instance *sr_serial_device_instance_new(
const char *port, int fd)
{

View File

@ -17,13 +17,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <glib.h>
#include <sigrok.h>
#include <config.h>
/* demo.c */
extern GIOChannel channels[2];

View File

@ -17,14 +17,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <zip.h>
#include <glib.h>
#include <sigrok.h>
#include <config.h>
extern struct session *session;
extern struct sr_device_plugin session_driver;

View File

@ -35,18 +35,22 @@ int serial_set_params(int fd, int speed, int bits, int parity, int stopbits,
/*--- hardware/common/ezusb.c -----------------------------------------------*/
#ifdef HAVE_LIBUSB_1_0
int ezusb_reset(struct libusb_device_handle *hdl, int set_clear);
int ezusb_install_firmware(libusb_device_handle *hdl, char *filename);
int ezusb_upload_firmware(libusb_device *dev, int configuration,
const char *filename);
#endif
/*--- hardware/common/misc.c ------------------------------------------------*/
#ifdef HAVE_LIBUSB_1_0
int opendev2(int device_index, struct sr_device_instance **sdi,
libusb_device *dev, struct libusb_device_descriptor *des,
int *skip, uint16_t vid, uint16_t pid, int interface);
int opendev3(struct sr_device_instance **sdi, libusb_device *dev,
struct libusb_device_descriptor *des,
uint16_t vid, uint16_t pid, int interface);
#endif
#endif

View File

@ -71,9 +71,11 @@ struct sr_device_instance *sr_get_device_instance(GSList *device_instances,
void sr_device_instance_free(struct sr_device_instance *sdi);
/* USB-specific instances */
#ifdef HAVE_LIBUSB_1_0
struct sr_usb_device_instance *sr_usb_device_instance_new(uint8_t bus,
uint8_t address, struct libusb_device_handle *hdl);
void sr_usb_device_instance_free(struct sr_usb_device_instance *usb);
#endif
/* Serial-specific instances */
struct sr_serial_device_instance *sr_serial_device_instance_new(

View File

@ -25,7 +25,9 @@
#include <stdint.h>
#include <inttypes.h>
#include <glib.h>
#ifdef HAVE_LIBUSB_1_0
#include <libusb.h>
#endif
#ifdef __cplusplus
extern "C" {
@ -262,11 +264,13 @@ enum {
SR_SERIAL_INSTANCE,
};
#ifdef HAVE_LIBUSB_1_0
struct sr_usb_device_instance {
uint8_t bus;
uint8_t address;
struct libusb_device_handle *devhdl;
};
#endif
struct sr_serial_device_instance {
char *port;