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:
parent
8a579c3aab
commit
2a0ff6c5d0
15 changed files with 713 additions and 441 deletions
|
@ -21,8 +21,6 @@ case "$host" in
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
AC_PROG_RANLIB
|
|
||||||
|
|
||||||
AC_PATH_PROG(PKG_CONFIG, pkg-config)
|
AC_PATH_PROG(PKG_CONFIG, pkg-config)
|
||||||
|
|
||||||
# Checks for header files.
|
# Checks for header files.
|
||||||
|
|
673
install-sh
673
install-sh
|
@ -1,276 +1,519 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
|
||||||
# install - install a program, script, or datafile
|
# 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
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
# documentation for any purpose is hereby granted without fee, provided that
|
# of this software and associated documentation files (the "Software"), to
|
||||||
# the above copyright notice appear in all copies and that both that
|
# deal in the Software without restriction, including without limitation the
|
||||||
# copyright notice and this permission notice appear in supporting
|
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||||
# documentation, and that the name of M.I.T. not be used in advertising or
|
# sell copies of the Software, and to permit persons to whom the Software is
|
||||||
# publicity pertaining to distribution of the software without specific,
|
# furnished to do so, subject to the following conditions:
|
||||||
# written prior permission. M.I.T. makes no representations about the
|
#
|
||||||
# suitability of this software for any purpose. It is provided "as is"
|
# The above copyright notice and this permission notice shall be included in
|
||||||
# without express or implied warranty.
|
# 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
|
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||||
# `make' implicit rules from creating a file called install from it
|
# `make' implicit rules from creating a file called install from it
|
||||||
# when there is no Makefile.
|
# when there is no Makefile.
|
||||||
#
|
#
|
||||||
# This script is compatible with the BSD install script, but was written
|
# 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
|
# from scratch.
|
||||||
# shared with many OS's install programs.
|
|
||||||
|
|
||||||
|
nl='
|
||||||
|
'
|
||||||
|
IFS=" "" $nl"
|
||||||
|
|
||||||
# set DOITPROG to echo to test this script
|
# set DOITPROG to echo to test this script
|
||||||
|
|
||||||
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
# 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}"
|
posix_glob='?'
|
||||||
cpprog="${CPPROG-cp}"
|
initialize_posix_glob='
|
||||||
chmodprog="${CHMODPROG-chmod}"
|
test "$posix_glob" != "?" || {
|
||||||
chownprog="${CHOWNPROG-chown}"
|
if (set -f) 2>/dev/null; then
|
||||||
chgrpprog="${CHGRPPROG-chgrp}"
|
posix_glob=
|
||||||
stripprog="${STRIPPROG-strip}"
|
else
|
||||||
rmprog="${RMPROG-rm}"
|
posix_glob=:
|
||||||
mkdirprog="${MKDIRPROG-mkdir}"
|
fi
|
||||||
|
}
|
||||||
|
'
|
||||||
|
|
||||||
transformbasename=""
|
posix_mkdir=
|
||||||
transform_arg=""
|
|
||||||
instcmd="$mvprog"
|
# Desired mode of installed file.
|
||||||
chmodcmd="$chmodprog 0755"
|
mode=0755
|
||||||
chowncmd=""
|
|
||||||
chgrpcmd=""
|
chgrpcmd=
|
||||||
stripcmd=""
|
chmodcmd=$chmodprog
|
||||||
|
chowncmd=
|
||||||
|
mvcmd=$mvprog
|
||||||
rmcmd="$rmprog -f"
|
rmcmd="$rmprog -f"
|
||||||
mvcmd="$mvprog"
|
stripcmd=
|
||||||
src=""
|
|
||||||
dst=""
|
|
||||||
dir_arg=""
|
|
||||||
|
|
||||||
while [ x"$1" != x ]; do
|
src=
|
||||||
|
dst=
|
||||||
|
dir_arg=
|
||||||
|
dst_arg=
|
||||||
|
|
||||||
|
copy_on_change=false
|
||||||
|
no_target_directory=
|
||||||
|
|
||||||
|
usage="\
|
||||||
|
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
|
||||||
|
or: $0 [OPTION]... SRCFILES... DIRECTORY
|
||||||
|
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
|
||||||
|
or: $0 [OPTION]... -d DIRECTORIES...
|
||||||
|
|
||||||
|
In the 1st form, copy SRCFILE to DSTFILE.
|
||||||
|
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
|
||||||
|
In the 4th, create DIRECTORIES.
|
||||||
|
|
||||||
|
Options:
|
||||||
|
--help display this help and exit.
|
||||||
|
--version display version info and exit.
|
||||||
|
|
||||||
|
-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.
|
||||||
|
|
||||||
|
Environment variables override the default commands:
|
||||||
|
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
|
||||||
|
RMPROG STRIPPROG
|
||||||
|
"
|
||||||
|
|
||||||
|
while test $# -ne 0; do
|
||||||
case $1 in
|
case $1 in
|
||||||
-c) instcmd=$cpprog
|
-c) ;;
|
||||||
shift
|
|
||||||
continue;;
|
|
||||||
|
|
||||||
-d) dir_arg=true
|
-C) copy_on_change=true;;
|
||||||
shift
|
|
||||||
continue;;
|
|
||||||
|
|
||||||
-m) chmodcmd="$chmodprog $2"
|
-d) dir_arg=true;;
|
||||||
shift
|
|
||||||
shift
|
|
||||||
continue;;
|
|
||||||
|
|
||||||
-o) chowncmd="$chownprog $2"
|
|
||||||
shift
|
|
||||||
shift
|
|
||||||
continue;;
|
|
||||||
|
|
||||||
-g) chgrpcmd="$chgrpprog $2"
|
-g) chgrpcmd="$chgrpprog $2"
|
||||||
shift
|
shift;;
|
||||||
shift
|
|
||||||
continue;;
|
|
||||||
|
|
||||||
-s) stripcmd=$stripprog
|
--help) echo "$usage"; exit $?;;
|
||||||
shift
|
|
||||||
continue;;
|
|
||||||
|
|
||||||
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
|
-m) mode=$2
|
||||||
shift
|
case $mode in
|
||||||
continue;;
|
*' '* | *' '* | *'
|
||||||
|
'* | *'*'* | *'?'* | *'['*)
|
||||||
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
|
echo "$0: invalid mode: $mode" >&2
|
||||||
shift
|
exit 1;;
|
||||||
continue;;
|
|
||||||
|
|
||||||
*) if [ x"$src" = x ]
|
|
||||||
then
|
|
||||||
src=$1
|
|
||||||
else
|
|
||||||
# this colon is to work around a 386BSD /bin/sh bug
|
|
||||||
:
|
|
||||||
dst=$1
|
|
||||||
fi
|
|
||||||
shift
|
|
||||||
continue;;
|
|
||||||
esac
|
esac
|
||||||
done
|
shift;;
|
||||||
|
|
||||||
if [ x"$src" = x ]
|
-o) chowncmd="$chownprog $2"
|
||||||
then
|
shift;;
|
||||||
echo "$0: no input file specified" >&2
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
:
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ x"$dir_arg" != x ]; then
|
-s) stripcmd=$stripprog;;
|
||||||
dst=$src
|
|
||||||
src=""
|
|
||||||
|
|
||||||
if [ -d "$dst" ]; then
|
-t) dst_arg=$2
|
||||||
instcmd=:
|
shift;;
|
||||||
chmodcmd=""
|
|
||||||
else
|
|
||||||
instcmd=$mkdirprog
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
|
|
||||||
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
|
-T) no_target_directory=true;;
|
||||||
# might cause directories to be created, which would be especially bad
|
|
||||||
# if $src (and thus $dsttmp) contains '*'.
|
|
||||||
|
|
||||||
if [ -f "$src" ] || [ -d "$src" ]
|
--version) echo "$0 $scriptversion"; exit $?;;
|
||||||
then
|
|
||||||
:
|
|
||||||
else
|
|
||||||
echo "$0: $src does not exist" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ x"$dst" = x ]
|
--) shift
|
||||||
then
|
break;;
|
||||||
echo "$0: no destination specified" >&2
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
:
|
|
||||||
fi
|
|
||||||
|
|
||||||
# If destination is a directory, append the input filename; if your system
|
-*) echo "$0: invalid option: $1" >&2
|
||||||
# does not like double slashes in filenames, you may need to add some logic
|
exit 1;;
|
||||||
|
|
||||||
if [ -d "$dst" ]
|
*) break;;
|
||||||
then
|
esac
|
||||||
dst=$dst/`basename "$src"`
|
|
||||||
else
|
|
||||||
:
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
## this sed command emulates the dirname command
|
|
||||||
dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
|
|
||||||
|
|
||||||
# Make sure that the destination directory exists.
|
|
||||||
# this part is taken from Noah Friedman's mkinstalldirs script
|
|
||||||
|
|
||||||
# Skip lots of stat calls in the usual case.
|
|
||||||
if [ ! -d "$dstdir" ]; then
|
|
||||||
defaultIFS='
|
|
||||||
'
|
|
||||||
IFS="${IFS-$defaultIFS}"
|
|
||||||
|
|
||||||
oIFS=$IFS
|
|
||||||
# Some sh's can't handle IFS=/ for some reason.
|
|
||||||
IFS='%'
|
|
||||||
set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
|
|
||||||
IFS=$oIFS
|
|
||||||
|
|
||||||
pathcomp=''
|
|
||||||
|
|
||||||
while [ $# -ne 0 ] ; do
|
|
||||||
pathcomp=$pathcomp$1
|
|
||||||
shift
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
if [ ! -d "$pathcomp" ] ;
|
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
|
||||||
then
|
# When -d is used, all remaining arguments are directories to create.
|
||||||
$mkdirprog "$pathcomp"
|
# When -t is used, the destination is already specified.
|
||||||
else
|
# 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
|
fi
|
||||||
|
shift # arg
|
||||||
pathcomp=$pathcomp/
|
dst_arg=$arg
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ x"$dir_arg" != x ]
|
if test $# -eq 0; then
|
||||||
then
|
if test -z "$dir_arg"; then
|
||||||
$doit $instcmd "$dst" &&
|
echo "$0: no input file specified." >&2
|
||||||
|
exit 1
|
||||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dst"; else : ; fi &&
|
fi
|
||||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dst"; else : ; fi &&
|
# It's OK to call `install-sh -d' without argument.
|
||||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dst"; else : ; fi &&
|
# This can happen when creating conditional directories.
|
||||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dst"; else : ; fi
|
exit 0
|
||||||
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
|
fi
|
||||||
|
|
||||||
# don't allow the sed command to completely eliminate the filename
|
if test -z "$dir_arg"; then
|
||||||
|
|
||||||
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
|
trap '(exit $?); exit' 1 2 13 15
|
||||||
|
|
||||||
# Move or copy the file name to the temp name
|
# 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;;
|
||||||
|
|
||||||
$doit $instcmd "$src" "$dsttmp" &&
|
*[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
|
||||||
|
|
||||||
# and set any options; do chmod last to preserve setuid bits
|
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
|
||||||
|
|
||||||
|
# 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
|
||||||
|
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'
|
||||||
|
`
|
||||||
|
|
||||||
|
test -d "$dstdir"
|
||||||
|
dstdir_status=$?
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
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
|
||||||
|
mkdir_mode=
|
||||||
|
fi
|
||||||
|
|
||||||
|
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 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 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
|
||||||
|
|
||||||
|
# Make a couple of temp file names in the proper directory.
|
||||||
|
dsttmp=$dstdir/_inst.$$_
|
||||||
|
rmtmp=$dstdir/_rm.$$_
|
||||||
|
|
||||||
|
# Trap to clean up those temp files at exit.
|
||||||
|
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
|
||||||
|
|
||||||
|
# Copy the file name to the temp name.
|
||||||
|
(umask $cp_umask && $doit_exec $cpprog "$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
|
# 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
|
# ignore errors from any of these, just make sure not to ignore
|
||||||
# errors from the above "$doit $instcmd $src $dsttmp" command.
|
# 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"; } &&
|
||||||
|
|
||||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else :;fi &&
|
# If -C, don't bother to copy if it wouldn't change the file.
|
||||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else :;fi &&
|
if $copy_on_change &&
|
||||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dsttmp"; else :;fi &&
|
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
|
||||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else :;fi &&
|
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
|
||||||
|
|
||||||
# Now remove or move aside any old file at destination location. We try this
|
eval "$initialize_posix_glob" &&
|
||||||
# two ways since rm can't unlink itself on some systems and the destination
|
$posix_glob set -f &&
|
||||||
# file might be busy for other reasons. In this case, the final cleanup
|
set X $old && old=:$2:$4:$5:$6 &&
|
||||||
# might fail but the new file should still install successfully.
|
set X $new && new=:$2:$4:$5:$6 &&
|
||||||
|
$posix_glob set +f &&
|
||||||
|
|
||||||
{
|
test "$old" = "$new" &&
|
||||||
if [ -f "$dstdir/$dstfile" ]
|
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
|
||||||
then
|
then
|
||||||
$doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null ||
|
rm -f "$dsttmp"
|
||||||
$doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null ||
|
|
||||||
{
|
|
||||||
echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
|
|
||||||
(exit 1); exit
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
:
|
# Rename the file to the real destination.
|
||||||
fi
|
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
|
||||||
|
|
||||||
|
# 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.
|
# Now rename the file to the real destination.
|
||||||
|
$doit $mvcmd "$dsttmp" "$dst"
|
||||||
$doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
|
|
||||||
|
|
||||||
fi &&
|
|
||||||
|
|
||||||
# The final little trick to "correctly" pass the exit status to the exit trap.
|
|
||||||
|
|
||||||
{
|
|
||||||
(exit 0); exit
|
|
||||||
}
|
}
|
||||||
|
fi || exit 1
|
||||||
|
|
||||||
|
trap '' 0
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# 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
197
missing
|
@ -1,6 +1,10 @@
|
||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# Common stub for a few missing GNU programs while installing.
|
# 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.
|
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
|
||||||
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# 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
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the Free Software
|
# along with this program; if not, write to the Free Software
|
||||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||||
# 02111-1307, USA.
|
# 02110-1301, USA.
|
||||||
|
|
||||||
# As a special exception to the GNU General Public License, if you
|
# As a special exception to the GNU General Public License, if you
|
||||||
# distribute this file as part of a program that contains a
|
# distribute this file as part of a program that contains a
|
||||||
|
@ -29,6 +33,8 @@ if test $# -eq 0; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
run=:
|
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
|
# In the cases where this matters, `missing' is being run in the
|
||||||
# srcdir already.
|
# srcdir already.
|
||||||
|
@ -38,18 +44,24 @@ else
|
||||||
configure_ac=configure.in
|
configure_ac=configure.in
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case "$1" in
|
msg="missing on your system"
|
||||||
|
|
||||||
|
case $1 in
|
||||||
--run)
|
--run)
|
||||||
# Try to run requested program, and just exit if it succeeds.
|
# Try to run requested program, and just exit if it succeeds.
|
||||||
run=
|
run=
|
||||||
shift
|
shift
|
||||||
"$@" && exit 0
|
"$@" && 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)
|
-h|--h|--he|--hel|--help)
|
||||||
echo "\
|
echo "\
|
||||||
|
@ -67,6 +79,7 @@ Supported PROGRAM values:
|
||||||
aclocal touch file \`aclocal.m4'
|
aclocal touch file \`aclocal.m4'
|
||||||
autoconf touch file \`configure'
|
autoconf touch file \`configure'
|
||||||
autoheader touch file \`config.h.in'
|
autoheader touch file \`config.h.in'
|
||||||
|
autom4te touch the output file, or create a stub one
|
||||||
automake touch all \`Makefile.in' files
|
automake touch all \`Makefile.in' files
|
||||||
bison create \`y.tab.[ch]', if possible, from existing .[ch]
|
bison create \`y.tab.[ch]', if possible, from existing .[ch]
|
||||||
flex create \`lex.yy.c', if possible, from existing .c
|
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
|
lex create \`lex.yy.c', if possible, from existing .c
|
||||||
makeinfo touch the output file
|
makeinfo touch the output file
|
||||||
tar try tar, gnutar, gtar, then tar without non-portable flags
|
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)
|
-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
|
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
|
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
|
||||||
# We have it, but it failed.
|
# We have it, but it failed.
|
||||||
exit 1
|
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
|
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 "\
|
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
|
you modified \`acinclude.m4' or \`${configure_ac}'. You might want
|
||||||
to install the \`Automake' and \`Perl' packages. Grab them from
|
to install the \`Automake' and \`Perl' packages. Grab them from
|
||||||
any GNU archive site."
|
any GNU archive site."
|
||||||
|
@ -102,13 +149,8 @@ WARNING: \`$1' is missing on your system. You should only need it if
|
||||||
;;
|
;;
|
||||||
|
|
||||||
autoconf)
|
autoconf)
|
||||||
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
|
|
||||||
# We have it, but it failed.
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo 1>&2 "\
|
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
|
you modified \`${configure_ac}'. You might want to install the
|
||||||
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
|
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
|
||||||
archive site."
|
archive site."
|
||||||
|
@ -116,13 +158,8 @@ WARNING: \`$1' is missing on your system. You should only need it if
|
||||||
;;
|
;;
|
||||||
|
|
||||||
autoheader)
|
autoheader)
|
||||||
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
|
|
||||||
# We have it, but it failed.
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo 1>&2 "\
|
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
|
you modified \`acconfig.h' or \`${configure_ac}'. You might want
|
||||||
to install the \`Autoconf' and \`GNU m4' packages. Grab them
|
to install the \`Autoconf' and \`GNU m4' packages. Grab them
|
||||||
from any GNU archive site."
|
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"
|
test -z "$files" && files="config.h"
|
||||||
touch_files=
|
touch_files=
|
||||||
for f in $files; do
|
for f in $files; do
|
||||||
case "$f" in
|
case $f in
|
||||||
*:*) touch_files="$touch_files "`echo "$f" |
|
*:*) touch_files="$touch_files "`echo "$f" |
|
||||||
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
|
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
|
||||||
*) touch_files="$touch_files $f.in";;
|
*) touch_files="$touch_files $f.in";;
|
||||||
|
@ -140,13 +177,8 @@ WARNING: \`$1' is missing on your system. You should only need it if
|
||||||
;;
|
;;
|
||||||
|
|
||||||
automake*)
|
automake*)
|
||||||
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
|
|
||||||
# We have it, but it failed.
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo 1>&2 "\
|
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 modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
|
||||||
You might want to install the \`Automake' and \`Perl' packages.
|
You might want to install the \`Automake' and \`Perl' packages.
|
||||||
Grab them from any GNU archive site."
|
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)
|
autom4te)
|
||||||
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
|
|
||||||
# We have it, but it failed.
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo 1>&2 "\
|
echo 1>&2 "\
|
||||||
WARNING: \`$1' is needed, and you do not seem to have it handy on your
|
WARNING: \`$1' is needed, but is $msg.
|
||||||
system. You might have modified some files without having the
|
You might have modified some files without having the
|
||||||
proper tools for further handling them.
|
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."
|
archive site."
|
||||||
|
|
||||||
file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
|
file=`echo "$*" | sed -n "$sed_output"`
|
||||||
test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
|
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
|
||||||
if test -f "$file"; then
|
if test -f "$file"; then
|
||||||
touch $file
|
touch $file
|
||||||
else
|
else
|
||||||
|
@ -185,74 +212,67 @@ WARNING: \`$1' is needed, and you do not seem to have it handy on your
|
||||||
|
|
||||||
bison|yacc)
|
bison|yacc)
|
||||||
echo 1>&2 "\
|
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
|
you modified a \`.y' file. You may need the \`Bison' package
|
||||||
in order for those modifications to take effect. You can get
|
in order for those modifications to take effect. You can get
|
||||||
\`Bison' from any GNU archive site."
|
\`Bison' from any GNU archive site."
|
||||||
rm -f y.tab.c y.tab.h
|
rm -f y.tab.c y.tab.h
|
||||||
if [ $# -ne 1 ]; then
|
if test $# -ne 1; then
|
||||||
eval LASTARG="\${$#}"
|
eval LASTARG="\${$#}"
|
||||||
case "$LASTARG" in
|
case $LASTARG in
|
||||||
*.y)
|
*.y)
|
||||||
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
|
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
|
||||||
if [ -f "$SRCFILE" ]; then
|
if test -f "$SRCFILE"; then
|
||||||
cp "$SRCFILE" y.tab.c
|
cp "$SRCFILE" y.tab.c
|
||||||
fi
|
fi
|
||||||
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
|
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
|
||||||
if [ -f "$SRCFILE" ]; then
|
if test -f "$SRCFILE"; then
|
||||||
cp "$SRCFILE" y.tab.h
|
cp "$SRCFILE" y.tab.h
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
if [ ! -f y.tab.h ]; then
|
if test ! -f y.tab.h; then
|
||||||
echo >y.tab.h
|
echo >y.tab.h
|
||||||
fi
|
fi
|
||||||
if [ ! -f y.tab.c ]; then
|
if test ! -f y.tab.c; then
|
||||||
echo 'main() { return 0; }' >y.tab.c
|
echo 'main() { return 0; }' >y.tab.c
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
lex|flex)
|
lex|flex)
|
||||||
echo 1>&2 "\
|
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
|
you modified a \`.l' file. You may need the \`Flex' package
|
||||||
in order for those modifications to take effect. You can get
|
in order for those modifications to take effect. You can get
|
||||||
\`Flex' from any GNU archive site."
|
\`Flex' from any GNU archive site."
|
||||||
rm -f lex.yy.c
|
rm -f lex.yy.c
|
||||||
if [ $# -ne 1 ]; then
|
if test $# -ne 1; then
|
||||||
eval LASTARG="\${$#}"
|
eval LASTARG="\${$#}"
|
||||||
case "$LASTARG" in
|
case $LASTARG in
|
||||||
*.l)
|
*.l)
|
||||||
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
|
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
|
||||||
if [ -f "$SRCFILE" ]; then
|
if test -f "$SRCFILE"; then
|
||||||
cp "$SRCFILE" lex.yy.c
|
cp "$SRCFILE" lex.yy.c
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
if [ ! -f lex.yy.c ]; then
|
if test ! -f lex.yy.c; then
|
||||||
echo 'main() { return 0; }' >lex.yy.c
|
echo 'main() { return 0; }' >lex.yy.c
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
help2man)
|
help2man)
|
||||||
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
|
|
||||||
# We have it, but it failed.
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo 1>&2 "\
|
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
|
you modified a dependency of a manual page. You may need the
|
||||||
\`Help2man' package in order for those modifications to take
|
\`Help2man' package in order for those modifications to take
|
||||||
effect. You can get \`Help2man' from any GNU archive site."
|
effect. You can get \`Help2man' from any GNU archive site."
|
||||||
|
|
||||||
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
|
file=`echo "$*" | sed -n "$sed_output"`
|
||||||
if test -z "$file"; then
|
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
|
||||||
file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
|
if test -f "$file"; then
|
||||||
fi
|
|
||||||
if [ -f "$file" ]; then
|
|
||||||
touch $file
|
touch $file
|
||||||
else
|
else
|
||||||
test -z "$file" || exec >$file
|
test -z "$file" || exec >$file
|
||||||
|
@ -262,32 +282,36 @@ WARNING: \`$1' is missing on your system. You should only need it if
|
||||||
;;
|
;;
|
||||||
|
|
||||||
makeinfo)
|
makeinfo)
|
||||||
if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then
|
|
||||||
# We have makeinfo, but it failed.
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo 1>&2 "\
|
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
|
you modified a \`.texi' or \`.texinfo' file, or any other file
|
||||||
indirectly affecting the aspect of the manual. The spurious
|
indirectly affecting the aspect of the manual. The spurious
|
||||||
call might also be the consequence of using a buggy \`make' (AIX,
|
call might also be the consequence of using a buggy \`make' (AIX,
|
||||||
DU, IRIX). You might want to install the \`Texinfo' package or
|
DU, IRIX). You might want to install the \`Texinfo' package or
|
||||||
the \`GNU make' package. Grab either from any GNU archive site."
|
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
|
if test -z "$file"; then
|
||||||
file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
|
# ... or it is the one specified with @setfilename ...
|
||||||
file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
|
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
|
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
|
touch $file
|
||||||
;;
|
;;
|
||||||
|
|
||||||
tar)
|
tar)
|
||||||
shift
|
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.
|
# We have already tried tar in the generic part.
|
||||||
# Look for gnutar/gtar before invocation to avoid ugly error
|
# 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
|
fi
|
||||||
firstarg="$1"
|
firstarg="$1"
|
||||||
if shift; then
|
if shift; then
|
||||||
case "$firstarg" in
|
case $firstarg in
|
||||||
*o*)
|
*o*)
|
||||||
firstarg=`echo "$firstarg" | sed s/o//`
|
firstarg=`echo "$firstarg" | sed s/o//`
|
||||||
tar "$firstarg" "$@" && exit 0
|
tar "$firstarg" "$@" && exit 0
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
case "$firstarg" in
|
case $firstarg in
|
||||||
*h*)
|
*h*)
|
||||||
firstarg=`echo "$firstarg" | sed s/h//`
|
firstarg=`echo "$firstarg" | sed s/h//`
|
||||||
tar "$firstarg" "$@" && exit 0
|
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 "\
|
echo 1>&2 "\
|
||||||
WARNING: \`$1' is needed, and you do not seem to have it handy on your
|
WARNING: \`$1' is needed, and is $msg.
|
||||||
system. You might have modified some files without having the
|
You might have modified some files without having the
|
||||||
proper tools for further handling them. Check the \`README' file,
|
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
|
this package. You may also peek at any GNU archive site, in case
|
||||||
some other package would contain this missing \`$1' program."
|
some other package would contain this missing \`$1' program."
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -334,3 +358,10 @@ WARNING: \`$1' is needed, and you do not seem to have it handy on your
|
||||||
esac
|
esac
|
||||||
|
|
||||||
exit 0
|
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:
|
||||||
|
|
|
@ -59,7 +59,7 @@ typedef struct {
|
||||||
SCARDCONTEXT hCtx;
|
SCARDCONTEXT hCtx;
|
||||||
SCARDHANDLE hCard;
|
SCARDHANDLE hCard;
|
||||||
SCARD_IO_REQUEST ioCard;
|
SCARD_IO_REQUEST ioCard;
|
||||||
} dev_spec_acr122;
|
} acr122_spec_t;
|
||||||
|
|
||||||
nfc_device_t* acr122_connect(const nfc_device_desc_t* pndd)
|
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 uiReader;
|
||||||
uint32_t uiDevIndex;
|
uint32_t uiDevIndex;
|
||||||
nfc_device_t* pnd;
|
nfc_device_t* pnd;
|
||||||
dev_spec_acr122* pdsa;
|
acr122_spec_t* pas;
|
||||||
dev_spec_acr122 dsa;
|
acr122_spec_t as;
|
||||||
char* pcFirmware;
|
char* pcFirmware;
|
||||||
|
|
||||||
// Clear the reader list
|
// Clear the reader list
|
||||||
memset(acList,0x00,szListLen);
|
memset(acList,0x00,szListLen);
|
||||||
|
|
||||||
// Test if context succeeded
|
// 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
|
// 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("PCSC reports following device(s):");
|
||||||
DBG("- %s",acList);
|
DBG("- %s",acList);
|
||||||
|
@ -121,20 +121,20 @@ nfc_device_t* acr122_connect(const nfc_device_desc_t* pndd)
|
||||||
for (uiReader=0; uiReader<uiReaderCount; uiReader++)
|
for (uiReader=0; uiReader<uiReaderCount; uiReader++)
|
||||||
{
|
{
|
||||||
// Test if we were able to connect to the "emulator" card
|
// 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
|
// 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
|
// We can not connect to this device, we will just ignore it
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Configure I/O settings for card communication
|
// 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
|
// 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)
|
if (strstr(pcFirmware,FIRMWARE_TEXT) != NULL)
|
||||||
{
|
{
|
||||||
// We found a occurence, test if it has the right index
|
// 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
|
// Allocate memory and store the device specification
|
||||||
pdsa = malloc(sizeof(dev_spec_acr122));
|
pas = malloc(sizeof(acr122_spec_t));
|
||||||
*pdsa = dsa;
|
*pas = as;
|
||||||
|
|
||||||
// Done, we found the reader we are looking for
|
// Done, we found the reader we are looking for
|
||||||
pnd = malloc(sizeof(nfc_device_t));
|
pnd = malloc(sizeof(nfc_device_t));
|
||||||
strcpy(pnd->acName,pcFirmware);
|
strcpy(pnd->acName,pcFirmware);
|
||||||
pnd->ct = CT_PN532;
|
pnd->nc = NC_PN532;
|
||||||
pnd->ds = (dev_spec)pdsa;
|
pnd->nds = (nfc_device_spec_t)pas;
|
||||||
pnd->bActive = true;
|
pnd->bActive = true;
|
||||||
pnd->bCrc = true;
|
pnd->bCrc = true;
|
||||||
pnd->bPar = 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)
|
void acr122_disconnect(nfc_device_t* pnd)
|
||||||
{
|
{
|
||||||
dev_spec_acr122* pdsa = (dev_spec_acr122*)pnd->ds;
|
acr122_spec_t* pas = (acr122_spec_t*)pnd->nds;
|
||||||
SCardDisconnect(pdsa->hCard,SCARD_LEAVE_CARD);
|
SCardDisconnect(pas->hCard,SCARD_LEAVE_CARD);
|
||||||
SCardReleaseContext(pdsa->hCtx);
|
SCardReleaseContext(pas->hCtx);
|
||||||
free(pdsa);
|
free(pas);
|
||||||
free(pnd);
|
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 };
|
byte_t abtRxCmd[5] = { 0xFF,0xC0,0x00,0x00 };
|
||||||
size_t szRxCmdLen = sizeof(abtRxCmd);
|
size_t szRxCmdLen = sizeof(abtRxCmd);
|
||||||
byte_t abtRxBuf[ACR122_RESPONSE_LEN];
|
byte_t abtRxBuf[ACR122_RESPONSE_LEN];
|
||||||
size_t szRxBufLen;
|
size_t szRxBufLen;
|
||||||
byte_t abtTxBuf[ACR122_WRAP_LEN+ACR122_COMMAND_LEN] = { 0xFF, 0x00, 0x00, 0x00 };
|
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
|
// Make sure the command does not overflow the send buffer
|
||||||
if (szTxLen > ACR122_COMMAND_LEN) return false;
|
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);
|
print_hex(abtTxBuf,szTxLen+5);
|
||||||
#endif
|
#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 {
|
} 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
|
// Make sure we received the byte-count we expected
|
||||||
if (szRxBufLen != 2) return false;
|
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
|
// Retrieve the response bytes
|
||||||
abtRxCmd[4] = abtRxBuf[1];
|
abtRxCmd[4] = abtRxBuf[1];
|
||||||
szRxBufLen = sizeof(abtRxBuf);
|
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
|
#ifdef DEBUG
|
||||||
|
@ -237,20 +237,20 @@ bool acr122_transceive(const dev_spec ds, const byte_t* pbtTx, const size_t szTx
|
||||||
return true;
|
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 };
|
byte_t abtGetFw[5] = { 0xFF,0x00,0x48,0x00,0x00 };
|
||||||
uint32_t uiResult;
|
uint32_t uiResult;
|
||||||
|
|
||||||
dev_spec_acr122* pdsa = (dev_spec_acr122*)ds;
|
acr122_spec_t* pas = (acr122_spec_t*)nds;
|
||||||
static char abtFw[11];
|
static char abtFw[11];
|
||||||
size_t szFwLen = sizeof(abtFw);
|
size_t szFwLen = sizeof(abtFw);
|
||||||
memset(abtFw,0x00,szFwLen);
|
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 {
|
} 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
|
#ifdef DEBUG
|
||||||
|
@ -263,17 +263,17 @@ char* acr122_firmware(const dev_spec ds)
|
||||||
return abtFw;
|
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 };
|
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];
|
byte_t abtBuf[2];
|
||||||
size_t szBufLen = sizeof(abtBuf);
|
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 {
|
} 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,11 +35,11 @@ nfc_device_t* acr122_connect(const nfc_device_desc_t* pndd);
|
||||||
void acr122_disconnect(nfc_device_t* pnd);
|
void acr122_disconnect(nfc_device_t* pnd);
|
||||||
|
|
||||||
// Callback function used by libnfc to transmit commands to the PN53X chip
|
// 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
|
// Various additional features this device supports
|
||||||
char* acr122_firmware(const dev_spec ds);
|
char* acr122_firmware(const nfc_device_spec_t nds);
|
||||||
bool acr122_led_red(const dev_spec ds, bool bOn);
|
bool acr122_led_red(const nfc_device_spec_t nds, bool bOn);
|
||||||
|
|
||||||
#endif // _LIBNFC_DEV_ACR122_H_
|
#endif // _LIBNFC_DEV_ACR122_H_
|
||||||
|
|
||||||
|
|
|
@ -127,8 +127,8 @@ nfc_device_t* arygon_connect(const nfc_device_desc_t* pndd)
|
||||||
// We have a connection
|
// We have a connection
|
||||||
pnd = malloc(sizeof(nfc_device_t));
|
pnd = malloc(sizeof(nfc_device_t));
|
||||||
strcpy(pnd->acName,"ARYGON");
|
strcpy(pnd->acName,"ARYGON");
|
||||||
pnd->ct = CT_PN532;
|
pnd->nc = NC_PN532;
|
||||||
pnd->ds = (dev_spec)sp;
|
pnd->nds = (nfc_device_spec_t)sp;
|
||||||
pnd->bActive = true;
|
pnd->bActive = true;
|
||||||
pnd->bCrc = true;
|
pnd->bCrc = true;
|
||||||
pnd->bPar = 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)
|
void arygon_disconnect(nfc_device_t* pnd)
|
||||||
{
|
{
|
||||||
uart_close((serial_port)pnd->ds);
|
uart_close((serial_port)pnd->nds);
|
||||||
free(pnd);
|
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 abtTxBuf[BUFFER_LENGTH] = { DEV_ARYGON_PROTOCOL_TAMA, 0x00, 0x00, 0xff }; // Every packet must start with "00 00 ff"
|
||||||
byte_t abtRxBuf[BUFFER_LENGTH];
|
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: ");
|
printf(" TX: ");
|
||||||
print_hex(abtTxBuf,szTxLen+8);
|
print_hex(abtTxBuf,szTxLen+8);
|
||||||
#endif
|
#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)");
|
ERR("Unable to transmit data. (TX)");
|
||||||
return false;
|
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
|
* 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)");
|
ERR("Unable to receive data. (RX)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ nfc_device_t* arygon_connect(const nfc_device_desc_t* pndd);
|
||||||
void arygon_disconnect(nfc_device_t* pnd);
|
void arygon_disconnect(nfc_device_t* pnd);
|
||||||
|
|
||||||
// Callback function used by libnfc to transmit commands to the PN53X chip
|
// 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_
|
#endif // _LIBNFC_DEV_ARYGON_H_
|
||||||
|
|
||||||
|
|
|
@ -44,10 +44,10 @@ typedef struct {
|
||||||
usb_dev_handle* pudh;
|
usb_dev_handle* pudh;
|
||||||
uint32_t uiEndPointIn;
|
uint32_t uiEndPointIn;
|
||||||
uint32_t uiEndPointOut;
|
uint32_t uiEndPointOut;
|
||||||
} dev_spec_pn531_usb;
|
} usb_spec_t;
|
||||||
|
|
||||||
// Find transfer endpoints for bulk transfers
|
// 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 uiIndex;
|
||||||
uint32_t uiEndPoint;
|
uint32_t uiEndPoint;
|
||||||
|
@ -68,7 +68,7 @@ static void get_end_points(struct usb_device *dev, dev_spec_pn531_usb* pdsp)
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("Bulk endpoint in : 0x%02X\n", uiEndPoint);
|
printf("Bulk endpoint in : 0x%02X\n", uiEndPoint);
|
||||||
#endif
|
#endif
|
||||||
pdsp->uiEndPointIn = uiEndPoint;
|
pus->uiEndPointIn = uiEndPoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test if we dealing with a bulk OUT endpoint
|
// 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
|
#ifdef DEBUG
|
||||||
printf("Bulk endpoint in : 0x%02X\n", uiEndPoint);
|
printf("Bulk endpoint in : 0x%02X\n", uiEndPoint);
|
||||||
#endif
|
#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_bus *bus;
|
||||||
struct usb_device *dev;
|
struct usb_device *dev;
|
||||||
nfc_device_t* pnd = INVALID_DEVICE_INFO;
|
nfc_device_t* pnd = INVALID_DEVICE_INFO;
|
||||||
dev_spec_pn531_usb* pdsp;
|
usb_spec_t* pus;
|
||||||
dev_spec_pn531_usb dsp;
|
usb_spec_t us;
|
||||||
uint32_t uiDevIndex;
|
uint32_t uiDevIndex;
|
||||||
|
|
||||||
dsp.uiEndPointIn = 0;
|
us.uiEndPointIn = 0;
|
||||||
dsp.uiEndPointOut = 0;
|
us.uiEndPointOut = 0;
|
||||||
dsp.pudh = NULL;
|
us.pudh = NULL;
|
||||||
|
|
||||||
usb_init();
|
usb_init();
|
||||||
if (usb_find_busses() < 0) return INVALID_DEVICE_INFO;
|
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");
|
DBG("Found PN531 device");
|
||||||
|
|
||||||
// Open the PN531 USB device
|
// Open the PN531 USB device
|
||||||
dsp.pudh = usb_open(dev);
|
us.pudh = usb_open(dev);
|
||||||
|
|
||||||
get_end_points(dev,&dsp);
|
get_end_points(dev,&us);
|
||||||
if(usb_set_configuration(dsp.pudh,1) < 0)
|
if(usb_set_configuration(us.pudh,1) < 0)
|
||||||
{
|
{
|
||||||
DBG("Set config failed");
|
DBG("Set config failed");
|
||||||
usb_close(dsp.pudh);
|
usb_close(us.pudh);
|
||||||
return INVALID_DEVICE_INFO;
|
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");
|
DBG("Can't claim interface");
|
||||||
usb_close(dsp.pudh);
|
usb_close(us.pudh);
|
||||||
return INVALID_DEVICE_INFO;
|
return INVALID_DEVICE_INFO;
|
||||||
}
|
}
|
||||||
// Allocate memory for the device info and specification, fill it and return the info
|
// Allocate memory for the device info and specification, fill it and return the info
|
||||||
pdsp = malloc(sizeof(dev_spec_pn531_usb));
|
pus = malloc(sizeof(usb_spec_t));
|
||||||
*pdsp = dsp;
|
*pus = us;
|
||||||
pnd = malloc(sizeof(nfc_device_t));
|
pnd = malloc(sizeof(nfc_device_t));
|
||||||
strcpy(pnd->acName,"PN531USB");
|
strcpy(pnd->acName,"PN531USB");
|
||||||
pnd->ct = CT_PN531;
|
pnd->nc = NC_PN531;
|
||||||
pnd->ds = (dev_spec)pdsp;
|
pnd->nds = (nfc_device_spec_t)pus;
|
||||||
pnd->bActive = true;
|
pnd->bActive = true;
|
||||||
pnd->bCrc = true;
|
pnd->bCrc = true;
|
||||||
pnd->bPar = 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)
|
void pn531_usb_disconnect(nfc_device_t* pnd)
|
||||||
{
|
{
|
||||||
dev_spec_pn531_usb* pdsp = (dev_spec_pn531_usb*)pnd->ds;
|
usb_spec_t* pus = (usb_spec_t*)pnd->nds;
|
||||||
usb_release_interface(pdsp->pudh,0);
|
usb_release_interface(pus->pudh,0);
|
||||||
usb_close(pdsp->pudh);
|
usb_close(pus->pudh);
|
||||||
free(pnd->ds);
|
free(pnd->nds);
|
||||||
free(pnd);
|
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;
|
size_t uiPos = 0;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
byte_t abtTx[BUFFER_LENGTH] = { 0x00, 0x00, 0xff }; // Every packet must start with "00 00 ff"
|
byte_t abtTx[BUFFER_LENGTH] = { 0x00, 0x00, 0xff }; // Every packet must start with "00 00 ff"
|
||||||
byte_t abtRx[BUFFER_LENGTH];
|
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)
|
// Packet length = data length (len) + checksum (1) + end of stream marker (1)
|
||||||
abtTx[3] = szTxLen;
|
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);
|
print_hex(abtTx,szTxLen+7);
|
||||||
#endif
|
#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 )
|
if( ret < 0 )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
@ -212,7 +212,7 @@ bool pn531_usb_transceive(const dev_spec ds, const byte_t* pbtTx, const size_t s
|
||||||
return false;
|
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 )
|
if( ret < 0 )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#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 )
|
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 )
|
if( ret < 0 )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
|
|
@ -35,7 +35,7 @@ nfc_device_t* pn531_usb_connect(const nfc_device_desc_t* pndd);
|
||||||
void pn531_usb_disconnect(nfc_device_t* pnd);
|
void pn531_usb_disconnect(nfc_device_t* pnd);
|
||||||
|
|
||||||
// Callback function used by libnfc to transmit commands to the PN53X chip
|
// 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_
|
#endif // _LIBNFC_DEV_PN531_H_
|
||||||
|
|
||||||
|
|
|
@ -120,8 +120,8 @@ nfc_device_t* pn532_uart_connect(const nfc_device_desc_t* pndd)
|
||||||
// We have a connection
|
// We have a connection
|
||||||
pnd = malloc(sizeof(nfc_device_t));
|
pnd = malloc(sizeof(nfc_device_t));
|
||||||
strcpy(pnd->acName,"PN532_UART");
|
strcpy(pnd->acName,"PN532_UART");
|
||||||
pnd->ct = CT_PN532;
|
pnd->nc = NC_PN532;
|
||||||
pnd->ds = (dev_spec)sp;
|
pnd->nds = (nfc_device_spec_t)sp;
|
||||||
pnd->bActive = true;
|
pnd->bActive = true;
|
||||||
pnd->bCrc = true;
|
pnd->bCrc = true;
|
||||||
pnd->bPar = 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)
|
void pn532_uart_disconnect(nfc_device_t* pnd)
|
||||||
{
|
{
|
||||||
uart_close((serial_port)pnd->ds);
|
uart_close((serial_port)pnd->nds);
|
||||||
free(pnd);
|
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 abtTxBuf[BUFFER_LENGTH] = { 0x00, 0x00, 0xff }; // Every packet must start with "00 00 ff"
|
||||||
byte_t abtRxBuf[BUFFER_LENGTH];
|
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: ");
|
printf(" TX: ");
|
||||||
print_hex(abtTxBuf,szTxLen+7);
|
print_hex(abtTxBuf,szTxLen+7);
|
||||||
#endif
|
#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)");
|
ERR("Unable to transmit data. (TX)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -178,7 +178,7 @@ bool pn532_uart_transceive(const dev_spec ds, const byte_t* pbtTx, const size_t
|
||||||
*/
|
*/
|
||||||
delay_ms(30);
|
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)");
|
ERR("Unable to receive data. (RX)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ nfc_device_t* pn532_uart_connect(const nfc_device_desc_t* pndd);
|
||||||
void pn532_uart_disconnect(nfc_device_t* pnd);
|
void pn532_uart_disconnect(nfc_device_t* pnd);
|
||||||
|
|
||||||
// Callback function used by libnfc to transmit commands to the PN53X chip
|
// 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_
|
#endif // _LIBNFC_DEV_PN532_UART_H_
|
||||||
|
|
||||||
|
|
|
@ -43,10 +43,10 @@ typedef struct {
|
||||||
usb_dev_handle* pudh;
|
usb_dev_handle* pudh;
|
||||||
uint32_t uiEndPointIn;
|
uint32_t uiEndPointIn;
|
||||||
uint32_t uiEndPointOut;
|
uint32_t uiEndPointOut;
|
||||||
} dev_spec_pn533_usb;
|
} usb_spec_t;
|
||||||
|
|
||||||
// Find transfer endpoints for bulk transfers
|
// 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 uiIndex;
|
||||||
uint32_t uiEndPoint;
|
uint32_t uiEndPoint;
|
||||||
|
@ -67,7 +67,7 @@ static void get_end_points(struct usb_device *dev, dev_spec_pn533_usb* pdsp)
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("Bulk endpoint in : 0x%02X\n", uiEndPoint);
|
printf("Bulk endpoint in : 0x%02X\n", uiEndPoint);
|
||||||
#endif
|
#endif
|
||||||
pdsp->uiEndPointIn = uiEndPoint;
|
pus->uiEndPointIn = uiEndPoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test if we dealing with a bulk OUT endpoint
|
// 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
|
#ifdef DEBUG
|
||||||
printf("Bulk endpoint in : 0x%02X\n", uiEndPoint);
|
printf("Bulk endpoint in : 0x%02X\n", uiEndPoint);
|
||||||
#endif
|
#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_bus *bus;
|
||||||
struct usb_device *dev;
|
struct usb_device *dev;
|
||||||
nfc_device_t* pnd = INVALID_DEVICE_INFO;
|
nfc_device_t* pnd = INVALID_DEVICE_INFO;
|
||||||
dev_spec_pn533_usb* pdsp;
|
usb_spec_t* pus;
|
||||||
dev_spec_pn533_usb dsp;
|
usb_spec_t us;
|
||||||
uint32_t uiDevIndex;
|
uint32_t uiDevIndex;
|
||||||
|
|
||||||
dsp.uiEndPointIn = 0;
|
us.uiEndPointIn = 0;
|
||||||
dsp.uiEndPointOut = 0;
|
us.uiEndPointOut = 0;
|
||||||
dsp.pudh = NULL;
|
us.pudh = NULL;
|
||||||
|
|
||||||
usb_init();
|
usb_init();
|
||||||
if (usb_find_busses() < 0) return INVALID_DEVICE_INFO;
|
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");
|
DBG("Found PN533 device");
|
||||||
|
|
||||||
// Open the PN533 USB device
|
// Open the PN533 USB device
|
||||||
dsp.pudh = usb_open(dev);
|
us.pudh = usb_open(dev);
|
||||||
|
|
||||||
get_end_points(dev,&dsp);
|
get_end_points(dev,&us);
|
||||||
if(usb_set_configuration(dsp.pudh,1) < 0)
|
if(usb_set_configuration(us.pudh,1) < 0)
|
||||||
{
|
{
|
||||||
DBG("Setting config failed");
|
DBG("Setting config failed");
|
||||||
usb_close(dsp.pudh);
|
usb_close(us.pudh);
|
||||||
return INVALID_DEVICE_INFO;
|
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");
|
DBG("Can't claim interface");
|
||||||
usb_close(dsp.pudh);
|
usb_close(us.pudh);
|
||||||
return INVALID_DEVICE_INFO;
|
return INVALID_DEVICE_INFO;
|
||||||
}
|
}
|
||||||
// Allocate memory for the device info and specification, fill it and return the info
|
// Allocate memory for the device info and specification, fill it and return the info
|
||||||
pdsp = malloc(sizeof(dev_spec_pn533_usb));
|
pus = malloc(sizeof(usb_spec_t));
|
||||||
*pdsp = dsp;
|
*pus = us;
|
||||||
pnd = malloc(sizeof(nfc_device_t));
|
pnd = malloc(sizeof(nfc_device_t));
|
||||||
strcpy(pnd->acName,"PN533USB");
|
strcpy(pnd->acName,"PN533USB");
|
||||||
pnd->ct = CT_PN533;
|
pnd->nc = NC_PN533;
|
||||||
pnd->ds = (dev_spec)pdsp;
|
pnd->nds = (nfc_device_spec_t)pus;
|
||||||
pnd->bActive = true;
|
pnd->bActive = true;
|
||||||
pnd->bCrc = true;
|
pnd->bCrc = true;
|
||||||
pnd->bPar = 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)
|
void pn533_usb_disconnect(nfc_device_t* pnd)
|
||||||
{
|
{
|
||||||
dev_spec_pn533_usb* pdsp = (dev_spec_pn533_usb*)pnd->ds;
|
usb_spec_t* pus = (usb_spec_t*)pnd->nds;
|
||||||
usb_release_interface(pdsp->pudh,0);
|
usb_release_interface(pus->pudh,0);
|
||||||
usb_close(pdsp->pudh);
|
usb_close(pus->pudh);
|
||||||
free(pnd->ds);
|
free(pnd->nds);
|
||||||
free(pnd);
|
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;
|
size_t uiPos = 0;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
byte_t abtTx[BUFFER_LENGTH] = { 0x00, 0x00, 0xff }; // Every packet must start with "00 00 ff"
|
byte_t abtTx[BUFFER_LENGTH] = { 0x00, 0x00, 0xff }; // Every packet must start with "00 00 ff"
|
||||||
byte_t abtRx[BUFFER_LENGTH];
|
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)
|
// Packet length = data length (len) + checksum (1) + end of stream marker (1)
|
||||||
abtTx[3] = szTxLen;
|
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);
|
print_hex(abtTx,szTxLen+7);
|
||||||
#endif
|
#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 )
|
if( ret < 0 )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
@ -208,7 +208,7 @@ bool pn533_usb_transceive(const dev_spec ds, const byte_t* pbtTx, const size_t s
|
||||||
return false;
|
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 )
|
if( ret < 0 )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#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 )
|
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 )
|
if( ret < 0 )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
|
|
@ -32,7 +32,7 @@ nfc_device_t* pn533_usb_connect(const nfc_device_desc_t* pndd);
|
||||||
void pn533_usb_disconnect(nfc_device_t* pnd);
|
void pn533_usb_disconnect(nfc_device_t* pnd);
|
||||||
|
|
||||||
// Callback function used by libnfc to transmit commands to the PN53X chip
|
// 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_
|
#endif // _LIBNFC_DEV_PN533_H_
|
||||||
|
|
||||||
|
|
|
@ -37,14 +37,14 @@
|
||||||
typedef uint8_t byte_t;
|
typedef uint8_t byte_t;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
CT_PN531 = 0x10,
|
NC_PN531 = 0x10,
|
||||||
CT_PN532 = 0x20,
|
NC_PN532 = 0x20,
|
||||||
CT_PN533 = 0x30,
|
NC_PN533 = 0x30,
|
||||||
} chip_type;
|
} nfc_chip_t;
|
||||||
|
|
||||||
struct driver_callbacks; // Prototype the callback struct
|
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
|
#define DEVICE_NAME_LENGTH 256
|
||||||
/**
|
/**
|
||||||
|
@ -57,9 +57,9 @@ typedef struct {
|
||||||
/** Device name string, including device wrapper firmware */
|
/** Device name string, including device wrapper firmware */
|
||||||
char acName[DEVICE_NAME_LENGTH];
|
char acName[DEVICE_NAME_LENGTH];
|
||||||
/** PN53X chip type, this is useful for some "bug" work-arounds */
|
/** PN53X chip type, this is useful for some "bug" work-arounds */
|
||||||
chip_type ct;
|
nfc_chip_t nc;
|
||||||
/** Pointer to the device connection specification */
|
/** Pointer to the device connection specification */
|
||||||
dev_spec ds;
|
nfc_device_spec_t nds;
|
||||||
/** This represents if the PN53X device was initialized succesful */
|
/** This represents if the PN53X device was initialized succesful */
|
||||||
bool bActive;
|
bool bActive;
|
||||||
/** Is the crc automaticly added, checked and removed from the frames */
|
/** Is the crc automaticly added, checked and removed from the frames */
|
||||||
|
@ -98,7 +98,7 @@ struct driver_callbacks {
|
||||||
/** Connect callback */
|
/** Connect callback */
|
||||||
nfc_device_t* (*connect)(const nfc_device_desc_t* pndd);
|
nfc_device_t* (*connect)(const nfc_device_desc_t* pndd);
|
||||||
/** Transceive callback */
|
/** 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 */
|
/** Disconnect callback */
|
||||||
void (*disconnect)(nfc_device_t* pnd);
|
void (*disconnect)(nfc_device_t* pnd);
|
||||||
};
|
};
|
||||||
|
|
|
@ -115,7 +115,7 @@ bool pn53x_transceive(const nfc_device_t* pnd, const byte_t* pbtTx, const size_t
|
||||||
|
|
||||||
*pszRxLen = MAX_FRAME_LEN;
|
*pszRxLen = MAX_FRAME_LEN;
|
||||||
// Call the tranceive callback function of the current device
|
// 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)
|
// Make sure there was no failure reported by the PN53X chip (0x00 == OK)
|
||||||
if (pbtRx[0] != 0) return false;
|
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[2] = ui16Reg >> 8;
|
||||||
abtCmd[3] = ui16Reg & 0xff;
|
abtCmd[3] = ui16Reg & 0xff;
|
||||||
// We can not use pn53x_transceive() because abtRx[0] gives no status info
|
// 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;
|
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[3] = ui16Reg & 0xff;
|
||||||
abtCmd[4] = ui8Value | (pn53x_get_reg(pnd,ui16Reg) & (~ui8SybmolMask));
|
abtCmd[4] = ui8Value | (pn53x_get_reg(pnd,ui16Reg) & (~ui8SybmolMask));
|
||||||
// We can not use pn53x_transceive() because abtRx[0] gives no status info
|
// 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)
|
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;
|
abtCmd[2] = ui8Value;
|
||||||
// We can not use pn53x_transceive() because abtRx[0] gives no status info
|
// 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)
|
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
|
// Try to retrieve PN53x chip revision
|
||||||
// We can not use pn53x_transceive() because abtRx[0] gives no status info
|
// 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
|
// 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);
|
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
|
// 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 NC_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 NC_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_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
|
// 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[2] = RFCI_FIELD;
|
||||||
abtCmd[3] = (bEnable) ? 1 : 0;
|
abtCmd[3] = (bEnable) ? 1 : 0;
|
||||||
// We can not use pn53x_transceive() because abtRx[0] gives no status info
|
// 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;
|
break;
|
||||||
|
|
||||||
case DCO_ACTIVATE_CRYPTO1:
|
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[4] = (bEnable) ? 0xff : 0x00; // MxRtyPSL, default: 0x01
|
||||||
abtCmd[5] = (bEnable) ? 0xff : 0x00; // MxRtyPassiveActivation, default: 0xff
|
abtCmd[5] = (bEnable) ? 0xff : 0x00; // MxRtyPassiveActivation, default: 0xff
|
||||||
// We can not use pn53x_transceive() because abtRx[0] gives no status info
|
// 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;
|
break;
|
||||||
|
|
||||||
case DCO_ACCEPT_INVALID_FRAMES:
|
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
|
// Try to find a tag, call the tranceive callback function of the current device
|
||||||
szRxLen = MAX_FRAME_LEN;
|
szRxLen = MAX_FRAME_LEN;
|
||||||
// We can not use pn53x_transceive() because abtRx[0] gives no status info
|
// 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
|
// Make sure one tag has been found, the PN53X returns 0x00 if none was available
|
||||||
if (abtRx[0] != 1) return false;
|
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:
|
case IM_ISO14443A_106:
|
||||||
// Somehow they switched the lower and upper ATQA bytes around for the PN531 chipset
|
// 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[0] = abtRx[3];
|
||||||
pti->tia.abtAtqa[1] = abtRx[2];
|
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
|
// 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)
|
// abtRx[0] contains the emulation mode (baudrate, 14443-4?, DEP and framing type)
|
||||||
szRxLen = MAX_FRAME_LEN;
|
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
|
// Get the last bit-count that is stored in the received byte
|
||||||
ui8Bits = pn53x_get_reg(pnd,REG_CIU_CONTROL) & SYMBOL_RX_LAST_BITS;
|
ui8Bits = pn53x_get_reg(pnd,REG_CIU_CONTROL) & SYMBOL_RX_LAST_BITS;
|
||||||
|
|
Loading…
Add table
Reference in a new issue