From: Martin Ling Date: Sat, 14 Jun 2014 11:25:18 +0000 (+0100) Subject: Fix build for platforms without enumeration & port metadata support. X-Git-Tag: libserialport-0.1.1~122 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=e4ce975a54c60cda6615e4829ae1408adaec8fcf;p=libserialport.git Fix build for platforms without enumeration & port metadata support. --- diff --git a/configure.ac b/configure.ac index 266879a..2df4865 100644 --- a/configure.ac +++ b/configure.ac @@ -101,6 +101,8 @@ mingw* | cygwin*) AM_CONDITIONAL([LINUX], false) AM_CONDITIONAL([WIN32], false) AM_CONDITIONAL([MACOSX], false) + AC_DEFINE(NO_ENUMERATION) + AC_DEFINE(NO_PORT_METADATA) esac AC_SUBST(SP_PKGLIBS) diff --git a/serialport.c b/serialport.c index c759821..290786a 100644 --- a/serialport.c +++ b/serialport.c @@ -99,10 +99,12 @@ enum sp_return sp_get_port_by_name(const char *portname, struct sp_port **port_p port->usb_serial = NULL; port->bluetooth_address = NULL; +#ifndef NO_PORT_METADATA if ((ret = get_port_details(port)) != SP_OK) { sp_free_port(port); return ret; } +#endif *port_ptr = port; @@ -323,7 +325,11 @@ enum sp_return sp_list_ports(struct sp_port ***list_ptr) list[0] = NULL; +#ifdef NO_ENUMERATION + ret = SP_ERR_SUPP; +#else ret = list_ports(&list); +#endif switch (ret) { case SP_OK: