diff --git a/src/libsigrok-internal.h b/src/libsigrok-internal.h index 3ea3590a..6fbc1d24 100644 --- a/src/libsigrok-internal.h +++ b/src/libsigrok-internal.h @@ -723,6 +723,7 @@ struct sr_usb_dev_inst { }; #endif +struct sr_serial_dev_inst; #ifdef HAVE_SERIAL_COMM struct ser_lib_functions; struct sr_serial_dev_inst { @@ -843,6 +844,30 @@ SR_PRIV void sr_usb_dev_inst_free(struct sr_usb_dev_inst *usb); #endif #ifdef HAVE_SERIAL_COMM +#ifndef HAVE_LIBSERIALPORT +/* + * Some identifiers which initially got provided by libserialport are + * used internally within the libsigrok serial layer's implementation, + * while libserialport no longer is the exclusive provider of serial + * communication support. Declare the identifiers here so they remain + * available across all build configurations. + */ +enum libsp_parity { + SP_PARITY_NONE = 0, + SP_PARITY_ODD = 1, + SP_PARITY_EVEN = 2, + SP_PARITY_MARK = 3, + SP_PARITY_SPACE = 4, +}; + +enum libsp_flowcontrol { + SP_FLOWCONTROL_NONE = 0, + SP_FLOWCONTROL_XONXOFF = 1, + SP_FLOWCONTROL_RTSCTS = 2, + SP_FLOWCONTROL_DTRDSR = 3, +}; +#endif + /* Serial-specific instances */ SR_PRIV struct sr_serial_dev_inst *sr_serial_dev_inst_new(const char *port, const char *serialcomm); diff --git a/src/serial.c b/src/serial.c index dc6e0126..aca99d99 100644 --- a/src/serial.c +++ b/src/serial.c @@ -25,7 +25,9 @@ #include #include #include +#ifdef HAVE_LIBSERIALPORT #include +#endif #include #include "libsigrok-internal.h" #ifdef _WIN32 @@ -50,6 +52,8 @@ * @{ */ +#ifdef HAVE_SERIAL_COMM + /* See if a (assumed opened) serial port is of any supported type. */ static int dev_is_supported(struct sr_serial_dev_inst *serial) { @@ -870,4 +874,10 @@ SR_PRIV int serial_timeout(struct sr_serial_dev_inst *port, int num_bytes) return timeout_ms; } +#else + +/* TODO Put fallback.c content here? */ + +#endif + /** @} */