From 1a369f0fad0f2e008f6abb7a4b7a7844133c733b Mon Sep 17 00:00:00 2001 From: Samo Fortuna Date: Wed, 22 Feb 2017 12:20:53 +0100 Subject: [PATCH] cardreader: add SCARD_CTL_CODE js implementation --- lib/pcsclite.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/pcsclite.js b/lib/pcsclite.js index 09cc4ad..869105c 100644 --- a/lib/pcsclite.js +++ b/lib/pcsclite.js @@ -140,6 +140,15 @@ CardReader.prototype.control = function(data, control_code, res_len, cb) { }); }; +CardReader.prototype.SCARD_CTL_CODE = function(code) { + var isWin = /^win/.test(process.platform); + if (isWin) { + return (0x31 << 16 | (code) << 2); + } else { + return 0x42000000 + (code); + } +}; + // extend prototype function inherits(target, source) { for (var k in source.prototype) {