libnfc icon indicating copy to clipboard operation
libnfc copied to clipboard

Less restrictive nfc_open for better support of Sony RC-S330

Open TanukiSharp opened this issue 6 years ago • 0 comments

This topic is very hard to title, since the question is a bit wide and precise at the same time.

I'm using a Sony RC-S330 device and I know it is not totally correctly supported because of lack of specs and schematics, however I have the same problem as this issue (https://github.com/nfc-tools/libnfc/issues/515) and it is not possible to make something decent if each time a card is dropped on the device, it is then required to unplug and re-plug the card reader.

I figured out that the function nfc_open fails because (below is a pseudo stack)

libnfc/nfc.c:240 -> nfc_open libnfc/nfc.c:269 -> pn53x_usb_open libnfc/drivers/pn53x_usb.c:499 -> pn53x_usb_init libnfc/drivers/pn53x_usb.c:757 -> pn53x_init libnfc/chips/pn53x.c:130 -> pn53x_SetParameters

The function pn53x_SetParameters fails, and so the pn53x_init at line 131 returns the error and thus the nfc_open process is interrupted. I tested by replacing the return by a log at line 131 and the nfc_open function now succeeds all the time, and at least calling nfc_initiator_poll_target after still works.

I'm not saying ignoring an error is good, first I would like to ask why calling pn53x_SetParameters is required since the comment suggest it's more a hack ? And is it really important if it fails or not ?

Thanks.

TanukiSharp avatar Jun 01 '19 15:06 TanukiSharp