diff options
author | laforge <laforge@e0336214-984f-0b4b-a45f-81c69e1f0ede> | 2006-10-07 20:55:16 +0000 |
---|---|---|
committer | laforge <laforge@e0336214-984f-0b4b-a45f-81c69e1f0ede> | 2006-10-07 20:55:16 +0000 |
commit | fe4ffab6d97f2e2696bf7f1fb52a175342611aec (patch) | |
tree | 528bd408acafde03001e6d9296069badba9dcffb /include | |
parent | 2f426580fa990c1e190d09f9d6a4a7fc9b6d25c3 (diff) |
- use C99 compiler flags
- implement some getopt/setopt functions for UID and layer2 specific parameters
- basic rfid scanning support
- add commandline arguments for layer2 / scanning to librfid-tool
- try to detect both supported readers automatically in librfid-tool
- add new 'l2_supported' and 'proto_supported members to rfid_reader
git-svn-id: https://svn.gnumonks.org/trunk/librfid@1895 e0336214-984f-0b4b-a45f-81c69e1f0ede
Diffstat (limited to 'include')
-rw-r--r-- | include/librfid/Makefile.am | 5 | ||||
-rw-r--r-- | include/librfid/rfid.h | 11 | ||||
-rw-r--r-- | include/librfid/rfid_layer2.h | 7 | ||||
-rw-r--r-- | include/librfid/rfid_layer2_iso14443a.h | 4 | ||||
-rw-r--r-- | include/librfid/rfid_layer2_iso14443b.h | 11 | ||||
-rw-r--r-- | include/librfid/rfid_reader.h | 3 | ||||
-rw-r--r-- | include/librfid/rfid_scan.h | 12 |
7 files changed, 48 insertions, 5 deletions
diff --git a/include/librfid/Makefile.am b/include/librfid/Makefile.am index 59ce8cb..4b1337d 100644 --- a/include/librfid/Makefile.am +++ b/include/librfid/Makefile.am @@ -1,10 +1,11 @@ -pkginclude_HEADERS = rfid.h rfid_asic.h rfid_asic_rc632.h \ +pkginclude_HEADERS = rfid.h rfid_scan.h rfid_asic.h rfid_asic_rc632.h \ rfid_layer2.h rfid_layer2_iso14443a.h \ rfid_layer2_iso14443b.h rfid_layer2_iso15693.h \ rfid_protocol.h rfid_protocol_tcl.h \ rfid_protocol_mifare_ul.h \ rfid_protocol_mifare_classic.h \ rfid_reader.h \ - rfid_reader_cm5121.h + rfid_reader_cm5121.h \ + rfid_reader_openpcd.h diff --git a/include/librfid/rfid.h b/include/librfid/rfid.h index b1943d7..c3f8fc1 100644 --- a/include/librfid/rfid.h +++ b/include/librfid/rfid.h @@ -11,7 +11,9 @@ enum rfid_frametype { RFID_MIFARE_FRAME, }; -#if 1 +//#define DEBUG + +#ifdef DEBUG #define DEBUGP(x, args ...) fprintf(stderr, "%s(%d):%s: " x, __FILE__, __LINE__, __FUNCTION__, ## args) #define DEBUGPC(x, args ...) fprintf(stderr, x, ## args) #else @@ -29,4 +31,11 @@ extern const char *rfid_hexdump(const void *data, unsigned int len); int rfid_init(); +enum rfid_opt_level { + RFID_LEVEL_ASIC, + RFID_LEVEL_READER, + RFID_LEVEL_LAYER2, + RFID_LEVEL_LAYER3, +}; + #endif /* _RFID_H */ diff --git a/include/librfid/rfid_layer2.h b/include/librfid/rfid_layer2.h index 3dd54a2..514a735 100644 --- a/include/librfid/rfid_layer2.h +++ b/include/librfid/rfid_layer2.h @@ -14,6 +14,12 @@ enum rfid_layer2_id { RFID_LAYER2_ISO15693, }; +/* 0...0xffff = global options, 0x10000...0x1ffff = private options */ +#define RFID_OPT_L2_PRIV 0x00010000 +enum rfid_layer2_opt { + RFID_OPT_LAYER2_UID = 0x0001, +}; + struct rfid_layer2_handle *rfid_layer2_init(struct rfid_reader_handle *rh, unsigned int id); int rfid_layer2_open(struct rfid_layer2_handle *l2h); @@ -63,6 +69,7 @@ struct rfid_layer2_handle { struct rfid_reader_handle *rh; unsigned char uid[10]; /* triple size 14443a id is 10 bytes */ unsigned int uid_len; + unsigned int proto_supported; union { struct iso14443a_handle iso14443a; struct iso14443b_handle iso14443b; diff --git a/include/librfid/rfid_layer2_iso14443a.h b/include/librfid/rfid_layer2_iso14443a.h index 81f1680..87b6be0 100644 --- a/include/librfid/rfid_layer2_iso14443a.h +++ b/include/librfid/rfid_layer2_iso14443a.h @@ -2,8 +2,8 @@ #define _RFID_ISO14443A_H enum rfid_14443a_opt { - RFID_OPT_14443A_SPEED_RX = 0x00000001, - RFID_OPT_14443A_SPEED_TX = 0x00000002, + RFID_OPT_14443A_SPEED_RX = 0x00010001, + RFID_OPT_14443A_SPEED_TX = 0x00010002, }; enum rfid_14443_opt_speed { diff --git a/include/librfid/rfid_layer2_iso14443b.h b/include/librfid/rfid_layer2_iso14443b.h index 5d6d979..07c185f 100644 --- a/include/librfid/rfid_layer2_iso14443b.h +++ b/include/librfid/rfid_layer2_iso14443b.h @@ -1,6 +1,17 @@ #ifndef _RFID_LAYER2_ISO14443B_H #define _RFID_LAYER2_ISO14443B_H +#include <librfid/rfid_layer2.h> + +enum rfid_iso14443_opt { + RFID_OPT_14443B_CID = 0x00010001, + RFID_OPT_14443B_FSC = 0x00010002, + RFID_OPT_14443B_FSD = 0x00010003, + RFID_OPT_14443B_FWT = 0x00010004, + RFID_OPT_14443B_TR0 = 0x00010005, + RFID_OPT_14443B_TR1 = 0x00010006, +}; + #ifdef __LIBRFID__ struct iso14443b_atqb { diff --git a/include/librfid/rfid_reader.h b/include/librfid/rfid_reader.h index ce29981..2221abd 100644 --- a/include/librfid/rfid_reader.h +++ b/include/librfid/rfid_reader.h @@ -9,6 +9,9 @@ struct rfid_reader_handle; struct rfid_reader { char *name; unsigned int id; + unsigned int l2_supported; + unsigned int proto_supported; + int (*transceive)(struct rfid_reader_handle *h, enum rfid_frametype frametype, const unsigned char *tx_buf, unsigned int tx_len, diff --git a/include/librfid/rfid_scan.h b/include/librfid/rfid_scan.h new file mode 100644 index 0000000..dcfd7bf --- /dev/null +++ b/include/librfid/rfid_scan.h @@ -0,0 +1,12 @@ +#ifndef _RFID_SCAN_H +#define _RFID_SCAN_H + +#include <librfid/rfid_reader.h> +#include <librfid/rfid_layer2.h> +#include <librfid/rfid_protocol.h> + +int rfid_scan(struct rfid_reader_handle *rh, + struct rfid_layer2_handle **l2h, + struct rfid_protocol_handle **ph); + +#endif /* _RFID_SCAN_H */ |