This commit is contained in:
Philippe Teuwen 2017-02-18 13:05:59 +01:00
parent f184407cc5
commit e4df2f3334
16 changed files with 121 additions and 120 deletions

View file

@ -196,7 +196,7 @@ spi_send_receive(spi_port sp, const uint8_t *pbtTx, const size_t szTx, uint8_t *
struct spi_ioc_transfer tr_send = {
.tx_buf = (unsigned long) pbtTx,
.rx_buf = 0,
.len = szTx ,
.len = szTx,
.delay_usecs = 0,
.speed_hz = 0,
.bits_per_word = 0,

View file

@ -78,7 +78,7 @@ const char *serial_ports_device_radix[] = { "tty.SLAB_USBtoUART", "tty.usbserial
# elif defined (__FreeBSD__) || defined (__OpenBSD__) || defined(__FreeBSD_kernel__)
const char *serial_ports_device_radix[] = { "cuaU", "cuau", NULL };
# elif defined (__NetBSD__)
const char *serial_ports_device_radix[] = { "tty0", "ttyC", "ttyS", "ttyU", "ttyY" , NULL };
const char *serial_ports_device_radix[] = { "tty0", "ttyC", "ttyS", "ttyU", "ttyY", NULL };
# elif defined (__linux__) || defined (__CYGWIN__)
const char *serial_ports_device_radix[] = { "ttyUSB", "ttyS", "ttyACM", "ttyAMA", "ttyO", NULL };
# else

View file

@ -611,7 +611,7 @@ pn53x_decode_target_data(const uint8_t *pbtRawData, size_t szRawData, pn53x_type
pbtRawData += 2;
memcpy(pnti->nji.btId, pbtRawData, 4);
break;
// Should not happend...
// Should not happend...
case NMT_DEP:
return NFC_ECHIP;
}
@ -829,7 +829,7 @@ pn53x_set_property_int(struct nfc_device *pnd, const nfc_property property, cons
case NP_TIMEOUT_COM:
CHIP_DATA(pnd)->timeout_communication = value;
return pn53x_RFConfiguration__Various_timings(pnd, pn53x_int_to_timeout(CHIP_DATA(pnd)->timeout_atr), pn53x_int_to_timeout(CHIP_DATA(pnd)->timeout_communication));
// Following properties are invalid (not integer)
// Following properties are invalid (not integer)
case NP_HANDLE_CRC:
case NP_HANDLE_PARITY:
case NP_ACTIVATE_FIELD:
@ -952,7 +952,7 @@ pn53x_set_property_bool(struct nfc_device *pnd, const nfc_property property, con
return res;
}
return pn53x_write_register(pnd, PN53X_REG_CIU_RxMode, SYMBOL_RX_SPEED, 0x00);
// Following properties are invalid (not boolean)
// Following properties are invalid (not boolean)
case NP_TIMEOUT_COMMAND:
case NP_TIMEOUT_ATR:
case NP_TIMEOUT_COM:
@ -2391,7 +2391,7 @@ pn53x_target_receive_bytes(struct nfc_device *pnd, uint8_t *pbtRx, const size_t
return pnd->last_error;
}
}
// NO BREAK
// NO BREAK
case NMT_JEWEL:
case NMT_ISO14443B:
case NMT_ISO14443BI:
@ -2496,7 +2496,7 @@ pn53x_target_send_bytes(struct nfc_device *pnd, const uint8_t *pbtTx, const size
return pnd->last_error;
}
}
// NO BREAK
// NO BREAK
case NMT_JEWEL:
case NMT_ISO14443B:
case NMT_ISO14443BI:
@ -3215,7 +3215,7 @@ pn53x_nm_to_ptt(const nfc_modulation nm)
switch (nm.nmt) {
case NMT_ISO14443A:
return PTT_MIFARE;
// return PTT_ISO14443_4A_106;
// return PTT_ISO14443_4A_106;
case NMT_ISO14443B:
switch (nm.nbr) {

View file

@ -60,7 +60,7 @@ static int
escaped_value(const char line[BUFSIZ], int i, char **value)
{
if (line[i] != '"')
goto FAIL;
goto FAIL;
i++;
if (line[i] == 0 || line[i] == '\n')
goto FAIL;

View file

@ -120,19 +120,19 @@ static struct timespec __transaction_stop;
* @return length (in bytes) of read data, or driver error code (negative value)
*/
static ssize_t pn532_i2c_read(const i2c_device id,
uint8_t *buf, const size_t len)
uint8_t *buf, const size_t len)
{
struct timespec transaction_start, bus_free_time = { 0 };
ssize_t ret;
struct timespec transaction_start, bus_free_time = { 0 };
ssize_t ret;
clock_gettime(CLOCK_MONOTONIC, &transaction_start);
bus_free_time.tv_nsec = (PN532_BUS_FREE_TIME * 1000 * 1000) -
(transaction_start.tv_nsec - __transaction_stop.tv_nsec);
nanosleep(&bus_free_time, NULL);
clock_gettime(CLOCK_MONOTONIC, &transaction_start);
bus_free_time.tv_nsec = (PN532_BUS_FREE_TIME * 1000 * 1000) -
(transaction_start.tv_nsec - __transaction_stop.tv_nsec);
nanosleep(&bus_free_time, NULL);
ret = i2c_read(id, buf, len);
clock_gettime(CLOCK_MONOTONIC, &__transaction_stop);
return ret;
ret = i2c_read(id, buf, len);
clock_gettime(CLOCK_MONOTONIC, &__transaction_stop);
return ret;
}
/**
@ -148,19 +148,19 @@ static ssize_t pn532_i2c_read(const i2c_device id,
* @return NFC_SUCCESS on success, otherwise driver error code
*/
static ssize_t pn532_i2c_write(const i2c_device id,
const uint8_t *buf, const size_t len)
const uint8_t *buf, const size_t len)
{
struct timespec transaction_start, bus_free_time = { 0 };
ssize_t ret;
struct timespec transaction_start, bus_free_time = { 0 };
ssize_t ret;
clock_gettime(CLOCK_MONOTONIC, &transaction_start);
bus_free_time.tv_nsec = (PN532_BUS_FREE_TIME * 1000 * 1000) -
(transaction_start.tv_nsec - __transaction_stop.tv_nsec);
nanosleep(&bus_free_time, NULL);
clock_gettime(CLOCK_MONOTONIC, &transaction_start);
bus_free_time.tv_nsec = (PN532_BUS_FREE_TIME * 1000 * 1000) -
(transaction_start.tv_nsec - __transaction_stop.tv_nsec);
nanosleep(&bus_free_time, NULL);
ret = i2c_write(id, buf, len);
clock_gettime(CLOCK_MONOTONIC, &__transaction_stop);
return ret;
ret = i2c_write(id, buf, len);
clock_gettime(CLOCK_MONOTONIC, &__transaction_stop);
return ret;
}
/**

View file

@ -433,7 +433,7 @@ pn532_spi_receive(nfc_device *pnd, uint8_t *pbtData, const size_t szDataLen, int
goto error;
}
pnd->last_error = spi_send_receive(DRIVER_DATA(pnd)->port, &pn532_spi_cmd_dataread, 1, abtRxBuf , 4, true);
pnd->last_error = spi_send_receive(DRIVER_DATA(pnd)->port, &pn532_spi_cmd_dataread, 1, abtRxBuf, 4, true);
if (pnd->last_error < 0) {
goto error;

View file

@ -351,7 +351,7 @@ pn53x_usb_open(const nfc_context *context, const nfc_connstring connstring)
}
switch (DRIVER_DATA(pnd)->model) {
// empirical tuning
// empirical tuning
case ASK_LOGO:
CHIP_DATA(pnd)->timer_correction = 50;
break;
@ -697,12 +697,12 @@ pn53x_usb_set_property_bool(nfc_device *pnd, const nfc_property property, const
}
break;
case SCM_SCL3712:
if (NP_ACTIVATE_FIELD == property) {
// Switch on/off LED according to ACTIVATE_FIELD option
if ((res = pn53x_write_register(pnd, PN53X_SFR_P3, _BV(P32), bEnable ? 0 : _BV(P32))) < 0)
return res;
}
break;
if (NP_ACTIVATE_FIELD == property) {
// Switch on/off LED according to ACTIVATE_FIELD option
if ((res = pn53x_write_register(pnd, PN53X_SFR_P3, _BV(P32), bEnable ? 0 : _BV(P32))) < 0)
return res;
}
break;
case NXP_PN531:
case NXP_PN533:
case SONY_PN531:

View file

@ -388,7 +388,7 @@ nfc_list_devices(nfc_context *context, nfc_connstring connstrings[], const size_
pndl = pndl->next;
}
} else if (context->user_defined_device_count == 0) {
log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_INFO, "Warning: %s" , "user must specify device(s) manually when autoscan is disabled");
log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_INFO, "Warning: %s", "user must specify device(s) manually when autoscan is disabled");
}
return device_found;