diff --git a/Makefile b/Makefile index f4f63a911d..64cce77d8b 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,13 @@ OBJS= $(SRC:.cpp=.o) LDFLAGS=-lm -g -Wall -std=c++11 $(shell pkg-config --libs libftdipp1 libudev) CXXFLAGS=-g -Wall -std=c++11 $(shell pkg-config --cflags libftdipp1 libudev) +# libftdi < 1.4 as no usb_addr +ifeq ($(shell pkg-config --atleast-version=1.4 libftdipp1 && echo 1),) +CXXFLAGS+=-DOLD_FTDI_VERSION=1 +else +CXXFLAGS+=-DOLD_FTDI_VERSION=0 +endif + all:$(EXEC_NAME) $(EXEC_NAME):$(OBJS) diff --git a/ftdipp_mpsse.cpp b/ftdipp_mpsse.cpp index 96ae20186d..5131a0ef27 100644 --- a/ftdipp_mpsse.cpp +++ b/ftdipp_mpsse.cpp @@ -81,7 +81,11 @@ void FTDIpp_MPSSE::open_device(unsigned int baudrate) if (_bus == -1 or _addr == -1) ret = ftdi_usb_open_desc(_ftdi, _vid, _pid, NULL, NULL); else +#if (OLD_FTDI_VERSION == 1) + ret = ftdi_usb_open_desc(_ftdi, _vid, _pid, _product, NULL); +#else ret = ftdi_usb_open_bus_addr(_ftdi, _bus, _addr); +#endif if (ret < 0) { fprintf(stderr, "unable to open ftdi device: %d (%s)\n", ret, ftdi_get_error_string(_ftdi));