santigimeno / node-pcsclite

Bindings over pcsclite to access Smart Cards
ISC License
170 stars 127 forks source link

Default protocol assignment fix #100

Closed cyrstron closed 5 months ago

cyrstron commented 9 months ago

When connect function is called without explicit protocol CardReader seems to work unstable.

Correct me if I'm wrong, but it looks like there should be logical OR, instead of binary OR.

martinpaljak commented 9 months ago

It is a bitfield, logical or would give you a boolean result.

https://pcsclite.apdu.fr/api/group__API.html#ga4e515829752e0a8dbc4d630696a8d6a5

martinpaljak commented 9 months ago

So this PR is wrong. Which reader and which card cause the instability, and on which platform?

cyrstron commented 9 months ago

Oh, I see, so it is a bit mask.

So I launched the lib on MacOS Sonoma (14.0 23A344) and used with two types of card readers: SCR3310 and IOGEAR GSR205. And I used Common Access Card.

When I do not set a protocol and insert a card, it works maybe 1 out of 10 times. And I get SCARD_W_RESET_CARD error almost all the times.

I was thinking to blame the devices (they are used pretty often for testing purposes), but when I specified a protocol, it worked all the time without any issues. So my initial thought was that there might be a typo with default assignment.