Rename chip_type to nfc_chip_t.

Rename dev_spec to nfc_device_spec_t.
Update configure.ac and autotools related files.
This commit is contained in:
Romuald Conty 2009-11-18 10:52:13 +00:00
parent 8a579c3aab
commit 2a0ff6c5d0
15 changed files with 713 additions and 441 deletions

View file

@ -21,8 +21,6 @@ case "$host" in
;;
esac
AC_PROG_RANLIB
AC_PATH_PROG(PKG_CONFIG, pkg-config)
# Checks for header files.

View file

@ -1,276 +1,519 @@
#!/bin/sh
#
# install - install a program, script, or datafile
# This comes from X11R5 (mit/util/scripts/install.sh).
scriptversion=2006-12-25.00
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
#
# Copyright 1991 by the Massachusetts Institute of Technology
# Copyright (C) 1994 X Consortium
#
# Permission to use, copy, modify, distribute, and sell this software and its
# documentation for any purpose is hereby granted without fee, provided that
# the above copyright notice appear in all copies and that both that
# copyright notice and this permission notice appear in supporting
# documentation, and that the name of M.I.T. not be used in advertising or
# publicity pertaining to distribution of the software without specific,
# written prior permission. M.I.T. makes no representations about the
# suitability of this software for any purpose. It is provided "as is"
# without express or implied warranty.
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name of the X Consortium shall not
# be used in advertising or otherwise to promote the sale, use or other deal-
# ings in this Software without prior written authorization from the X Consor-
# tium.
#
#
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch. It can only install one file at a time, a restriction
# shared with many OS's install programs.
# from scratch.
nl='
'
IFS=" "" $nl"
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}"
doit=${DOITPROG-}
if test -z "$doit"; then
doit_exec=exec
else
doit_exec=$doit
fi
# Put in absolute file names if you don't have them in your path;
# or use environment vars.
# put in absolute paths if you don't have them in your path; or use env. vars.
chgrpprog=${CHGRPPROG-chgrp}
chmodprog=${CHMODPROG-chmod}
chownprog=${CHOWNPROG-chown}
cmpprog=${CMPPROG-cmp}
cpprog=${CPPROG-cp}
mkdirprog=${MKDIRPROG-mkdir}
mvprog=${MVPROG-mv}
rmprog=${RMPROG-rm}
stripprog=${STRIPPROG-strip}
mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
chmodprog="${CHMODPROG-chmod}"
chownprog="${CHOWNPROG-chown}"
chgrpprog="${CHGRPPROG-chgrp}"
stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
posix_glob='?'
initialize_posix_glob='
test "$posix_glob" != "?" || {
if (set -f) 2>/dev/null; then
posix_glob=
else
posix_glob=:
fi
}
'
transformbasename=""
transform_arg=""
instcmd="$mvprog"
chmodcmd="$chmodprog 0755"
chowncmd=""
chgrpcmd=""
stripcmd=""
posix_mkdir=
# Desired mode of installed file.
mode=0755
chgrpcmd=
chmodcmd=$chmodprog
chowncmd=
mvcmd=$mvprog
rmcmd="$rmprog -f"
mvcmd="$mvprog"
src=""
dst=""
dir_arg=""
stripcmd=
while [ x"$1" != x ]; do
case $1 in
-c) instcmd=$cpprog
shift
continue;;
src=
dst=
dir_arg=
dst_arg=
-d) dir_arg=true
shift
continue;;
copy_on_change=false
no_target_directory=
-m) chmodcmd="$chmodprog $2"
shift
shift
continue;;
usage="\
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
or: $0 [OPTION]... SRCFILES... DIRECTORY
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
or: $0 [OPTION]... -d DIRECTORIES...
-o) chowncmd="$chownprog $2"
shift
shift
continue;;
In the 1st form, copy SRCFILE to DSTFILE.
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
In the 4th, create DIRECTORIES.
-g) chgrpcmd="$chgrpprog $2"
shift
shift
continue;;
Options:
--help display this help and exit.
--version display version info and exit.
-s) stripcmd=$stripprog
shift
continue;;
-c (ignored)
-C install only if different (preserve the last data modification time)
-d create directories instead of installing files.
-g GROUP $chgrpprog installed files to GROUP.
-m MODE $chmodprog installed files to MODE.
-o USER $chownprog installed files to USER.
-s $stripprog installed files.
-t DIRECTORY install into DIRECTORY.
-T report an error if DSTFILE is a directory.
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
shift
continue;;
Environment variables override the default commands:
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
RMPROG STRIPPROG
"
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
shift
continue;;
while test $# -ne 0; do
case $1 in
-c) ;;
*) if [ x"$src" = x ]
then
src=$1
else
# this colon is to work around a 386BSD /bin/sh bug
:
dst=$1
fi
shift
continue;;
-C) copy_on_change=true;;
-d) dir_arg=true;;
-g) chgrpcmd="$chgrpprog $2"
shift;;
--help) echo "$usage"; exit $?;;
-m) mode=$2
case $mode in
*' '* | *' '* | *'
'* | *'*'* | *'?'* | *'['*)
echo "$0: invalid mode: $mode" >&2
exit 1;;
esac
shift;;
-o) chowncmd="$chownprog $2"
shift;;
-s) stripcmd=$stripprog;;
-t) dst_arg=$2
shift;;
-T) no_target_directory=true;;
--version) echo "$0 $scriptversion"; exit $?;;
--) shift
break;;
-*) echo "$0: invalid option: $1" >&2
exit 1;;
*) break;;
esac
shift
done
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
# When -d is used, all remaining arguments are directories to create.
# When -t is used, the destination is already specified.
# Otherwise, the last argument is the destination. Remove it from $@.
for arg
do
if test -n "$dst_arg"; then
# $@ is not empty: it contains at least $arg.
set fnord "$@" "$dst_arg"
shift # fnord
fi
shift # arg
dst_arg=$arg
done
fi
if test $# -eq 0; then
if test -z "$dir_arg"; then
echo "$0: no input file specified." >&2
exit 1
fi
# It's OK to call `install-sh -d' without argument.
# This can happen when creating conditional directories.
exit 0
fi
if test -z "$dir_arg"; then
trap '(exit $?); exit' 1 2 13 15
# Set umask so as not to create temps with too-generous modes.
# However, 'strip' requires both read and write access to temps.
case $mode in
# Optimize common cases.
*644) cp_umask=133;;
*755) cp_umask=22;;
*[0-7])
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw='% 200'
fi
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
*)
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw=,u+rw
fi
cp_umask=$mode$u_plus_rw;;
esac
fi
for src
do
# Protect names starting with `-'.
case $src in
-*) src=./$src;;
esac
if test -n "$dir_arg"; then
dst=$src
dstdir=$dst
test -d "$dstdir"
dstdir_status=$?
else
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if test ! -f "$src" && test ! -d "$src"; then
echo "$0: $src does not exist." >&2
exit 1
fi
if test -z "$dst_arg"; then
echo "$0: no destination specified." >&2
exit 1
fi
dst=$dst_arg
# Protect names starting with `-'.
case $dst in
-*) dst=./$dst;;
esac
done
if [ x"$src" = x ]
then
echo "$0: no input file specified" >&2
# If destination is a directory, append the input filename; won't work
# if double slashes aren't ignored.
if test -d "$dst"; then
if test -n "$no_target_directory"; then
echo "$0: $dst_arg: Is a directory" >&2
exit 1
else
:
fi
fi
dstdir=$dst
dst=$dstdir/`basename "$src"`
dstdir_status=0
else
# Prefer dirname, but fall back on a substitute if dirname fails.
dstdir=`
(dirname "$dst") 2>/dev/null ||
expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$dst" : 'X\(//\)[^/]' \| \
X"$dst" : 'X\(//\)$' \| \
X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
echo X"$dst" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'
`
if [ x"$dir_arg" != x ]; then
dst=$src
src=""
test -d "$dstdir"
dstdir_status=$?
fi
fi
if [ -d "$dst" ]; then
instcmd=:
chmodcmd=""
obsolete_mkdir_used=false
if test $dstdir_status != 0; then
case $posix_mkdir in
'')
# Create intermediate dirs using mode 755 as modified by the umask.
# This is like FreeBSD 'install' as of 1997-10-28.
umask=`umask`
case $stripcmd.$umask in
# Optimize common cases.
*[2367][2367]) mkdir_umask=$umask;;
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
*[0-7])
mkdir_umask=`expr $umask + 22 \
- $umask % 100 % 40 + $umask % 20 \
- $umask % 10 % 4 + $umask % 2
`;;
*) mkdir_umask=$umask,go-w;;
esac
# With -d, create the new directory with the user-specified mode.
# Otherwise, rely on $mkdir_umask.
if test -n "$dir_arg"; then
mkdir_mode=-m$mode
else
instcmd=$mkdirprog
fi
else
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if [ -f "$src" ] || [ -d "$src" ]
then
:
else
echo "$0: $src does not exist" >&2
exit 1
mkdir_mode=
fi
if [ x"$dst" = x ]
then
echo "$0: no destination specified" >&2
exit 1
posix_mkdir=false
case $umask in
*[123567][0-7][0-7])
# POSIX mkdir -p sets u+wx bits regardless of umask, which
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
;;
*)
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
if (umask $mkdir_umask &&
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
then
if test -z "$dir_arg" || {
# Check for POSIX incompatibilities with -m.
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
# other-writeable bit of parent directory when it shouldn't.
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
ls_ld_tmpdir=`ls -ld "$tmpdir"`
case $ls_ld_tmpdir in
d????-?r-*) different_mode=700;;
d????-?--*) different_mode=755;;
*) false;;
esac &&
$mkdirprog -m$different_mode -p -- "$tmpdir" && {
ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
}
}
then posix_mkdir=:
fi
rmdir "$tmpdir/d" "$tmpdir"
else
# Remove any dirs left behind by ancient mkdir implementations.
rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
fi
trap '' 0;;
esac;;
esac
if
$posix_mkdir && (
umask $mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
)
then :
else
# The umask is ridiculous, or mkdir does not conform to POSIX,
# or it failed possibly due to a race condition. Create the
# directory the slow way, step by step, checking for races as we go.
case $dstdir in
/*) prefix='/';;
-*) prefix='./';;
*) prefix='';;
esac
eval "$initialize_posix_glob"
oIFS=$IFS
IFS=/
$posix_glob set -f
set fnord $dstdir
shift
$posix_glob set +f
IFS=$oIFS
prefixes=
for d
do
test -z "$d" && continue
prefix=$prefix$d
if test -d "$prefix"; then
prefixes=
else
:
if $posix_mkdir; then
(umask=$mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
# Don't fail if two instances are running concurrently.
test -d "$prefix" || exit 1
else
case $prefix in
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
*) qprefix=$prefix;;
esac
prefixes="$prefixes '$qprefix'"
fi
fi
prefix=$prefix/
done
# If destination is a directory, append the input filename; if your system
# does not like double slashes in filenames, you may need to add some logic
if test -n "$prefixes"; then
# Don't fail if two instances are running concurrently.
(umask $mkdir_umask &&
eval "\$doit_exec \$mkdirprog $prefixes") ||
test -d "$dstdir" || exit 1
obsolete_mkdir_used=true
fi
fi
fi
if [ -d "$dst" ]
then
dst=$dst/`basename "$src"`
else
:
fi
fi
if test -n "$dir_arg"; then
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
else
## this sed command emulates the dirname command
dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
# Make a couple of temp file names in the proper directory.
dsttmp=$dstdir/_inst.$$_
rmtmp=$dstdir/_rm.$$_
# Make sure that the destination directory exists.
# this part is taken from Noah Friedman's mkinstalldirs script
# Trap to clean up those temp files at exit.
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
# Skip lots of stat calls in the usual case.
if [ ! -d "$dstdir" ]; then
defaultIFS='
'
IFS="${IFS-$defaultIFS}"
# Copy the file name to the temp name.
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
oIFS=$IFS
# Some sh's can't handle IFS=/ for some reason.
IFS='%'
set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
IFS=$oIFS
# and set any options; do chmod last to preserve setuid bits.
#
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $cpprog $src $dsttmp" command.
#
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
pathcomp=''
# If -C, don't bother to copy if it wouldn't change the file.
if $copy_on_change &&
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
while [ $# -ne 0 ] ; do
pathcomp=$pathcomp$1
shift
eval "$initialize_posix_glob" &&
$posix_glob set -f &&
set X $old && old=:$2:$4:$5:$6 &&
set X $new && new=:$2:$4:$5:$6 &&
$posix_glob set +f &&
if [ ! -d "$pathcomp" ] ;
then
$mkdirprog "$pathcomp"
else
:
fi
test "$old" = "$new" &&
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
then
rm -f "$dsttmp"
else
# Rename the file to the real destination.
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
pathcomp=$pathcomp/
# The rename failed, perhaps because mv can't rename something else
# to itself, or perhaps because mv is so ancient that it does not
# support -f.
{
# Now remove or move aside any old file at destination location.
# We try this two ways since rm can't unlink itself on some
# systems and the destination file might be busy for other
# reasons. In this case, the final cleanup might fail but the new
# file should still install successfully.
{
test ! -f "$dst" ||
$doit $rmcmd -f "$dst" 2>/dev/null ||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
} ||
{ echo "$0: cannot unlink or rename $dst" >&2
(exit 1); exit 1
}
} &&
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dst"
}
fi || exit 1
trap '' 0
fi
done
fi
if [ x"$dir_arg" != x ]
then
$doit $instcmd "$dst" &&
if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dst"; else : ; fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dst"; else : ; fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dst"; else : ; fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dst"; else : ; fi
else
# If we're going to rename the final executable, determine the name now.
if [ x"$transformarg" = x ]
then
dstfile=`basename "$dst"`
else
dstfile=`basename "$dst" $transformbasename |
sed $transformarg`$transformbasename
fi
# don't allow the sed command to completely eliminate the filename
if [ x"$dstfile" = x ]
then
dstfile=`basename "$dst"`
else
:
fi
# Make a couple of temp file names in the proper directory.
dsttmp=$dstdir/#inst.$$#
rmtmp=$dstdir/#rm.$$#
# Trap to clean up temp files at exit.
trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0
trap '(exit $?); exit' 1 2 13 15
# Move or copy the file name to the temp name
$doit $instcmd "$src" "$dsttmp" &&
# and set any options; do chmod last to preserve setuid bits
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $instcmd $src $dsttmp" command.
if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else :;fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else :;fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dsttmp"; else :;fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else :;fi &&
# Now remove or move aside any old file at destination location. We try this
# two ways since rm can't unlink itself on some systems and the destination
# file might be busy for other reasons. In this case, the final cleanup
# might fail but the new file should still install successfully.
{
if [ -f "$dstdir/$dstfile" ]
then
$doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null ||
$doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null ||
{
echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
(exit 1); exit
}
else
:
fi
} &&
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
fi &&
# The final little trick to "correctly" pass the exit status to the exit trap.
{
(exit 0); exit
}
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

197
missing
View file

@ -1,6 +1,10 @@
#! /bin/sh
# Common stub for a few missing GNU programs while installing.
# Copyright (C) 1996, 1997, 1999, 2000, 2002 Free Software Foundation, Inc.
scriptversion=2006-05-10.23
# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006
# Free Software Foundation, Inc.
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
# This program is free software; you can redistribute it and/or modify
@ -15,8 +19,8 @@
# 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., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
@ -29,6 +33,8 @@ if test $# -eq 0; then
fi
run=:
sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
# In the cases where this matters, `missing' is being run in the
# srcdir already.
@ -38,18 +44,24 @@ else
configure_ac=configure.in
fi
case "$1" in
msg="missing on your system"
case $1 in
--run)
# Try to run requested program, and just exit if it succeeds.
run=
shift
"$@" && exit 0
# Exit code 63 means version mismatch. This often happens
# when the user try to use an ancient version of a tool on
# a file that requires a minimum version. In this case we
# we should proceed has if the program had been absent, or
# if --run hadn't been passed.
if test $? = 63; then
run=:
msg="probably too old"
fi
;;
esac
# If it does not exist, or fails to run (possibly an outdated version),
# try to emulate it.
case "$1" in
-h|--h|--he|--hel|--help)
echo "\
@ -67,6 +79,7 @@ Supported PROGRAM values:
aclocal touch file \`aclocal.m4'
autoconf touch file \`configure'
autoheader touch file \`config.h.in'
autom4te touch the output file, or create a stub one
automake touch all \`Makefile.in' files
bison create \`y.tab.[ch]', if possible, from existing .[ch]
flex create \`lex.yy.c', if possible, from existing .c
@ -74,11 +87,15 @@ Supported PROGRAM values:
lex create \`lex.yy.c', if possible, from existing .c
makeinfo touch the output file
tar try tar, gnutar, gtar, then tar without non-portable flags
yacc create \`y.tab.[ch]', if possible, from existing .[ch]"
yacc create \`y.tab.[ch]', if possible, from existing .[ch]
Send bug reports to <bug-automake@gnu.org>."
exit $?
;;
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
echo "missing 0.4 - GNU automake"
echo "missing $scriptversion (GNU Automake)"
exit $?
;;
-*)
@ -87,14 +104,44 @@ Supported PROGRAM values:
exit 1
;;
aclocal*)
esac
# Now exit if we have it, but it failed. Also exit now if we
# don't have it and --version was passed (most likely to detect
# the program).
case $1 in
lex|yacc)
# Not GNU programs, they don't have --version.
;;
tar)
if test -n "$run"; then
echo 1>&2 "ERROR: \`tar' requires --run"
exit 1
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
exit 1
fi
;;
*)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
# Could not run --version or --help. This is probably someone
# running `$TOOL --version' or `$TOOL --help' to check whether
# $TOOL exists and not knowing $TOOL uses missing.
exit 1
fi
;;
esac
# If it does not exist, or fails to run (possibly an outdated version),
# try to emulate it.
case $1 in
aclocal*)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
WARNING: \`$1' is $msg. You should only need it if
you modified \`acinclude.m4' or \`${configure_ac}'. You might want
to install the \`Automake' and \`Perl' packages. Grab them from
any GNU archive site."
@ -102,13 +149,8 @@ WARNING: \`$1' is missing on your system. You should only need it if
;;
autoconf)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
WARNING: \`$1' is $msg. You should only need it if
you modified \`${configure_ac}'. You might want to install the
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
archive site."
@ -116,13 +158,8 @@ WARNING: \`$1' is missing on your system. You should only need it if
;;
autoheader)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
WARNING: \`$1' is $msg. You should only need it if
you modified \`acconfig.h' or \`${configure_ac}'. You might want
to install the \`Autoconf' and \`GNU m4' packages. Grab them
from any GNU archive site."
@ -130,7 +167,7 @@ WARNING: \`$1' is missing on your system. You should only need it if
test -z "$files" && files="config.h"
touch_files=
for f in $files; do
case "$f" in
case $f in
*:*) touch_files="$touch_files "`echo "$f" |
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
*) touch_files="$touch_files $f.in";;
@ -140,13 +177,8 @@ WARNING: \`$1' is missing on your system. You should only need it if
;;
automake*)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
WARNING: \`$1' is $msg. You should only need it if
you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
You might want to install the \`Automake' and \`Perl' packages.
Grab them from any GNU archive site."
@ -156,20 +188,15 @@ WARNING: \`$1' is missing on your system. You should only need it if
;;
autom4te)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is needed, and you do not seem to have it handy on your
system. You might have modified some files without having the
WARNING: \`$1' is needed, but is $msg.
You might have modified some files without having the
proper tools for further handling them.
You can get \`$1Help2man' as part of \`Autoconf' from any GNU
You can get \`$1' as part of \`Autoconf' from any GNU
archive site."
file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
file=`echo "$*" | sed -n "$sed_output"`
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
if test -f "$file"; then
touch $file
else
@ -185,74 +212,67 @@ WARNING: \`$1' is needed, and you do not seem to have it handy on your
bison|yacc)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
WARNING: \`$1' $msg. You should only need it if
you modified a \`.y' file. You may need the \`Bison' package
in order for those modifications to take effect. You can get
\`Bison' from any GNU archive site."
rm -f y.tab.c y.tab.h
if [ $# -ne 1 ]; then
if test $# -ne 1; then
eval LASTARG="\${$#}"
case "$LASTARG" in
case $LASTARG in
*.y)
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
if [ -f "$SRCFILE" ]; then
if test -f "$SRCFILE"; then
cp "$SRCFILE" y.tab.c
fi
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
if [ -f "$SRCFILE" ]; then
if test -f "$SRCFILE"; then
cp "$SRCFILE" y.tab.h
fi
;;
esac
fi
if [ ! -f y.tab.h ]; then
if test ! -f y.tab.h; then
echo >y.tab.h
fi
if [ ! -f y.tab.c ]; then
if test ! -f y.tab.c; then
echo 'main() { return 0; }' >y.tab.c
fi
;;
lex|flex)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
WARNING: \`$1' is $msg. You should only need it if
you modified a \`.l' file. You may need the \`Flex' package
in order for those modifications to take effect. You can get
\`Flex' from any GNU archive site."
rm -f lex.yy.c
if [ $# -ne 1 ]; then
if test $# -ne 1; then
eval LASTARG="\${$#}"
case "$LASTARG" in
case $LASTARG in
*.l)
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
if [ -f "$SRCFILE" ]; then
if test -f "$SRCFILE"; then
cp "$SRCFILE" lex.yy.c
fi
;;
esac
fi
if [ ! -f lex.yy.c ]; then
if test ! -f lex.yy.c; then
echo 'main() { return 0; }' >lex.yy.c
fi
;;
help2man)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
WARNING: \`$1' is $msg. You should only need it if
you modified a dependency of a manual page. You may need the
\`Help2man' package in order for those modifications to take
effect. You can get \`Help2man' from any GNU archive site."
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
if test -z "$file"; then
file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
fi
if [ -f "$file" ]; then
file=`echo "$*" | sed -n "$sed_output"`
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
if test -f "$file"; then
touch $file
else
test -z "$file" || exec >$file
@ -262,32 +282,36 @@ WARNING: \`$1' is missing on your system. You should only need it if
;;
makeinfo)
if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then
# We have makeinfo, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
WARNING: \`$1' is $msg. You should only need it if
you modified a \`.texi' or \`.texinfo' file, or any other file
indirectly affecting the aspect of the manual. The spurious
call might also be the consequence of using a buggy \`make' (AIX,
DU, IRIX). You might want to install the \`Texinfo' package or
the \`GNU make' package. Grab either from any GNU archive site."
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
# The file to touch is that specified with -o ...
file=`echo "$*" | sed -n "$sed_output"`
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
if test -z "$file"; then
file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
# ... or it is the one specified with @setfilename ...
infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
file=`sed -n '
/^@setfilename/{
s/.* \([^ ]*\) *$/\1/
p
q
}' $infile`
# ... or it is derived from the source name (dir/f.texi becomes f.info)
test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
fi
# If the file does not exist, the user really needs makeinfo;
# let's fail without touching anything.
test -f $file || exit 1
touch $file
;;
tar)
shift
if test -n "$run"; then
echo 1>&2 "ERROR: \`tar' requires --run"
exit 1
fi
# We have already tried tar in the generic part.
# Look for gnutar/gtar before invocation to avoid ugly error
@ -300,13 +324,13 @@ WARNING: \`$1' is missing on your system. You should only need it if
fi
firstarg="$1"
if shift; then
case "$firstarg" in
case $firstarg in
*o*)
firstarg=`echo "$firstarg" | sed s/o//`
tar "$firstarg" "$@" && exit 0
;;
esac
case "$firstarg" in
case $firstarg in
*h*)
firstarg=`echo "$firstarg" | sed s/h//`
tar "$firstarg" "$@" && exit 0
@ -323,10 +347,10 @@ WARNING: I can't seem to be able to run \`tar' with the given arguments.
*)
echo 1>&2 "\
WARNING: \`$1' is needed, and you do not seem to have it handy on your
system. You might have modified some files without having the
WARNING: \`$1' is needed, and is $msg.
You might have modified some files without having the
proper tools for further handling them. Check the \`README' file,
it often tells you about the needed prerequirements for installing
it often tells you about the needed prerequisites for installing
this package. You may also peek at any GNU archive site, in case
some other package would contain this missing \`$1' program."
exit 1
@ -334,3 +358,10 @@ WARNING: \`$1' is needed, and you do not seem to have it handy on your
esac
exit 0
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

View file

@ -59,7 +59,7 @@ typedef struct {
SCARDCONTEXT hCtx;
SCARDHANDLE hCard;
SCARD_IO_REQUEST ioCard;
} dev_spec_acr122;
} acr122_spec_t;
nfc_device_t* acr122_connect(const nfc_device_desc_t* pndd)
{
@ -71,18 +71,18 @@ nfc_device_t* acr122_connect(const nfc_device_desc_t* pndd)
uint32_t uiReader;
uint32_t uiDevIndex;
nfc_device_t* pnd;
dev_spec_acr122* pdsa;
dev_spec_acr122 dsa;
acr122_spec_t* pas;
acr122_spec_t as;
char* pcFirmware;
// Clear the reader list
memset(acList,0x00,szListLen);
// Test if context succeeded
if (SCardEstablishContext(SCARD_SCOPE_USER,NULL,NULL,&(dsa.hCtx)) != SCARD_S_SUCCESS) return INVALID_DEVICE_INFO;
if (SCardEstablishContext(SCARD_SCOPE_USER,NULL,NULL,&(as.hCtx)) != SCARD_S_SUCCESS) return INVALID_DEVICE_INFO;
// Retrieve the string array of all available pcsc readers
if (SCardListReaders(dsa.hCtx,NULL,acList,(void*)&szListLen) != SCARD_S_SUCCESS) return INVALID_DEVICE_INFO;
if (SCardListReaders(as.hCtx,NULL,acList,(void*)&szListLen) != SCARD_S_SUCCESS) return INVALID_DEVICE_INFO;
DBG("PCSC reports following device(s):");
DBG("- %s",acList);
@ -121,20 +121,20 @@ nfc_device_t* acr122_connect(const nfc_device_desc_t* pndd)
for (uiReader=0; uiReader<uiReaderCount; uiReader++)
{
// Test if we were able to connect to the "emulator" card
if (SCardConnect(dsa.hCtx,pacReaders[uiReader],SCARD_SHARE_EXCLUSIVE,SCARD_PROTOCOL_T0 | SCARD_PROTOCOL_T1,&(dsa.hCard),(void*)&(dsa.ioCard.dwProtocol)) != SCARD_S_SUCCESS)
if (SCardConnect(as.hCtx,pacReaders[uiReader],SCARD_SHARE_EXCLUSIVE,SCARD_PROTOCOL_T0 | SCARD_PROTOCOL_T1,&(as.hCard),(void*)&(as.ioCard.dwProtocol)) != SCARD_S_SUCCESS)
{
// Connect to ACR122 firmware version >2.0
if (SCardConnect(dsa.hCtx,pacReaders[uiReader],SCARD_SHARE_DIRECT,0,&(dsa.hCard),(void*)&(dsa.ioCard.dwProtocol)) != SCARD_S_SUCCESS)
if (SCardConnect(as.hCtx,pacReaders[uiReader],SCARD_SHARE_DIRECT,0,&(as.hCard),(void*)&(as.ioCard.dwProtocol)) != SCARD_S_SUCCESS)
{
// We can not connect to this device, we will just ignore it
continue;
}
}
// Configure I/O settings for card communication
dsa.ioCard.cbPciLength = sizeof(SCARD_IO_REQUEST);
as.ioCard.cbPciLength = sizeof(SCARD_IO_REQUEST);
// Retrieve the current firmware version
pcFirmware = acr122_firmware((nfc_device_t*)&dsa);
pcFirmware = acr122_firmware((nfc_device_t*)&as);
if (strstr(pcFirmware,FIRMWARE_TEXT) != NULL)
{
// We found a occurence, test if it has the right index
@ -146,14 +146,14 @@ nfc_device_t* acr122_connect(const nfc_device_desc_t* pndd)
}
// Allocate memory and store the device specification
pdsa = malloc(sizeof(dev_spec_acr122));
*pdsa = dsa;
pas = malloc(sizeof(acr122_spec_t));
*pas = as;
// Done, we found the reader we are looking for
pnd = malloc(sizeof(nfc_device_t));
strcpy(pnd->acName,pcFirmware);
pnd->ct = CT_PN532;
pnd->ds = (dev_spec)pdsa;
pnd->nc = NC_PN532;
pnd->nds = (nfc_device_spec_t)pas;
pnd->bActive = true;
pnd->bCrc = true;
pnd->bPar = true;
@ -168,21 +168,21 @@ nfc_device_t* acr122_connect(const nfc_device_desc_t* pndd)
void acr122_disconnect(nfc_device_t* pnd)
{
dev_spec_acr122* pdsa = (dev_spec_acr122*)pnd->ds;
SCardDisconnect(pdsa->hCard,SCARD_LEAVE_CARD);
SCardReleaseContext(pdsa->hCtx);
free(pdsa);
acr122_spec_t* pas = (acr122_spec_t*)pnd->nds;
SCardDisconnect(pas->hCard,SCARD_LEAVE_CARD);
SCardReleaseContext(pas->hCtx);
free(pas);
free(pnd);
}
bool acr122_transceive(const dev_spec ds, const byte_t* pbtTx, const size_t szTxLen, byte_t* pbtRx, size_t* pszRxLen)
bool acr122_transceive(const nfc_device_spec_t nds, const byte_t* pbtTx, const size_t szTxLen, byte_t* pbtRx, size_t* pszRxLen)
{
byte_t abtRxCmd[5] = { 0xFF,0xC0,0x00,0x00 };
size_t szRxCmdLen = sizeof(abtRxCmd);
byte_t abtRxBuf[ACR122_RESPONSE_LEN];
size_t szRxBufLen;
byte_t abtTxBuf[ACR122_WRAP_LEN+ACR122_COMMAND_LEN] = { 0xFF, 0x00, 0x00, 0x00 };
dev_spec_acr122* pdsa = (dev_spec_acr122*)ds;
acr122_spec_t* pas = (acr122_spec_t*)nds;
// Make sure the command does not overflow the send buffer
if (szTxLen > ACR122_COMMAND_LEN) return false;
@ -198,14 +198,14 @@ bool acr122_transceive(const dev_spec ds, const byte_t* pbtTx, const size_t szTx
print_hex(abtTxBuf,szTxLen+5);
#endif
if (pdsa->ioCard.dwProtocol == SCARD_PROTOCOL_UNDEFINED)
if (pas->ioCard.dwProtocol == SCARD_PROTOCOL_UNDEFINED)
{
if (SCardControl(pdsa->hCard,IOCTL_CCID_ESCAPE_SCARD_CTL_CODE,abtTxBuf,szTxLen+5,abtRxBuf,szRxBufLen,(void*)&szRxBufLen) != SCARD_S_SUCCESS) return false;
if (SCardControl(pas->hCard,IOCTL_CCID_ESCAPE_SCARD_CTL_CODE,abtTxBuf,szTxLen+5,abtRxBuf,szRxBufLen,(void*)&szRxBufLen) != SCARD_S_SUCCESS) return false;
} else {
if (SCardTransmit(pdsa->hCard,&(pdsa->ioCard),abtTxBuf,szTxLen+5,NULL,abtRxBuf,(void*)&szRxBufLen) != SCARD_S_SUCCESS) return false;
if (SCardTransmit(pas->hCard,&(pas->ioCard),abtTxBuf,szTxLen+5,NULL,abtRxBuf,(void*)&szRxBufLen) != SCARD_S_SUCCESS) return false;
}
if (pdsa->ioCard.dwProtocol == SCARD_PROTOCOL_T0)
if (pas->ioCard.dwProtocol == SCARD_PROTOCOL_T0)
{
// Make sure we received the byte-count we expected
if (szRxBufLen != 2) return false;
@ -216,7 +216,7 @@ bool acr122_transceive(const dev_spec ds, const byte_t* pbtTx, const size_t szTx
// Retrieve the response bytes
abtRxCmd[4] = abtRxBuf[1];
szRxBufLen = sizeof(abtRxBuf);
if (SCardTransmit(pdsa->hCard,&(pdsa->ioCard),abtRxCmd,szRxCmdLen,NULL,abtRxBuf,(void*)&szRxBufLen) != SCARD_S_SUCCESS) return false;
if (SCardTransmit(pas->hCard,&(pas->ioCard),abtRxCmd,szRxCmdLen,NULL,abtRxBuf,(void*)&szRxBufLen) != SCARD_S_SUCCESS) return false;
}
#ifdef DEBUG
@ -237,20 +237,20 @@ bool acr122_transceive(const dev_spec ds, const byte_t* pbtTx, const size_t szTx
return true;
}
char* acr122_firmware(const dev_spec ds)
char* acr122_firmware(const nfc_device_spec_t nds)
{
byte_t abtGetFw[5] = { 0xFF,0x00,0x48,0x00,0x00 };
uint32_t uiResult;
dev_spec_acr122* pdsa = (dev_spec_acr122*)ds;
acr122_spec_t* pas = (acr122_spec_t*)nds;
static char abtFw[11];
size_t szFwLen = sizeof(abtFw);
memset(abtFw,0x00,szFwLen);
if (pdsa->ioCard.dwProtocol == SCARD_PROTOCOL_UNDEFINED)
if (pas->ioCard.dwProtocol == SCARD_PROTOCOL_UNDEFINED)
{
uiResult = SCardControl(pdsa->hCard,IOCTL_CCID_ESCAPE_SCARD_CTL_CODE,abtGetFw,sizeof(abtGetFw),abtFw,szFwLen,(void*)&szFwLen);
uiResult = SCardControl(pas->hCard,IOCTL_CCID_ESCAPE_SCARD_CTL_CODE,abtGetFw,sizeof(abtGetFw),abtFw,szFwLen,(void*)&szFwLen);
} else {
uiResult = SCardTransmit(pdsa->hCard,&(pdsa->ioCard),abtGetFw,sizeof(abtGetFw),NULL,(byte_t*)abtFw,(void*)&szFwLen);
uiResult = SCardTransmit(pas->hCard,&(pas->ioCard),abtGetFw,sizeof(abtGetFw),NULL,(byte_t*)abtFw,(void*)&szFwLen);
}
#ifdef DEBUG
@ -263,17 +263,17 @@ char* acr122_firmware(const dev_spec ds)
return abtFw;
}
bool acr122_led_red(const dev_spec ds, bool bOn)
bool acr122_led_red(const nfc_device_spec_t nds, bool bOn)
{
byte_t abtLed[9] = { 0xFF,0x00,0x40,0x05,0x04,0x00,0x00,0x00,0x00 };
dev_spec_acr122* pdsa = (dev_spec_acr122*)ds;
acr122_spec_t* pas = (acr122_spec_t*)nds;
byte_t abtBuf[2];
size_t szBufLen = sizeof(abtBuf);
if (pdsa->ioCard.dwProtocol == SCARD_PROTOCOL_UNDEFINED)
if (pas->ioCard.dwProtocol == SCARD_PROTOCOL_UNDEFINED)
{
return (SCardControl(pdsa->hCard,IOCTL_CCID_ESCAPE_SCARD_CTL_CODE,abtLed,sizeof(abtLed),abtBuf,szBufLen,(void*)&szBufLen) == SCARD_S_SUCCESS);
return (SCardControl(pas->hCard,IOCTL_CCID_ESCAPE_SCARD_CTL_CODE,abtLed,sizeof(abtLed),abtBuf,szBufLen,(void*)&szBufLen) == SCARD_S_SUCCESS);
} else {
return (SCardTransmit(pdsa->hCard,&(pdsa->ioCard),abtLed,sizeof(abtLed),NULL,(byte_t*)abtBuf,(void*)&szBufLen) == SCARD_S_SUCCESS);
return (SCardTransmit(pas->hCard,&(pas->ioCard),abtLed,sizeof(abtLed),NULL,(byte_t*)abtBuf,(void*)&szBufLen) == SCARD_S_SUCCESS);
}
}

View file

@ -35,11 +35,11 @@ nfc_device_t* acr122_connect(const nfc_device_desc_t* pndd);
void acr122_disconnect(nfc_device_t* pnd);
// Callback function used by libnfc to transmit commands to the PN53X chip
bool acr122_transceive(const dev_spec ds, const byte_t* pbtTx, const size_t szTxLen, byte_t* pbtRx, size_t* pszRxLen);
bool acr122_transceive(const nfc_device_spec_t nds, const byte_t* pbtTx, const size_t szTxLen, byte_t* pbtRx, size_t* pszRxLen);
// Various additional features this device supports
char* acr122_firmware(const dev_spec ds);
bool acr122_led_red(const dev_spec ds, bool bOn);
char* acr122_firmware(const nfc_device_spec_t nds);
bool acr122_led_red(const nfc_device_spec_t nds, bool bOn);
#endif // _LIBNFC_DEV_ACR122_H_

View file

@ -127,8 +127,8 @@ nfc_device_t* arygon_connect(const nfc_device_desc_t* pndd)
// We have a connection
pnd = malloc(sizeof(nfc_device_t));
strcpy(pnd->acName,"ARYGON");
pnd->ct = CT_PN532;
pnd->ds = (dev_spec)sp;
pnd->nc = NC_PN532;
pnd->nds = (nfc_device_spec_t)sp;
pnd->bActive = true;
pnd->bCrc = true;
pnd->bPar = true;
@ -138,11 +138,11 @@ nfc_device_t* arygon_connect(const nfc_device_desc_t* pndd)
void arygon_disconnect(nfc_device_t* pnd)
{
uart_close((serial_port)pnd->ds);
uart_close((serial_port)pnd->nds);
free(pnd);
}
bool arygon_transceive(const dev_spec ds, const byte_t* pbtTx, const size_t szTxLen, byte_t* pbtRx, size_t* pszRxLen)
bool arygon_transceive(const nfc_device_spec_t nds, const byte_t* pbtTx, const size_t szTxLen, byte_t* pbtRx, size_t* pszRxLen)
{
byte_t abtTxBuf[BUFFER_LENGTH] = { DEV_ARYGON_PROTOCOL_TAMA, 0x00, 0x00, 0xff }; // Every packet must start with "00 00 ff"
byte_t abtRxBuf[BUFFER_LENGTH];
@ -170,7 +170,7 @@ bool arygon_transceive(const dev_spec ds, const byte_t* pbtTx, const size_t szTx
printf(" TX: ");
print_hex(abtTxBuf,szTxLen+8);
#endif
if (!uart_send((serial_port)ds,abtTxBuf,szTxLen+8)) {
if (!uart_send((serial_port)nds,abtTxBuf,szTxLen+8)) {
ERR("Unable to transmit data. (TX)");
return false;
}
@ -190,7 +190,7 @@ bool arygon_transceive(const dev_spec ds, const byte_t* pbtTx, const size_t szTx
* For more information, see Issue 23 on development site : http://code.google.com/p/libnfc/issues/detail?id=23
*/
if (!uart_receive((serial_port)ds,abtRxBuf,&szRxBufLen)) {
if (!uart_receive((serial_port)nds,abtRxBuf,&szRxBufLen)) {
ERR("Unable to receive data. (RX)");
return false;
}

View file

@ -32,7 +32,7 @@ nfc_device_t* arygon_connect(const nfc_device_desc_t* pndd);
void arygon_disconnect(nfc_device_t* pnd);
// Callback function used by libnfc to transmit commands to the PN53X chip
bool arygon_transceive(const dev_spec ds, const byte_t* pbtTx, const size_t szTxLen, byte_t* pbtRx, size_t* pszRxLen);
bool arygon_transceive(const nfc_device_spec_t nds, const byte_t* pbtTx, const size_t szTxLen, byte_t* pbtRx, size_t* pszRxLen);
#endif // _LIBNFC_DEV_ARYGON_H_

View file

@ -44,10 +44,10 @@ typedef struct {
usb_dev_handle* pudh;
uint32_t uiEndPointIn;
uint32_t uiEndPointOut;
} dev_spec_pn531_usb;
} usb_spec_t;
// Find transfer endpoints for bulk transfers
static void get_end_points(struct usb_device *dev, dev_spec_pn531_usb* pdsp)
static void get_end_points(struct usb_device *dev, usb_spec_t* pus)
{
uint32_t uiIndex;
uint32_t uiEndPoint;
@ -68,7 +68,7 @@ static void get_end_points(struct usb_device *dev, dev_spec_pn531_usb* pdsp)
#ifdef DEBUG
printf("Bulk endpoint in : 0x%02X\n", uiEndPoint);
#endif
pdsp->uiEndPointIn = uiEndPoint;
pus->uiEndPointIn = uiEndPoint;
}
// Test if we dealing with a bulk OUT endpoint
@ -77,7 +77,7 @@ static void get_end_points(struct usb_device *dev, dev_spec_pn531_usb* pdsp)
#ifdef DEBUG
printf("Bulk endpoint in : 0x%02X\n", uiEndPoint);
#endif
pdsp->uiEndPointOut = uiEndPoint;
pus->uiEndPointOut = uiEndPoint;
}
}
}
@ -91,13 +91,13 @@ nfc_device_t* pn531_usb_connect(const nfc_device_desc_t* pndd)
struct usb_bus *bus;
struct usb_device *dev;
nfc_device_t* pnd = INVALID_DEVICE_INFO;
dev_spec_pn531_usb* pdsp;
dev_spec_pn531_usb dsp;
usb_spec_t* pus;
usb_spec_t us;
uint32_t uiDevIndex;
dsp.uiEndPointIn = 0;
dsp.uiEndPointOut = 0;
dsp.pudh = NULL;
us.uiEndPointIn = 0;
us.uiEndPointOut = 0;
us.pudh = NULL;
usb_init();
if (usb_find_busses() < 0) return INVALID_DEVICE_INFO;
@ -130,29 +130,29 @@ nfc_device_t* pn531_usb_connect(const nfc_device_desc_t* pndd)
DBG("Found PN531 device");
// Open the PN531 USB device
dsp.pudh = usb_open(dev);
us.pudh = usb_open(dev);
get_end_points(dev,&dsp);
if(usb_set_configuration(dsp.pudh,1) < 0)
get_end_points(dev,&us);
if(usb_set_configuration(us.pudh,1) < 0)
{
DBG("Set config failed");
usb_close(dsp.pudh);
usb_close(us.pudh);
return INVALID_DEVICE_INFO;
}
if(usb_claim_interface(dsp.pudh,0) < 0)
if(usb_claim_interface(us.pudh,0) < 0)
{
DBG("Can't claim interface");
usb_close(dsp.pudh);
usb_close(us.pudh);
return INVALID_DEVICE_INFO;
}
// Allocate memory for the device info and specification, fill it and return the info
pdsp = malloc(sizeof(dev_spec_pn531_usb));
*pdsp = dsp;
pus = malloc(sizeof(usb_spec_t));
*pus = us;
pnd = malloc(sizeof(nfc_device_t));
strcpy(pnd->acName,"PN531USB");
pnd->ct = CT_PN531;
pnd->ds = (dev_spec)pdsp;
pnd->nc = NC_PN531;
pnd->nds = (nfc_device_spec_t)pus;
pnd->bActive = true;
pnd->bCrc = true;
pnd->bPar = true;
@ -166,20 +166,20 @@ nfc_device_t* pn531_usb_connect(const nfc_device_desc_t* pndd)
void pn531_usb_disconnect(nfc_device_t* pnd)
{
dev_spec_pn531_usb* pdsp = (dev_spec_pn531_usb*)pnd->ds;
usb_release_interface(pdsp->pudh,0);
usb_close(pdsp->pudh);
free(pnd->ds);
usb_spec_t* pus = (usb_spec_t*)pnd->nds;
usb_release_interface(pus->pudh,0);
usb_close(pus->pudh);
free(pnd->nds);
free(pnd);
}
bool pn531_usb_transceive(const dev_spec ds, const byte_t* pbtTx, const size_t szTxLen, byte_t* pbtRx, size_t* pszRxLen)
bool pn531_usb_transceive(const nfc_device_spec_t nds, const byte_t* pbtTx, const size_t szTxLen, byte_t* pbtRx, size_t* pszRxLen)
{
size_t uiPos = 0;
int ret = 0;
byte_t abtTx[BUFFER_LENGTH] = { 0x00, 0x00, 0xff }; // Every packet must start with "00 00 ff"
byte_t abtRx[BUFFER_LENGTH];
dev_spec_pn531_usb* pdsp = (dev_spec_pn531_usb*)ds;
usb_spec_t* pus = (usb_spec_t*)nds;
// Packet length = data length (len) + checksum (1) + end of stream marker (1)
abtTx[3] = szTxLen;
@ -203,7 +203,7 @@ bool pn531_usb_transceive(const dev_spec ds, const byte_t* pbtTx, const size_t s
print_hex(abtTx,szTxLen+7);
#endif
ret = usb_bulk_write(pdsp->pudh, pdsp->uiEndPointOut, (char*)abtTx, szTxLen+7, USB_TIMEOUT);
ret = usb_bulk_write(pus->pudh, pus->uiEndPointOut, (char*)abtTx, szTxLen+7, USB_TIMEOUT);
if( ret < 0 )
{
#ifdef DEBUG
@ -212,7 +212,7 @@ bool pn531_usb_transceive(const dev_spec ds, const byte_t* pbtTx, const size_t s
return false;
}
ret = usb_bulk_read(pdsp->pudh, pdsp->uiEndPointIn, (char*)abtRx, BUFFER_LENGTH, USB_TIMEOUT);
ret = usb_bulk_read(pus->pudh, pus->uiEndPointIn, (char*)abtRx, BUFFER_LENGTH, USB_TIMEOUT);
if( ret < 0 )
{
#ifdef DEBUG
@ -228,7 +228,7 @@ bool pn531_usb_transceive(const dev_spec ds, const byte_t* pbtTx, const size_t s
if( ret == 6 )
{
ret = usb_bulk_read(pdsp->pudh, pdsp->uiEndPointIn, (char*)abtRx, BUFFER_LENGTH, USB_TIMEOUT);
ret = usb_bulk_read(pus->pudh, pus->uiEndPointIn, (char*)abtRx, BUFFER_LENGTH, USB_TIMEOUT);
if( ret < 0 )
{
#ifdef DEBUG

View file

@ -35,7 +35,7 @@ nfc_device_t* pn531_usb_connect(const nfc_device_desc_t* pndd);
void pn531_usb_disconnect(nfc_device_t* pnd);
// Callback function used by libnfc to transmit commands to the PN53X chip
bool pn531_usb_transceive(const dev_spec ds, const byte_t* pbtTx, const size_t szTxLen, byte_t* pbtRx, size_t* pszRxLen);
bool pn531_usb_transceive(const nfc_device_spec_t nds, const byte_t* pbtTx, const size_t szTxLen, byte_t* pbtRx, size_t* pszRxLen);
#endif // _LIBNFC_DEV_PN531_H_

View file

@ -120,8 +120,8 @@ nfc_device_t* pn532_uart_connect(const nfc_device_desc_t* pndd)
// We have a connection
pnd = malloc(sizeof(nfc_device_t));
strcpy(pnd->acName,"PN532_UART");
pnd->ct = CT_PN532;
pnd->ds = (dev_spec)sp;
pnd->nc = NC_PN532;
pnd->nds = (nfc_device_spec_t)sp;
pnd->bActive = true;
pnd->bCrc = true;
pnd->bPar = true;
@ -131,11 +131,11 @@ nfc_device_t* pn532_uart_connect(const nfc_device_desc_t* pndd)
void pn532_uart_disconnect(nfc_device_t* pnd)
{
uart_close((serial_port)pnd->ds);
uart_close((serial_port)pnd->nds);
free(pnd);
}
bool pn532_uart_transceive(const dev_spec ds, const byte_t* pbtTx, const size_t szTxLen, byte_t* pbtRx, size_t* pszRxLen)
bool pn532_uart_transceive(const nfc_device_spec_t nds, const byte_t* pbtTx, const size_t szTxLen, byte_t* pbtRx, size_t* pszRxLen)
{
byte_t abtTxBuf[BUFFER_LENGTH] = { 0x00, 0x00, 0xff }; // Every packet must start with "00 00 ff"
byte_t abtRxBuf[BUFFER_LENGTH];
@ -163,7 +163,7 @@ bool pn532_uart_transceive(const dev_spec ds, const byte_t* pbtTx, const size_t
printf(" TX: ");
print_hex(abtTxBuf,szTxLen+7);
#endif
if (!uart_send((serial_port)ds,abtTxBuf,szTxLen+7)) {
if (!uart_send((serial_port)nds,abtTxBuf,szTxLen+7)) {
ERR("Unable to transmit data. (TX)");
return false;
}
@ -178,7 +178,7 @@ bool pn532_uart_transceive(const dev_spec ds, const byte_t* pbtTx, const size_t
*/
delay_ms(30);
if (!uart_receive((serial_port)ds,abtRxBuf,&szRxBufLen)) {
if (!uart_receive((serial_port)nds,abtRxBuf,&szRxBufLen)) {
ERR("Unable to receive data. (RX)");
return false;
}

View file

@ -32,7 +32,7 @@ nfc_device_t* pn532_uart_connect(const nfc_device_desc_t* pndd);
void pn532_uart_disconnect(nfc_device_t* pnd);
// Callback function used by libnfc to transmit commands to the PN53X chip
bool pn532_uart_transceive(const dev_spec ds, const byte_t* pbtTx, const size_t szTxLen, byte_t* pbtRx, size_t* pszRxLen);
bool pn532_uart_transceive(const nfc_device_spec_t nds, const byte_t* pbtTx, const size_t szTxLen, byte_t* pbtRx, size_t* pszRxLen);
#endif // _LIBNFC_DEV_PN532_UART_H_

View file

@ -43,10 +43,10 @@ typedef struct {
usb_dev_handle* pudh;
uint32_t uiEndPointIn;
uint32_t uiEndPointOut;
} dev_spec_pn533_usb;
} usb_spec_t;
// Find transfer endpoints for bulk transfers
static void get_end_points(struct usb_device *dev, dev_spec_pn533_usb* pdsp)
static void get_end_points(struct usb_device *dev, usb_spec_t* pus)
{
uint32_t uiIndex;
uint32_t uiEndPoint;
@ -67,7 +67,7 @@ static void get_end_points(struct usb_device *dev, dev_spec_pn533_usb* pdsp)
#ifdef DEBUG
printf("Bulk endpoint in : 0x%02X\n", uiEndPoint);
#endif
pdsp->uiEndPointIn = uiEndPoint;
pus->uiEndPointIn = uiEndPoint;
}
// Test if we dealing with a bulk OUT endpoint
@ -76,7 +76,7 @@ static void get_end_points(struct usb_device *dev, dev_spec_pn533_usb* pdsp)
#ifdef DEBUG
printf("Bulk endpoint in : 0x%02X\n", uiEndPoint);
#endif
pdsp->uiEndPointOut = uiEndPoint;
pus->uiEndPointOut = uiEndPoint;
}
}
}
@ -88,13 +88,13 @@ nfc_device_t* pn533_usb_connect(const nfc_device_desc_t* pndd)
struct usb_bus *bus;
struct usb_device *dev;
nfc_device_t* pnd = INVALID_DEVICE_INFO;
dev_spec_pn533_usb* pdsp;
dev_spec_pn533_usb dsp;
usb_spec_t* pus;
usb_spec_t us;
uint32_t uiDevIndex;
dsp.uiEndPointIn = 0;
dsp.uiEndPointOut = 0;
dsp.pudh = NULL;
us.uiEndPointIn = 0;
us.uiEndPointOut = 0;
us.pudh = NULL;
usb_init();
if (usb_find_busses() < 0) return INVALID_DEVICE_INFO;
@ -126,29 +126,29 @@ nfc_device_t* pn533_usb_connect(const nfc_device_desc_t* pndd)
DBG("Found PN533 device");
// Open the PN533 USB device
dsp.pudh = usb_open(dev);
us.pudh = usb_open(dev);
get_end_points(dev,&dsp);
if(usb_set_configuration(dsp.pudh,1) < 0)
get_end_points(dev,&us);
if(usb_set_configuration(us.pudh,1) < 0)
{
DBG("Setting config failed");
usb_close(dsp.pudh);
usb_close(us.pudh);
return INVALID_DEVICE_INFO;
}
if(usb_claim_interface(dsp.pudh,0) < 0)
if(usb_claim_interface(us.pudh,0) < 0)
{
DBG("Can't claim interface");
usb_close(dsp.pudh);
usb_close(us.pudh);
return INVALID_DEVICE_INFO;
}
// Allocate memory for the device info and specification, fill it and return the info
pdsp = malloc(sizeof(dev_spec_pn533_usb));
*pdsp = dsp;
pus = malloc(sizeof(usb_spec_t));
*pus = us;
pnd = malloc(sizeof(nfc_device_t));
strcpy(pnd->acName,"PN533USB");
pnd->ct = CT_PN533;
pnd->ds = (dev_spec)pdsp;
pnd->nc = NC_PN533;
pnd->nds = (nfc_device_spec_t)pus;
pnd->bActive = true;
pnd->bCrc = true;
pnd->bPar = true;
@ -162,20 +162,20 @@ nfc_device_t* pn533_usb_connect(const nfc_device_desc_t* pndd)
void pn533_usb_disconnect(nfc_device_t* pnd)
{
dev_spec_pn533_usb* pdsp = (dev_spec_pn533_usb*)pnd->ds;
usb_release_interface(pdsp->pudh,0);
usb_close(pdsp->pudh);
free(pnd->ds);
usb_spec_t* pus = (usb_spec_t*)pnd->nds;
usb_release_interface(pus->pudh,0);
usb_close(pus->pudh);
free(pnd->nds);
free(pnd);
}
bool pn533_usb_transceive(const dev_spec ds, const byte_t* pbtTx, const size_t szTxLen, byte_t* pbtRx, size_t* pszRxLen)
bool pn533_usb_transceive(const nfc_device_spec_t nds, const byte_t* pbtTx, const size_t szTxLen, byte_t* pbtRx, size_t* pszRxLen)
{
size_t uiPos = 0;
int ret = 0;
byte_t abtTx[BUFFER_LENGTH] = { 0x00, 0x00, 0xff }; // Every packet must start with "00 00 ff"
byte_t abtRx[BUFFER_LENGTH];
dev_spec_pn533_usb* pdsp = (dev_spec_pn533_usb*)ds;
usb_spec_t* pus = (usb_spec_t*)nds;
// Packet length = data length (len) + checksum (1) + end of stream marker (1)
abtTx[3] = szTxLen;
@ -199,7 +199,7 @@ bool pn533_usb_transceive(const dev_spec ds, const byte_t* pbtTx, const size_t s
print_hex(abtTx,szTxLen+7);
#endif
ret = usb_bulk_write(pdsp->pudh, pdsp->uiEndPointOut, (char*)abtTx, szTxLen+7, USB_TIMEOUT);
ret = usb_bulk_write(pus->pudh, pus->uiEndPointOut, (char*)abtTx, szTxLen+7, USB_TIMEOUT);
if( ret < 0 )
{
#ifdef DEBUG
@ -208,7 +208,7 @@ bool pn533_usb_transceive(const dev_spec ds, const byte_t* pbtTx, const size_t s
return false;
}
ret = usb_bulk_read(pdsp->pudh, pdsp->uiEndPointIn, (char*)abtRx, BUFFER_LENGTH, USB_TIMEOUT);
ret = usb_bulk_read(pus->pudh, pus->uiEndPointIn, (char*)abtRx, BUFFER_LENGTH, USB_TIMEOUT);
if( ret < 0 )
{
#ifdef DEBUG
@ -224,7 +224,7 @@ bool pn533_usb_transceive(const dev_spec ds, const byte_t* pbtTx, const size_t s
if( ret == 6 )
{
ret = usb_bulk_read(pdsp->pudh, pdsp->uiEndPointIn, (char*)abtRx, BUFFER_LENGTH, USB_TIMEOUT);
ret = usb_bulk_read(pus->pudh, pus->uiEndPointIn, (char*)abtRx, BUFFER_LENGTH, USB_TIMEOUT);
if( ret < 0 )
{
#ifdef DEBUG

View file

@ -32,7 +32,7 @@ nfc_device_t* pn533_usb_connect(const nfc_device_desc_t* pndd);
void pn533_usb_disconnect(nfc_device_t* pnd);
// Callback function used by libnfc to transmit commands to the PN53X chip
bool pn533_usb_transceive(const dev_spec ds, const byte_t* pbtTx, const size_t szTxLen, byte_t* pbtRx, size_t* pszRxLen);
bool pn533_usb_transceive(const nfc_device_spec_t nds, const byte_t* pbtTx, const size_t szTxLen, byte_t* pbtRx, size_t* pszRxLen);
#endif // _LIBNFC_DEV_PN533_H_

View file

@ -37,14 +37,14 @@
typedef uint8_t byte_t;
typedef enum {
CT_PN531 = 0x10,
CT_PN532 = 0x20,
CT_PN533 = 0x30,
} chip_type;
NC_PN531 = 0x10,
NC_PN532 = 0x20,
NC_PN533 = 0x30,
} nfc_chip_t;
struct driver_callbacks; // Prototype the callback struct
typedef void* dev_spec; // Device connection specification
typedef void* nfc_device_spec_t; // Device connection specification
#define DEVICE_NAME_LENGTH 256
/**
@ -57,9 +57,9 @@ typedef struct {
/** Device name string, including device wrapper firmware */
char acName[DEVICE_NAME_LENGTH];
/** PN53X chip type, this is useful for some "bug" work-arounds */
chip_type ct;
nfc_chip_t nc;
/** Pointer to the device connection specification */
dev_spec ds;
nfc_device_spec_t nds;
/** This represents if the PN53X device was initialized succesful */
bool bActive;
/** Is the crc automaticly added, checked and removed from the frames */
@ -98,7 +98,7 @@ struct driver_callbacks {
/** Connect callback */
nfc_device_t* (*connect)(const nfc_device_desc_t* pndd);
/** Transceive callback */
bool (*transceive)(const dev_spec ds, const byte_t* pbtTx, const size_t szTxLen, byte_t* pbtRx, size_t* pszRxLen);
bool (*transceive)(const nfc_device_spec_t nds, const byte_t* pbtTx, const size_t szTxLen, byte_t* pbtRx, size_t* pszRxLen);
/** Disconnect callback */
void (*disconnect)(nfc_device_t* pnd);
};

View file

@ -115,7 +115,7 @@ bool pn53x_transceive(const nfc_device_t* pnd, const byte_t* pbtTx, const size_t
*pszRxLen = MAX_FRAME_LEN;
// Call the tranceive callback function of the current device
if (!pnd->pdc->transceive(pnd->ds,pbtTx,szTxLen,pbtRx,pszRxLen)) return false;
if (!pnd->pdc->transceive(pnd->nds,pbtTx,szTxLen,pbtRx,pszRxLen)) return false;
// Make sure there was no failure reported by the PN53X chip (0x00 == OK)
if (pbtRx[0] != 0) return false;
@ -134,7 +134,7 @@ byte_t pn53x_get_reg(const nfc_device_t* pnd, uint16_t ui16Reg)
abtCmd[2] = ui16Reg >> 8;
abtCmd[3] = ui16Reg & 0xff;
// We can not use pn53x_transceive() because abtRx[0] gives no status info
pnd->pdc->transceive(pnd->ds,abtCmd,4,&ui8Value,&szValueLen);
pnd->pdc->transceive(pnd->nds,abtCmd,4,&ui8Value,&szValueLen);
return ui8Value;
}
@ -147,7 +147,7 @@ bool pn53x_set_reg(const nfc_device_t* pnd, uint16_t ui16Reg, uint8_t ui8SybmolM
abtCmd[3] = ui16Reg & 0xff;
abtCmd[4] = ui8Value | (pn53x_get_reg(pnd,ui16Reg) & (~ui8SybmolMask));
// We can not use pn53x_transceive() because abtRx[0] gives no status info
return pnd->pdc->transceive(pnd->ds,abtCmd,5,NULL,NULL);
return pnd->pdc->transceive(pnd->nds,abtCmd,5,NULL,NULL);
}
bool pn53x_set_parameters(const nfc_device_t* pnd, uint8_t ui8Value)
@ -157,7 +157,7 @@ bool pn53x_set_parameters(const nfc_device_t* pnd, uint8_t ui8Value)
abtCmd[2] = ui8Value;
// We can not use pn53x_transceive() because abtRx[0] gives no status info
return pnd->pdc->transceive(pnd->ds,abtCmd,3,NULL,NULL);
return pnd->pdc->transceive(pnd->nds,abtCmd,3,NULL,NULL);
}
bool pn53x_set_tx_bits(const nfc_device_t* pnd, uint8_t ui8Bits)
@ -310,7 +310,7 @@ nfc_device_t* nfc_connect(nfc_device_desc_t* pndd)
// Try to retrieve PN53x chip revision
// We can not use pn53x_transceive() because abtRx[0] gives no status info
if (!pnd->pdc->transceive(pnd->ds,pncmd_get_firmware_version,2,abtFw,&szFwLen))
if (!pnd->pdc->transceive(pnd->nds,pncmd_get_firmware_version,2,abtFw,&szFwLen))
{
// Failed to get firmware revision??, whatever...let's disconnect and clean up and return err
ERR("Failed to get firmware revision for: %s", pnd->acName);
@ -319,11 +319,11 @@ nfc_device_t* nfc_connect(nfc_device_desc_t* pndd)
}
// Add the firmware revision to the device name, PN531 gives 2 bytes info, but PN532 gives 4
switch(pnd->ct)
switch(pnd->nc)
{
case CT_PN531: sprintf(pnd->acName,"%s - PN531 v%d.%d",pnd->acName,abtFw[0],abtFw[1]); break;
case CT_PN532: sprintf(pnd->acName,"%s - PN532 v%d.%d (0x%02x)",pnd->acName,abtFw[1],abtFw[2],abtFw[3]); break;
case CT_PN533: sprintf(pnd->acName,"%s - PN533 v%d.%d (0x%02x)",pnd->acName,abtFw[1],abtFw[2],abtFw[3]); break;
case NC_PN531: sprintf(pnd->acName,"%s - PN531 v%d.%d",pnd->acName,abtFw[0],abtFw[1]); break;
case NC_PN532: sprintf(pnd->acName,"%s - PN532 v%d.%d (0x%02x)",pnd->acName,abtFw[1],abtFw[2],abtFw[3]); break;
case NC_PN533: sprintf(pnd->acName,"%s - PN533 v%d.%d (0x%02x)",pnd->acName,abtFw[1],abtFw[2],abtFw[3]); break;
}
// Reset the ending transmission bits register, it is unknown what the last tranmission used there
@ -384,7 +384,7 @@ bool nfc_configure(nfc_device_t* pnd, const dev_config_option dco, const bool bE
abtCmd[2] = RFCI_FIELD;
abtCmd[3] = (bEnable) ? 1 : 0;
// We can not use pn53x_transceive() because abtRx[0] gives no status info
if (!pnd->pdc->transceive(pnd->ds,abtCmd,4,NULL,NULL)) return false;
if (!pnd->pdc->transceive(pnd->nds,abtCmd,4,NULL,NULL)) return false;
break;
case DCO_ACTIVATE_CRYPTO1:
@ -399,7 +399,7 @@ bool nfc_configure(nfc_device_t* pnd, const dev_config_option dco, const bool bE
abtCmd[4] = (bEnable) ? 0xff : 0x00; // MxRtyPSL, default: 0x01
abtCmd[5] = (bEnable) ? 0xff : 0x00; // MxRtyPassiveActivation, default: 0xff
// We can not use pn53x_transceive() because abtRx[0] gives no status info
if (!pnd->pdc->transceive(pnd->ds,abtCmd,6,NULL,NULL)) return false;
if (!pnd->pdc->transceive(pnd->nds,abtCmd,6,NULL,NULL)) return false;
break;
case DCO_ACCEPT_INVALID_FRAMES:
@ -536,7 +536,7 @@ bool nfc_initiator_select_tag(const nfc_device_t* pnd, const init_modulation im,
// Try to find a tag, call the tranceive callback function of the current device
szRxLen = MAX_FRAME_LEN;
// We can not use pn53x_transceive() because abtRx[0] gives no status info
if (!pnd->pdc->transceive(pnd->ds,abtCmd,4+szInitLen,abtRx,&szRxLen)) return false;
if (!pnd->pdc->transceive(pnd->nds,abtCmd,4+szInitLen,abtRx,&szRxLen)) return false;
// Make sure one tag has been found, the PN53X returns 0x00 if none was available
if (abtRx[0] != 1) return false;
@ -549,7 +549,7 @@ bool nfc_initiator_select_tag(const nfc_device_t* pnd, const init_modulation im,
{
case IM_ISO14443A_106:
// Somehow they switched the lower and upper ATQA bytes around for the PN531 chipset
if (pnd->ct == CT_PN531)
if (pnd->nc == NC_PN531)
{
pti->tia.abtAtqa[0] = abtRx[3];
pti->tia.abtAtqa[1] = abtRx[2];
@ -839,7 +839,7 @@ bool nfc_target_init(const nfc_device_t* pnd, byte_t* pbtRx, size_t* pszRxBits)
// Request the initialization as a target, we can not use pn53x_transceive() because
// abtRx[0] contains the emulation mode (baudrate, 14443-4?, DEP and framing type)
szRxLen = MAX_FRAME_LEN;
if (!pnd->pdc->transceive(pnd->ds,abtCmd,39,abtRx,&szRxLen)) return false;
if (!pnd->pdc->transceive(pnd->nds,abtCmd,39,abtRx,&szRxLen)) return false;
// Get the last bit-count that is stored in the received byte
ui8Bits = pn53x_get_reg(pnd,REG_CIU_CONTROL) & SYMBOL_RX_LAST_BITS;