Commit Graph

35 Commits

Author SHA1 Message Date
petrzjunior
acb4e8527a Fix compiler warnings 2020-01-25 16:56:49 +01:00
Petr Zahradnik
f300d5e0a6 Provide AsyncResource 2020-01-25 16:56:49 +01:00
Petr Zahradnik
0f3ff2c20a Use Nan::Set in all places 2020-01-25 16:55:15 +01:00
Petr Zahradnik
9cc61350a0 Use Nan wrapper for type conversion 2020-01-25 16:26:26 +01:00
jimmythesaint82
2ccd6e1693 Node 12 fixes 2019-06-21 01:32:31 +02:00
Martin Endler
4b32290bae Merge branch master of https://github.com/santigimeno/node-pcsclite 2017-09-04 19:17:14 +02:00
Santiago Gimeno
a5a02f8e82 src: fix -Wsign-compare warning on OS X
By casting `SCARD_E_INSUFFICIENT_BUFFER` to `LONG`.
2017-03-01 22:38:01 +01:00
Vojtěch Štěpančík
9f871e9096 If the SCardSvr service is disabled on startup, set it's start type to automatic 2017-02-19 14:46:39 +01:00
Martin Endler
8f2ba026cf Merge branch 'master' of git://github.com/santigimeno/node-pcsclite into master
# Conflicts:
#	package.json
2017-01-26 19:16:06 +01:00
Martin Endler
11f939ff32 Allow keep trying if SCard service is unavailable 2017-01-26 19:10:48 +01:00
Santiago Gimeno
c311ea038c pcsclite: return SCardGetStatusChange errors
So it's possible to know when and why pcsc stops watching for events.
2016-11-24 15:02:57 +01:00
Santiago Gimeno
455afb1134 src: fix readers_name memory deletion
- After implementing SCARD_AUTOALLOCATE functionality for getting card
  readers name, the deletion of the allocated memory in
  `PCSCLite:: HandleReaderStatusChange` was not correctly migrated and
  was causing serious issues in `Windows`.

- See: https://github.com/santigimeno/node-pcsclite/issues/45.
2016-01-22 10:16:34 +01:00
Santiago Gimeno
b63f33c7a0 src: improve get_card_readers logic
- Use SCARD_AUTOALLOCATE if available. It avoids one extra call to
  SCardListReaders.
- If it's not available handle SCARD_E_INSUFFICIENT_BUFFER error by
  retrying get_card_readers.
2015-12-30 11:10:21 +01:00
Santiago Gimeno
0bcf3d8436 src: multiple thread synchronization improvements
- Allow up to 4 the number of times SCardCancel is called before waiting for
  the status `thread` to finish.
- Destroy the mutexes and conds only in the destructors.
- Check that the thread handles are still valid before calling join on them.
2015-12-22 14:59:03 +01:00
Florian Ramillien
06d31638e2 src: handle last event before exit status threads
- Avoid 2 consecutive calls to uv_async_send when exiting the cardreader.cpp
  check status thread.
- Fix mutex unlock location in cardreader.cpp check status thread.

PR-URL: https://github.com/santigimeno/node-pcsclite/pull/46
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2015-12-22 14:35:55 +01:00
Santiago Gimeno
4650a529f7 Revert "src: handle last event before exiting status threads"
This reverts commit 3800c39291.
2015-09-26 16:13:46 +02:00
Florian Ramillien
3800c39291 src: handle last event before exiting status threads
- Avoid 2 consecutive calls to uv_async_send when exiting the cardreader.cpp
  check status thread.
- Fix mutex unlock location in cardreader.cpp check status thread.

PR-URL: https://github.com/santigimeno/node-pcsclite/pull/46
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2015-09-26 14:46:45 +02:00
Santiago Gimeno
1ca9670420 src: fix sign-compare warnings in OSX
- Cast SCARD_E_TIMEOUT and SCARD_E_NO_READERS_AVAILABLE to LONG

PR-URL: https://github.com/santigimeno/node-pcsclite/pull/44
2015-09-18 07:02:43 +02:00
Santiago Gimeno
b373413669 src: fix double free crashes
- After upgrading to nan2 the buffers returned in some of the functions were
  being released because of Nan:NewBuffer. See:
  https://github.com/nodejs/nan/blob/master/doc/buffers.md#api_nan_new_buffer
2015-09-01 14:47:23 +02:00
Santiago Gimeno
37b557fe56 src: upgrade to nan@2.x.x
- To support nodejs/iojs@3.x.x
2015-08-12 12:07:51 +02:00
Fozi
399d837ae8 src: Windows compile fixes 2015-05-27 16:09:29 +02:00
Santiago Gimeno
1a3c7dec1c src: multiple Windows fixes
- Cross platform implementations of sleep and snprintf.
2015-05-27 16:09:29 +02:00
Santiago Gimeno
0c5e07e0e5 src: migrate pthreads to uv_threads
- So it can be compatible in every platform supported by libuv.
- Use attached threads instead of detached.
- Remove all CardReader 'status' listeners before emitting the
  'end' event.
2015-05-27 16:09:29 +02:00
Santiago Gimeno
86083a3ad0 src: LONG should be converted to v8::Number 2015-01-16 16:21:38 +01:00
Santiago Gimeno
b2513ff119 src: add unistd.h to fix sleep compilation error
- Fix a couple of warnings.
2014-11-06 10:58:24 +01:00
Santiago Gimeno
c5602733a4 src: fix PCSCLite.close() for OS X 2014-09-26 13:14:51 +02:00
Santiago Gimeno
5b10f8519c src: fix for OSs not supporting PnP Notification
- Instead of waiting for the notification, it will poll every second for a new
  card reader.
- Thanks to Ludovic Rousseau for the help. See:
  https://github.com/santigimeno/node-pcsclite/issues/14
2014-09-23 18:35:58 +02:00
Santiago Gimeno
f85250beb0 src: add error_msg to create pretty pcsc errors 2014-09-23 18:31:58 +02:00
Santiago Gimeno
ec0b79562c src: establish context on PCSCLite constructor
- Remove SCardEstablishContext from get_card_readers.
- Initialize m_status_thread to NULL so calling PCSCLite destructor does not
  crash in case the thread has not been launched. For example when
  SCardEstablish context fails
- Thanks to Ludovic Rousseau for pointing that out @
  https://github.com/santigimeno/node-pcsclite/pull/15#issuecomment-56222251.
2014-09-23 18:31:15 +02:00
Santiago Gimeno
44a89dbbf6 src: fix OS X compilation issues 2014-09-11 07:32:20 -07:00
Santiago Gimeno
26faed6dec src: refactor to use nan
- Now it supports latest 0.8.x, 0.10.x and 0.11.x
2014-08-05 10:10:00 +02:00
Santiago Gimeno
cd01cd4788 src: remove fprintf's 2014-07-28 13:36:02 +02:00
Santiago Gimeno
040f91c7b9 Change SCARD_READERSTATE initialization
- To remove some compiler warnings
2013-10-15 17:31:01 +02:00
Santiago Gimeno
1844bf1f3a Initialize SCARD_READERSTATE
- Not doing so was leading to random memory corruption errors.
2013-08-08 13:45:05 +02:00
Santiago Gimeno
b40f9a2f88 Initial Implementation 2013-06-20 16:37:28 +02:00