Merge changes from https://github.com/santigimeno/node-pcsclite
Close #7
This commit is contained in:
@@ -114,7 +114,10 @@ CardReader.prototype.connect = function (options, cb) {
|
||||
|
||||
options = options || {};
|
||||
options.share_mode = options.share_mode || this.SCARD_SHARE_EXCLUSIVE;
|
||||
options.protocol = options.protocol || this.SCARD_PROTOCOL_T0 | this.SCARD_PROTOCOL_T1;
|
||||
|
||||
if (typeof options.protocol === 'undefined' || options.protocol === null) {
|
||||
options.protocol = this.SCARD_PROTOCOL_T0 | this.SCARD_PROTOCOL_T1;
|
||||
}
|
||||
|
||||
if (!this.connected) {
|
||||
this._connect(options.share_mode, options.protocol, cb);
|
||||
@@ -171,6 +174,18 @@ CardReader.prototype.control = function (data, control_code, res_len, cb) {
|
||||
|
||||
};
|
||||
|
||||
CardReader.prototype.SCARD_CTL_CODE = function (code) {
|
||||
|
||||
const isWin = /^win/.test(process.platform);
|
||||
|
||||
if (isWin) {
|
||||
return (0x31 << 16 | (code) << 2);
|
||||
} else {
|
||||
return 0x42000000 + (code);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// extend prototype
|
||||
function inherits(target, source) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user