ftdipp_mpsse: add workaround for libftdi < 1.4
This commit is contained in:
parent
ec8d890d27
commit
0a604baaae
7
Makefile
7
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)
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
|
|
|||
Loading…
Reference in New Issue