nfc-pcsc: Control Error in LED Example
Hey @pokusew,
Thanks for this great package!
I am getting this error when trying to run the led.js example on macOS 10.12.4:
*[master][~/Desktop/nfc-pcsc]$ node -r babel-register examples/led.js
New reader detected ACS ACR122U
12:38:01 AM info ACS ACR122U device attached
Setting AID to F222222222
AID parsed [ 242, 34, 34, 34, 34 ]
trying to connect CONNECT_MODE_DIRECT 3
status { state: 18, atr: <Buffer > }
changes 18
card removed
connected { type: 3, protocol: 3 }
<Buffer ff 00 52 00 00>
transmitting control <Buffer ff 00 52 00 00> 2
{ ControlError: An error occurred while transmitting control.
at reader.control (/Users/risean/Desktop/nfc-pcsc/src/Reader.js:327:20)
at /Users/risean/Desktop/nfc-pcsc/node_modules/@pokusew/pcsclite/lib/pcsclite.js:169:11
name: 'ControlError',
code: 'failure',
previous:
Error: SCardControl error: Transaction failed.(0x80100016)
at Error (native) }
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 27 (2 by maintainers)
For me, the control commands do not work at all and a quick fix seems to be sending everything as a transmit command. Then, the LED and buzzer control works at least while a card is present.
UPDATE The final fix on Windows was to change the following in the node module, file
Reader.js
:to
And in pcsclite change in
cardreader.h
#define IOCTL_CCID_ESCAPE (0x42000000 + 3500)
to#define IOCTL_CCID_ESCAPE (0x003136B0)
and runyarn
to rebuild.Maybe they released a new hardware version and by that the escape command changed?!
@pokusew Any docs for how to do this on linux? Debby based.
Edit: Editing the file should work
Making the change as per above then
Should do it š
Any update on windows 10? Iām getting:
any help on how to enable this on win 10 x64?
Pasting this from the forum that I found this issue attached to. In case anyoneās still trying to figure out how to do it on OSX.
It took Apple completely dropping the ball with Sonoma in terms of smart card reader support for the solution to this problem to come to light. In turns out, there is a way to completely ignore the CCID driver that comes with OSX and just install you own. Not sure why I never thought about doing that until I was forced to do it. Here are the steps I took to achieve this:
Make sure you have installed both libusb and pkg-config from brew.
Assuming youāve followed along correctly and everything ran without issues, you should now have a new CCID driver installed in /usr/local/libexec/SmartCardServices/drivers/ifd-ccid.bundle. If you open the bundle, you can find the same Info.plist but this one is editable.
Once you have made all your changes, in order for this driver to take effect you have to reboot the system.
Hi, Any progress connecting directly on Win 10?
{ ControlError: An error occurred while transmitting control. at reader.control (C:\Users\Irakli.Tabagari\Desktop\fitness_backend_Geo\node _modules\nfc-pcsc\dist\Reader.js:260:25) at C:\Users\Irakli.Tabagari\Desktop\fitness_backend_Geo\node_modules@pokuse w\pcsclite\lib\pcsclite.js:170:11 name: āControlErrorā, code: āfailureā, previous: Error: SCardControl error: Incorrect function. (0x00000001) }
@mich356c I am having the same issue with an ACR1222L. I tried your solution but it didnāt work. Did you manage to find a solution?
I figured out where to add the DWORD values, but Iām still unable to connect in direct mode. If anyone stumbles upon this and is able to figure it out, please let me know! Hereās how to figure out where to add your values:
Properties
and go toDetails
Device Instance Path
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum
+ the path you got from step 4 as described in http://tech.springcard.com/2013/scardcontrol-linux-and-java/ at āWorking with MSā CCID driverāThe error I get is:
Obviously changing port means you have to re-add the values for that entry.
Iām pretty confident this is the right place, but for some reason it just isnāt working š
Hi @therealri,
I think that it caused by the special feature of standard PCSC drivers (in all OSs).
By default standard system PCSC driver doesnāt allow to send any commands in direct mode (i.e. without any card present). You can still send LED control commands when a card is present but it is quite useless.
To allow sending control (i.e. escape) commands in direct mode, you have to set a special value in registry (when you are on Windows) or in Info.plist of driver (on macOS and Linux). Here is an article to this problematic, but it is quite old.
I was dealing with this problem too (I am also on macOS and btw using ACR122U too š). So, I figured out the instructions how to enable this feature in macOS (OS X):
You have to set the value of
ifdDriverOptions
to0x0001
(the default value is 0x0000 which disables control commands).Unfortunately, this file is protected by System Integrity Protection (csrutil), so before editing you have to temporary disable it.
So step by step:
csrutil disable
/usr/libexec/SmartCardServices/drivers/ifd-ccid.bundle/Contents/Info.plist
(Finder -> Go To Folder or Command-Shift-G)ifdDriverOptions
to0x0001
and save the changes (now after rebooting the example and other control commands should work as expected)csrutil enable
)Let me know if you have any problems.
Hope it helps.