bla
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
LIBVERSION= 0:0:0
|
||||
|
||||
noinst_HEADERS = openpcd.h
|
||||
noinst_DATA = openpcd.dll
|
||||
|
||||
INCLUDES = -I$(top_srcdir)/include
|
||||
LIBRFID_DIR = $(top_builddir)/src/.libs/
|
||||
CLEANFILES = $(noinst_DATA)
|
||||
|
||||
.c.o:
|
||||
$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@
|
||||
|
||||
.o.dll:
|
||||
$(CC) -mno-cygwin --add-stdcall-alias -shared -o $@ -L$(LIBRFID_DIR) $< -lrfid -lwinmm -Wl,-no-undefined -Wl,--entry,__cygwin_noncygwin_dll_entry@12
|
||||
$(STRIP) --strip-unneeded $@
|
||||
@@ -0,0 +1,427 @@
|
||||
# Makefile.in generated by automake 1.11 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
|
||||
# Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
|
||||
VPATH = @srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
target_triplet = @target@
|
||||
subdir = win32
|
||||
DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
|
||||
$(srcdir)/Makefile.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.in
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
SOURCES =
|
||||
DIST_SOURCES =
|
||||
DATA = $(noinst_DATA)
|
||||
HEADERS = $(noinst_HEADERS)
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
AR = @AR@
|
||||
AS = @AS@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
BUILDENV = @BUILDENV@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
FGREP = @FGREP@
|
||||
FIRMWARE_PATH = @FIRMWARE_PATH@
|
||||
GREP = @GREP@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LD = @LD@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LIBTOOL_DEPS = @LIBTOOL_DEPS@
|
||||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
NM = @NM@
|
||||
NMEDIT = @NMEDIT@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
OPENCT_CFLAGS = @OPENCT_CFLAGS@
|
||||
OPENCT_LIBS = @OPENCT_LIBS@
|
||||
OTOOL = @OTOOL@
|
||||
OTOOL64 = @OTOOL64@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
RANLIB = @RANLIB@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target = @target@
|
||||
target_alias = @target_alias@
|
||||
target_cpu = @target_cpu@
|
||||
target_os = @target_os@
|
||||
target_vendor = @target_vendor@
|
||||
to_host_path_cmd = @to_host_path_cmd@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
LIBVERSION = 0:0:0
|
||||
noinst_HEADERS = openpcd.h
|
||||
noinst_DATA = openpcd.dll
|
||||
INCLUDES = -I$(top_srcdir)/include
|
||||
LIBRFID_DIR = $(top_builddir)/src/.libs/
|
||||
CLEANFILES = $(noinst_DATA)
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .dll .o
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
|
||||
&& { if test -f $@; then exit 0; else break; fi; }; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu win32/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu win32/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(am__aclocal_m4_deps):
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
mkid -fID $$unique
|
||||
tags: TAGS
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
set x; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
shift; \
|
||||
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
if test $$# -gt 0; then \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
"$$@" $$unique; \
|
||||
else \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$unique; \
|
||||
fi; \
|
||||
fi
|
||||
ctags: CTAGS
|
||||
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
test -z "$(CTAGS_ARGS)$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& $(am__cd) $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) "$$here"
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile $(DATA) $(HEADERS)
|
||||
installdirs:
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic clean-libtool mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-generic distclean-tags
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-dvi: install-dvi-am
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-html: install-html-am
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-am
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-am
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am:
|
||||
|
||||
.MAKE: install-am install-strip
|
||||
|
||||
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
|
||||
clean-libtool ctags distclean distclean-generic \
|
||||
distclean-libtool distclean-tags distdir dvi dvi-am html \
|
||||
html-am info info-am install install-am install-data \
|
||||
install-data-am install-dvi install-dvi-am install-exec \
|
||||
install-exec-am install-html install-html-am install-info \
|
||||
install-info-am install-man install-pdf install-pdf-am \
|
||||
install-ps install-ps-am install-strip installcheck \
|
||||
installcheck-am installdirs maintainer-clean \
|
||||
maintainer-clean-generic mostlyclean mostlyclean-generic \
|
||||
mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
|
||||
uninstall-am
|
||||
|
||||
|
||||
.c.o:
|
||||
$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@
|
||||
|
||||
.o.dll:
|
||||
$(CC) -mno-cygwin --add-stdcall-alias -shared -o $@ -L$(LIBRFID_DIR) $< -lrfid -lwinmm -Wl,-no-undefined -Wl,--entry,__cygwin_noncygwin_dll_entry@12
|
||||
$(STRIP) --strip-unneeded $@
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
@@ -0,0 +1,389 @@
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* Mifare support for accessing RFID cards with OpenPCD RFID reader */
|
||||
/* in WIN32 - see http://www.openpcd.org */
|
||||
/* */
|
||||
/* Copyright (C) 2007 Milosch Meriac <meriac@bitmanufaktur.de> */
|
||||
/* */
|
||||
/* Redistribution and use in source and binary forms, with or without */
|
||||
/* modification, are permitted provided that the following conditions are*/
|
||||
/* met: */
|
||||
/* */
|
||||
/* Redistributions of source code must retain the above copyright notice,*/
|
||||
/* this list of conditions and the following disclaimer. */
|
||||
/* Redistributions in binary form must reproduce the above copyright */
|
||||
/* notice, this list of conditions and the following disclaimer in the */
|
||||
/* documentation and/or other materials provided with the distribution. */
|
||||
/* */
|
||||
/* The name of the author may not be used to endorse or promote products */
|
||||
/* derived from this software without specific prior written permission. */
|
||||
/* */
|
||||
/* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR */
|
||||
/* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED */
|
||||
/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE*/
|
||||
/* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, */
|
||||
/* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
|
||||
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR */
|
||||
/* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */
|
||||
/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, */
|
||||
/* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING */
|
||||
/* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
|
||||
/* POSSIBILITY OF SUCH DAMAGE. */
|
||||
/* */
|
||||
/*************************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <windows.h>
|
||||
|
||||
#include <librfid/rfid.h>
|
||||
#include <librfid/rfid_scan.h>
|
||||
#include <librfid/rfid_reader.h>
|
||||
#include <librfid/rfid_protocol.h>
|
||||
#include <librfid/rfid_protocol_mifare_classic.h>
|
||||
|
||||
#define BUILD_DLL
|
||||
#include "openpcd.h"
|
||||
|
||||
#define LIBMIFARE_MAGIC 0xDEADBEEF
|
||||
|
||||
struct openpcd_state
|
||||
{
|
||||
unsigned int magic;
|
||||
unsigned int cl_auth;
|
||||
struct rfid_reader_handle *rh;
|
||||
struct rfid_layer2_handle *l2h;
|
||||
struct rfid_protocol_handle *ph;
|
||||
unsigned char key[MIFARE_CL_KEY_LEN];
|
||||
unsigned int uid;
|
||||
} openpcd_state;
|
||||
|
||||
int openpcd_cl_auth(struct openpcd_state* state ,int page)
|
||||
{
|
||||
int rc;
|
||||
|
||||
if(!state || page<=0 || page>MIFARE_CL_PAGE_MAX )
|
||||
return PCDERROR_INVALID_PARAMETER;
|
||||
|
||||
if(!state->ph)
|
||||
return PCDERROR_CLOSED;
|
||||
|
||||
rc = mfcl_set_key(state->ph, state->key);
|
||||
if (rc < 0)
|
||||
return PCDERROR_KEY_FORMAT;
|
||||
|
||||
rc = mfcl_auth(state->ph, state->cl_auth, page);
|
||||
|
||||
return rc<0 ? PCDERROR_KEY_AUTH : PCDERROR_NONE;
|
||||
}
|
||||
|
||||
EXPORT int EXPORT_CONVENTION openpcd_set_key(MIFARE_HANDLE handle,unsigned int key_id,const void* key)
|
||||
{
|
||||
struct openpcd_state *state;
|
||||
|
||||
if(!handle)
|
||||
return PCDERROR_INVALID_PARAMETER;
|
||||
state=(struct openpcd_state*)handle;
|
||||
|
||||
switch(key_id)
|
||||
{
|
||||
case PCDAUTH_KEYID_1A:
|
||||
state->cl_auth=RFID_CMD_MIFARE_AUTH1A;
|
||||
break;
|
||||
case PCDAUTH_KEYID_1B:
|
||||
state->cl_auth=RFID_CMD_MIFARE_AUTH1B;
|
||||
break;
|
||||
default:
|
||||
return PCDERROR_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
memcpy(state->key,key,MIFARE_CL_KEY_LEN);
|
||||
|
||||
return PCDERROR_NONE;
|
||||
}
|
||||
|
||||
EXPORT int EXPORT_CONVENTION openpcd_select_card(MIFARE_HANDLE handle)
|
||||
{
|
||||
int res;
|
||||
struct openpcd_state *state;
|
||||
|
||||
if(!handle)
|
||||
return PCDERROR_INVALID_PARAMETER;
|
||||
state=(struct openpcd_state*)handle;
|
||||
|
||||
state->l2h = rfid_layer2_init(state->rh,RFID_LAYER2_ISO14443A);
|
||||
if(!state->l2h)
|
||||
res=PCDERROR_LAYER2_INIT;
|
||||
else
|
||||
{
|
||||
if( rfid_layer2_open(state->l2h)>=0 )
|
||||
{
|
||||
state->ph = rfid_protocol_init(state->l2h,RFID_PROTOCOL_MIFARE_CLASSIC);
|
||||
|
||||
if(state->ph)
|
||||
{
|
||||
if(rfid_protocol_open(state->ph)>=0)
|
||||
return PCDERROR_NONE;
|
||||
|
||||
rfid_protocol_fini(state->ph);
|
||||
state->ph=NULL;
|
||||
|
||||
res=PCDERROR_LAYER3_OPEN;
|
||||
}
|
||||
else
|
||||
res=PCDERROR_LAYER3_INIT;
|
||||
|
||||
rfid_layer2_close(state->l2h);
|
||||
}
|
||||
else
|
||||
res=PCDERROR_LAYER2_OPEN;
|
||||
}
|
||||
|
||||
rfid_layer2_fini(state->l2h);
|
||||
state->l2h=NULL;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
EXPORT int EXPORT_CONVENTION openpcd_deselect_card(MIFARE_HANDLE handle)
|
||||
{
|
||||
struct openpcd_state *state;
|
||||
|
||||
if(!handle)
|
||||
return PCDERROR_INVALID_PARAMETER;
|
||||
state=(struct openpcd_state*)handle;
|
||||
|
||||
if(state->ph)
|
||||
{
|
||||
rfid_protocol_close(state->ph);
|
||||
rfid_protocol_fini(state->ph);
|
||||
rfid_layer2_close(state->l2h);
|
||||
rfid_layer2_fini(state->l2h);
|
||||
|
||||
state->ph=NULL;
|
||||
state->l2h=NULL;
|
||||
state->uid=0;
|
||||
|
||||
return PCDERROR_NONE;
|
||||
}
|
||||
else
|
||||
return PCDERROR_CLOSED;
|
||||
}
|
||||
|
||||
EXPORT int EXPORT_CONVENTION openpcd_get_card_id(MIFARE_HANDLE handle,unsigned int *uid)
|
||||
{
|
||||
unsigned int uid_len;
|
||||
struct openpcd_state *state;
|
||||
|
||||
if(!handle || !uid)
|
||||
return PCDERROR_INVALID_PARAMETER;
|
||||
state=(struct openpcd_state*)handle;
|
||||
|
||||
if(state->ph)
|
||||
{
|
||||
uid_len=sizeof(*uid);
|
||||
if(rfid_layer2_getopt(state->l2h,RFID_OPT_LAYER2_UID,uid,&uid_len))
|
||||
return PCDERROR_INVALID_PARAMETER;
|
||||
else
|
||||
return uid_len==4 ? PCDERROR_NONE:PCDERROR_READ_FAILED;
|
||||
}
|
||||
else
|
||||
return PCDERROR_CLOSED;
|
||||
}
|
||||
|
||||
EXPORT int EXPORT_CONVENTION openpcd_open_reader(MIFARE_HANDLE *handle)
|
||||
{
|
||||
struct rfid_reader_handle *rh;
|
||||
struct openpcd_state *state;
|
||||
|
||||
if(!handle)
|
||||
return PCDERROR_INVALID_PARAMETER;
|
||||
|
||||
rh = rfid_reader_open(NULL, RFID_READER_OPENPCD);
|
||||
if(!rh)
|
||||
return PCDERROR_NO_READER;
|
||||
|
||||
state=(struct openpcd_state*)malloc(sizeof(*state));
|
||||
if(state)
|
||||
{
|
||||
memset(state,0,sizeof(*state));
|
||||
state->magic=LIBMIFARE_MAGIC;
|
||||
state->rh=rh;
|
||||
state->cl_auth=RFID_CMD_MIFARE_AUTH1A;
|
||||
memset(state->key,0xFF,sizeof(state->key));
|
||||
|
||||
// do initial reset
|
||||
openpcd_reset_reader((MIFARE_HANDLE)state);
|
||||
Sleep(1500);
|
||||
// reopen
|
||||
state->rh = rfid_reader_open(NULL, RFID_READER_OPENPCD);
|
||||
|
||||
*handle=(MIFARE_HANDLE)state;
|
||||
|
||||
return PCDERROR_NONE;
|
||||
}
|
||||
else
|
||||
{
|
||||
rfid_reader_close(rh);
|
||||
return PCDERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
|
||||
EXPORT int EXPORT_CONVENTION openpcd_close_reader(MIFARE_HANDLE handle)
|
||||
{
|
||||
struct openpcd_state *state;
|
||||
|
||||
if(!handle)
|
||||
return PCDERROR_INVALID_PARAMETER;
|
||||
state=(struct openpcd_state*)handle;
|
||||
|
||||
openpcd_deselect_card(handle);
|
||||
|
||||
openpcd_reset_reader(handle);
|
||||
Sleep(500);
|
||||
|
||||
state->magic=0;
|
||||
rfid_reader_close(state->rh);
|
||||
free(state);
|
||||
|
||||
return PCDERROR_NONE;
|
||||
}
|
||||
|
||||
EXPORT int EXPORT_CONVENTION openpcd_read(MIFARE_HANDLE handle,int page, void* data, int len)
|
||||
{
|
||||
int res;
|
||||
unsigned int count;
|
||||
unsigned char buf[MIFARE_CL_PAGE_SIZE];
|
||||
struct openpcd_state *state;
|
||||
|
||||
if( !handle || !buf || page<0 || page>MIFARE_CL_PAGE_MAX || len<=0 || len>sizeof(buf))
|
||||
return PCDERROR_INVALID_PARAMETER;
|
||||
|
||||
state=(struct openpcd_state*)handle;
|
||||
if ( (res=openpcd_cl_auth(state,page)) < 0)
|
||||
return res;
|
||||
|
||||
count = sizeof(buf);
|
||||
res = rfid_protocol_read(state->ph, page, buf, &count);
|
||||
if(res>=0)
|
||||
memcpy(data,buf,len);
|
||||
|
||||
if ( res<0 )
|
||||
return PCDERROR_READ_FAILED;
|
||||
else
|
||||
return count;
|
||||
}
|
||||
|
||||
EXPORT int EXPORT_CONVENTION openpcd_write(MIFARE_HANDLE handle,int page,const void *data,int len)
|
||||
{
|
||||
int res;
|
||||
unsigned char buf[16];
|
||||
struct openpcd_state *state;
|
||||
|
||||
if( !handle || !buf || page<0 || page>MIFARE_CL_PAGE_MAX || len<=0 || len>sizeof(buf))
|
||||
return PCDERROR_INVALID_PARAMETER;
|
||||
|
||||
state=(struct openpcd_state*)handle;
|
||||
if ( (res=openpcd_cl_auth(state,page)) < 0)
|
||||
return res;
|
||||
|
||||
memcpy(buf,data,len);
|
||||
memset(&buf[len],0,sizeof(buf)-len);
|
||||
|
||||
res = rfid_protocol_write(state->ph, page, buf, sizeof(buf));
|
||||
|
||||
return (res<0 && res!=-101) ? PCDERROR_WRITE_FAILED : len;
|
||||
}
|
||||
|
||||
EXPORT int EXPORT_CONVENTION openpcd_get_api_version(MIFARE_HANDLE handle, unsigned int *version)
|
||||
{
|
||||
unsigned char b;
|
||||
struct openpcd_state *state;
|
||||
|
||||
if( !handle || !version )
|
||||
return PCDERROR_INVALID_PARAMETER;
|
||||
state=(struct openpcd_state*)handle;
|
||||
|
||||
b=0;
|
||||
|
||||
if(state->rh->reader->get_api_version(state->rh,&b)<0)
|
||||
return PCDERROR_READER_VERSION;
|
||||
else
|
||||
{
|
||||
*version=b;
|
||||
return PCDERROR_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
EXPORT int EXPORT_CONVENTION openpcd_reset_reader(MIFARE_HANDLE handle)
|
||||
{
|
||||
struct openpcd_state *state;
|
||||
|
||||
if( !handle )
|
||||
return PCDERROR_INVALID_PARAMETER;
|
||||
state=(struct openpcd_state*)handle;
|
||||
|
||||
return (state->rh->reader->reset(state->rh)<0) ? PCDERROR_WRITE_FAILED : PCDERROR_NONE;
|
||||
}
|
||||
|
||||
EXPORT int EXPORT_CONVENTION openpcd_get_environment(
|
||||
MIFARE_HANDLE handle,
|
||||
unsigned char count,
|
||||
unsigned char* data
|
||||
)
|
||||
{
|
||||
struct openpcd_state *state;
|
||||
|
||||
if( !handle )
|
||||
return PCDERROR_INVALID_PARAMETER;
|
||||
state=(struct openpcd_state*)handle;
|
||||
|
||||
return (state->rh->reader->get_environment(state->rh,count,data)<0) ? PCDERROR_READ_FAILED : PCDERROR_NONE;
|
||||
}
|
||||
|
||||
EXPORT int EXPORT_CONVENTION openpcd_set_environment(
|
||||
MIFARE_HANDLE handle,
|
||||
unsigned char count,
|
||||
const unsigned char* data)
|
||||
{
|
||||
struct openpcd_state *state;
|
||||
|
||||
if( !handle )
|
||||
return PCDERROR_INVALID_PARAMETER;
|
||||
state=(struct openpcd_state*)handle;
|
||||
|
||||
return (state->rh->reader->set_environment(state->rh,count,data)<0) ? PCDERROR_WRITE_FAILED : PCDERROR_NONE;
|
||||
}
|
||||
|
||||
EXPORT char* EXPORT_CONVENTION openpcd_get_error_text(int error)
|
||||
{
|
||||
const static char* msg[]={
|
||||
"PCDERROR_NONE", // 0
|
||||
"PCDERROR_INVALID_PARAMETER", // -1
|
||||
"PCDERROR_KEY_FORMAT", // -2
|
||||
"PCDERROR_KEY_AUTH", // -3
|
||||
"PCDERROR_NO_CARD_FOUND", // -4
|
||||
"PCDERROR_LAYER2_INIT", // -5
|
||||
"PCDERROR_LAYER2_OPEN", // -6
|
||||
"PCDERROR_LAYER3_INIT", // -7
|
||||
"PCDERROR_LAYER3_OPEN", // -8
|
||||
"PCDERROR_SELECT", // -9
|
||||
"PCDERROR_READ_FAILED", // -10
|
||||
"PCDERROR_WRITE_FAILED", // -11
|
||||
"PCDERROR_CLOSED", // -12
|
||||
"PCDERROR_NO_READER", // -13
|
||||
"PCDERROR_OUT_OF_MEMORY", // -14
|
||||
"PCDERROR_READER_VERSION" // -15
|
||||
};
|
||||
const int count=sizeof(msg)/sizeof(msg[0]);
|
||||
|
||||
if(error>0)
|
||||
error=0;
|
||||
else
|
||||
error=-error;
|
||||
|
||||
return (error>=count) ? "PCDERROR_UNKNOWN" : (char*)msg[error];
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
LIBRARY openpcd.dll
|
||||
EXPORTS
|
||||
openpcd_open_reader@4
|
||||
openpcd_close_reader@4
|
||||
openpcd_select_card@4
|
||||
openpcd_deselect_card@4
|
||||
openpcd_read@16
|
||||
openpcd_write@16
|
||||
openpcd_get_card_id@8
|
||||
openpcd_set_key@12
|
||||
openpcd_get_error_text@4
|
||||
openpcd_get_api_version@8
|
||||
openpcd_get_environment@12
|
||||
openpcd_set_environment@12
|
||||
openpcd_reset_reader@4
|
||||
@@ -0,0 +1,175 @@
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* Mifare support for accessing RFID cards with OpenPCD RFID reader */
|
||||
/* in WIN32 - see http://www.openpcd.org */
|
||||
/* */
|
||||
/* Copyright (C) 2007 Milosch Meriac <meriac@bitmanufaktur.de> */
|
||||
/* */
|
||||
/* Redistribution and use in source and binary forms, with or without */
|
||||
/* modification, are permitted provided that the following conditions are*/
|
||||
/* met: */
|
||||
/* */
|
||||
/* Redistributions of source code must retain the above copyright notice,*/
|
||||
/* this list of conditions and the following disclaimer. */
|
||||
/* Redistributions in binary form must reproduce the above copyright */
|
||||
/* notice, this list of conditions and the following disclaimer in the */
|
||||
/* documentation and/or other materials provided with the distribution. */
|
||||
/* */
|
||||
/* The name of the author may not be used to endorse or promote products */
|
||||
/* derived from this software without specific prior written permission. */
|
||||
/* */
|
||||
/* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR */
|
||||
/* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED */
|
||||
/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE*/
|
||||
/* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, */
|
||||
/* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
|
||||
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR */
|
||||
/* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */
|
||||
/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, */
|
||||
/* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING */
|
||||
/* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
|
||||
/* POSSIBILITY OF SUCH DAMAGE. */
|
||||
/* */
|
||||
/*************************************************************************/
|
||||
|
||||
#ifndef __OPENPCD_H__
|
||||
#define __OPENPCD_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif/*__cplusplus*/
|
||||
|
||||
#define EXPORT_CONVENTION __stdcall
|
||||
#ifdef BUILD_DLL
|
||||
/* DLL export */
|
||||
#define EXPORT __declspec(dllexport)
|
||||
#else
|
||||
/* EXE import */
|
||||
#define EXPORT __declspec(dllimport)
|
||||
#endif /*BUILD_DLL*/
|
||||
|
||||
#define PCDERROR_NONE 0
|
||||
#define PCDERROR_INVALID_PARAMETER -1
|
||||
#define PCDERROR_KEY_FORMAT -2
|
||||
#define PCDERROR_KEY_AUTH -3
|
||||
#define PCDERROR_NO_CARD_FOUND -4
|
||||
#define PCDERROR_LAYER2_INIT -5
|
||||
#define PCDERROR_LAYER2_OPEN -6
|
||||
#define PCDERROR_LAYER3_INIT -7
|
||||
#define PCDERROR_LAYER3_OPEN -8
|
||||
#define PCDERROR_SELECT -9
|
||||
#define PCDERROR_READ_FAILED -10
|
||||
#define PCDERROR_WRITE_FAILED -11
|
||||
#define PCDERROR_CLOSED -12
|
||||
#define PCDERROR_NO_READER -13
|
||||
#define PCDERROR_OUT_OF_MEMORY -14
|
||||
#define PCDERROR_READER_VERSION -15
|
||||
|
||||
#define PCDAUTH_KEY_LENGTH 6
|
||||
#define PCDAUTH_KEYID_1A 0
|
||||
#define PCDAUTH_KEYID_1B 1
|
||||
|
||||
typedef void* MIFARE_HANDLE;
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* Six steps for reading/writing to MIFARE cards */
|
||||
/* */
|
||||
/*************************************************************************/
|
||||
|
||||
/* Step 1. open reader
|
||||
|
||||
supply the address of your handle variable to retrieve a handle
|
||||
to the current reader.
|
||||
*/
|
||||
EXPORT int EXPORT_CONVENTION openpcd_open_reader(MIFARE_HANDLE *handle);
|
||||
|
||||
/* Step 2. set MIFARE classic key
|
||||
|
||||
if your key differs from the default Infineon key (6*0xFF), you can
|
||||
supply a different key here. The key size is PCDAUTH_KEY_LENGTH bytes.
|
||||
You can chose to set key_id to PCDAUTH_KEYID_1A or *_1B.
|
||||
*/
|
||||
EXPORT int EXPORT_CONVENTION openpcd_set_key(MIFARE_HANDLE handle,unsigned int key_id,const void* key);
|
||||
|
||||
/* Step 3. select card
|
||||
|
||||
start the anticollosion to select a card in the reader field - retry if
|
||||
it fails. Currently supports only on card in the readerv field.
|
||||
*/
|
||||
EXPORT int EXPORT_CONVENTION openpcd_select_card(MIFARE_HANDLE handle);
|
||||
|
||||
/* Step 4. read/write card
|
||||
|
||||
read, write from the selected card - specify the page and supply up to
|
||||
16 bytes of payload
|
||||
*/
|
||||
EXPORT int EXPORT_CONVENTION openpcd_read(MIFARE_HANDLE handle,int page, void* data, int len);
|
||||
EXPORT int EXPORT_CONVENTION openpcd_write(MIFARE_HANDLE handle,int page,const void *data,int len);
|
||||
|
||||
/* Step 5. deselect card when done
|
||||
*/
|
||||
EXPORT int EXPORT_CONVENTION openpcd_deselect_card(MIFARE_HANDLE handle);
|
||||
|
||||
/* Step 6. close reader after deselected card
|
||||
*/
|
||||
EXPORT int EXPORT_CONVENTION openpcd_close_reader(MIFARE_HANDLE handle);
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* Support functions */
|
||||
/* */
|
||||
/*************************************************************************/
|
||||
|
||||
/* openpcd_get_error_text:
|
||||
|
||||
Used for converting the error code into a string
|
||||
*/
|
||||
EXPORT char* EXPORT_CONVENTION openpcd_get_error_text(int error);
|
||||
|
||||
|
||||
/* openpcd_get_card_id:
|
||||
|
||||
Get the card id of a selected RFID card
|
||||
*/
|
||||
EXPORT int EXPORT_CONVENTION openpcd_get_card_id(MIFARE_HANDLE handle,unsigned int *uid);
|
||||
|
||||
/* openpcd_get_api_version:
|
||||
|
||||
Get the USB api version of the reader
|
||||
*/
|
||||
EXPORT int EXPORT_CONVENTION openpcd_get_api_version(MIFARE_HANDLE handle,unsigned int *version);
|
||||
|
||||
/* openpcd_reset_reader:
|
||||
|
||||
Reset the attached reader
|
||||
*/
|
||||
EXPORT int EXPORT_CONVENTION openpcd_reset_reader(MIFARE_HANDLE handle);
|
||||
|
||||
/* openpcd_get_environment
|
||||
|
||||
Store the given data to the nonvolatile reader flash
|
||||
Returns read data count at index or error code
|
||||
*/
|
||||
EXPORT int EXPORT_CONVENTION openpcd_get_environment(
|
||||
MIFARE_HANDLE handle,
|
||||
unsigned char count,
|
||||
unsigned char* data
|
||||
);
|
||||
|
||||
/* openpcd_set_environment
|
||||
|
||||
Read data from nonvolatile reader flash
|
||||
Returns written data count at index or error code
|
||||
*/
|
||||
EXPORT int EXPORT_CONVENTION openpcd_set_environment(
|
||||
MIFARE_HANDLE handle,
|
||||
unsigned char count,
|
||||
const unsigned char* data
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif/*__cplusplus*/
|
||||
#endif/*__OPENPCD_H__*/
|
||||
Binary file not shown.
Reference in New Issue
Block a user