drivers/acr122_pcsc: allow LIBNFC_DEFAULT_DEVICE=acr122_pcsc
This commit is contained in:
parent
56e44670a5
commit
47e90ee510
1 changed files with 17 additions and 2 deletions
|
@ -252,13 +252,28 @@ acr122_pcsc_open (const nfc_connstring connstring)
|
||||||
struct acr122_pcsc_descriptor ndd;
|
struct acr122_pcsc_descriptor ndd;
|
||||||
int connstring_decode_level = acr122_pcsc_connstring_decode (connstring, &ndd);
|
int connstring_decode_level = acr122_pcsc_connstring_decode (connstring, &ndd);
|
||||||
|
|
||||||
|
if (connstring_decode_level < 1) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
nfc_connstring fullconnstring;
|
||||||
|
if (connstring_decode_level == 1) {
|
||||||
|
// Device was not specified, take the first one we can find
|
||||||
|
size_t szDeviceFound;
|
||||||
|
acr122_pcsc_probe(&fullconnstring, 1, &szDeviceFound);
|
||||||
|
if (szDeviceFound < 1)
|
||||||
|
return NULL;
|
||||||
|
connstring_decode_level = acr122_pcsc_connstring_decode (fullconnstring, &ndd);
|
||||||
if (connstring_decode_level < 2) {
|
if (connstring_decode_level < 2) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
memcpy(fullconnstring, connstring, sizeof(nfc_connstring));
|
||||||
|
}
|
||||||
// FIXME: acr122_pcsc_open() does not take care about bus index
|
// FIXME: acr122_pcsc_open() does not take care about bus index
|
||||||
|
|
||||||
char *pcFirmware;
|
char *pcFirmware;
|
||||||
nfc_device *pnd = nfc_device_new (connstring);
|
nfc_device *pnd = nfc_device_new (fullconnstring);
|
||||||
pnd->driver_data = malloc (sizeof (struct acr122_pcsc_data));
|
pnd->driver_data = malloc (sizeof (struct acr122_pcsc_data));
|
||||||
|
|
||||||
// Alloc and init chip's data
|
// Alloc and init chip's data
|
||||||
|
|
Loading…
Add table
Reference in a new issue