예제 #1
0
void cardreader_do_reset(struct s_reader *reader)
{
	reader_nullcard(reader);
	ATR atr;
	int32_t ret = 0;
	int16_t i = 0;
	int16_t j = 0;
	if (reader->typ == R_SMART && reader->smartdev_found >= 4) j = 1; else j = 1; // back to a single start

	for (i= 0; i < j; i++) {

		ret = ICC_Async_Reset(reader, &atr, reader_activate_card, reader_get_cardsystem);

		if(ret == -1)
			{ return; }

		if(ret == 0)
		{
			uint16_t y;
			uint16_t deprecated;
			if (reader->typ == R_SMART && reader->smartdev_found >= 4) y = 2; else y= 2;
//			rdr_log(reader, "the restart atempts in deprecated is %u", y);
			for(deprecated = reader->deprecated; deprecated < y; deprecated++)
			{
				if(!reader_activate_card(reader, &atr, deprecated)) { break; }
				ret = reader_get_cardsystem(reader, &atr);
				if(ret)
					{ break; }
				if(!deprecated)
					{ rdr_log(reader, "Normal mode failed, reverting to Deprecated Mode"); }
			}
		}
			if (ret){
				rdr_log(reader,"THIS WAS A SUCCESSFUL START ATTEMPT No  %u out of max alloted of %u", (i+1), j);
				break;
			}
			else {
				rdr_log(reader, "THIS WAS A FAILED START ATTEMPT No %u out of max alloted of %u", (i+1), j);
			}
	}
	if(!ret)
	{
		reader->card_status = CARD_FAILURE;
		rdr_log(reader, "card initializing error");
		ICC_Async_DisplayMsg(reader, "AER");
		led_status_card_activation_error();
	}
	else
	{
		cardreader_get_card_info(reader);
		reader->card_status = CARD_INSERTED;
		do_emm_from_file(reader);
		ICC_Async_DisplayMsg(reader, "AOK");
	}

	return;
}
예제 #2
0
void cardreader_do_reset(struct s_reader *reader)
{
  reader_nullcard(reader);
  ATR atr;
	int32_t ret = 0;

	ret = ICC_Async_Reset(reader, &atr, reader_activate_card, reader_get_cardsystem);

	if (ret == -1)
		return;

	if (ret == 0) {
		uint16_t deprecated;
		for (deprecated = reader->deprecated; deprecated < 2; deprecated++) {
			if (!reader_activate_card(reader, &atr, deprecated)) break;
			ret = reader_get_cardsystem(reader, &atr);
			if (ret)
				break;
			if (!deprecated)
				rdr_log(reader, "Normal mode failed, reverting to Deprecated Mode");
		}
	}

 if (!ret)
      {
        reader->card_status = CARD_FAILURE;
        rdr_log(reader, "card initializing error");
		ICC_Async_DisplayMsg(reader, "AER");
		led_status_card_activation_error();
      }
      else
      {
        cardreader_get_card_info(reader);
        reader->card_status = CARD_INSERTED;
        do_emm_from_file(reader);
		ICC_Async_DisplayMsg(reader, "AOK");
		ICC_Set_Transmit_Timeout(reader);
      }

	return;
}