Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with card reader previously attached #89

Open
elia9090 opened this issue Jul 12, 2019 · 3 comments
Open

Issue with card reader previously attached #89

elia9090 opened this issue Jul 12, 2019 · 3 comments

Comments

@elia9090
Copy link

Hi,
first of all, thanks for your library.
I'm using your library on an Electron app with an ACR122U card reader and Mirafare Classic tags.
Everything works perfectly but if the app starts and the reader is already attached to the PC it does not register it.

I tried to use the usb-detection library and the device is correctly shown.

Can you help me?

@mathiscode
Copy link

+1; I'm not using Electron, but I have a similar issue. I have to physically disconnect/reconnect the reader before the nfc.on('reader') listener gets fired.

@mlongo4290
Copy link

+1; Same issue here. I'm on an electron app.

@mlongo4290
Copy link

mlongo4290 commented Feb 6, 2020

I've found out!!
doing new NFC() right after the require lead to our issue. So instead of doing this

const { NFC } = require('nfc-pcsc');
const nfc = new NFC(); //THIS LEAD TO OUR ERROR
//other code
app.on('ready', function() {
    //your code
    nfc.on('reader', reader => {//handle reader});
})

We must do this

const { NFC } = require('nfc-pcsc');
//other code
app.on('ready', function() {
    //your code
    const nfc = new NFC(); //THIS HANDLES ALREADY CONNECTED READER IN THE RIGHT WAY
    nfc.on('reader', reader => {//handle reader});
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants