Ejemplo n.º 1
0
/*
 * Get/set parmaters for T1 protocol
 */
static int t1_set_param(ifd_protocol_t * prot, int type, long value)
{
	t1_state_t *t1 = (t1_state_t *) prot;

	switch (type) {
	case IFD_PROTOCOL_RECV_TIMEOUT:
		t1->timeout = value;
		break;
	case IFD_PROTOCOL_BLOCK_ORIENTED:
		t1->block_oriented = value;
		break;
	case IFD_PROTOCOL_T1_CHECKSUM_LRC:
	case IFD_PROTOCOL_T1_CHECKSUM_CRC:
		t1_set_checksum(t1, type);
		break;
	case IFD_PROTOCOL_T1_IFSC:
		t1->ifsc = value;
		break;
	case IFD_PROTOCOL_T1_IFSD:
		t1->ifsd = value;
		break;
	default:
		ct_error("Unsupported parameter %d", type);
		return -1;
	}

	return 0;
}
Ejemplo n.º 2
0
/*
 * Get/set parmaters for T1 protocol
 */
int t1_set_param(t1_state_t * t1, int type, long value)
{
	switch (type) {
	case IFD_PROTOCOL_T1_CHECKSUM_LRC:
	case IFD_PROTOCOL_T1_CHECKSUM_CRC:
		t1_set_checksum(t1, type);
		break;
	case IFD_PROTOCOL_T1_IFSC:
		t1->ifsc = value;
		break;
	case IFD_PROTOCOL_T1_IFSD:
		t1->ifsd = value;
		break;
	case IFD_PROTOCOL_T1_STATE:
		t1->state = value;
		break;
	case IFD_PROTOCOL_T1_MORE:
		t1->more = value;
		break;
	default:
		DEBUG_INFO2("Unsupported parameter %d", type);
		return -1;
	}

	return 0;
}
Ejemplo n.º 3
0
/*
 * Attach t1 protocol
 */
static int t1_init(ifd_protocol_t * prot)
{
	t1_state_t *t1 = (t1_state_t *) prot;

	t1_set_defaults(t1);
	t1_set_checksum(t1, IFD_PROTOCOL_T1_CHECKSUM_LRC);

	/* If the device is attached through USB etc, assume the
	 * device will do the framing for us */
	if (prot->reader->device->type != IFD_DEVICE_TYPE_SERIAL)
		t1->block_oriented = 1;
	return 0;
}