Commit Graph
71 Commits
Author SHA1 Message Date
Romain Tartiere bb06d45a05 Really silent down gcc with -Wextra. 2010-07-31 12:57:02 +00:00
Romain Tartiere 93494aad24 Fix serial string for FreeBSD.
I am sure we don't have /dev/ttyUSB*, and since I use /dev/cuau0 with a
cross-over cable to connect 2 machines and have a serial console, I guess
"/dev/cuau" is the SERIAL_STRING that's expected to work for me.  A quick test
would be cool however, but I don't own a serial NFC device.
2010-07-31 10:13:18 +00:00
Romain Tartiere f01b73ab32 Move usb_reset(3) call.
As the documentation states, and as reported in isssue 81 (fixed in r421),
usb_reset()'s argument is invalid after the call and so usb_close(3) must be
called before usb_reset(3).
2010-07-29 10:47:53 +00:00
Romain Tartiere af584bd474 Fix packet length checksum computation.
The doc says LCS (aka abtTx[4]) must be set so that the lower byte of LCS+LEN
(aka abtTx[3]) is 0x00.  This has not to be related to the USB buffer size, so
that we can adjust it without breaking down the libnfc.
2010-07-25 16:31:53 +00:00
Romain Tartiere 7f9f907bc2 Silent down compiler. 2010-07-24 18:54:50 +00:00
Romain Tartiere e6d079d87a Fix a regression introduced at r461.
This prevents the ATR_REQ from being processed and some tags detection fails in
libfreefare.
2010-07-24 17:20:48 +00:00
Romain Tartiere 4ff66d125f Fix a regression introduced at r458.
Both abtInit and szInitLen are initialised using pbtInitData and szInitDataLen,
so we must use them when calling pn53x_InListPassiveTarget().
2010-07-24 16:30:44 +00:00
Romain Tartiere 7945dd18fa Enhance 'make indent'.
- Complete indent(1)'s arguments list;
  - Ensure files to be indented have no local edit;
  - Hide indent command-line details.  Since everything is static, no need for V=1 support.
2010-07-21 22:32:02 +00:00
Romain Tartiere 67fb1330f8 Rework the indent target.
- Check indent is present at ./configure stage;
  - If gindent(1) is installed, use it instead of indent(1);
2010-07-21 13:09:48 +00:00
Romain Tartiere d8f12035fc Add missing carriage return at EOF (yes, I have nothing better to do ATM). 2010-06-26 21:56:32 +00:00
Romain Tartiere 9941191cfc Fix build when configured with --enable-debug. 2010-04-28 12:55:00 +00:00
Romain Tartiere 16786c61e3 Remove bitutils I reverted instead of removing in r412. 2010-04-26 13:20:57 +00:00
Romain Tartiere b28abd77b0 Merge the libnfc-less-bitutils-more-ponies branch into trunk. 2010-04-26 13:13:13 +00:00
Romain Tartiere 00af8b7ae1 Fix ${DRIVERS_SOURCES} modifications. 2010-04-26 13:05:21 +00:00
Romain Tartiere 204130477e (libnfc-less-bitutils-more-ponies) MFT 2010-04-17 13:45:00 +00:00
Romain Tartiere be3f152d3c Fix a few more warnings. 2010-04-17 13:42:08 +00:00
Romain Tartiere 086e24c407 (libnfc-less-bitutils-more-ponies) Fix build on windows:
- do not depends on byte swapping functions / macros;
  - add basic err.h functionalities.
2010-04-16 22:38:45 +00:00
Romain Tartiere 3e8e1c8844 Fix build on Windows (using cmake and nmake). 2010-04-16 20:39:56 +00:00
Romain Tartiere 3820c34f28 (libnfc-less-bitutils-more-ponies) MFT 2010-04-16 19:27:49 +00:00
Romain Tartiere 0e6719908b (libnfc-less-bitutils-more-ponies) Update CMakeLists.txt. 2010-04-16 17:42:00 +00:00
Romain Tartiere 3dccc218df Enable drivers in cmake again (disabled implicitly in r375). 2010-04-16 17:35:00 +00:00
Romain Tartiere 39761badb7 Fix cmake breakage introduced in r360:
undefined reference to `print_nfc_iso14443a_info'
2010-04-16 17:20:22 +00:00
Romain Tartiere 5e452dbb13 Fix cmake breakage introduced in r352:
error: 'for' loop initial declaration used outside C99 mode
2010-04-16 17:10:08 +00:00
Romain Tartiere 10baef235f (libnfc-less-bitutils-more-ponies) Get rid of bitutils.[hc] (part 1).
- New API function append_iso14443a_crc();
  - Add a PRINT_HEX macro for driver debugging (replaces print_hex function from bitutils.c);
  - Move bit-mirroring related functions to libnfc/mirror-subr.[hc];
  - Move iso14443 related functions to libnfc/iso14443-subr.c;
  - Move libnfc/bitutils.c hex-dumping code to examples/nfc-utils.c;
  - Replace calls to swap_endian32() and swap_endian64() functions with calls to bswap32() and bswap64 provided by endian.h.

And while I am here:
  - Fix the DBG macro so that it does not throw warning at compile time.
2010-04-16 16:38:57 +00:00
Romain Tartiere 5302930b09 Avoid using a 'comma pasting' GNU extension (non-portable, reported my clang).
This is not a 'complete' fix since the DBG macro is still using it; but more globally, this file should not be part of the libnfc installed files.  We should rely on error codes and maybe some logging mechanism (e.g. syslog() on POSIX compliant systems and RegisterEventSource() / ReportEvent() on Windows).
2010-04-16 14:50:48 +00:00
Romain Tartiere 0b301d8ff6 Add missing documentation lines. 2010-04-16 13:00:33 +00:00
Romain Tartiere 7b65174856 Remove deprecated DEBUG_CFLAGS. 2010-04-16 12:58:29 +00:00
Romain Tartiere 4dbeff47db Fix warnings on 32bit systems:
- format '%ld' expects type 'long int', but argument 2 has type 'unsigned int';
  - format '%ld' expects type 'long int', but argument 2 has type 'size_t'.

Tested on FreeBSD arm.
2010-04-15 23:11:36 +00:00
Romain Tartiere ae99d155b5 Make nfc-list rely on the libnfcutils.a convenience library and call nfc_initiator_select_tag(). 2010-04-09 22:08:17 +00:00
Romain Tartiere b8630c4230 Fix various warnings:
- format '%d' expects type 'int', but argument 2 has type 'long unsigned int';
  - format '%d' expects type 'int', but argument 2 has type 'size_t';
  - unused variable 'nti';
  - unused parameter 'argc'.
2010-04-09 22:03:52 +00:00
Romain Tartiere ee3715e267 Add convenience library infrastructure and move the print_nfc_iso14443a_info() function away from bitutils. 2010-04-09 21:57:03 +00:00
Romain Tartiere 5473befa13 Fix a brunch of -Wextra warnings:
- 'static' is not at beginning of declaration;
  - unused parameter;
  - comparison between signed and unsigned.
2010-04-07 15:08:04 +00:00
Romain Tartiere c7d77d7664 Rearrange source code. 2010-04-07 14:37:19 +00:00
Romain Tartiere c4c7fa236a Attempt to be able to compile using manual makefile AND with CMake (missing parts from r332) 2010-04-06 17:55:12 +00:00
Romain Tartiere 09d2fff619 Add another missing CMakeLists.txt in autotooled tarball. 2010-04-03 12:06:50 +00:00
Romain Tartiere 22d4ea3207 Add missing CMakeLists.txt in autotooled tarball. 2010-04-03 12:03:24 +00:00
Romain Tartiere 667ba72dbd Strip CT (Cascade Tag) from UIDs in nfc_initiator_select_tag(). 2010-03-30 16:05:01 +00:00
Romain Tartiere f20a681315 Prevent the Windows installer from installing manual pages. 2010-03-23 10:00:48 +00:00
Romain Tartiere f372104163 Fix build on Windows when using CMake (Tested on Windows XP SP3 with WinSDK 7) 2010-03-22 20:34:02 +00:00
Romain Tartiere b3b3f47876 - Sync libnfc version in CMake with the one in the autotools;
- Only add gcc-specific options when using gcc.
2010-03-22 20:28:30 +00:00
Romain Tartiere e223b93d91 The obsolete function usleep(3) also needs _XOPEN_SOURCE >= 500. 2010-02-20 13:01:43 +00:00
Romain Tartiere b67dbe668b Honour ctype(3) caveats section. 2010-02-17 14:36:33 +00:00
Romain Tartiere 9bafef8d88 Include pn53x.conf in libnfc tarballs since pn53x.rules is in it too. 2010-02-16 14:09:35 +00:00
Romain Tartiere 219d5657e8 Add devd(8) rules to change USB devices permissions when they are plugged-in on FreeBSD. 2010-02-16 14:06:56 +00:00
Romain Tartiere 386597af6e Define _NETBSD_SOURCE that makes a few more serial speeds defined in termios.h. 2010-02-10 13:46:12 +00:00
Romain Tartiere 0d395733af Fix indent after last commit. 2010-02-10 11:23:38 +00:00
Romain Tartiere c8c03fe2e0 Do not add libusb to PKG_CONFIG_REQUIRES unless it is located using this method. Fix build failure for software detecting libnfc using pkg-config on FreeBSD (at least) when libusb is part of the system. 2010-02-10 11:23:01 +00:00
Romain Tartiere 1e0272d006 Make configure fail if pkg-config cannot be found. 2010-02-08 19:43:25 +00:00
Romain Tartiere 3914cf7eac Fix build on NetBSD. 2010-02-08 19:40:41 +00:00
Romain Tartiere 10183ffd22 ATM, there is no particular reason to keep O_NDELAY in open(2) flags (not defined by POSIX, BTW), but a particular reason to suppress it: it breaks build on FreeBSD. 2010-01-28 15:46:55 +00:00
Romain Tartiere 19672806d2 Fix some more cc warnings. 2010-01-28 15:42:50 +00:00
Romain Tartiere 4669279589 Add missing header. Fix build at least on FreeBSD 7.2.
Reported by:	tinderbox
2010-01-28 14:32:23 +00:00
Romain Tartiere 7d20198520 Tweak the libusb detection.
1. Try to use pkg-config to locate libusb;
  2. Try with libusb-config if not found;
  3. Try to locate headers and lib if still not found.

This would hopefully prevent build failures in some very particular cases, such as cross compiling libnfc on a FreeBSD version for another FreeBSD version that does not use the same libusb.

http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/142836

Reported by:	Dmitry Marakasov
2010-01-28 13:56:04 +00:00
Romain Tartiere e92de4d49e Ensure UART file descriptors are valid before using them in uart_close ().
The uart_open() function may call uart_close() with a 'serial_port' structure with an invalid member 'fd' if the port was not opened successfully.  The call to uart_close() was kept for consistency with the rest of the function because uart_close() is also in charge of freeing 'serial_port'.
2010-01-15 10:38:50 +00:00
Romain Tartiere 3f8068b760 Include "config.h" at the beginning of all source code, remove it from headers.
While here distinguish licence comments using the /*- special comment delimiter.
2010-01-15 10:18:11 +00:00
Romain Tartiere 31597117a2 Update the ChangeLog entry of FreeBSD support (libnfc has not been run on a "today current" -CURRENT FreeBSD system. It's smooth on -STABLE BTW).
While here, fix a typo and adjust style for consistency.
2010-01-06 10:24:49 +00:00
Romain Tartiere 73448612af Increase _XOPEN_SOURCE to 600.
The snprintf() function conforms to C99.  On FreeBSD, sys/cdefs.h instruct us that _XOPEN_SOURCE == 500 defines _POSIX_C_SOURCE as 199506 which in turn defines __ISO_C_VISIBLE as 1990.  600 is the minimal _XOPEN_SOURCE value we can use to allow us using C99 functions.

Reported by:	tinderbox
2009-12-23 12:01:40 +00:00
Romain Tartiere e0fab1c9a7 Add stdlib.h header where applicable (where we call malloc() / free()).
Reported by:	tinderbox
2009-12-23 11:56:56 +00:00
Romain Tartiere aa7d7171c8 Sync libnfc.pc includedir with the rest of the project source files.
When I introduced headers separation (aka includes-revamp branch), the libnfc source code includes have been changed from '#include "../xx/nfc*.h"' to '#include <nfc/nfc*>' (when compiling, the source include dir (src/include) has precedence over '${prefix}/include').  For the sake of consistency, update libnfc.pc includedir so that compiling third party code using '#include <nfc/nfc*>' just works (tm).  This provides much more consistent headers since they are usually referred relative to the includedir (exceptions are e.g. glib, gtk, xorg... quite bigger than libnfc I could say).
2009-12-22 21:02:19 +00:00
Romain Tartiere 61a0aba66e Make use of the new AM_SILENT_RULES macro of automake 1.11 if possible.
We can see warnings again!
2009-12-16 23:16:21 +00:00
Romain Tartiere 462d986633 Free memory allocated by pick_device() once we are connected to the device in nfc_connect(). 2009-12-16 23:14:31 +00:00
Romain Tartiere 86dac7a4bb Do not call drivers' connect() function if pick_device() returns NULL. 2009-12-03 02:08:40 +00:00
Romain Tartiere 2b8232b9ab Merge the includes-revamp branch into trunk. 2009-12-01 14:23:00 +00:00
Romain Tartiere dedfbb0ec8 Fix CMakeLists for FreeBSD. 2009-12-01 13:26:34 +00:00
Romain Tartiere 5c164c97b2 Fix build on recent FreeBSD (ie. upcoming FreeBSD 8.0; FreeBSD CURRENT).
Since March 9, 2009; the FreeBSD operating system base ships with libusb.  As a consequence, the devel/libusb ports that used to provide userland programs access to USB devices is useless and so marked as IGNORE for recent versions of FreeBSD.  This patch detects the FreeBSD version configure is run on and conditionally ignore the libusb detection if relevant.

Obtained from:	Ooo vcs.
2009-11-26 23:32:40 +00:00
Romain Tartiere 92cdc705cd Avoid blocking operations in acr122_list_devices.
The various SCardConnect() can block if a device is already opened in PC/SC potentially leading to deadlocks.  Avoiding using this and matching the device name against a list of supported devices instead.
2009-11-25 02:55:05 +00:00
Romain Tartiere 21df72269a Reindent; Fix ACR122 driver [1]; make distcheck OK.
Pointy hat to:   me [1]
2009-11-24 18:05:31 +00:00
Romain Tartiere 4e50bf7a8b Fix ACR122 with firmware > 2.0 support. 2009-11-24 17:58:07 +00:00
Romain Tartiere 220bef3490 ACR122 devices support enhancements.
- Add driver agnostic nfc_pick_device(), nfc_list_devices();
  - New API function: nfc_list_devices();
  - PCSC Context sharing for acr122 driver;
  - List all devices in nfc-list(1);
  - Various code fixes and cleanup;
  - Remove warnings when compiling;
  - Merge r191:199 from trunk \_°< Coin!
2009-11-24 17:49:24 +00:00
Romain Tartiere 1af29561e8 Add device listing capabilities
- acr122: add acr122_pick_device(), acr122_list_devices();
  - Add device name to device descriptions (nfc_device_desc_t) to select a given PCSC device;
  - Use constants for driver names;
  - Various code cleanups and enhancements.
2009-11-24 13:03:48 +00:00
Romain Tartiere fbb924e3bb Add workarounds for libusb in c99. 2009-11-24 12:55:34 +00:00