From: Gerhard Sittig Date: Thu, 27 Dec 2018 13:29:00 +0000 (+0100) Subject: serial: make LCR, modbus, SCPI over serial depend on generic serial comm X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=48b7c3462927616916a1296c862e96e3a36c2a80;p=libsigrok.git serial: make LCR, modbus, SCPI over serial depend on generic serial comm Add guards around the implementation of ES51919 chip support for LCR, as well as modbus and SCPI over serial. To accept when the source files get compiled in the absence of their dependencies, end up with an empty implementation in that case. This approach can simplify build rules when several optional external dependencies result in differing sets of supported communication means. --- diff --git a/src/lcr/es51919.c b/src/lcr/es51919.c index 474602b4..38750098 100644 --- a/src/lcr/es51919.c +++ b/src/lcr/es51919.c @@ -27,6 +27,8 @@ #define LOG_PREFIX "es51919" +#ifdef HAVE_SERIAL_COMM + struct dev_buffer { /** Total size of the buffer. */ size_t size; @@ -854,3 +856,5 @@ SR_PRIV int es51919_serial_acquisition_start(const struct sr_dev_inst *sdi) return SR_OK; } + +#endif diff --git a/src/modbus/modbus_serial_rtu.c b/src/modbus/modbus_serial_rtu.c index 065c25f6..f7fee0ab 100644 --- a/src/modbus/modbus_serial_rtu.c +++ b/src/modbus/modbus_serial_rtu.c @@ -26,6 +26,8 @@ #define LOG_PREFIX "modbus_serial" +#ifdef HAVE_SERIAL_COMM + #define BUFFER_SIZE 1024 struct modbus_serial_rtu { @@ -207,3 +209,5 @@ SR_PRIV const struct sr_modbus_dev_inst modbus_serial_rtu_dev = { .close = modbus_serial_rtu_close, .free = modbus_serial_rtu_free, }; + +#endif diff --git a/src/scpi/scpi_serial.c b/src/scpi/scpi_serial.c index 96fb70d6..c73d1b48 100644 --- a/src/scpi/scpi_serial.c +++ b/src/scpi/scpi_serial.c @@ -28,6 +28,8 @@ #define LOG_PREFIX "scpi_serial" +#ifdef HAVE_SERIAL_COMM + struct scpi_serial { struct sr_serial_dev_inst *serial; gboolean got_newline; @@ -214,3 +216,5 @@ SR_PRIV const struct sr_scpi_dev_inst scpi_serial_dev = { .close = scpi_serial_close, .free = scpi_serial_free, }; + +#endif