projects
/
librfid
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Simplify compile options (either --enable-ccid or --enable-openct implies --enable...
[librfid]
/
src
/
rfid_reader_cm5121.c
diff --git
a/src/rfid_reader_cm5121.c
b/src/rfid_reader_cm5121.c
index
ab1e701
..
9587272
100644
(file)
--- a/
src/rfid_reader_cm5121.c
+++ b/
src/rfid_reader_cm5121.c
@@
-1,6
+1,6
@@
/* Omnikey CardMan 5121 specific RC632 transport layer
*
/* Omnikey CardMan 5121 specific RC632 transport layer
*
- * (C) 2005 by Harald Welte <laforge@gnumonks.org>
+ * (C) 2005
-2006
by Harald Welte <laforge@gnumonks.org>
*
* The 5121 is an Atmel AT89C5122 based USB CCID reader (probably the same
* design like the 3121). It's CL RC632 is connected via address/data bus,
*
* The 5121 is an Atmel AT89C5122 based USB CCID reader (probably the same
* design like the 3121). It's CL RC632 is connected via address/data bus,
@@
-26,17
+26,21
@@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <librfid/rfid.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <librfid/rfid.h>
+
+#ifndef LIBRFID_FIRMWARE
+
#include <librfid/rfid_reader.h>
#include <librfid/rfid_asic.h>
#include <librfid/rfid_asic_rc632.h>
#include <librfid/rfid_reader_cm5121.h>
#include <librfid/rfid_reader.h>
#include <librfid/rfid_asic.h>
#include <librfid/rfid_asic_rc632.h>
#include <librfid/rfid_reader_cm5121.h>
+#include <librfid/rfid_layer2.h>
+#include <librfid/rfid_protocol.h>
#include "cm5121_source.h"
#include "cm5121_source.h"
@@
-301,7
+305,6
@@
static int cm5121_enable_rc632(struct rfid_asic_transport_handle *rath)
unsigned int rx_len = sizeof(rx_buf);
PC_to_RDR_Escape(rath->data, tx_buf, 1, rx_buf, &rx_len);
unsigned int rx_len = sizeof(rx_buf);
PC_to_RDR_Escape(rath->data, tx_buf, 1, rx_buf, &rx_len);
- printf("received %u bytes from 01 command\n", rx_len);
return 0;
}
return 0;
}
@@
-312,12
+315,12
@@
cm5121_open(void *data)
struct rfid_reader_handle *rh;
struct rfid_asic_transport_handle *rath;
struct rfid_reader_handle *rh;
struct rfid_asic_transport_handle *rath;
- rh = malloc(sizeof(*rh));
+ rh = malloc
_reader_handle
(sizeof(*rh));
if (!rh)
return NULL;
memset(rh, 0, sizeof(*rh));
if (!rh)
return NULL;
memset(rh, 0, sizeof(*rh));
- rath = malloc(sizeof(*rath));
+ rath = malloc
_rat_handle
(sizeof(*rath));
if (!rath)
goto out_rh;
memset(rath, 0, sizeof(*rath));
if (!rath)
goto out_rh;
memset(rath, 0, sizeof(*rath));
@@
-339,9
+342,9
@@
cm5121_open(void *data)
return rh;
out_rath:
return rh;
out_rath:
- free(rath);
+ free
_rat_handle
(rath);
out_rh:
out_rh:
- free(rh);
+ free
_reader_handle
(rh);
return NULL;
}
return NULL;
}
@@
-351,15
+354,21
@@
cm5121_close(struct rfid_reader_handle *rh)
{
struct rfid_asic_transport_handle *rath = rh->ah->rath;
rc632_close(rh->ah);
{
struct rfid_asic_transport_handle *rath = rh->ah->rath;
rc632_close(rh->ah);
- free(rath);
- free(rh);
+ free
_rat_handle
(rath);
+ free
_reader_handle
(rh);
}
}
-struct rfid_reader rfid_reader_cm5121 = {
+
const
struct rfid_reader rfid_reader_cm5121 = {
.name = "Omnikey CardMan 5121 RFID",
.open = &cm5121_open,
.close = &cm5121_close,
.transceive = &cm5121_transceive,
.name = "Omnikey CardMan 5121 RFID",
.open = &cm5121_open,
.close = &cm5121_close,
.transceive = &cm5121_transceive,
+ .l2_supported = (1 << RFID_LAYER2_ISO14443A) |
+ (1 << RFID_LAYER2_ISO14443B) |
+ (1 << RFID_LAYER2_ISO15693),
+ .proto_supported = (1 << RFID_PROTOCOL_TCL) |
+ (1 << RFID_PROTOCOL_MIFARE_UL) |
+ (1 << RFID_PROTOCOL_MIFARE_CLASSIC),
.iso14443a = {
.init = &cm5121_14443a_init,
.transceive_sf = &cm5121_transceive_sf,
.iso14443a = {
.init = &cm5121_14443a_init,
.transceive_sf = &cm5121_transceive_sf,
@@
-371,10
+380,13
@@
struct rfid_reader rfid_reader_cm5121 = {
.iso14443b = {
.init = &cm5121_14443b_init,
},
.iso14443b = {
.init = &cm5121_14443b_init,
},
+ .iso15693 = {
+ .init = &cm5121_15693_init,
+ },
.mifare_classic = {
.setkey = &cm5121_mifare_setkey,
.auth = &cm5121_mifare_auth,
},
};
.mifare_classic = {
.setkey = &cm5121_mifare_setkey,
.auth = &cm5121_mifare_auth,
},
};
-
+#endif /* LIBRFID_FIRMWARE */