]> sigrok.org Git - libsigrok.git/commitdiff
Fix build when no libusb-LA is compiled.
authorUwe Hermann <redacted>
Wed, 2 Feb 2011 09:25:52 +0000 (10:25 +0100)
committerUwe Hermann <redacted>
Wed, 2 Feb 2011 09:25:52 +0000 (10:25 +0100)
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.

hardware/asix-sigma/asix-sigma.c
hardware/common/misc.c
hardware/saleae-logic/saleae-logic.c
hardware/zeroplus-logic-cube/zeroplus.c
hwplugin.c
session.c
session_file.c
sigrok-internal.h
sigrok-proto.h
sigrok.h

index f488cdc50c9e09f3ec9677a0485b4e7ec6efd5c8..427d7905982166c15b1e9a9b008a14f232808917 100644 (file)
  * 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
index 03fe2689c6f308d5717d05d1925f7e791a5103fb..43b158ae742c32356aff8b3d80b6ecb1adb9e46d 100644 (file)
  * 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
index b66fd30d9743387c0cb80c4388daedb985906af1..a270e0b4850ca27a3aff4fa6404b9210085916de 100644 (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
index 0c3d25bc803ca29e2dc7d157423f237460c043f7..ba5fd522cb6e26b31f0ff2978fc40890111262cc 100644 (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
index 31fed10c8583fe77e255c8f38f2813477ca61112..b10164693f52adec61d8a8f457587c255055d0d1 100644 (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)
 {
index ed86de3c8b27b4cb073e40b3de3dcee6c44ba5c3..7732629131c1a0f4957ef71546a643c571c6a9cd 100644 (file)
--- a/session.c
+++ b/session.c
  * 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];
index 88dfe4f5bb96a1bc28aeaec587b63d5aef31a8bf..d6480b682e1d4ac67127cfbbd889c3aa85bcf427 100644 (file)
  * 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;
index 3de444e882c0a625fb04f1e44990657dd60bf0bc..b30d417dd1cda8e8154e020fda89708a2d2bdf30 100644 (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
index f6187a91ad3bf8da11665fe7208db906d2e05d5d..57b899df16ac36c894cec77773ce6e8601a88af8 100644 (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(
index 59ab45b50714b0148bc0e0de7d525f7b331b5c02..983246bb81f7366a7c7a737ddffff916ce659cd4 100644 (file)
--- a/sigrok.h
+++ b/sigrok.h
@@ -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;