nfc-tools / libnfc

Platform independent Near Field Communication (NFC) library
http://nfc-tools.org
GNU Lesser General Public License v3.0
1.72k stars 442 forks source link

nfc_open failed to open device after running nfc-dep-initiator example #515

Open Ahmed-Elias opened 6 years ago

Ahmed-Elias commented 6 years ago

Hello,

I am using PN533 device to run the nfc-dep-initiator sample but once it finishes I am unable to open the device again until replugging the device.

I receive this error when I call nfc-list "error libnfc.driver.pn53x_usb Unable to set USB configuration (Broken pipe)" I am using libnfc version 1.7.1

Best regards, Ahmed

TanukiSharp commented 5 years ago

Hi @Ahmed-Elias.

Not sure if you are still interested, but I got a similar problem, and solved it by commenting the following line: https://github.com/nfc-tools/libnfc/blob/master/libnfc/chips/pn53x.c#L131

Actually with a Sony reader (Felica) for some reason setting a parameter here fails, but it seems to not cause any problem if the error is ignored. I simply log it but do not return.

I will open/update an issue for that.

Ahmed-Elias commented 5 years ago

Hello Sebastien,

Thanks for your reply. I will try your solution and feedback you although I have found another solution that is working fine be me now. after debugging I found the usb_set_configuration method in pnx53x_usb.c file always fails after the first connection, I tried first to search if there is a resource that is not closed correctly but I didn't found so I just now comment the error handling and it is working fine.

I will try to update if I find a better solution I working deeply on the library these days.

Best Regards, Ahmed

On Sat, Jun 1, 2019 at 4:46 PM Sebastien ROBERT notifications@github.com wrote:

Hi @Ahmed-Elias https://github.com/Ahmed-Elias.

Not sure if you are still interested, but I got a similar problem, and solved it by commenting the following line: https://github.com/nfc-tools/libnfc/blob/master/libnfc/chips/pn53x.c#L131

Actually with a Sony reader (Felica) for some reason setting a parameter here fails, but it seems to not cause any problem if the error is ignored. I simply log it but do not return.

I will open/update an issue for that.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/nfc-tools/libnfc/issues/515?email_source=notifications&email_token=AKV3LIQ5GMZMQPGPBJEYOALPYKDWFA5CNFSM4GCB2NIKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWXCACY#issuecomment-497950731, or mute the thread https://github.com/notifications/unsubscribe-auth/AKV3LIWZH77K2YFNYUJO6RDPYKDWFANCNFSM4GCB2NIA .