void sap_transfer_atr_req(void *sap_device)
{
	char atr[] = "ATR response!";

	DBG("status: %d", sim_card_conn_status);

	switch (sim_card_conn_status) {
	case SIM_MISSING:
		sap_transfer_atr_rsp(sap_device, SAP_RESULT_ERROR_CARD_REMOVED,
								NULL, 0);
		break;
	case SIM_POWERED_OFF:
		sap_transfer_atr_rsp(sap_device, SAP_RESULT_ERROR_POWERED_OFF,
								NULL, 0);
		break;
	case SIM_DISCONNECTED:
		sap_transfer_atr_rsp(sap_device, SAP_RESULT_ERROR_NO_REASON,
								NULL, 0);
		break;
	case SIM_CONNECTED:
		sap_transfer_atr_rsp(sap_device, SAP_RESULT_OK,
						(uint8_t *)atr, sizeof(atr));
		break;
	}
}
Example #2
0
void sap_transfer_atr_req(void *sap_device)
{
    uint8_t result;

    DBG("sap_device %p", sap_device);

    if (u8500.state != STE_ENABLED) {
        result = get_sap_result(STE_GET_ATR_MSG, STE_STATUS_FAILURE);
        sap_transfer_atr_rsp(sap_device, result, NULL, 0);
        return;
    }

    if (send_request(u8500.io, STE_GET_ATR_REQ, NULL) < 0)
        sap_transfer_atr_rsp(sap_device, SAP_RESULT_ERROR_NO_DATA, NULL,
                             0);
}
Example #3
0
void sap_transfer_atr_req(void *sap_device)
{
	char atr[] = "ATR response!";

	DBG("status: %d", sim_card_conn_status);

	if (sim_card_conn_status == SIM_MISSING)
		sap_transfer_atr_rsp(sap_device, SAP_RESULT_ERROR_CARD_REMOVED,
								NULL, 0);
	else if (sim_card_conn_status == SIM_POWERED_OFF)
		sap_transfer_atr_rsp(sap_device, SAP_RESULT_ERROR_POWERED_OFF,
								NULL, 0);
	else if (sim_card_conn_status != SIM_CONNECTED)
		sap_transfer_atr_rsp(sap_device, SAP_RESULT_ERROR_NO_REASON,
								NULL, 0);
	else
		sap_transfer_atr_rsp(sap_device, SAP_RESULT_OK,
						(uint8_t *)&atr, sizeof(atr));
}