FreeCalypso > hg > fc-sim-tools
view simtool/sstlist.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 | ddd767f6e15b |
children |
line wrap: on
line source
/* * This module implements the sst command, listing the SIM Service Table * in a human-readable, yet very compact form: just a list of activated * (or allocated but not activated, specially marked) service numbers. */ #include <sys/types.h> #include <stdio.h> #include "simresp.h" #include "curfile.h" #include "file_id.h" cmd_sst(argc, argv, outf) char **argv; FILE *outf; { int rc; unsigned byte, pos, code, nserv, linelen; rc = select_op(DF_GSM); if (rc < 0) return(rc); rc = select_op(EF_SST); if (rc < 0) return(rc); rc = parse_ef_select_response(); if (rc < 0) return(rc); if (curfile_structure != 0x00) { fprintf(stderr, "error: EF_SST is not transparent\n"); return(-1); } if (curfile_total_size < 2) { fprintf(stderr, "error: EF_SST is shorter than spec minimum of 2 bytes\n"); return(-1); } if (curfile_total_size > 256) { fprintf(stderr, "error: EF_SST is longer than our 256 byte limit\n"); return(-1); } rc = readbin_op(0, curfile_total_size); if (rc < 0) return(rc); linelen = 0; for (byte = 0, nserv = 1; byte < curfile_total_size; byte++) { for (pos = 0; pos < 8; pos += 2, nserv++) { code = (sim_resp_data[byte] >> pos) & 3; if (!(code & 1)) continue; if (linelen > 73) { putc('\n', outf); linelen = 0; } if (linelen) { putc(' ', outf); linelen++; } linelen += fprintf(outf, "%u", nserv); if (!(code & 2)) { putc('^', outf); linelen++; } } } if (linelen) putc('\n', outf); return(0); }