Created attachment 199030 [details] patch file for the Port Adding this compiler flags is necessary so that the pn532 module can be use over uart. With out this patch this is not possible as the necessary define for the serial baud rate is hidden in sys/_termios.h behind the __BSD_VISIBLE flag.
Every once a while, I come back to this issue, wonder how this should be done by the autotools, and get lots in the libnfc code. After another attempt today, I can't see the problem this patch is supposed to fix. configure reports: Selected drivers: acr122_pcsc...... no acr122_usb....... yes acr122s.......... yes arygon........... yes pn53x_usb........ yes pn532_uart....... yes <-------- What you are trying to fix pn532_spi....... no pn532_i2c........ no And the build complete successfully (this is on FreeBSD 12.0). Can you please provide more details about your setup, what you are trying to do, how you do it and what is the result?
The problem is the the pn532 module is try to communicate at 115200 baud [1] but this baud is hide behind the __BSD_VISIBLE flag in sys/_termios.h. The problem dose not become visible at compile time but only at runtime as the library is not able to connect to any pn532 module using UART, because it can't set the necessary baud on the serial interface. Here[2] the preprocessor flag is used to enable the necessary speed for communication with the module, but this flag is not set unless the __BSD_VISIBLE is set as it is defined in sys/_termios.h in line 208 [3] [1] https://github.com/nfc-tools/libnfc/blob/master/libnfc/drivers/pn532_uart.c#L51 [2]https://github.com/nfc-tools/libnfc/blob/master/libnfc/buses/uart.c#L211 [3]https://svnweb.freebsd.org/base/stable/12/sys/sys/_termios.h?revision=339434&view=markup#l208
Okay, I though it was a build failure. I guess the autotools should still do something magic that adds -D__BSD_VISIBLE somewhere, but this fix is straightforward. I should have asked for details sooner, I was looking in the wrong direction. Thank you for the details, I will commit your patch soon.
A commit references this bug: Author: romain Date: Fri Feb 22 02:13:45 UTC 2019 New revision: 493539 URL: https://svnweb.freebsd.org/changeset/ports/493539 Log: Fix pn532 module use over UART Some macros are only visible if __BSD_VISIBLE is defined. When absent, libnfc compiles successfuly, but some features are broken. This fix PN532 over UART. PR: 233045 Reported by: alex@xanderio.de Changes: head/devel/libnfc/Makefile
Committed, thanks! Sorry for the delay