From b6a8745838673e96c9215f4b73781cde0ac2f3b6 Mon Sep 17 00:00:00 2001 From: Marcos Vives Del Sol Date: Sat, 21 Feb 2015 22:57:36 +0100 Subject: [PATCH 1/5] Fix compilation under Cygwin --- libnfc/buses/uart.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libnfc/buses/uart.c b/libnfc/buses/uart.c index 953c126..72594b0 100644 --- a/libnfc/buses/uart.c +++ b/libnfc/buses/uart.c @@ -77,12 +77,17 @@ const char *serial_ports_device_radix[] = { "tty.SLAB_USBtoUART", "tty.usbserial-", NULL }; # elif defined (__FreeBSD__) || defined (__OpenBSD__) || defined(__FreeBSD_kernel__) const char *serial_ports_device_radix[] = { "cuaU", "cuau", NULL }; -# elif defined (__linux__) +# elif defined (__linux__) || defined (__CYGWIN__) const char *serial_ports_device_radix[] = { "ttyUSB", "ttyS", "ttyACM", "ttyAMA", "ttyO", NULL }; # else # error "Can't determine serial string for your system" # endif +#ifdef __CYGWIN__ +// Under Cygwin, FIONREAD is defined in this file +# include +#endif + // Work-around to claim uart interface using the c_iflag (software input processing) from the termios struct # define CCLAIMED 0x80000000 From 9d82d598f051d154e03cf87b4f3c880b7c8e56a4 Mon Sep 17 00:00:00 2001 From: Marcos Vives Del Sol Date: Sat, 21 Feb 2015 23:04:06 +0100 Subject: [PATCH 2/5] Fix "missing return" compiler warnings --- libnfc/nfc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libnfc/nfc.c b/libnfc/nfc.c index 4294367..2820a14 100644 --- a/libnfc/nfc.c +++ b/libnfc/nfc.c @@ -1307,6 +1307,8 @@ str_nfc_baud_rate(const nfc_baud_rate nbr) case NBR_847: return "847 kbps"; } + + return "???"; } /** @ingroup string-converter @@ -1335,6 +1337,8 @@ str_nfc_modulation_type(const nfc_modulation_type nmt) case NMT_DEP: return "D.E.P."; } + + return "???"; } /** @ingroup string-converter From 5a08fcf2bc8699d89f741e94c25a47eeb04cc5be Mon Sep 17 00:00:00 2001 From: Marcos Vives Del Sol Date: Sun, 22 Feb 2015 13:27:13 +0100 Subject: [PATCH 3/5] Fix "undefined reference"s --- utils/Makefile.am | 1 + 1 file changed, 1 insertion(+) diff --git a/utils/Makefile.am b/utils/Makefile.am index 9637d25..2555bcd 100644 --- a/utils/Makefile.am +++ b/utils/Makefile.am @@ -14,6 +14,7 @@ AM_CPPFLAGS = $(all_includes) $(LIBNFC_CFLAGS) noinst_LTLIBRARIES = libnfcutils.la libnfcutils_la_SOURCES = nfc-utils.c +libnfcutils_la_LIBADD = -lnfc nfc_emulate_forum_tag4_SOURCES = nfc-emulate-forum-tag4.c nfc-utils.h nfc_emulate_forum_tag4_LDADD = $(top_builddir)/libnfc/libnfc.la \ From 92c5bd864bad54f8a96c7fed0f7b49f8e6b14d80 Mon Sep 17 00:00:00 2001 From: Marcos Vives Del Sol Date: Sun, 22 Feb 2015 13:29:07 +0100 Subject: [PATCH 4/5] Added Windows-specific files to .gitignore --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 318dcfc..170b8ea 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ *~ +*.exe Doxyfile INSTALL Makefile @@ -11,6 +12,7 @@ cmake/Makefile cmake/Makefile.in cmake/modules/Makefile cmake/modules/Makefile.in +compile config.guess config.h config.h.in @@ -102,6 +104,7 @@ test/.deps/ test/.libs/ test/Makefile test/Makefile.in +test-driver utils/*.la utils/*.lo utils/*.o From 4e823d8db01570c216b6941341b623dcbef52cd5 Mon Sep 17 00:00:00 2001 From: Marcos Vives Del Sol Date: Sun, 22 Feb 2015 20:41:59 +0100 Subject: [PATCH 5/5] Use TIOCINQ instead of FIONREAD in Cygwin --- libnfc/buses/uart.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libnfc/buses/uart.c b/libnfc/buses/uart.c index 72594b0..3f41e19 100644 --- a/libnfc/buses/uart.c +++ b/libnfc/buses/uart.c @@ -83,9 +83,11 @@ const char *serial_ports_device_radix[] = { "ttyUSB", "ttyS", "ttyACM", "ttyAMA" # error "Can't determine serial string for your system" # endif +// As of 2015/Feb/22, Cygwin does not handle FIONREAD on physical serial devices. +// We'll use TIOCINQ instead which is pretty much the same. #ifdef __CYGWIN__ -// Under Cygwin, FIONREAD is defined in this file -# include +# include +# define FIONREAD TIOCINQ #endif // Work-around to claim uart interface using the c_iflag (software input processing) from the termios struct