Background:
------
I'm using LibNFC with a an ACR122U card reader. I am using it in Tag
Emulation mode and sending NDEF messages over it from a mobile phone. This
uses the ISO7816 card protocol to transfer NDEF files, according to NFC
Forum Type 4 Tag Operation Specification.
In the Capability Container, the Maximum C-APDU data size can be specified
which defines the maximum size of data transferred in a single ISO7816
UPDATE_BINARY command. The valid valid range is 0001h to FFFFh.
The actual UPDATE_BINARY command contains several fields: CLA, INS, P1, P2,
LC, DATA - all of these (except data) are one byte long in my case (as set
up in the Capability container).
The SCardControl call returns "lpBytesReturned" - which, in my case is the
length of the ISO7816 command (plus 4 bytes, I believe) - but, I hope
you'll agree, this should certainly be MORE than the LC field of the
command itself.
------
Problem:
While receiving small data, all works well. However when the mobile phone
tries to send the Maximum sized packet (as defined by the Capability
Container) I seem to hit a limit in lpBytesReturned of 249. The LC field
itself states the DATA field should be length 0xFF, so lpBytesReturned
should really be 255 + 5(for CLA, INS, P1...) (+ 4?).
------
Things I've checked:
-Changing maximum c-apdu data size
Changing the C-APDU Data size of 0xFE still causes the same error in my
application code, but I see that the received LC Field is 0xFE, so the
remote device is at least honouring this.
Changine the size to 0xEF is a work around that prevents me ever hitting
this 'upper limit'
-Params passed to SCardControl
The length of the response buffer (cbRecvLength) that is passed in to
SCardControl is 268
------
Things I have not checked:
I do not know whether a problem lies with the mobile device, debugging this
would be extremely difficult, although I have had a dig around. It could
simply not be sending enough data. I wonder if there is any way I am
misusing PC/SC or any way of debugging this side further or any chance this
is a bug (unlikely)?
------
Other information:
Output of /usr/sbin/pcscd --version :


  pcsc-lite version 1.8.6.


  Copyright (C) 1999-2002 by David Corcoran <[email protected]>.


  Copyright (C) 2001-2011 by Ludovic Rousseau <[email protected]>.


  Copyright (C) 2003-2004 by Damien Sauveron <[email protected]>.


  Report bugs to <[email protected]>.


  Enabled features: Linux i686-pc-linux-gnu serial usb libudev
usbdropdir=/usr/lib/pcsc/drivers ipcdir=/var/run/pcscd
configdir=/etc/reader.conf.d
Reported Reader by pcsc_scan:
  Reader 0: ACS ACR122U PICC Interface 00 00
The relevant call to SCardControl from LibNFC:
  if (SCardControl(DRIVER_DATA(pnd)->hCard,
IOCTL_CCID_ESCAPE_SCARD_CTL_CODE, abtTxBuf, szTxBuf,
DRIVER_DATA(pnd)->abtRx, ACR122_PCSC_RESPONSE_LEN, &dwRxLen) !=
SCARD_S_SUCCESS) {
      pnd->last_error = NFC_EIO;
      return pnd->last_error;
  }
------

Thanks in advance for any help. If you require any more information about
my set-up, please let me know along with instructions on how to get that
information.

Best,

Sam Duke
_______________________________________________
Muscle mailing list
[email protected]
http://lists.musclecard.com/mailman/listinfo/muscle_lists.musclecard.com

Reply via email to