Пример #1
0
static int32_t Cool_Init (struct s_reader *reader)
{
	char *device = reader->device;
	int32_t reader_nb = 0;
	// this is to stay compatible with older config.
	if(strlen(device))
		reader_nb=atoi((const char *)device);
	if(reader_nb>1) {
		// there are only 2 readers in the coolstream : 0 or 1
		rdr_log(reader, "Coolstream reader device can only be 0 or 1");
		return 0;
	}
	if (!cs_malloc(&reader->spec_dev, sizeof(struct s_coolstream_reader)))
		return 0;
	if (cnxt_smc_open (&specdev()->handle, &reader_nb, NULL, NULL))
		return 0;

	int32_t ret = cnxt_smc_enable_flow_control(specdev()->handle, 1);
	coolapi_check_error("cnxt_smc_enable_flow_control", ret);

	specdev()->cardbuflen = 0;
	if (reader->cool_timeout_init > 0) {
		rdr_debug_mask(reader, D_DEVICE, "init timeout set to cool_timeout_init = %i", reader->cool_timeout_init);
		specdev()->read_write_transmit_timeout = reader->cool_timeout_init;
	} else {
		rdr_debug_mask(reader, D_DEVICE, "No init timeout specified - using value from ATR. If you encounter any problems while card init try to use the reader parameter cool_timeout_init = 500");
		specdev()->read_write_transmit_timeout = -1;
	}
	return OK;
}
Пример #2
0
static int32_t Cool_Init(struct s_reader *reader)
{
	char *device = reader->device;
	int32_t reader_nb = 0;
	// this is to stay compatible with older config.
	if(strlen(device))
		{ reader_nb = atoi((const char *)device); }
	if(reader_nb > 1)
	{
		// there are only 2 readers in the coolstream : 0 or 1
		rdr_log(reader, "Coolstream reader device can only be 0 or 1");
		return 0;
	}
	if(!cs_malloc(&reader->crdr_data, sizeof(struct cool_data)))
		{ return ERROR; }
	struct cool_data *crdr_data = reader->crdr_data;
	if(cnxt_smc_open(&crdr_data->handle, &reader_nb, NULL, NULL))
		{ return 0; }

	int32_t ret = cnxt_smc_enable_flow_control(crdr_data->handle, 0);
	coolapi_check_error("cnxt_smc_enable_flow_control", ret);

	crdr_data->cardbuflen = 0;
	crdr_data->pps = 0;
	return OK;
}
Пример #3
0
int32_t Cool_Init (struct s_reader *reader)
{
	char *device = reader->device;
	int32_t reader_nb = 0;
	// this is to stay compatible with older config.
	if(strlen(device))
		reader_nb=atoi((const char *)device);
	if(reader_nb>1) {
		// there are only 2 readers in the coolstream : 0 or 1
		cs_log("Coolstream reader device can only be 0 or 1");
		return FALSE;
	}
	reader->spec_dev=malloc(sizeof(struct s_coolstream_reader));
	if (cnxt_smc_open (&specdev()->handle, &reader_nb, NULL, NULL))
		return FALSE;

	int32_t ret = cnxt_smc_enable_flow_control(specdev()->handle);
	check_error("cnxt_smc_enable_flow_control", ret);

	specdev()->cardbuflen = 0;
	if (reader->cool_timeout_init > 0) {
		cs_debug_mask(D_DEVICE,"%s init timeout set to cool_timeout_init = %i", reader->label, reader->cool_timeout_init);
		specdev()->read_write_transmit_timeout = reader->cool_timeout_init;
	} else {
		cs_debug_mask(D_DEVICE,"No init timeout for reader %s specified - using default init timeout (%i). If you encounter any problems while card init try to use the reader parameter cool_timeout_init = 500", reader->label, READ_WRITE_TRANSMIT_TIMEOUT);
		specdev()->read_write_transmit_timeout = READ_WRITE_TRANSMIT_TIMEOUT;
	}
	return OK;
}
Пример #4
0
int32_t Cool_Init (char *device)
{
	cnxt_smc_init (NULL); //not sure whether this should be in coolapi_open_all
	int32_t reader_nb = 0;
	// this is to stay compatible with older config.
	if(strlen(device))
		reader_nb=atoi((const char *)device);
	if(reader_nb>1) {
		// there are only 2 readers in the coolstream : 0 or 1
		cs_log("Coolstream reader device can only be 0 or 1");
		return FALSE;
	}
	cur_client()->reader->spec_dev=malloc(sizeof(struct s_coolstream_reader));
	if (cnxt_smc_open (&specdev()->handle, &reader_nb))
		return FALSE;
	specdev()->cardbuflen = 0;
	return OK;
}