FreeCalypso > hg > fc-sim-tools
view libcommon/atr.c @ 99:97ba63d9361a
scripts/fcsim1-sst: turn off STK & OTA services
In the initial unprogrammed state of the cards from Grcard, SST has
services 25 through 29 set to allocated and activated. However,
these cards appear to not actually support OTA, ENVELOPE commands
do nothing (just return SW 9000), and they were never observed
issuing any proactive SIM commands, even after a feature-generous
TERMINAL PROFILE. Therefore, let's list these STK & OTA services
as allocated, but not activated in our FCSIM1 SST.
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Wed, 05 May 2021 04:26:07 +0000 |
parents | c9ef9e91dd8e |
children |
line wrap: on
line source
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <strings.h> extern FILE *cpipeF, *rpipeF; extern char be_atr_string[]; cmd_atr() { char inbuf[128], *cp; /* do we have it already? */ if (be_atr_string[0]) { printf("ATR: %s\n", be_atr_string); return(0); } /* nope - request it from the BE */ fputs("atr\n", cpipeF); fflush(cpipeF); /* collect BE response */ if (!fgets(inbuf, sizeof inbuf, rpipeF)) { fprintf(stderr, "comm error: EOF reading from back end\n"); return(-1); } cp = index(inbuf, '\n'); if (!cp) { fprintf(stderr, "comm error: response from back end has no newline\n"); return(-1); } *cp = '\0'; if (!inbuf[0]) { fprintf(stderr, "comm error: response from back end is an empty line\n"); return(-1); } puts(inbuf); return(0); }