diff options
| author | Harald Welte <laforge@gnumonks.org> | 2013-03-04 17:52:33 +0000 | 
|---|---|---|
| committer | Harald Welte <laforge@gnumonks.org> | 2014-10-26 19:09:23 +0100 | 
| commit | d83d29610a7c63a387fee77dbc2b18b19dc83b14 (patch) | |
| tree | d0f3f4e7cefcc7ebcdcaa5620155e79f82ccd891 /src/sim | |
| parent | 7674960ffadd5d7cb1a58ecee77252fe19e1e86f (diff) | |
sim: further updates/fixes
Diffstat (limited to 'src/sim')
| -rw-r--r-- | src/sim/core.c | 11 | ||||
| -rw-r--r-- | src/sim/reader.c | 5 | ||||
| -rw-r--r-- | src/sim/reader_pcsc.c | 1 | ||||
| -rw-r--r-- | src/sim/sim_int.h | 2 | 
4 files changed, 16 insertions, 3 deletions
diff --git a/src/sim/core.c b/src/sim/core.c index bf682777..d1d4de73 100644 --- a/src/sim/core.c +++ b/src/sim/core.c @@ -279,3 +279,14 @@ const struct osim_card_sw *osim_find_sw(const struct osim_card_profile *cp,  	}  	return NULL;  } + +enum osim_card_sw_class osim_sw_class(const struct osim_card_profile *cp, +				      uint16_t sw_in) +{ +	const struct osim_card_sw *csw = osim_find_sw(cp, sw_in); + +	if (!csw) +		return SW_CLS_NONE; + +	return csw->class; +} diff --git a/src/sim/reader.c b/src/sim/reader.c index 71d10d14..4f72dd0f 100644 --- a/src/sim/reader.c +++ b/src/sim/reader.c @@ -166,6 +166,7 @@ case_2s:  			goto transceive_again;  			break;  		case 0x61: /* Case 4S.3: command accepted with info added */ +		case 0x9F: /* FIXME: This is specific to SIM cards */  			tpduh->ins = 0xC0;  			tpduh->p1 = tpduh->p2 = 0;  			tpduh->p3 = OSMO_MIN(msgb_apdu_le(amsg), sw & 0xff); @@ -230,13 +231,13 @@ int osim_transceive_apdu(struct osim_chan_hdl *st, struct msgb *amsg) -struct osim_reader_hdl *osim_reader_open(int idx, const char *name) +struct osim_reader_hdl *osim_reader_open(int idx, const char *name, void *ctx)  {  	/* FIXME: support multiple drivers */  	const struct osim_reader_ops *ops = &pcsc_reader_ops;  	struct osim_reader_hdl *rh; -	rh = ops->reader_open(idx, name); +	rh = ops->reader_open(idx, name, ctx);  	if (!rh)  		return NULL;  	rh->ops = ops; diff --git a/src/sim/reader_pcsc.c b/src/sim/reader_pcsc.c index 60a9dee1..b490b97f 100644 --- a/src/sim/reader_pcsc.c +++ b/src/sim/reader_pcsc.c @@ -70,6 +70,7 @@ static struct osim_reader_hdl *pcsc_reader_open(int num, const char *id, void *c  	rc = SCardEstablishContext(SCARD_SCOPE_SYSTEM, NULL, NULL,  				   &st->hContext); +	PCSC_ERROR(rc, "SCardEstablishContext");  	if (rc != SCARD_S_SUCCESS)  		goto end; diff --git a/src/sim/sim_int.h b/src/sim/sim_int.h index 411c3225..73f144ca 100644 --- a/src/sim/sim_int.h +++ b/src/sim/sim_int.h @@ -28,7 +28,7 @@ add_adf_with_ef(struct osim_file_desc *parent,  struct osim_reader_ops {  	const char *name; -	struct osim_reader_hdl *(*reader_open)(int idx, const char *name); +	struct osim_reader_hdl *(*reader_open)(int idx, const char *name, void *ctx);  	struct osim_card_hdl *(*card_open)(struct osim_reader_hdl *rh);  	int (*transceive)(struct osim_reader_hdl *rh, struct msgb *msg);  };  | 
