示例#1
0
static int32_t stapi_getstatus(struct s_reader *reader, int32_t *in) {
    return STReader_GetStatus(reader->stsmart_handle, in);
}
示例#2
0
int32_t ICC_Async_GetStatus (struct s_reader *reader, int32_t * card)
{
	int32_t in=0;

	if (reader->crdr.active==1 && reader->crdr.get_status) {
		call(reader->crdr.get_status(reader, &in));

		if (in)
			*card = TRUE;
		else
			*card = FALSE;

		return OK;
	}

	switch(reader->typ) {
		case R_DB2COM1:
		case R_DB2COM2:
#if defined(TUXBOX) && defined(PPC)
			{
			uint16_t msr=1;
			IO_Serial_Ioctl_Lock(reader, 1);
			ioctl(reader->fdmc, GET_PCDAT, &msr);
			if (reader->typ == R_DB2COM2)
				in=(!(msr & 1));
			else
				in=((msr & 0x0f00) == 0x0f00);
			IO_Serial_Ioctl_Lock(reader, 0);
			}
			break;
#endif
		case R_SC8in1:
			cs_writelock(&sc8in1_lock);
			call (Sc8in1_GetStatus(reader, &in));
			cs_writeunlock(&sc8in1_lock);
			break;
		case R_MP35:
		case R_MOUSE:
			call (Phoenix_GetStatus(reader, &in));
			break;
#if defined(LIBUSB)
		case R_SMART:
			call (SR_GetStatus(reader, &in));
			break;
#endif
		case R_INTERNAL:
#if defined(SCI_DEV)
			call (Sci_GetStatus(reader, &in));
#elif defined(COOL)
			call (Cool_GetStatus(&in));
#elif defined(WITH_STAPI)
			call (STReader_GetStatus(reader->stsmart_handle, &in));
#elif defined(AZBOX)
			call(Azbox_GetStatus(reader, &in));
#endif
			break;
#ifdef HAVE_PCSC
		case R_PCSC:
			in =  pcsc_check_card_inserted(reader);
			break;
#endif
		default:
			cs_log("ERROR ICC_Get_Status: unknow reader type %i",reader->typ);
			return ERROR;
	}

  if (in)
		*card = TRUE;
	else
		*card = FALSE;

	return OK;
}