Check-in [6218cc54fc]
Overview
SHA1:6218cc54fc39669fa039e2a42819102fa646054f
Date: 2016-02-16 17:04:58
User: rkeene
Comment:Added workaround for Google's PCSC where we cannot determine the amount of space required to hold the reader list automatically
Timelines: family | ancestors | descendants | both | trunk
Downloads: Tarball | ZIP archive
Other Links: files | file ages | folders | manifest
Tags And Properties
Context
2016-02-16
23:24
[fdd66a54cd] Simplified some slot disconnect logic and updated to store an ID type hint on the slot itself so that if we reinitialize we treat it as the same type of device (user: rkeene, tags: trunk)
17:04
[6218cc54fc] Added workaround for Google's PCSC where we cannot determine the amount of space required to hold the reader list automatically (user: rkeene, tags: trunk)
16:06
[54d3a148ef] Fixed an issue where the mutex released slightly too early (user: rkeene, tags: trunk)
Changes

Modified cackey.c from [3b58f20dd7] to [ebe379d38c].

4893
4894
4895
4896
4897
4898
4899







4900
4901
4902
4903
4904
4905
4906

			cackey_pcsc_disconnect();
			cackey_pcsc_connect();

			CACKEY_DEBUG_PRINTF("Trying SCardListReaders() again");
			scard_listreaders_ret = SCardListReaders(*cackey_pcsc_handle, NULL, NULL, &pcsc_readers_len);
		}








		if (scard_listreaders_ret == SCARD_S_SUCCESS && pcsc_readers_len != 0) {
			pcsc_readers = malloc(pcsc_readers_len);
			pcsc_readers_s = pcsc_readers;

			scard_listreaders_ret = SCardListReaders(*cackey_pcsc_handle, NULL, pcsc_readers, &pcsc_readers_len);
			if (scard_listreaders_ret == SCARD_S_SUCCESS) {







>
>
>
>
>
>
>







4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913

			cackey_pcsc_disconnect();
			cackey_pcsc_connect();

			CACKEY_DEBUG_PRINTF("Trying SCardListReaders() again");
			scard_listreaders_ret = SCardListReaders(*cackey_pcsc_handle, NULL, NULL, &pcsc_readers_len);
		}

		if (scard_listreaders_ret == SCARD_E_INSUFFICIENT_BUFFER) {
			CACKEY_DEBUG_PRINTF("Error. SCardListReaders() returned SCARD_E_INSUFFICIENT_BUFFER, assuming this is a bug (e.g., Google PCSC) and allocating a massive amount of space to hold the reader list.");

			pcsc_readers_len = 32768;
			scard_listreaders_ret = SCARD_S_SUCCESS;
		}

		if (scard_listreaders_ret == SCARD_S_SUCCESS && pcsc_readers_len != 0) {
			pcsc_readers = malloc(pcsc_readers_len);
			pcsc_readers_s = pcsc_readers;

			scard_listreaders_ret = SCardListReaders(*cackey_pcsc_handle, NULL, pcsc_readers, &pcsc_readers_len);
			if (scard_listreaders_ret == SCARD_S_SUCCESS) {