Closed flakjacket95 closed 6 years ago
Can you post the sample code please?
Yes, very simple really.
cmd = < Buffer 00 cb 3f ff 05 5c 03 5f c1 02 00>
and
cmd = < Buffer 00 c0 00 00 00>
My transmit code is as follows:
this.device.transmit(cmd, 0xFF, protocol, (err, response) => {
....
}
I think I've figured out what causes the issue. And that is that my interpretation of the 0xFF
above was just including the response information and not the status code (sw1 and sw2). So, therefore, when 0xFF bytes of data are returned, the status code 6100
or whatever, actually makes the number of returned bytes 0x102. Hence, my issue can be resolved by increasing that number to 0x102
I'll close this issue now, as I think this is more an interpretation issue on my part but, perhaps a note in the docs could be helpful here, if anyone has this issue in the future.
This issue arrises, in my case, when requesting a file greater than 256 bytes in size. I have executed a GET_DATA command, and the response sent back from the card is
6100
From my understanding,
6100
does not mean 0 bytes left to read, as your library seems to interpret it as. Instead, it means there are more than 256 bytes left, just read a full 256.An example exchange would be as follows:
Instead, your program sends the proper request but, appears to improperly setup the buffer, as I receive the following error:
Error: SCardTransmit error: Insufficient buffer.(0x80100008)