X-Git-Url: https://git.realraum.at/?p=svn42.git;a=blobdiff_plain;f=mifare-read%2Fmifare-read.c;fp=mifare-read%2Fmifare-read.c;h=0000000000000000000000000000000000000000;hp=0acf1bbb69a2c0a183dc27d96be8195092441e91;hb=ce52b2a412383c7958cbd6f0dc8251fbf28b3c08;hpb=4ee2501ff864b8e15202ee814e8bafcc0c2adf6c diff --git a/mifare-read/mifare-read.c b/mifare-read/mifare-read.c deleted file mode 100644 index 0acf1bb..0000000 --- a/mifare-read/mifare-read.c +++ /dev/null @@ -1,93 +0,0 @@ -/* mifare-tool - a small command-line tool for librfid mifare testing - * - * (C) 2006 by Harald Welte - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 - * as published by the Free Software Foundation - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -struct rfid_reader_handle *rh = NULL; -struct rfid_layer2_handle *l2h = NULL; - -void sigHandler(int sig) -{ - printf("sig handler called\n"); - -/* rfid_layer2_close(l2h); */ -/* rfid_layer2_fini(l2h); */ - - rfid_reader_close(rh); - exit(0); -} - -int l2_init(int layer2) -{ - int rc; - - l2h = rfid_layer2_init(rh, layer2); - if (!l2h) { - fprintf(stderr, "error during layer2(%d)_init (0=14a,1=14b,3=15)\n",layer2); - return -1; - } - - rc = rfid_layer2_open(l2h); - if (rc < 0) { -// fprintf(stderr, "error during layer2_open\n"); - rfid_layer2_fini(l2h); - return rc; - } - - return 0; -} - -int main(int argc, char **argv) -{ - unsigned int uid, uid_len; - - rfid_init(); - rh = rfid_reader_open(NULL, RFID_READER_OPENPCD); - if (!rh) { - fprintf(stderr, "No OpenPCD found\n"); - exit(1); - } - - (void) signal(SIGHUP, sigHandler); - (void) signal(SIGINT, sigHandler); - (void) signal(SIGTERM, sigHandler); - - while(l2_init(RFID_LAYER2_ISO14443A) < 0); - - uid_len = sizeof(uid); - uid = 0; - if(rfid_layer2_getopt(l2h, RFID_OPT_LAYER2_UID, &uid, &uid_len) >= 0) - printf("UID=%08X\n",uid); - fflush(stdout); - -/* rfid_layer2_close(l2h); */ -/* rfid_layer2_fini(l2h); */ - - rfid_reader_close(rh); - exit(0); -} -