Gemplus GemPC 410 and GemPC 430 IFD Handler
===========================================

This package provides the source code for the GemPC 410 (serial) and
GemPC 430 (usb) smart card familly readers PC/SC ifd handler.

Both readers use a GemCore chip and the same set of commands. Only the
low level transport layer is different.


See README.410 for GemPC410 specific comments.
See README.430 for GemPC430 specific comments.


Authors:
========

- David Corcoran for the original headers and empty ifdhandler.c file
- Jean-Luc Giraud for the main part of GemPC430/ and half of common/
- Ludovic Rousseau for the main part of GemPC410/ and half of common/


Supported readers:
==================

- GemPC 410
  . normal GemPC 410 (GemCore-R1.21-GM)
  . IBM 410p (v1.21)
  . GemPC 410-SL (GemCore-R1.21-GM)

- GemPC 412
  . GCR412 FirstUSA (GemCore-R1.21-GM)

- GemPC 413
  . EMV complient (GemCore-R1.32-GK)

- GemPC 415
  . VISA and American Express 415 (unkown)

- GemPC 430
  . normal GemPC 430 (GemUsb-R1.04-GM)

- GemPC 432
  . target.com (GemUsb-R1.04-WM)

- GemPC 435
  . American Express Blue Card reader (GemUsb-R1.04-A)

The number in () is the GemCore version as seen in the logs generated by
the driver. Like in "(GemPC430) OS string: GemUsb-R1.04-GM" or
"(GemPC410) OS string: GemCore-R1.21-I"


Unsupported GemCore based readers:
==================================

- GCR400
  Very old version of the GemPC410.

- GCR410
  Old version of the GemPC410. This reader uses a GemCore version 1.118
  or 1.10. With this firmware the case 4 commands (both input and output
  data) will not work.


Licences:
=========

The files in GemPC410/ are under GNU General Public Licence.

The files in GemPC430/ are under a BSD-like licence (except main.c which
is under GPL but is not needed to build the driver).

The files in common/ are under a double licence BSD-like and GNU General
Public Licence. except the files ifdhandler.c, ifdhandler.h and
pcscdefines.h which are originally written by David Corcoran and are
under the BSD-like licence.

That means that the GemPC 410 driver is under GNU General Public
Licence, and that the GemPC 430 driver is the BSD-like licence or the
GNU General Public Licence at your choice.


Supported pcsc-lite versions
============================

pcsc-lite 1.1.2beta4 and later
    You can get the latest pcsc-lite version from
    http://linuxnet.com/middle.html or from
    http://pcsclite.alioth.debian.org/

Get pcsc-lite higher than 1.2.0 if you want to use /etc/reader.conf
DEVICENAME fields managed by the new API IFDHCreateChannelByName()


History:
========

1.0.8 - 14 December 2017, Ludovic Rousseau
    - fix typo in log message

1.0.7 - 8 April 2012, Ludovic Rousseau
    - add GemPC430/50-pcscd-ifd-gempc.rules udev file
    - Use CFLAGS and LDFLAGS in Makefile (Debian bug #667931)


1.0.6 - 16 June 2010, Ludovic Rousseau
    - fix an error in opening a serial port
      Thanks to Joerg Hartenberger for the patch

    - fix spelling error

1.0.5 - 12 April 2009, Ludovic Rousseau
    - correctly manage LDFLAGS 
      Thanks to Arfrever Frehtes Taifersar Arahesis for the patch

    - correct compilation warnings

1.0.4 - 15 October 2008, Ludovic Rousseau
    - Allow the header to be read in several calls

      Previously, if the header was not read in a single read() calls,
      there was an error. This is an issue because some commands return
      the two first bytes, then a small pause, then the rest of the
      header ...

      At least this happens on a gci410emv connected thru an usb adapter
      ...  Now it works fine.

      Patch from Sylvain Munaut

    - Fix powerup sequence when switching to ISO mode
        
      If somehow the reader/card was in EMV mode, we need to switch it
      to ISO. This was done but the final attemp to powerup tried to
      power it up in EMV mode ... most likely a typo.
	    
      Patch from Sylvain Munaut

1.0.3 - 14 August 2007, Ludovic Rousseau
    - correct a big bug unnoticed for many years and declared on PowerPC
      with gcc 4.x (Debian bug #428323)
    - do not strip the library so we have debug symbols if needed.
      strip should be called by the package build process (if needed)

1.0.2 - 29 June 2007, Ludovic Rousseau
    - correctly handle empty response from the GemPC410 reader

1.0.1 - 9 February 2006, Ludovic Rousseau
    - remove a useless "POUET" debug message
    - allow compilation with pcsc-lite-1.2.9-beta10. The check script
      was buggy for beta > 9
    - fix some compilation warnings with gcc 4.0

1.0.0 - 17 June 2005, Ludovic Rousseau
    - use new pcscd log function with dynamic level
    - use `pkg-config libpcsclite --variable=usbdropdir` to know where
      to install the driver

0.9.3 - 8 August 2004, Ludovic Rousseau
    - maintainance release to make it compile using gcc-3.4

0.9.2 - 25 July 2004, Ludovic Rousseau
    - use the header files provided by pcsc-lite 1.2.9-beta
    - use pkg-config to know the where to find the pcsc-lite include
      files
    - minium pcsc-lite version is 1.2.9-beta5

0.9.1 - 27 February 2004, Ludovic Rousseau
    - add a compilation flag AUTOMATIC_PPS to activate automatic PPS
      negociation by the reader firmware. I received many bug reports
      with some cards. The card works until some APDU returns a
      "invalid procedure byte" error. By default the automatic PPS
      negociation is now NOT performed. Uncomment a line in
      GemPC4?0/Config.h to revert to the previous behavior and choose
      speed versus safety
    - GemPC430/libusb_wrap.c: use pcsc-lite new
      IFDHCreateChannelByName() scheme: usb:vendor/product
      In 0.9.0 the driver failed when used with a CVS version of
      pcsc-lite. Thanks to Dr Russel Winder for the bug report
    - common/GCCmds.h: the GemCore error message now contains the file,
      function and line number of the command with error and not of the
      error printing function
    - add two GemCore error code descriptions: 0x15 and 0xE4

0.9.0 - 22 January 2004, Ludovic Rousseau
    - add support of IFDHCreateChannelByName() (from pcsc-lite > 1.2.0)
    - GemPC430/libusb_wrap.c: reset the reader in case of timeout on
      write (reader freeze?). Thanks to Patrick Valsecchi for the patch.
    - use asymetric timeout for USB read and write. The reader/card may
      be busy when we read (long timeout) but should be OK when we write
      (short timeout)

0.8.2 - 22 Octobre 2003, Ludovic Rousseau
    - Remove support for multi slot. The code was never used and is now
      broken under revent pcsc-lite versions. The error under pcsc-lite is:
        readerfactory.c:1391 RFInitializeReader: Attempting startup of GemPC430 0 0.
        readerfactory.c:1133 RFBindFunctions: Loading IFD Handler 2.0
        ifdhandler.c:87 (GemPC43x) Entering IFDHCreateChannel (lun: 0)
        GCCmds.c:394 (GemPC43x) GCCmdSetMode
        GCCmds.c:319 (GemPC43x) GCCmdGetOSVersion
        GemPC430Utils.c:51 (GemPC43x) OS string: GemUsb-R1.04-GM 
        ifdhandler.c:158 (GemPC43x) entering IFDHGetCapabilities (lun: 0)
        ifdhandler.c:158 (GemPC43x) entering IFDHGetCapabilities (lun: 0)
        readerfactory.c:1391 RFInitializeReader: Attempting startup of GemPC430 0 1.
        readerfactory.c:925 RFLoadReader: Warning library pointer not NULL
        readerfactory.c:1133 RFBindFunctions: Loading IFD Handler 2.0
        ifdhandler.c:87 (GemPC43x) Entering IFDHCreateChannel (lun: 1)
        libusb_wrap.c:106 (GemPC43x) USB driver with lun 1 already in use
        GemPC430Utils.c:30 (GemPC43x) OpenUSB failed
        ifdhandler.c:102 (GemPC43x) OpenReader failed
        readerfactory.c:1428 RFInitializeReader: Open Port 200000 Failed
        readerfactory.c:423 RFAddReader: GemPC430 init failed.
        hotplug_libusb.c:344 Adding USB device: 002:002
        readerfactory.c:119 RFAddReader: Duplicate reader found.
        hotplug_libusb.c:344 Adding USB device: 002:002
        readerfactory.c:119 RFAddReader: Duplicate reader found.
        [...]
      The reader told pcsc-lite that it supported two slots and
      pcsc-lite wanted to start two readers (one for each slot).
    - add support for 7 new GemCore error codes
    - check: Explain how to tell check to look elsewhere than just /usr/
      and /usr/local/

0.8.1 - 2 Septembre 2003, Ludovic Rousseau
    - ./check: uses paths defined in the Makefiles (if libusb is not
      installed in /usr or /usr/local)
    - common/GCCmds.c: add support of GemCore "Parity error during
      exchange"
    - GemPC410/devfs/libgempc410.devfsd.conf: use $devpath instead of
      $devname otherwise we have /dev/pcsc/1 -> tts/0 instead of
      /dev/pcsc/1 -> /dev/tts/0
    - GemPC430/Info.plist: use new <array></array> style
    - common/ifdhandler.c: FDHGetCapabilities() add support of tag
      TAG_IFD_SLOTS_NUMBER. All the readers I have/know have only one
      slot so this does not bring any new real functionnality.
    - Makefiles: do not exit with failure if makedepend(1) does not
      exist
    - update build and distclean rules.

0.8.0 - 12 April 2003, Ludovic Rousseau
    - Add support for GemPC 413 reader. That reader uses GemCore 2000
      and is EMV complient (different powerup sequence).
    - Add support for driver aliasing for USB drivers. Allows to connect
      different readers like a 430 and a 432 at the same time. You will
      need pcsc-lite-1.1.2beta4 for that.
    - change USB timeout from 10 to 60 seconds.
    - check: do not use /usr/local/include by default since cpp will
      warning on some systems (recent RedHat systems).
    - optimize Makefile to limit restarting unnecessary check and building.
    - driver filename for USB is now versioned (ie libGemPC430.so.0.8.0).

0.7.4 - 20 November 2002, Ludovic Rousseau
    - add comment on how to compile the USB driver (install libusb, etc.)
    - add the ./check script (MacOS X is not concerned here).
      Many users add problems with a "undefined symbol: debug_msg" error
      when starting pcscd. It will now NOT be possible to compile the
      drivers unless the _minimum_ versions of libusb and pcsc-lite are
      installed.

0.7.3 - 18 October 2002, Ludovic Rousseau
    - The GemPC430 driver under Linux now support hotplug. With the
      previous versions the reader(s) needed to be plugged _before_
      pcscd is started.

0.7.2 - 15 October 2002, Ludovic Rousseau
    - very very small modification. The previous compilation problem was
      not corrected.

0.7.1 - 15 October 2002, Ludovic Rousseau
    - very small modification to ease or allow compilation on some
      platforms (all 11 Debian supported platforms except i386)

0.7.0 - 13 October 2002, Jean-Luc Giraud, Ludovic Rousseau
    - the drivers are now shipped with low level debug messages OFF
    - do not depend on makedepend(1) anymore. Use it if present only.
    - GemPC410:
      - retry the last command if GBP returns a wrong first byte (NAD).
        This will help some GemPC410 to work. Before pcscd had to be
        started a second time.
      - add support for GemCore Repeat requests
    - GemPC410/devfs/ contains configuration files for devfs Linux systems
    - README.430: add a note about /proc/bus/usb/ directory under Linux
    - usbserial_mosx.c:
      - better stability and multiple reader support
      - the productId is now read from the Info.plist. This allow to
        support readers like the 432 and 435 without recompiling the
        library
    - libusb_wrap.[c|h] new files to use libusb under Linux and other
      systems supported by libusb. The USB driver _should_ work under
      FreeBSD and OpenBSD but in fact does not.

0.6.5 - 16 August 2002, Ludovic Rousseau
    - update README with the new readers supported (412, 415, 432, 435)
    - we now use the debug facilities from pcscd. see "Supported
      pcsc-lite" section
    - GemPC410/gbpserial.c: the serial initialisation should work
    - GemPC430/usbserial_linux.c: support for 432 and 435 readers

0.6.4 - 21 May 2002, Ludovic Rousseau
    - common/GCCmds.c: perform a powerup without PPS managment if the
      powerup with PPS managment failed
    - */Makefile: correctly remove .dependencies files
    - change sys_errlist[errno] to strerror(errno) to be (more) ready
      for the Hurd

0.6.3 - 9 May 2002, Ludovic Rousseau
    - README.410: Add info on /dev/pcsc/ for OpenBSD and FreeBSD
    - Case1 APDUs are converted in ISO IN commands (with length=0)
      instead of ISO OUT commands
    - some code cleanup

0.6.2 - 01 Apr 2002, Ludovic Rousseau, Jean-Luc Giraud
    - Add support for TAG_IFD_SIMULTANEOUS_ACCESS in IFDHGetCapabilities
    - Restore automatic PPS management compatible with Cyberflex
    - GemPC430/usbserial_mosx.c: fixes for multi-reader support
    - GemPC410/gbpserial.c: complete reimplementation of serial port
      configuration

0.6.1 - 11 Mar 2002, Ludovic Rousseau
    - GemPC410/gbpserial.c:
      . modified again the port BAUDS setting during open().

0.6.0 - 7 Mar 2002, Ludovic Rousseau
    - GemPC410/gbpserial.c:
      . modified the port BAUDS setting during open().
      . Changed the timeout delay from 2 to 10 seconds
    - common/ifdhandler.c: IFDHTransmitToICC: now manages case 1 APDU
      (only CLA, INS, P1, P2) as an outgoing APDU (CLA, INS, P1, P2, 0)
    - add a debug level: PERIODIC for... periodic calls. Do not define
      DEBUG_LEVEL_PERIODIC in GemPC4?0/Config.h if you don't want to see
      periodic logs from GCCmdCardStatus(), IFDHSetCapabilities() and
      IFDHICCPresence()
    - add a note about support of the IBM-410p reader.

0.5.10 - 3 Mar 2002, Ludovic Rousseau, Jean-Luc Giraud
    - fix bug with some kind of Cyberflex Access cards:
      . disable PPS management
      . the reader stays at 9600 bauds in all cases
    - fix bug when more than 252 output bytes are expected and less than
      that are available (which is the case when the card sends an error)
    - modify install: rule to include release version number in
      filename, create symlinks, remove execution right on the .so lib
    - README.410: Add a script to create the /dev/pcsc/? links
    - GemPC430/GemPC430Utils.c, GemPC410/GemPC410Utils.c,
      common/GCCmds.c: guarantee that the os_string is \0 terminated
    - GemPC410/resetGemPC410.c, GemPC410/gbpserial.c: use
      cfgetospeed()/cfsetospeed() instead of accessing directly the
      termios structure
      . the driver now works under OpenBSD
    - common/ifdhandler.c: also log APDU results

0.5.9 - 30 Nov 2001, Jean-Luc Giraud
    - fix bug in GCUtils.c/gemcore_ISO_EXCHANGE_processing()
    - added ProjectBuilder folder for MacOS X

0.5.8 - 27 Nov 2001, Ludovic Rousseau
    - MANIFEST: do not contain non existing files
        include create_distrib.sh
    - create_distrib.sh: exit in case of error
        mkdir creates the parents directories if needed, 

0.5.7 - 27 Nov 2001, Ludovic Rousseau
    - GemPC430/usblinux.c: crashed with two readers and no root
      priviledges
    - GemPC410/main.c: test code now support ISO 7816 case 1, 2, 3 and 4
      using Jean-Luc ReaderTest Java applet (not included here)
    - common/GCUtils.c: add support for IFD_ICC_NOT_PRESENT GemCore
      error status
    - GemPC410/gbpserial.c: prepare to support multi serial readers
    - GemPC430/usbserial_mosx.c: prepare to support multi USB readers
    - GemPC410/gbpserial.c: use explain_gbp() to log a descriptive GBP
      level error message
    - MANIFEST: add README.410
    - GemPC410/GemPC410Utils.c: log "OS string" at CRITICAL level to
      always have it the logs
    - GemPC430/GemPC430Utils.c: log "OS string" at CRITICAL level to
      always have it the logs
    - common/ifdhandler.c: Add APDU logging
    - common/GCdebug.h: add DEBUG_COMM3() and DEBUG_CRITICAL3() which is
      typically used to log error messages like "blabla /foo/bar: file not
      found"

0.5.6 - 15 Nov 2001, Ludovic Rousseau
    - all: migrate the type return value from RESPONSECODE to ifd_t,
      status_t or gcore_t
    - GCCmds.c: migrate from low level GCSendCommand() use to higer
      level and simpler GCMakeCommand()
    - libGemPC410 now supports long commands

0.5.5 - 7 Nov 2001, Ludovic Rousseau
    include Jean-Luc modifications to add a new protocol layer
    patch GemPC410 to support this layer
    include patches from the Debian package

0.5.4 - 28 Oct 2001, Ludovic Rousseau
    first public release
    I clarified the licences

0.5.3 - 26 Oct 2001, Ludovic Rousseau
    GemPC 410 and GemPC 430 compiles and runs

0.5.2bis - 23 Oct 2001, Jean-Luc Giraud
    Jean-Luc starts to dispatch ifdhandler.c

0.5.2 - 22 Oct 2001, Ludovic Rousseau
    first release containing GemPC410/ GemPC430/ and common/

0.5 - 14 Oct 2001, Jean-Luc Giraud
    complete release containing the code for the GemPC 430

?.? - 25 Sep 2001, Jean-Luc Giraud
    release of ifdhandler.{c,h} and GemCore.h

$Id: README,v 1.42 2017/12/14 17:50:29 rousseau Exp $

 vim:ts=20
