Question

I'm trying to make a ACR1222L work with this ruby script that I found on github. The script is made for the older ACR122U, but in my research I've seen that they both should be pretty similar.

My problem is when trying to run the script, I get this error:

C:\Users\Emil\Desktop>driver.rb
Calibration Time!

Place and leave a tag on the device
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/smartcard-0.5.5/lib/smartcard/pcsc/conte
xt.rb:112:in `wait_for_status_change':  (0x100000006) (Smartcard::PCSC::Exception)
        from C:/Users/Emil/Desktop/driver.rb:24:in `<main>'

Could it be that the "smartcard" gem used by the script does not support the ACR1222L, or am I simply just missing something?

Hope that someone can help!

Was it helpful?

Solution

The Smartcard::PCSC::Exception error code you get (0x100000006) translates to the Windows API error code INVALID_HANDLE_EXCEPTION (0x00000006). This typically indicates that the context handle used in the API call is invalid. With the smartcard gem, the PS/SC context (SCardEstablishContext) is established through the initializer of Smartcard::PCSC::Context. This operation seems to be successful, otherwise you would get an exception on line 13. The source of the INVALID_HANDLE_EXCEPTION seems to be SCardGetStatusChange (invoked by context.wait_for_status_change).

A possible reason for that call to fail with an INVALID_HANDLE_EXCEPTION could be a mismatch in the handle format, for instance caused by a 32-bit/64-bit mismatch. Thus, I would assume that the smartcard gem is designed for 32-bit only (while your path indicates that you are using a 64-bit version of Ruby).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top