Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c1986ee9 authored by Harald Welte's avatar Harald Welte Committed by Linus Torvalds
Browse files

[PATCH] New Omnikey Cardman 4000 driver



Add new Omnikey Cardman 4000 smartcard reader driver

Signed-off-by: default avatarHarald Welte <laforge@gnumonks.org>
Cc: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 77c44ab1
Loading
Loading
Loading
Loading
+5 −0
Original line number Original line Diff line number Diff line
@@ -1873,6 +1873,11 @@ L: linux-tr@linuxtr.net
W:	http://www.linuxtr.net
W:	http://www.linuxtr.net
S:	Maintained
S:	Maintained


OMNIKEY CARDMAN 4000 DRIVER
P:	Harald Welte
M:	laforge@gnumonks.org
S:	Maintained

OMNIKEY CARDMAN 4040 DRIVER
OMNIKEY CARDMAN 4040 DRIVER
P:	Harald Welte
P:	Harald Welte
M:	laforge@gnumonks.org
M:	laforge@gnumonks.org
+11 −0
Original line number Original line Diff line number Diff line
@@ -18,6 +18,17 @@ config SYNCLINK_CS
	  The module will be called synclinkmp.  If you want to do that, say M
	  The module will be called synclinkmp.  If you want to do that, say M
	  here.
	  here.


config CARDMAN_4000
	tristate "Omnikey Cardman 4000 support"
	depends on PCMCIA
	help
	  Enable support for the Omnikey Cardman 4000 PCMCIA Smartcard
	  reader.

	  This kernel driver requires additional userspace support, either
	  by the vendor-provided PC/SC ifd_handler (http://www.omnikey.com/),
	  or via the cm4000 backend of OpenCT (http://www.opensc.com/).

config CARDMAN_4040
config CARDMAN_4040
	tristate "Omnikey CardMan 4040 support"
	tristate "Omnikey CardMan 4040 support"
	depends on PCMCIA
	depends on PCMCIA
+1 −0
Original line number Original line Diff line number Diff line
@@ -5,4 +5,5 @@
#
#


obj-$(CONFIG_SYNCLINK_CS) += synclink_cs.o
obj-$(CONFIG_SYNCLINK_CS) += synclink_cs.o
obj-$(CONFIG_CARDMAN_4000) += cm4000_cs.o
obj-$(CONFIG_CARDMAN_4040) += cm4040_cs.o
obj-$(CONFIG_CARDMAN_4040) += cm4040_cs.o
+2078 −0

File added.

Preview size limit exceeded, changes collapsed.

+66 −0
Original line number Original line Diff line number Diff line
#ifndef	_CM4000_H_
#define	_CM4000_H_

#define	MAX_ATR			33

#define	CM4000_MAX_DEV		4

/* those two structures are passed via ioctl() from/to userspace.  They are
 * used by existing userspace programs, so I kepth the awkward "bIFSD" naming
 * not to break compilation of userspace apps. -HW */

typedef struct atreq {
	int32_t atr_len;
	unsigned char atr[64];
	int32_t power_act;
	unsigned char bIFSD;
	unsigned char bIFSC;
} atreq_t;


/* what is particularly stupid in the original driver is the arch-dependant
 * member sizes. This leads to CONFIG_COMPAT breakage, since 32bit userspace
 * will lay out the structure members differently than the 64bit kernel.
 *
 * I've changed "ptsreq.protocol" from "unsigned long" to "u_int32_t".
 * On 32bit this will make no difference.  With 64bit kernels, it will make
 * 32bit apps work, too.
 */

typedef struct ptsreq {
	u_int32_t protocol; /*T=0: 2^0, T=1:  2^1*/
 	unsigned char flags;
 	unsigned char pts1;
 	unsigned char pts2;
	unsigned char pts3;
} ptsreq_t;

#define	CM_IOC_MAGIC		'c'
#define	CM_IOC_MAXNR	        255

#define	CM_IOCGSTATUS		_IOR (CM_IOC_MAGIC, 0, unsigned char *)
#define	CM_IOCGATR		_IOWR(CM_IOC_MAGIC, 1, atreq_t *)
#define	CM_IOCSPTS		_IOW (CM_IOC_MAGIC, 2, ptsreq_t *)
#define	CM_IOCSRDR		_IO  (CM_IOC_MAGIC, 3)
#define CM_IOCARDOFF            _IO  (CM_IOC_MAGIC, 4)

#define CM_IOSDBGLVL            _IOW(CM_IOC_MAGIC, 250, int*)

/* card and device states */
#define	CM_CARD_INSERTED		0x01
#define	CM_CARD_POWERED			0x02
#define	CM_ATR_PRESENT			0x04
#define	CM_ATR_VALID	 		0x08
#define	CM_STATE_VALID			0x0f
/* extra info only from CM4000 */
#define	CM_NO_READER			0x10
#define	CM_BAD_CARD			0x20


#ifdef __KERNEL__

#define	DEVICE_NAME		"cmm"
#define	MODULE_NAME		"cm4000_cs"

#endif	/* __KERNEL__ */
#endif	/* _CM4000_H_ */