PN532 + libnfc + mfoc with OSX
$ wget http://libnfc.googlecode.com/files/libnfc-1.7.0-rc7.tar.gz
$ tar xzvf libnfc-1.7.0-rc7.tar.gz
$ cd libnfc-1.7.0-rc7
$ ./configure --with-drivers=pn532_uart
$ vi utils/nfc-mfclassic.c
Comment out the following two lines
if (uiBlock == 0 && ! write_block_zero && ! magic2)
continue;
Result
//if (uiBlock == 0 && ! write_block_zero && ! magic2)
// continue;
$ vi libnfc/drivers/pn532_uart.c
Append 7 more 0x00 to allow wakeup to work correctly
const uint8_t pn532_wakeup_preamble[] = { 0x55, 0x55, 0x00, 0x00, 0x00 };
Result
const uint8_t pn532_wakeup_preamble[] = { 0x55, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
$ make
$ sudo make install
$ sudo cp /usr/local/etc/nfc/devices.d/libnfc.conf.sample /usr/local/etc/nfc/devices.d/pn532_uart.conf
Connect the PN532 board using a serial to USB cable
$ ls -la /dev/tty.usbserial*
crw-rw-rw- 1 root wheel 18, 12 May 13 20:16 /dev/tty.usbserial-FTDK0QLG
Notice the name of the usbserial TTY
$ sudo vi /usr/local/etc/nfc/devices.d/pn532_uart.conf
Change the conn string to the correct usbserial TTY name
name = "PN532 board via UART"
connstring = pn532_uart:/dev/tty.usbserial-FTDK0QLG
$ wget http://mfoc.googlecode.com/files/mfoc-0.10.5.tar.gz
$ tar xzvf mfoc-0.10.5.tar.gz
$ cd mfoc-0.10.5
$ ./configure LDFLAGS=-L/usr/local/lib PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
$ vi src/nfc-utils.c
Fix the following line by adding & before nt
str_nfc_target(&s, nt, verbose);
Result
str_nfc_target(&s, &nt, verbose);
$ make
$ sudo make install
You are now ready to use libnfc and the build in tools
$ nfc-list
$ nfc-poll

