changeset 26:4bd6275d7c79

fc-pcsc-atr trivial program added
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 12 Feb 2021 15:53:12 +0000
parents 9f28700301a6
children be946be3f9a7
files .hgignore misc/Makefile misc/fc-pcsc-atr.c
diffstat 3 files changed, 40 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/.hgignore	Fri Feb 12 05:26:33 2021 +0000
+++ b/.hgignore	Fri Feb 12 15:53:12 2021 +0000
@@ -2,6 +2,8 @@
 
 \.[oa]$
 
+^misc/fc-pcsc-atr$
+
 ^simtool/fc-simtool$
 
 ^uicc/fc-uicc-tool$
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/Makefile	Fri Feb 12 15:53:12 2021 +0000
@@ -0,0 +1,17 @@
+CC=	gcc
+CFLAGS=	-O2 -I/usr/include/PCSC -I../libcommon
+PROGS=	fc-pcsc-atr
+LIBS=	../libcommon/libcommon.a
+INSTBIN=/opt/freecalypso/bin
+
+all:	${PROGS}
+
+fc-pcsc-atr:	fc-pcsc-atr.o ${LIBS}
+	${CC} ${CFLAGS} -o $@ $@.o ${LIBS} -lpcsclite
+
+install:
+	mkdir -p ${INSTBIN}
+	install -c ${PROGS} ${INSTBIN}
+
+clean:
+	rm -f ${PROGS} *.o
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/fc-pcsc-atr.c	Fri Feb 12 15:53:12 2021 +0000
@@ -0,0 +1,21 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <pcsclite.h>
+#include <winscard.h>
+#include "cardif.h"
+
+main(argc, argv)
+	char **argv;
+{
+	int rc;
+
+	setup_pcsc_context();
+	get_reader_name();
+	printf("Card reader name: %s\n", reader_name_buf);
+	connect_to_card();
+	rc = retrieve_atr();
+	if (rc)
+		error_exit();
+	else
+		good_exit();
+}