SR_EXTRA_LIBS=
SR_EXTRA_CXX_LIBS=
-SR_ARG_OPT_PKG([libserialport], [LIBSERIALPORT], [NEED_SERIAL],
+SR_ARG_OPT_PKG([libserialport], [LIBSERIALPORT], ,
[libserialport >= 0.1.1])
SR_ARG_OPT_PKG([libftdi], [LIBFTDI], , [libftdi1 >= 1.0])
AS_IF([test "x$sr_have_libieee1284" = xyes],
[SR_PREPEND([SR_EXTRA_LIBS], [-lieee1284])])
+AS_IF([test "x$sr_have_libserialport" = xyes],
+ sr_have_serial_comm=yes, sr_have_serial_comm=no)
+AS_IF([test "x$sr_have_serial_comm" = xyes],
+ [AC_DEFINE([HAVE_SERIAL_COMM], [1], [Specifies whether serial communication is supported.])])
+AS_IF([test "x$sr_have_serial_comm" = xyes],
+ [SR_APPEND([sr_deps_avail], [serial_comm])])
+AM_CONDITIONAL([NEED_SERIAL], [test "x$sr_have_serial_comm" = xyes])
+
######################
## Feature checks ##
######################
m4_define([SR_DRIVER],
[_SR_DRIVER([$1], [$2], m4_expand([AS_TR_CPP([HW_$2])]), [$3])])
+# TODO
+# Make device drivers depend on the more generic HAVE_SERIAL_COMM
+# feature flag instead of the specific libserialport, which no longer
+# is the exclusive provider of serial communication support.
+
SR_DRIVER([Agilent DMM], [agilent-dmm], [libserialport])
SR_DRIVER([Appa 55II], [appa-55ii], [libserialport])
SR_DRIVER([Arachnid Labs Re:load Pro], [arachnid-labs-re-load-pro], [libserialport])
$sr_pkglibs_summary
Enabled hardware drivers:
$sr_driver_summary
+Enabled serial communication transports:
+ - serial comm ................... $sr_have_serial_comm
+ - libserialport ................. $sr_have_libserialport
+
Enabled SCPI backends:
- TCP............................. yes
- RPC............................. $sr_cv_have_rpc
- - serial.......................... $sr_have_libserialport
+ - serial.......................... $sr_have_serial_comm
- VISA............................ $sr_have_librevisa
- GPIB............................ $sr_have_libgpib
- USBTMC.......................... $sr_have_libusb
#if HAVE_RPC
g_string_append_printf(s, "RPC, ");
#endif
-#ifdef HAVE_LIBSERIALPORT
+#ifdef HAVE_SERIAL_COMM
g_string_append_printf(s, "serial, ");
#endif
#ifdef HAVE_LIBREVISA
#endif
-#ifdef HAVE_LIBSERIALPORT
+#ifdef HAVE_SERIAL_COMM
/**
* Allocate and init a struct for a serial device instance.
struct libusb_device **devlist;
#endif
-#ifdef HAVE_LIBSERIALPORT
+#ifdef HAVE_SERIAL_COMM
struct sr_serial_dev_inst *serial;
#endif
if (!sdi)
return NULL;
-#ifdef HAVE_LIBSERIALPORT
+#ifdef HAVE_SERIAL_COMM
if ((!sdi->connection_id) && (sdi->inst_type == SR_INST_SERIAL)) {
/* connection_id isn't populated, let's do that for serial devices. */
return TRUE;
}
-#ifdef HAVE_LIBSERIALPORT
+#ifdef HAVE_SERIAL_COMM
/**
* Arrange for the reception of another measurement from the DMM.
*
return TRUE;
}
-#ifdef HAVE_LIBSERIALPORT
+#ifdef HAVE_SERIAL_COMM
SR_PRIV int sr_metex14_packet_request(struct sr_serial_dev_inst *serial)
{
const uint8_t wbuf = 'D';
#include <config.h>
#include <glib.h>
#include <libsigrok/libsigrok.h>
+#include "libsigrok-internal.h"
-#ifndef HAVE_LIBSERIALPORT
+#ifndef HAVE_SERIAL_COMM
SR_API GSList *sr_serial_list(const struct sr_dev_driver *driver)
{
#ifndef LIBSIGROK_LIBSIGROK_INTERNAL_H
#define LIBSIGROK_LIBSIGROK_INTERNAL_H
+#include "config.h"
+
#include <glib.h>
#ifdef HAVE_LIBSERIALPORT
#include <libserialport.h>
};
#endif
-#ifdef HAVE_LIBSERIALPORT
+#ifdef HAVE_SERIAL_COMM
struct ser_lib_functions;
struct sr_serial_dev_inst {
/** Port name, e.g. '/dev/tty42'. */
SR_PRIV void sr_usb_dev_inst_free(struct sr_usb_dev_inst *usb);
#endif
-#ifdef HAVE_LIBSERIALPORT
+#ifdef HAVE_SERIAL_COMM
/* Serial-specific instances */
SR_PRIV struct sr_serial_dev_inst *sr_serial_dev_inst_new(const char *port,
const char *serialcomm);
SR_PRIV int std_dummy_dev_close(struct sr_dev_inst *sdi);
SR_PRIV int std_dummy_dev_acquisition_start(const struct sr_dev_inst *sdi);
SR_PRIV int std_dummy_dev_acquisition_stop(struct sr_dev_inst *sdi);
-#ifdef HAVE_LIBSERIALPORT
+#ifdef HAVE_SERIAL_COMM
SR_PRIV int std_serial_dev_open(struct sr_dev_inst *sdi);
SR_PRIV int std_serial_dev_acquisition_stop(struct sr_dev_inst *sdi);
#endif
/*--- serial.c --------------------------------------------------------------*/
-#ifdef HAVE_LIBSERIALPORT
+#ifdef HAVE_SERIAL_COMM
enum {
SERIAL_RDWR = 1,
SERIAL_RDONLY = 2,
gboolean is_hfe, is_unitless, is_logic, is_min, is_max, is_avg;
};
-#ifdef HAVE_LIBSERIALPORT
+#ifdef HAVE_SERIAL_COMM
SR_PRIV int sr_metex14_packet_request(struct sr_serial_dev_inst *serial);
#endif
SR_PRIV gboolean sr_metex14_packet_valid(const uint8_t *buf);
gboolean is_invalid;
};
-#ifdef HAVE_LIBSERIALPORT
+#ifdef HAVE_SERIAL_COMM
SR_PRIV int sr_asycii_packet_request(struct sr_serial_dev_inst *serial);
#endif
SR_PRIV gboolean sr_asycii_packet_valid(const uint8_t *buf);
SR_PRIV extern const struct sr_modbus_dev_inst modbus_serial_rtu_dev;
static const struct sr_modbus_dev_inst *modbus_devs[] = {
-#ifdef HAVE_LIBSERIALPORT
+#ifdef HAVE_SERIAL_COMM
&modbus_serial_rtu_dev, /* Must be last as it matches any resource. */
#endif
};
#ifdef HAVE_LIBGPIB
&scpi_libgpib_dev,
#endif
-#ifdef HAVE_LIBSERIALPORT
+#ifdef HAVE_SERIAL_COMM
&scpi_serial_dev, /* Must be last as it matches any resource. */
#endif
};
return SR_OK;
}
-#ifdef HAVE_LIBSERIALPORT
+#ifdef HAVE_SERIAL_COMM
/**
* Standard serial driver dev_open() callback API helper.
driver->dev_close(sdi);
if (sdi->conn) {
-#ifdef HAVE_LIBSERIALPORT
+#ifdef HAVE_SERIAL_COMM
if (sdi->inst_type == SR_INST_SERIAL)
sr_serial_dev_inst_free(sdi->conn);
#endif