summaryrefslogtreecommitdiffstats
path: root/Linux_x86/phDal4Nfc_uart.c
diff options
context:
space:
mode:
authorMartijn Coenen <maco@google.com>2011-11-02 15:58:37 -0700
committerMartijn Coenen <maco@google.com>2011-11-03 17:56:36 -0700
commitb99be65c277b0cc65a00a33e784ed49461531737 (patch)
treefa283e7ed283b12e692729a860fb51315d130d78 /Linux_x86/phDal4Nfc_uart.c
parent366238178f7a6d26ce051150f4fb65e533c2fae4 (diff)
downloadexternal_libnfc-nxp-b99be65c277b0cc65a00a33e784ed49461531737.zip
external_libnfc-nxp-b99be65c277b0cc65a00a33e784ed49461531737.tar.gz
external_libnfc-nxp-b99be65c277b0cc65a00a33e784ed49461531737.tar.bz2
Use NFC HAL for some libnfc settings.
The NFC HAL in libhardware allows us to store and retrieve product-specific settings. This patch moves two product-specific settings to the HAL: the device port, and the usage of the i2c workaround we had for crespo. This means configuring the port no longer needs to be done from JNI land. Change-Id: I2e19b6f188f808bc2f2a1f1abc28f2a6c47e6a4c
Diffstat (limited to 'Linux_x86/phDal4Nfc_uart.c')
-rw-r--r--Linux_x86/phDal4Nfc_uart.c38
1 files changed, 2 insertions, 36 deletions
diff --git a/Linux_x86/phDal4Nfc_uart.c b/Linux_x86/phDal4Nfc_uart.c
index a2f6db3..b19c5c5 100644
--- a/Linux_x86/phDal4Nfc_uart.c
+++ b/Linux_x86/phDal4Nfc_uart.c
@@ -28,7 +28,7 @@
#define LOG_TAG "NFC_uart"
#include <cutils/log.h>
-
+#include <hardware/nfc.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
@@ -159,7 +159,6 @@ PURPOSE: Closes the link
NFCSTATUS phDal4Nfc_uart_open_and_configure(pphDal4Nfc_sConfig_t pConfig, void ** pLinkHandle)
{
- char * pComPort;
int nComStatus;
NFCSTATUS nfcret = NFCSTATUS_SUCCESS;
int ret;
@@ -168,41 +167,8 @@ NFCSTATUS phDal4Nfc_uart_open_and_configure(pphDal4Nfc_sConfig_t pConfig, void *
srand(time(NULL));
- switch(pConfig->nLinkType)
- {
- case ENUM_DAL_LINK_TYPE_COM1:
- pComPort = "/dev/ttyO0";
- break;
- case ENUM_DAL_LINK_TYPE_COM2:
- pComPort = "/dev/ttyO1";
- break;
- case ENUM_DAL_LINK_TYPE_COM3:
- pComPort = "/dev/ttyO2";
- break;
- case ENUM_DAL_LINK_TYPE_COM4:
- pComPort = "/dev/ttyO3";
- break;
- case ENUM_DAL_LINK_TYPE_COM5:
- pComPort = "/dev/ttyO4";
- break;
- case ENUM_DAL_LINK_TYPE_COM6:
- pComPort = "/dev/ttyO5";
- break;
- case ENUM_DAL_LINK_TYPE_COM7:
- pComPort = "/dev/ttyO6";
- break;
- case ENUM_DAL_LINK_TYPE_COM8:
- pComPort = "/dev/ttyO7";
- break;
- case ENUM_DAL_LINK_TYPE_USB:
- pComPort = "/dev/ttyUSB0";
- break;
- default:
- return NFCSTATUS_INVALID_PARAMETER;
- }
-
/* open communication port handle */
- gComPortContext.nHandle = open(pComPort, O_RDWR | O_NOCTTY);
+ gComPortContext.nHandle = open(pConfig->deviceNode, O_RDWR | O_NOCTTY);
if (gComPortContext.nHandle < 0)
{
*pLinkHandle = NULL;