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:
parent
cddd1c5f47
commit
22b0238344
|
@ -23,11 +23,11 @@
|
||||||
* ASIX Sigma Logic Analyzer Driver
|
* ASIX Sigma Logic Analyzer Driver
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
#include <ftdi.h>
|
#include <ftdi.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <zlib.h>
|
#include <zlib.h>
|
||||||
#include <sigrok.h>
|
#include <sigrok.h>
|
||||||
#include <config.h>
|
|
||||||
#include "asix-sigma.h"
|
#include "asix-sigma.h"
|
||||||
|
|
||||||
#define USB_VENDOR 0xa600
|
#define USB_VENDOR 0xa600
|
||||||
|
|
|
@ -17,11 +17,16 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
#ifdef HAVE_LIBUSB_1_0
|
||||||
#include <libusb.h>
|
#include <libusb.h>
|
||||||
|
#endif
|
||||||
#include <sigrok.h>
|
#include <sigrok.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBUSB_1_0
|
||||||
|
|
||||||
int opendev2(int device_index, struct sr_device_instance **sdi,
|
int opendev2(int device_index, struct sr_device_instance **sdi,
|
||||||
libusb_device *dev, struct libusb_device_descriptor *des,
|
libusb_device *dev, struct libusb_device_descriptor *des,
|
||||||
int *skip, uint16_t vid, uint16_t pid, int interface)
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
@ -25,7 +26,6 @@
|
||||||
#include <libusb.h>
|
#include <libusb.h>
|
||||||
#include <sigrok.h>
|
#include <sigrok.h>
|
||||||
#include <sigrok-internal.h>
|
#include <sigrok-internal.h>
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#define USB_VENDOR 0x0925
|
#define USB_VENDOR 0x0925
|
||||||
#define USB_PRODUCT 0x3881
|
#define USB_PRODUCT 0x3881
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
@ -24,7 +25,6 @@
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <libusb.h>
|
#include <libusb.h>
|
||||||
#include <sigrok.h>
|
#include <sigrok.h>
|
||||||
#include "config.h"
|
|
||||||
#include "analyzer.h"
|
#include "analyzer.h"
|
||||||
|
|
||||||
#define USB_VENDOR 0x0c12
|
#define USB_VENDOR 0x0c12
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
@ -24,7 +25,6 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <sigrok.h>
|
#include <sigrok.h>
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
/* The list of loaded plugins lives here. */
|
/* The list of loaded plugins lives here. */
|
||||||
GSList *plugins;
|
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)
|
void sr_device_instance_free(struct sr_device_instance *sdi)
|
||||||
{
|
{
|
||||||
switch (sdi->instance_type) {
|
switch (sdi->instance_type) {
|
||||||
|
#ifdef HAVE_LIBUSB_1_0
|
||||||
case SR_USB_INSTANCE:
|
case SR_USB_INSTANCE:
|
||||||
sr_usb_device_instance_free(sdi->usb);
|
sr_usb_device_instance_free(sdi->usb);
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
case SR_SERIAL_INSTANCE:
|
case SR_SERIAL_INSTANCE:
|
||||||
sr_serial_device_instance_free(sdi->serial);
|
sr_serial_device_instance_free(sdi->serial);
|
||||||
break;
|
break;
|
||||||
|
@ -155,6 +157,8 @@ void sr_device_instance_free(struct sr_device_instance *sdi)
|
||||||
free(sdi);
|
free(sdi);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBUSB_1_0
|
||||||
|
|
||||||
struct sr_usb_device_instance *sr_usb_device_instance_new(uint8_t bus,
|
struct sr_usb_device_instance *sr_usb_device_instance_new(uint8_t bus,
|
||||||
uint8_t address, struct libusb_device_handle *hdl)
|
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. */
|
/* Nothing to do for this device instance type. */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
struct sr_serial_device_instance *sr_serial_device_instance_new(
|
struct sr_serial_device_instance *sr_serial_device_instance_new(
|
||||||
const char *port, int fd)
|
const char *port, int fd)
|
||||||
{
|
{
|
||||||
|
|
|
@ -17,13 +17,13 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <sigrok.h>
|
#include <sigrok.h>
|
||||||
#include <config.h>
|
|
||||||
|
|
||||||
/* demo.c */
|
/* demo.c */
|
||||||
extern GIOChannel channels[2];
|
extern GIOChannel channels[2];
|
||||||
|
|
|
@ -17,14 +17,13 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <zip.h>
|
#include <zip.h>
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <sigrok.h>
|
#include <sigrok.h>
|
||||||
#include <config.h>
|
|
||||||
|
|
||||||
|
|
||||||
extern struct session *session;
|
extern struct session *session;
|
||||||
extern struct sr_device_plugin session_driver;
|
extern struct sr_device_plugin session_driver;
|
||||||
|
|
|
@ -35,18 +35,22 @@ int serial_set_params(int fd, int speed, int bits, int parity, int stopbits,
|
||||||
|
|
||||||
/*--- hardware/common/ezusb.c -----------------------------------------------*/
|
/*--- hardware/common/ezusb.c -----------------------------------------------*/
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBUSB_1_0
|
||||||
int ezusb_reset(struct libusb_device_handle *hdl, int set_clear);
|
int ezusb_reset(struct libusb_device_handle *hdl, int set_clear);
|
||||||
int ezusb_install_firmware(libusb_device_handle *hdl, char *filename);
|
int ezusb_install_firmware(libusb_device_handle *hdl, char *filename);
|
||||||
int ezusb_upload_firmware(libusb_device *dev, int configuration,
|
int ezusb_upload_firmware(libusb_device *dev, int configuration,
|
||||||
const char *filename);
|
const char *filename);
|
||||||
|
#endif
|
||||||
|
|
||||||
/*--- hardware/common/misc.c ------------------------------------------------*/
|
/*--- hardware/common/misc.c ------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBUSB_1_0
|
||||||
int opendev2(int device_index, struct sr_device_instance **sdi,
|
int opendev2(int device_index, struct sr_device_instance **sdi,
|
||||||
libusb_device *dev, struct libusb_device_descriptor *des,
|
libusb_device *dev, struct libusb_device_descriptor *des,
|
||||||
int *skip, uint16_t vid, uint16_t pid, int interface);
|
int *skip, uint16_t vid, uint16_t pid, int interface);
|
||||||
int opendev3(struct sr_device_instance **sdi, libusb_device *dev,
|
int opendev3(struct sr_device_instance **sdi, libusb_device *dev,
|
||||||
struct libusb_device_descriptor *des,
|
struct libusb_device_descriptor *des,
|
||||||
uint16_t vid, uint16_t pid, int interface);
|
uint16_t vid, uint16_t pid, int interface);
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -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);
|
void sr_device_instance_free(struct sr_device_instance *sdi);
|
||||||
|
|
||||||
/* USB-specific instances */
|
/* USB-specific instances */
|
||||||
|
#ifdef HAVE_LIBUSB_1_0
|
||||||
struct sr_usb_device_instance *sr_usb_device_instance_new(uint8_t bus,
|
struct sr_usb_device_instance *sr_usb_device_instance_new(uint8_t bus,
|
||||||
uint8_t address, struct libusb_device_handle *hdl);
|
uint8_t address, struct libusb_device_handle *hdl);
|
||||||
void sr_usb_device_instance_free(struct sr_usb_device_instance *usb);
|
void sr_usb_device_instance_free(struct sr_usb_device_instance *usb);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Serial-specific instances */
|
/* Serial-specific instances */
|
||||||
struct sr_serial_device_instance *sr_serial_device_instance_new(
|
struct sr_serial_device_instance *sr_serial_device_instance_new(
|
||||||
|
|
4
sigrok.h
4
sigrok.h
|
@ -25,7 +25,9 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
#ifdef HAVE_LIBUSB_1_0
|
||||||
#include <libusb.h>
|
#include <libusb.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -262,11 +264,13 @@ enum {
|
||||||
SR_SERIAL_INSTANCE,
|
SR_SERIAL_INSTANCE,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBUSB_1_0
|
||||||
struct sr_usb_device_instance {
|
struct sr_usb_device_instance {
|
||||||
uint8_t bus;
|
uint8_t bus;
|
||||||
uint8_t address;
|
uint8_t address;
|
||||||
struct libusb_device_handle *devhdl;
|
struct libusb_device_handle *devhdl;
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
struct sr_serial_device_instance {
|
struct sr_serial_device_instance {
|
||||||
char *port;
|
char *port;
|
||||||
|
|
Loading…
Reference in New Issue