summaryrefslogtreecommitdiff
path: root/src/ccid
diff options
context:
space:
mode:
Diffstat (limited to 'src/ccid')
-rw-r--r--src/ccid/rfid_reader_cm5121_ccid_direct.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/ccid/rfid_reader_cm5121_ccid_direct.c b/src/ccid/rfid_reader_cm5121_ccid_direct.c
new file mode 100644
index 0000000..a2dfb99
--- /dev/null
+++ b/src/ccid/rfid_reader_cm5121_ccid_direct.c
@@ -0,0 +1,36 @@
+/* CM5121 backend for 'internal' CCID driver */
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdio.h>
+
+#include <librfid/rfid_asic.h>
+
+#include <include/ccid/ccid-driver.h>
+
+/* this is the sole function required by rfid_reader_cm5121.c */
+int
+PC_to_RDR_Escape(void *handle,
+ const unsigned char *tx_buf, unsigned int tx_len,
+ unsigned char *rx_buf, unsigned int *rx_len)
+{
+ int rc;
+ ccid_driver_t ch = handle;
+ size_t maxrxlen = *rx_len;
+
+ rc = ccid_transceive_escape (ch, tx_buf, tx_len,
+ rx_buf, maxrxlen, rx_len);
+
+ return rc;
+}
+
+int cm5121_source_init(struct rfid_asic_transport_handle *rath)
+{
+ int rc;
+
+ rc = ccid_open_reader(&rath->data, NULL);
+ if (rc) {
+ fprintf (stderr, "failed to open CCID reader: %#x\n", rc);
+ return -1;
+ }
+ return 0;
+}
personal git repositories of Harald Welte. Your mileage may vary