view simtool/main.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 3fe1954f5dec
children
line wrap: on
line source

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

extern char be_reader_name[];
extern char be_atr_string[];
extern char be_extra_info[];

main(argc, argv)
	char **argv;
{
	extern int optind;
	char command[512];
	int rc, batch_stdin;

	parse_global_options(argc, argv);
	launch_backend();
	collect_backend_init_strings();
	if (argc > optind) {
		rc = dispatch_ready_argv(argc - optind, argv + optind);
		if (rc)
			exit(1);
		else
			good_exit();
	}
	if (be_reader_name[0])
		printf("Card reader name: %s\n", be_reader_name);
	if (be_atr_string[0])
		printf("ATR: %s\n", be_atr_string);
	if (be_extra_info[0])
		puts(be_extra_info);
	batch_stdin = !isatty(0);
	for (;;) {
		if (!batch_stdin) {
			fputs("simtool> ", stdout);
			fflush(stdout);
		}
		if (!fgets(command, sizeof command, stdin))
			good_exit();
		if (batch_stdin)
			printf("Stdin command: %s", command);
		rc = simtool_dispatch_cmd(command, 0);
		if (batch_stdin && rc)
			exit(1);
	}
}