Support FTDI dongle under MacOS

This commit is contained in:
Romuald Conty 2012-09-27 07:35:55 +00:00
parent 6e7fdb1c80
commit 921d64dadc

View file

@ -1,9 +1,9 @@
/*-
* Public platform independent Near Field Communication (NFC) library
*
* Copyright (C) 2009, 2010, Roel Verdult, Romuald Conty
* Copyright (C) 2010, Roel Verdult, Romuald Conty
* Copyright (C) 2011, Romuald Conty, Romain Tartière
* Copyright (C) 2009-2011, Roel Verdult
* Copyright (C) 2009-2012, Romuald Conty
* Copyright (C) 2011, Romain Tartière
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
@ -25,8 +25,6 @@
* @brief POSIX UART driver
*/
/* vim: set ts=2 sw=2 et: */
#include <sys/ioctl.h>
#include <sys/select.h>
#include <sys/stat.h>
@ -48,7 +46,7 @@
# if defined(__APPLE__)
// FIXME: find UART connection string for PN53X device on Mac OS X when multiples devices are used
const char *serial_ports_device_radix[] = { "tty.SLAB_USBtoUART", NULL };
const char *serial_ports_device_radix[] = { "tty.SLAB_USBtoUART", "tty.usbserial-", NULL };
# elif defined (__FreeBSD__) || defined (__OpenBSD__)
const char *serial_ports_device_radix[] = { "cuaU", "cuau", NULL };
# elif defined (__linux__)
@ -343,9 +341,10 @@ uart_list_ports(void)
DIR *pdDir = opendir("/dev");
struct dirent *pdDirEnt;
while ((pdDirEnt = readdir(pdDir)) != NULL) {
#if !defined(__APPLE__)
if (!isdigit(pdDirEnt->d_name[strlen(pdDirEnt->d_name) - 1]))
continue;
#endif
const char **p = serial_ports_device_radix;
while (*p) {
if (!strncmp(pdDirEnt->d_name, *p, strlen(*p))) {