Compare commits
2138 Commits
libnfc-1.2
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 28ce753431 | |||
| 80ef76fdda | |||
|
|
42de50f2b7 | ||
|
|
5b9ae7ee51 | ||
|
|
3df7f25f11 | ||
|
|
16671bd0a3 | ||
|
|
6d0e8a5d9b | ||
|
|
a884a45ab1 | ||
|
|
c8185c9eca | ||
|
|
56f6bd4fbb | ||
|
|
1b8c244e38 | ||
|
|
fb290be070 | ||
|
|
a9cb26b28f | ||
|
|
c924e5e00c | ||
|
|
ba14d10e79 | ||
|
|
9a94f20050 | ||
|
|
180fbabfe1 | ||
|
|
1dc9dcb664 | ||
|
|
1f4d2fb3d4 | ||
|
|
2b5ad9ce0b | ||
|
|
7ebf9b92d6 | ||
|
|
3af2e14acc | ||
|
|
b5180a6a70 | ||
|
|
0cd314c514 | ||
|
|
c3f739dea3 | ||
|
|
126cf9c1be | ||
|
|
d9a04a54ff | ||
|
|
cc4311acab | ||
|
|
e37d24e691 | ||
|
|
1077228fbd | ||
|
|
5c09dc180a | ||
|
|
d5fcd08d41 | ||
|
|
f56bbabf6c | ||
|
|
9cece8b55d | ||
|
|
7ad18a2120 | ||
|
|
e21fab3685 | ||
|
|
82f23c411d | ||
|
|
66d3560608 | ||
|
|
fc51c8662b | ||
|
|
db081ed12d | ||
|
|
6fb61d3c1e | ||
|
|
f2677da74c | ||
|
|
0bf4cec661 | ||
|
|
0de55961c4 | ||
|
|
c8fcaea8ab | ||
|
|
6921e57fb8 | ||
|
|
01bc5693d9 | ||
|
|
db957aabdf | ||
|
|
f7b9b0eafa | ||
|
|
709ef8381f | ||
|
|
3c55b8746b | ||
|
|
02f0f6b290 | ||
|
|
7a5e654309 | ||
|
|
2b21d87e8e | ||
|
|
4e922e8194 | ||
|
|
3f4b7a037a | ||
|
|
dd96571f88 | ||
|
|
5a87f1f3db | ||
|
|
7b6ff73c4b | ||
|
|
e560689f60 | ||
|
|
a28a537610 | ||
|
|
4b7791f845 | ||
|
|
1f6f75af38 | ||
|
|
435e2ffc81 | ||
|
|
874d9605aa | ||
|
|
53eccd4be4 | ||
|
|
b02f94d7da | ||
|
|
f02ff51449 | ||
|
|
5c3c468a6a | ||
|
|
63cf0acb0b | ||
|
|
5294c0290f | ||
|
|
fa78e8b883 | ||
|
|
357ae384af | ||
|
|
c8692aa239 | ||
|
|
91d7c5d32f | ||
|
|
4525cd1c32 | ||
|
|
f52d04e0a7 | ||
|
|
5a059db901 | ||
|
|
730f705c0d | ||
|
|
6b4f6249bd | ||
|
|
d29b3170d9 | ||
|
|
4a2c764961 | ||
|
|
020f5317a6 | ||
|
|
675c30eb93 | ||
|
|
beb8fdd759 | ||
|
|
6f41ea3ad3 | ||
|
|
8352c80679 | ||
|
|
66176016ed | ||
|
|
f1bb27d1af | ||
|
|
c884f36b94 | ||
|
|
17e615e8b1 | ||
|
|
a07d879496 | ||
|
|
10f880374c | ||
|
|
96568a1023 | ||
|
|
dcc52cd4d5 | ||
|
|
19a51dc2bd | ||
|
|
61e93c1cdf | ||
|
|
cbc4e7b5c4 | ||
|
|
692038ceaf | ||
|
|
f3f588671c | ||
|
|
fbae17186b | ||
|
|
004eff8e96 | ||
|
|
7908d405dd | ||
|
|
ff4e1efa7b | ||
|
|
c34c446831 | ||
|
|
54ba7359ce | ||
|
|
fba969472d | ||
|
|
a85f003d91 | ||
|
|
8a1e14901d | ||
|
|
2a6a8e6e29 | ||
|
|
07f918283b | ||
|
|
6e035c33f3 | ||
|
|
a77a2a8497 | ||
|
|
6f793da1c1 | ||
|
|
8e7a8e1b61 | ||
|
|
959a992a81 | ||
|
|
75e5e23c81 | ||
|
|
f8b28523d7 | ||
|
|
ad695d0a18 | ||
|
|
454a8c4d70 | ||
|
|
fbdbe6eff3 | ||
|
|
c109d37783 | ||
|
|
141907e127 | ||
|
|
48d5f6b666 | ||
|
|
a4af2be66c | ||
|
|
91f7db5b4d | ||
|
|
ebb13d8965 | ||
|
|
c42e2502d4 | ||
|
|
c59219905c | ||
|
|
ae56188005 | ||
|
|
a9e4c915f2 | ||
|
|
793d5adde6 | ||
|
|
7ca85a02de | ||
|
|
85100c0aae | ||
|
|
ddfe2e648a | ||
|
|
2418d946a3 | ||
|
|
b5641f8562 | ||
|
|
f93169feb4 | ||
|
|
c52cdb10c8 | ||
|
|
4ae4cc86f8 | ||
|
|
980513f4d1 | ||
|
|
d11db46ddd | ||
|
|
a9af1927e6 | ||
|
|
25ee3a2f76 | ||
|
|
3ba065f00b | ||
|
|
40b54a10d7 | ||
|
|
2229b9ed69 | ||
|
|
4c914e67e5 | ||
|
|
7c9a2a8062 | ||
|
|
62f27c1c58 | ||
|
|
7a0a469c8a | ||
|
|
df4f9c0fbd | ||
|
|
e4ca7f45d2 | ||
|
|
216145fba5 | ||
|
|
2b96c9f3c5 | ||
|
|
2869ae2eb8 | ||
|
|
f9417586c0 | ||
|
|
14f48d0122 | ||
|
|
00700bc66d | ||
|
|
dcdbff0705 | ||
|
|
9f1a68530a | ||
|
|
9f4290b61b | ||
|
|
c9ac17c9f5 | ||
|
|
1bf542b9e2 | ||
|
|
767abe50e2 | ||
|
|
38164c49ef | ||
|
|
c958b2c25d | ||
|
|
a06bfe50a5 | ||
|
|
6235a8a26b | ||
|
|
b59f8fb3b4 | ||
|
|
fead8d6849 | ||
|
|
e41a42cf96 | ||
|
|
024fca9cb7 | ||
|
|
3ec9ecf800 | ||
|
|
560f6a6413 | ||
|
|
abae2bb17b | ||
|
|
f2457d0559 | ||
|
|
a9f3e3a2ac | ||
|
|
963eb074ec | ||
|
|
c04dd91e98 | ||
|
|
fe04b85678 | ||
|
|
3f8bb59f1e | ||
|
|
ca96e50e9b | ||
|
|
32bb627108 | ||
|
|
86ce8dff52 | ||
|
|
b65674a8e3 | ||
|
|
2d2a664f6c | ||
|
|
9ccfba2125 | ||
|
|
787382f4d5 | ||
|
|
b7ae7cb5fd | ||
|
|
6c44c20ffc | ||
|
|
c51caf424a | ||
|
|
e119296680 | ||
|
|
bf31594410 | ||
|
|
04ef5ca902 | ||
|
|
2033519b0c | ||
|
|
f2c264d4ae | ||
|
|
05220537ea | ||
|
|
c815c7a059 | ||
|
|
9a749e1a66 | ||
|
|
e4df2f3334 | ||
|
|
f184407cc5 | ||
|
|
e8d44f1ee8 | ||
|
|
4e4438435d | ||
|
|
02c06c8e28 | ||
|
|
047379406e | ||
|
|
be1b897617 | ||
|
|
15c31aecdb | ||
|
|
ff37cdb2be | ||
|
|
99a7d9aa35 | ||
|
|
c5e8adc169 | ||
|
|
646ab57ace | ||
|
|
db4433f116 | ||
|
|
7e3a7a6d05 | ||
|
|
732a282190 | ||
|
|
d808802b16 | ||
|
|
b86b7efb10 | ||
|
|
11bcf05a75 | ||
|
|
e26fe912fd | ||
|
|
20a1b978f3 | ||
|
|
968f59a988 | ||
|
|
e50b18848f | ||
|
|
372bf37eec | ||
|
|
295c70911a | ||
|
|
f16aeda9d0 | ||
|
|
7991c7d60c | ||
|
|
84c3e8a3ba | ||
|
|
11a2da2811 | ||
|
|
f9f03fa7fa | ||
|
|
8e5ec4acf3 | ||
|
|
e0c72b782f | ||
|
|
3592a60c1d | ||
|
|
9c7b9eda8c | ||
|
|
b38597f1e0 | ||
|
|
e9a750fc00 | ||
|
|
e32cc068ec | ||
|
|
b29332a309 | ||
|
|
e946f7a97a | ||
|
|
b2a9cce037 | ||
|
|
c3b3f64224 | ||
|
|
a07a496234 | ||
|
|
65477eea5e | ||
|
|
a625d6a02d | ||
|
|
d960673681 | ||
|
|
8f8f780c2b | ||
|
|
b953002f8f | ||
|
|
512be89700 | ||
|
|
61b42396d9 | ||
|
|
4a10d0f21b | ||
|
|
7eae55e929 | ||
|
|
0d3d5c13ff | ||
|
|
27ed3acc1a | ||
|
|
35cc69dffb | ||
|
|
4076046a66 | ||
|
|
659f5f407f | ||
|
|
41d694013c | ||
|
|
403650a0fc | ||
|
|
a4bc1b9f6c | ||
|
|
ed62b01a0f | ||
|
|
4b8871fd8f | ||
|
|
ecd0e59b5c | ||
|
|
7b1ff70a52 | ||
|
|
e1a25a8203 | ||
|
|
898f3a4d2f | ||
|
|
83b70d6326 | ||
|
|
7d4352dc98 | ||
|
|
e23f8a9f9c | ||
|
|
e37de54e18 | ||
|
|
e8e1826eeb | ||
|
|
8de7ce3899 | ||
|
|
1f68888020 | ||
|
|
291f70edee | ||
|
|
62159a33ef | ||
|
|
d63e624b09 | ||
|
|
b1a81b385d | ||
|
|
bc8bb8de89 | ||
|
|
c228396c2d | ||
|
|
10398b6bd9 | ||
|
|
24979c65cc | ||
|
|
c7f386dbcf | ||
|
|
42d455c4e7 | ||
|
|
619b476028 | ||
|
|
0cece94778 | ||
|
|
3aa2d46588 | ||
|
|
73c2ef8582 | ||
|
|
1d4720671e | ||
|
|
2046fb9461 | ||
|
|
758cb0cc05 | ||
|
|
c71d7267ac | ||
|
|
20f22b97e7 | ||
|
|
b5684c1755 | ||
|
|
87c6053d6f | ||
|
|
e7feb6587d | ||
|
|
48c271e49d | ||
|
|
53edc32a21 | ||
|
|
4193bb4873 | ||
|
|
b7f620fdab | ||
|
|
141e99959e | ||
|
|
5d2052e77f | ||
|
|
555f9ce4cf | ||
|
|
792e3d9cbd | ||
|
|
13fee61e87 | ||
|
|
09ce2233ce | ||
|
|
e72fe468a4 | ||
|
|
738970c135 | ||
|
|
c55bbec50d | ||
|
|
7ae5a0c333 | ||
|
|
17ed36a7a5 | ||
|
|
6be73720fa | ||
|
|
59f6c5de54 | ||
|
|
49dde9c28c | ||
|
|
7f23f1f84d | ||
|
|
04a51df796 | ||
|
|
68094b4f6d | ||
|
|
fecc19de4c | ||
|
|
11a4e3cd7f | ||
|
|
af8fe86b0d | ||
|
|
d028bc725d | ||
|
|
22078a8509 | ||
|
|
ef74d81a8b | ||
|
|
e96061e44b | ||
|
|
33ce39ff71 | ||
|
|
8fbedb87f5 | ||
|
|
c31f8bd9be | ||
|
|
0f77565a3c | ||
|
|
1fe7c00e48 | ||
|
|
fce491c829 | ||
|
|
f82aa75072 | ||
|
|
eeb226aceb | ||
|
|
1785ac14c2 | ||
|
|
4e823d8db0 | ||
|
|
92c5bd864b | ||
|
|
5a08fcf2bc | ||
|
|
9d82d598f0 | ||
|
|
b6a8745838 | ||
|
|
b978c45a11 | ||
|
|
bb9babbeda | ||
|
|
bd92f74a58 | ||
|
|
9a254712b5 | ||
|
|
e57dc8a746 | ||
|
|
89fc6a723e | ||
|
|
ddde2dd8f2 | ||
|
|
108de27c1b | ||
|
|
6b74323369 | ||
|
|
6ab3c368b8 | ||
|
|
db4fae9c2c | ||
|
|
7adad098c3 | ||
|
|
2d4543673e | ||
|
|
101245a4a6 | ||
|
|
78b827aa33 | ||
|
|
c0b9db6860 | ||
|
|
a7649da2b0 | ||
|
|
2aa4b99b7b | ||
|
|
73c84c214d | ||
|
|
491db20d54 | ||
|
|
415ad7cbac | ||
|
|
fd30e63b80 | ||
|
|
766ed55c79 | ||
|
|
2d584baa9b | ||
|
|
85bef73734 | ||
|
|
1f5e14f862 | ||
|
|
a38279793a | ||
|
|
1e4fe3bd27 | ||
|
|
9fd11d331b | ||
|
|
a3a7111210 | ||
|
|
7254e1b2ea | ||
|
|
ef81f06344 | ||
|
|
827d9792dd | ||
|
|
69c4d0768a | ||
|
|
510228b6e0 | ||
|
|
e11c5254af | ||
|
|
81e1dd715d | ||
|
|
71eda315c7 | ||
|
|
7d41ed34a3 | ||
|
|
9a84bb0ba0 | ||
|
|
62e78ab582 | ||
|
|
d6330a55d0 | ||
|
|
05579fde09 | ||
|
|
70f5c23486 | ||
|
|
5fe3fbdb5d | ||
|
|
d893e4398c | ||
|
|
ade71ee8a6 | ||
|
|
095f945224 | ||
|
|
9d63a93dd8 | ||
|
|
94f4e001f4 | ||
|
|
7b5ab23452 | ||
|
|
1a3acdadc4 | ||
|
|
744e052fbe | ||
|
|
65ad186109 | ||
|
|
e5c732e181 | ||
|
|
b7f590acc8 | ||
|
|
9a0a10826b | ||
|
|
7a30e35496 | ||
|
|
d47623319d | ||
|
|
7b7f506142 | ||
|
|
8026d6c047 | ||
|
|
aa2c1c47cd | ||
|
|
d89affd819 | ||
|
|
76a85ce84b | ||
|
|
0ee6dcad4b | ||
|
|
a7fc1bddaf | ||
|
|
4817a6e5c9 | ||
|
|
a1ef329962 | ||
|
|
b8e0eec91d | ||
|
|
250068462b | ||
|
|
7e5257dd44 | ||
|
|
186cccfe6a | ||
|
|
1d0d3c3b45 | ||
|
|
de1ca46066 | ||
|
|
1596255506 | ||
|
|
252f590d5c | ||
|
|
846189b62c | ||
|
|
9bb568b799 | ||
|
|
117b58f501 | ||
|
|
4a91859150 | ||
|
|
7cb8fd3833 | ||
|
|
2e51318bcb | ||
|
|
90160d6507 | ||
|
|
618ca1e92b | ||
|
|
54729fb458 | ||
|
|
cedbefb880 | ||
|
|
61884967ea | ||
|
|
a4f466df06 | ||
|
|
e2135dbaa5 | ||
|
|
679897d0a1 | ||
|
|
feb5f37aa3 | ||
|
|
70048a0b2c | ||
|
|
b5d76a327d | ||
|
|
d9854cfdd9 | ||
|
|
d9b531f50f | ||
|
|
ddf58f2d69 | ||
|
|
a5e7dec797 | ||
|
|
30fdf1d9c2 | ||
|
|
9240770ab1 | ||
|
|
3d040d73f3 | ||
|
|
b6b63f10b4 | ||
|
|
3e7dab1e8d | ||
|
|
107b4ece8b | ||
|
|
967f6e5623 | ||
|
|
3a8db49a83 | ||
|
|
fdcb2c3290 | ||
|
|
70f6c24ebb | ||
|
|
ad9694cf00 | ||
|
|
dcb7d137c1 | ||
|
|
c227e375ae | ||
|
|
ec933731b7 | ||
|
|
40672ed62b | ||
|
|
733080ba0c | ||
|
|
34bf7b3089 | ||
|
|
0b9fe52b2b | ||
|
|
98c4eee28f | ||
|
|
bcd479a5d2 | ||
|
|
565134d4c4 | ||
|
|
a2a335e3d4 | ||
|
|
07c54cd91b | ||
|
|
f6fff26f0f | ||
|
|
b52308d071 | ||
|
|
f1b4c8e7c2 | ||
|
|
6f90560fa9 | ||
|
|
f889de514b | ||
|
|
e24d730644 | ||
|
|
f8d2d178d5 | ||
|
|
c89532fa19 | ||
|
|
8fe13ece62 | ||
|
|
c3a5fba028 | ||
|
|
bb5b712a74 | ||
|
|
18fe330413 | ||
|
|
2db4a0e7e4 | ||
|
|
a5d40cefc8 | ||
|
|
5cda3af5d4 | ||
|
|
56e9f1978d | ||
|
|
cc7c0c32f1 | ||
|
|
ebe6335fc1 | ||
|
|
03e1f23a40 | ||
|
|
005713921e | ||
|
|
80a41010fb | ||
|
|
957bebfd48 | ||
|
|
9de66d463b | ||
|
|
d99bcb79fa | ||
|
|
5cc3f3551a | ||
|
|
35da0c0b8a | ||
|
|
4c707e04ad | ||
|
|
77445f1672 | ||
|
|
3cd26a18f1 | ||
|
|
238be3f068 | ||
|
|
1b11450312 | ||
|
|
6038aca7d1 | ||
|
|
c6bda74f44 | ||
|
|
c2fa73b404 | ||
|
|
f0471ebc89 | ||
|
|
7638e9ea87 | ||
|
|
af7eef0c54 | ||
|
|
5757fafe0c | ||
|
|
27c43e8b8a | ||
|
|
16a5fc419c | ||
|
|
0a5199a737 | ||
|
|
c1db25c05b | ||
|
|
936210c076 | ||
|
|
07dfed8a08 | ||
|
|
205aef9739 | ||
|
|
c97c70f5d5 | ||
|
|
41ec6d49f6 | ||
|
|
b84ac324ff | ||
|
|
0841a94c65 | ||
|
|
29c7ef19a9 | ||
|
|
27f3c4973d | ||
|
|
b950eacfdf | ||
|
|
9cb9e0e6da | ||
|
|
fc144fe389 | ||
|
|
d319e87ff8 | ||
|
|
a3475cc896 | ||
|
|
e6ab66037d | ||
|
|
c958201148 | ||
|
|
7d986844c4 | ||
|
|
a57793fe5a | ||
|
|
8b8b8d49a7 | ||
|
|
a8f91c05d2 | ||
|
|
0625544cc3 | ||
|
|
0b1bf105be | ||
|
|
1b45bd4ee1 | ||
|
|
f9bd5d79d2 | ||
|
|
c8e50b6852 | ||
|
|
f991771128 | ||
|
|
7c2f8b4cb0 | ||
|
|
dcc527df7b | ||
|
|
3eb1ee3b9c | ||
|
|
7df8fdd0f6 | ||
|
|
12b756e97a | ||
|
|
fc420d58af | ||
|
|
1ab282d43c | ||
|
|
f1a9a8ee38 | ||
|
|
794fcdc1ad | ||
|
|
87a3dd7067 | ||
|
|
1417bdc164 | ||
|
|
eb515a6952 | ||
|
|
542622a2f5 | ||
|
|
2be00e7615 | ||
|
|
cb3452db7b | ||
|
|
a422ae2211 | ||
|
|
b6b356b948 | ||
|
|
699e9123ea | ||
|
|
f3f2ec1c0f | ||
|
|
e898e5f73b | ||
|
|
890f028b0c | ||
|
|
69c435f348 | ||
|
|
06d5b54308 | ||
|
|
af57df532b | ||
|
|
5f70bdc699 | ||
|
|
2e801a62d5 | ||
|
|
c1372a009f | ||
|
|
77838b894c | ||
|
|
ca7477e935 | ||
|
|
8485996f13 | ||
|
|
ecc12d28aa | ||
|
|
e70a3314bf | ||
|
|
20e51e9752 | ||
|
|
16161e1a68 | ||
|
|
d019f9729d | ||
|
|
56ea2e65dc | ||
|
|
94617366a7 | ||
|
|
bb7b05681e | ||
|
|
a3f4145a2e | ||
|
|
dd209460b1 | ||
|
|
baa0f9ae36 | ||
|
|
d683a98065 | ||
|
|
bf164220ee | ||
|
|
a4a531068f | ||
|
|
ec99e9033a | ||
|
|
759cd106e5 | ||
|
|
cc03f84636 | ||
|
|
59271d27e9 | ||
|
|
e7f4d0778e | ||
|
|
38966cb2fb | ||
|
|
ad8b338a7b | ||
|
|
a9e3365d98 | ||
|
|
6a110b3849 | ||
|
|
7e26aa368d | ||
|
|
f19d233fad | ||
|
|
262555d568 | ||
|
|
8e2effdc53 | ||
|
|
ff11c8ac87 | ||
|
|
05b9cde966 | ||
|
|
3ac1d64b4f | ||
|
|
5704b668b7 | ||
|
|
fef6517e27 | ||
|
|
37cf7554d9 | ||
|
|
b3c6ea86ad | ||
|
|
563054d2a2 | ||
|
|
7b917f9a8b | ||
|
|
bd961222a3 | ||
|
|
d8a93217ff | ||
|
|
181cd914d5 | ||
|
|
c72846e3c6 | ||
|
|
a262be5633 | ||
|
|
f8d8052866 | ||
|
|
008158090c | ||
|
|
1c67c3f92a | ||
|
|
048ed88e16 | ||
|
|
fdd5bd3523 | ||
|
|
7fb538737d | ||
|
|
90622f52b7 | ||
|
|
b81519c6a9 | ||
|
|
a0b859b2a1 | ||
|
|
4dafd70b64 | ||
|
|
1d5f9956fb | ||
|
|
3e773ab494 | ||
|
|
a3facbdc7d | ||
|
|
658ec4585a | ||
|
|
f0d5896140 | ||
|
|
0aa1ff309e | ||
|
|
f152aaffa3 | ||
|
|
9632f3ef35 | ||
|
|
c37d1742c3 | ||
|
|
d577fda412 | ||
|
|
4769392157 | ||
|
|
3f5a3fd58f | ||
|
|
4822bb3e42 | ||
|
|
03bc30f116 | ||
|
|
e55efd6db0 | ||
|
|
73b5c9d0af | ||
|
|
ae6062e5ba | ||
|
|
09ef2e3927 | ||
|
|
bece73faaf | ||
|
|
232930c3d5 | ||
|
|
1de1832562 | ||
|
|
b0f216b3b2 | ||
|
|
cd98a4ac87 | ||
|
|
2ac7963076 | ||
|
|
9a20430bfc | ||
|
|
d143eba7ad | ||
|
|
b68a37b835 | ||
|
|
b1448f6785 | ||
|
|
ddd7cabda8 | ||
|
|
2334adc8bd | ||
|
|
70b0dffca7 | ||
|
|
bd8a9fe96e | ||
|
|
f07d784b8b | ||
|
|
999631588d | ||
|
|
aee56b9255 | ||
|
|
abf54c7598 | ||
|
|
ae571941c5 | ||
|
|
1f0b0e5b81 | ||
|
|
e7290de83b | ||
|
|
3aadb45988 | ||
|
|
b2b1d2a2a2 | ||
|
|
a6c405a5d5 | ||
|
|
0708279215 | ||
|
|
35b08dc5cc | ||
|
|
d7e7abb061 | ||
|
|
3d9ebb5044 | ||
|
|
9dcf7378b6 | ||
|
|
59227c3dd3 | ||
|
|
2506ee35f6 | ||
|
|
3e87abe88a | ||
|
|
e070decd3c | ||
|
|
3dd58e872a | ||
|
|
d9fd9155ea | ||
|
|
a0ebd8ba15 | ||
|
|
7e3549819e | ||
|
|
fd6d4db5b7 | ||
|
|
72b10c5d9b | ||
|
|
24e1edd858 | ||
|
|
5ced93fcbf | ||
|
|
7af127ac0d | ||
|
|
9935095a36 | ||
|
|
7e26869b68 | ||
|
|
1e16795341 | ||
|
|
ef5c39bd7b | ||
|
|
911bbfa38d | ||
|
|
09ce0e822c | ||
|
|
95179e7894 | ||
|
|
fc233c1775 | ||
|
|
f8601886fd | ||
|
|
ffd5928dc6 | ||
|
|
360365ca84 | ||
|
|
3584338d85 | ||
|
|
4487fd768e | ||
|
|
0203ade66c | ||
|
|
f961452cf8 | ||
|
|
43a1e57a62 | ||
|
|
73992041b4 | ||
|
|
487c8050ef | ||
|
|
4e89c61813 | ||
|
|
c2fe7673dd | ||
|
|
d6dce20302 | ||
|
|
c980c52aca | ||
|
|
414d00529e | ||
|
|
89b177c58a | ||
|
|
d5b6a7c4d1 | ||
|
|
5753d1e320 | ||
|
|
6b140bef11 | ||
|
|
4d0ee443d1 | ||
|
|
386e08d8b3 | ||
|
|
54e0bdb62f | ||
|
|
eddc46fd78 | ||
|
|
726f729aba | ||
|
|
cb70044510 | ||
|
|
a0e6422c5f | ||
|
|
5a401f42a3 | ||
|
|
3cd5c71052 | ||
|
|
225094e2c8 | ||
|
|
90451a16b9 | ||
|
|
8127a2ca63 | ||
|
|
b5f8ce91c7 | ||
|
|
cf9e02879a | ||
|
|
caa09db5fc | ||
|
|
50f5c610a1 | ||
|
|
40fadb8d2c | ||
|
|
15be4b885c | ||
|
|
cf2c6ef966 | ||
|
|
3f6024cd64 | ||
|
|
e81aaf5390 | ||
|
|
06bfed11b9 | ||
|
|
93e26b1475 | ||
|
|
fff6a092ab | ||
|
|
d26c5b248e | ||
|
|
519dd8f8e2 | ||
|
|
acdde1088c | ||
|
|
c01b961be0 | ||
|
|
3fff5985fc | ||
|
|
87182b5a65 | ||
|
|
9eeaf33b94 | ||
|
|
3c9d9a872c | ||
|
|
ef33827f04 | ||
|
|
9f682cc52b | ||
|
|
eb90c5a8db | ||
|
|
ef82a1e4d4 | ||
|
|
8bc7a1c291 | ||
|
|
683505f39b | ||
|
|
1682a86166 | ||
|
|
db8033622a | ||
|
|
f7010faf18 | ||
|
|
5446242094 | ||
|
|
a303b9e33c | ||
|
|
98948172b4 | ||
|
|
cd2b03a08a | ||
|
|
b675db73be | ||
|
|
4b97700352 | ||
|
|
88fd42a89d | ||
|
|
3c9cfc5036 | ||
|
|
5aab7513cf | ||
|
|
fa3ca0ab62 | ||
|
|
1e184f95e4 | ||
|
|
21302147a9 | ||
|
|
ebab43d532 | ||
|
|
3d580dc3ec | ||
|
|
2faa532826 | ||
|
|
df51859d74 | ||
|
|
2bcca34a59 | ||
|
|
8d32b00af2 | ||
|
|
c0b10139e2 | ||
|
|
edf540bb71 | ||
|
|
103a67fb75 | ||
|
|
2db7087041 | ||
|
|
c8e2d39cbc | ||
|
|
09e9a532d9 | ||
|
|
a6301e4310 | ||
|
|
109d496222 | ||
|
|
5876e33e49 | ||
|
|
0ac3b26982 | ||
|
|
9815ac728f | ||
|
|
49d7ce61f3 | ||
|
|
ca7d01ade3 | ||
|
|
edacadbce6 | ||
|
|
ea05559fa5 | ||
|
|
84af758877 | ||
|
|
532b30a2cd | ||
|
|
bcd53a7cdc | ||
|
|
4576bad369 | ||
|
|
04a7d2a3ba | ||
|
|
24fed18590 | ||
|
|
2d53208082 | ||
|
|
443f70dd65 | ||
|
|
cbdac66fa4 | ||
|
|
9a3a43cdba | ||
|
|
2fbf5ab741 | ||
|
|
085fb60777 | ||
|
|
6b5cd55fbf | ||
|
|
f2be582cd5 | ||
|
|
5d45718fe1 | ||
|
|
945e1d140d | ||
|
|
50401c5bf6 | ||
|
|
0458c8e24e | ||
|
|
ff3d8f708d | ||
|
|
de62e4c011 | ||
|
|
82c41b4fc1 | ||
|
|
007b78cbb4 | ||
|
|
8d9d6a5696 | ||
|
|
484dd5dfa5 | ||
|
|
0af58b1cdd | ||
|
|
8f015c4369 | ||
|
|
08f428fbdf | ||
|
|
53349c8c20 | ||
|
|
a3a3fa2848 | ||
|
|
995368cffa | ||
|
|
6be0b2396c | ||
|
|
5b0e276572 | ||
|
|
dc949c257e | ||
|
|
03e5611d14 | ||
|
|
84dc268781 | ||
|
|
0fd3c9fab3 | ||
|
|
cf6d843c18 | ||
|
|
2651cdce2e | ||
|
|
ac1d05328b | ||
|
|
9b3947b8ed | ||
|
|
d6c879083c | ||
|
|
4722b7dd97 | ||
|
|
7963fdfc3b | ||
|
|
3ee77eb79e | ||
|
|
6650105174 | ||
|
|
c239873634 | ||
|
|
dd451da4a5 | ||
|
|
7437f76007 | ||
|
|
fda8d60ce0 | ||
|
|
6c7c0a6e63 | ||
|
|
9f90a04a84 | ||
|
|
3629219a3b | ||
|
|
e4ebfccc54 | ||
|
|
bbf0d819f6 | ||
|
|
86b49d14ea | ||
|
|
56f9de23be | ||
|
|
d6c97cb974 | ||
|
|
f1b55b5390 | ||
|
|
bed1d4ba5e | ||
|
|
397222c33f | ||
|
|
b5aa91fd62 | ||
|
|
6bc9d64fbb | ||
|
|
9afa3c6598 | ||
|
|
6fd29775b2 | ||
|
|
2078135c07 | ||
|
|
b27f8634d6 | ||
|
|
26dabba7ac | ||
|
|
88a57a50b3 | ||
|
|
91ce008d62 | ||
|
|
2a1558fb32 | ||
|
|
1f0ec1b43a | ||
|
|
921d64dadc | ||
|
|
6e7fdb1c80 | ||
|
|
310d7eba07 | ||
|
|
82e3416619 | ||
|
|
de827ab583 | ||
|
|
2aba0f962a | ||
|
|
3cd6015c81 | ||
|
|
4288cd3c33 | ||
|
|
e40d857ac5 | ||
|
|
c87eab4958 | ||
|
|
86e92fd2a0 | ||
|
|
9f38ae715d | ||
|
|
ab312299d6 | ||
|
|
4b5b45f14a | ||
|
|
b4ef1a3a5d | ||
|
|
6f10d6e321 | ||
|
|
f47af31fb7 | ||
|
|
ce443d50ca | ||
|
|
c973800164 | ||
|
|
2b81baa14f | ||
|
|
b7a74931f6 | ||
|
|
c7820c6a77 | ||
|
|
62c4ffd0b7 | ||
|
|
13e1e054c2 | ||
|
|
d7e7979580 | ||
|
|
b5c634cb07 | ||
|
|
4a52c2ccd1 | ||
|
|
723e2860ae | ||
|
|
568317929d | ||
|
|
01303fab0d | ||
|
|
562205cc14 | ||
|
|
67522bae65 | ||
|
|
a2cd236441 | ||
|
|
26569c2202 | ||
|
|
7da28b87d2 | ||
|
|
26865bbc19 | ||
|
|
167238c60d | ||
|
|
8f08431ddf | ||
|
|
2c9275adde | ||
|
|
f0e85c027a | ||
|
|
dd12a4dd87 | ||
|
|
912e32ecab | ||
|
|
47e90ee510 | ||
|
|
56e44670a5 | ||
|
|
b237213f75 | ||
|
|
5a529ce30d | ||
|
|
b41c063d4a | ||
|
|
9deb6a7c6e | ||
|
|
476eab10a1 | ||
|
|
531702a1fc | ||
|
|
ff87cf62b1 | ||
|
|
969102c1a0 | ||
|
|
4e5c60411f | ||
|
|
beab815ecb | ||
|
|
48016fa297 | ||
|
|
db2173efdf | ||
|
|
6d45c804bb | ||
|
|
4bfd6ac874 | ||
|
|
2c5bac191f | ||
|
|
551512ad54 | ||
|
|
cfd95bae2c | ||
|
|
e4802de965 | ||
|
|
6710ca943e | ||
|
|
fb50e3b235 | ||
|
|
d98b5d00ab | ||
|
|
cf56496ee9 | ||
|
|
45ef3b43c4 | ||
|
|
bfcdb1bd4c | ||
|
|
d6a1249469 | ||
|
|
9ea7a9ea27 | ||
|
|
05acb85372 | ||
|
|
10f24d97aa | ||
|
|
782b72e29f | ||
|
|
3737481262 | ||
|
|
eb1e6d0cb4 | ||
|
|
d28889c696 | ||
|
|
7b82a98b72 | ||
|
|
028db71d79 | ||
|
|
a56e5f9cd7 | ||
|
|
9383fa66bf | ||
|
|
769fc63bb0 | ||
|
|
7597055f26 | ||
|
|
e9b2f5729c | ||
|
|
2256d5d3dc | ||
|
|
dfcabf71f0 | ||
|
|
1ac1196af6 | ||
|
|
59d47bc7da | ||
|
|
a14ec0cbaa | ||
|
|
b9e5e96e49 | ||
|
|
3e678822ce | ||
|
|
56f3baf7a9 | ||
|
|
324776353a | ||
|
|
55322ad802 | ||
|
|
054dc9b7ca | ||
|
|
a2b022609f | ||
|
|
02cf0b3d60 | ||
|
|
55ef86da33 | ||
|
|
2677dfb161 | ||
|
|
e80d545b38 | ||
|
|
2e075df1a9 | ||
|
|
7f9ba48018 | ||
|
|
0926f8a7c9 | ||
|
|
b5c1f2d619 | ||
|
|
b5e688e74a | ||
|
|
6abb1c4eab | ||
|
|
edefdf0157 | ||
|
|
72ad8f7ad5 | ||
|
|
714997fc34 | ||
|
|
96b1643522 | ||
|
|
a7325ffded | ||
|
|
b65c133f80 | ||
|
|
e60f4ef870 | ||
|
|
b3e21fecd2 | ||
|
|
da25554128 | ||
|
|
43569e22e4 | ||
|
|
61ba0478cd | ||
|
|
5c82158a5d | ||
|
|
59b8ffcdb1 | ||
|
|
851d035588 | ||
|
|
896fa54ece | ||
|
|
b10de698dd | ||
|
|
93157dd30d | ||
|
|
1cf9154296 | ||
|
|
b84e3d0f20 | ||
|
|
4990f57df8 | ||
|
|
8549bc1e4c | ||
|
|
82b2cfa883 | ||
|
|
2f9bc90a95 | ||
|
|
68a1d5c450 | ||
|
|
e7f85811a1 | ||
|
|
f98437c377 | ||
|
|
05789e5a68 | ||
|
|
3eba0e9b54 | ||
|
|
03d185b536 | ||
|
|
9720bc45b4 | ||
|
|
4878361d27 | ||
|
|
4cc3c72b31 | ||
|
|
5a5bdf1d66 | ||
|
|
75e776ffd0 | ||
|
|
e9bd9e4b67 | ||
|
|
983d4932f3 | ||
|
|
908fa416bf | ||
|
|
3d393e58a9 | ||
|
|
17c4a09c8f | ||
|
|
0f20377541 | ||
|
|
70484509af | ||
|
|
24e298626a | ||
|
|
e49eb6c660 | ||
|
|
26245add73 | ||
|
|
1f3b995c2a | ||
|
|
5a475cf074 | ||
|
|
838faa8d7e | ||
|
|
a3a0002f8d | ||
|
|
4c011279ff | ||
|
|
86c8ce536b | ||
|
|
3aa31abe18 | ||
|
|
b366b8c027 | ||
|
|
39216f9d7c | ||
|
|
207199dc34 | ||
|
|
1d55b6f8c6 | ||
|
|
d1b0e93e8e | ||
|
|
38bdfe3281 | ||
|
|
324af418db | ||
|
|
9eb37b3eee | ||
|
|
9d3ca39a44 | ||
|
|
ba58138aa9 | ||
|
|
2d393bff91 | ||
|
|
84a864f8d3 | ||
|
|
bd0de9bd61 | ||
|
|
0e2c60d0fa | ||
|
|
cc8d4f68ab | ||
|
|
f9a464e256 | ||
|
|
e86d08218b | ||
|
|
efa86f0e35 | ||
|
|
1ec504e163 | ||
|
|
00818e048c | ||
|
|
5e796e0a26 | ||
|
|
c10b473361 | ||
|
|
7df3bb5aeb | ||
|
|
e15f2eedbb | ||
|
|
48e92149e4 | ||
|
|
b41edfb0b4 | ||
|
|
3b8598dde8 | ||
|
|
22bea8d99b | ||
|
|
601105ef79 | ||
|
|
642f9a38f7 | ||
|
|
7e7ee3299e | ||
|
|
239fd750c4 | ||
|
|
c80ebdca25 | ||
|
|
8b07a5f4c7 | ||
|
|
5d4f22c548 | ||
|
|
c30e9eed36 | ||
|
|
81d76c8c70 | ||
|
|
5a1f0c2115 | ||
|
|
331234713d | ||
|
|
6ad07c3efb | ||
|
|
93b34fa70b | ||
|
|
125553c72e | ||
|
|
af22d34d57 | ||
|
|
254053b940 | ||
|
|
52c72383f1 | ||
|
|
e87241184a | ||
|
|
4b373263e4 | ||
|
|
7e1c776bc1 | ||
|
|
240cdcddab | ||
|
|
d4c5476652 | ||
|
|
c1faa48f54 | ||
|
|
a41b2b0da8 | ||
|
|
b699743973 | ||
|
|
6e7092b160 | ||
|
|
61c3e5b814 | ||
|
|
0de1136037 | ||
|
|
951dde8143 | ||
|
|
1c49329ffa | ||
|
|
d02da0db64 | ||
|
|
61074f3497 | ||
|
|
d6477df7a6 | ||
|
|
9c1371dcca | ||
|
|
ac6f652368 | ||
|
|
a40e63ab9d | ||
|
|
658fceb7fc | ||
|
|
b864215d63 | ||
|
|
340e80d7a8 | ||
|
|
f93bc59504 | ||
|
|
ff066e394d | ||
|
|
c41d7de8ca | ||
|
|
0f5cc5683d | ||
|
|
42276ccd14 | ||
|
|
c5f05f0592 | ||
|
|
9c5ec3c4e1 | ||
|
|
103485518c | ||
|
|
ba2a7cfe2e | ||
|
|
145cc4b2ad | ||
|
|
31f67be83e | ||
|
|
6eb2499aa8 | ||
|
|
bf7c36d9bb | ||
|
|
9bdc20353c | ||
|
|
98355d36a7 | ||
|
|
a615d969fd | ||
|
|
c181cb35ec | ||
|
|
26b9c28f48 | ||
|
|
8b76d55fdc | ||
|
|
9906e11572 | ||
|
|
b3b14a3fb8 | ||
|
|
2ac8df2b28 | ||
|
|
1e66caecd6 | ||
|
|
cc2622c49f | ||
|
|
90c05c7d13 | ||
|
|
c286eec920 | ||
|
|
3b657ee547 | ||
|
|
e76e531d2d | ||
|
|
297a8566a0 | ||
|
|
52bc5853d8 | ||
|
|
5a9a778879 | ||
|
|
90b5961b40 | ||
|
|
5c7454a2f7 | ||
|
|
dad3603936 | ||
|
|
9e67423cff | ||
|
|
784a2f86a2 | ||
|
|
ce846931bc | ||
|
|
322eec6fb1 | ||
|
|
c718fafee7 | ||
|
|
136cfdf48d | ||
|
|
54b6827971 | ||
|
|
63f168440b | ||
|
|
2e2d091bfd | ||
|
|
6752951084 | ||
|
|
789cb13dec | ||
|
|
b4ebb4510d | ||
|
|
b7f928a24c | ||
|
|
b6c23c7c0e | ||
|
|
55daa29a7c | ||
|
|
47f4883444 | ||
|
|
dc842a844c | ||
|
|
57db10acf0 | ||
|
|
1372c1df19 | ||
|
|
b24191a9b9 | ||
|
|
8fa83ac70f | ||
|
|
ace9fb27b1 | ||
|
|
dccfd65c80 | ||
|
|
66e3ea6146 | ||
|
|
b1a30e3e3b | ||
|
|
a2eb6a1f49 | ||
|
|
b2666dea15 | ||
|
|
d286a3c4b7 | ||
|
|
ea0ffa615a | ||
|
|
03a6f5e29c | ||
|
|
5ecf382dfc | ||
|
|
afd015f1b7 | ||
|
|
8c7b61eaba | ||
|
|
311d12feef | ||
|
|
8f7834c625 | ||
|
|
49ab6a7f31 | ||
|
|
590e3910de | ||
|
|
a12574e095 | ||
|
|
87c13825af | ||
|
|
481fb4943f | ||
|
|
e94513fdb7 | ||
|
|
f6b582cf2b | ||
|
|
e4524bc810 | ||
|
|
b33fb81234 | ||
|
|
cf99796a77 | ||
|
|
ca8bd1df91 | ||
|
|
c4b45cd390 | ||
|
|
0f3b733239 | ||
|
|
f6fc637d77 | ||
|
|
e8eec583ed | ||
|
|
580768a489 | ||
|
|
aff1a51eb7 | ||
|
|
c30453d176 | ||
|
|
d18cae4f06 | ||
|
|
24881bd32d | ||
|
|
028f310576 | ||
|
|
1a07613ce2 | ||
|
|
8d6f0d7321 | ||
|
|
e401f4ec4e | ||
|
|
fa7084fa77 | ||
|
|
752c247761 | ||
|
|
676477e20c | ||
|
|
3a1cb72681 | ||
|
|
10d9e30615 | ||
|
|
84918fd075 | ||
|
|
fd19773c21 | ||
|
|
eec2794d2d | ||
|
|
e6051ceca4 | ||
|
|
eb70f3842e | ||
|
|
9c314d5652 | ||
|
|
904f41e0f7 | ||
|
|
699e9008d1 | ||
|
|
0b42cbfb8f | ||
|
|
7b6baafd1d | ||
|
|
4259f595ec | ||
|
|
c40319c7b4 | ||
|
|
a8394caed5 | ||
|
|
29856a67a0 | ||
|
|
850b3c2375 | ||
|
|
7c88fc27b5 | ||
|
|
082edbf598 | ||
|
|
80a5ad1fd6 | ||
|
|
cbbda20018 | ||
|
|
bf5b97f86a | ||
|
|
91c46050c0 | ||
|
|
f4c3d9d4ed | ||
|
|
96538d052b | ||
|
|
17c63aebb5 | ||
|
|
917717c4ca | ||
|
|
22e25a8b1e | ||
|
|
c45d4e685a | ||
|
|
78ce62e7b6 | ||
|
|
975cd275d1 | ||
|
|
d8b31dbd46 | ||
|
|
0c2671d7f9 | ||
|
|
dc88d6f3aa | ||
|
|
4828211e97 | ||
|
|
6d66866268 | ||
|
|
1aadfef363 | ||
|
|
70155985f8 | ||
|
|
da6add3534 | ||
|
|
6b5a582386 | ||
|
|
12095307e5 | ||
|
|
224c7b3fc3 | ||
|
|
ff7696fffb | ||
|
|
e5601e562f | ||
|
|
b9bcfaf959 | ||
|
|
b98afced69 | ||
|
|
ab54a37678 | ||
|
|
53f1acfdcb | ||
|
|
520e64c095 | ||
|
|
ca3c5007f6 | ||
|
|
21dfe81d0b | ||
|
|
2a9f876363 | ||
|
|
2e630f7e0f | ||
|
|
d37b917352 | ||
|
|
e4dfa75045 | ||
|
|
9e1230bed7 | ||
|
|
7bb4f4597d | ||
|
|
c808511694 | ||
|
|
0e3357b589 | ||
|
|
ef3303839a | ||
|
|
b3cade2db2 | ||
|
|
009d851771 | ||
|
|
95914345e1 | ||
|
|
ebb352f1f3 | ||
|
|
25e2dbec95 | ||
|
|
902bbfb04c | ||
|
|
921d28d976 | ||
|
|
468027ba2b | ||
|
|
be0f0b0828 | ||
|
|
a2a93e7224 | ||
|
|
3a9327d1be | ||
|
|
d834860965 | ||
|
|
805d738b24 | ||
|
|
11a91af749 | ||
|
|
cd6946e751 | ||
|
|
77e522aade | ||
|
|
c0a38e6eb0 | ||
|
|
cad3dc652d | ||
|
|
579102bd7b | ||
|
|
04820bea47 | ||
|
|
80b4cd9767 | ||
|
|
e276d3e6ba | ||
|
|
651d88fd15 | ||
|
|
8dd8d25ef7 | ||
|
|
64b036b129 | ||
|
|
008f2a8d4c | ||
|
|
eb86efa341 | ||
|
|
4124dc662d | ||
|
|
5f890fedcc | ||
|
|
0265515a0c | ||
|
|
72422e819b | ||
|
|
412c326c3a | ||
|
|
f2cb0eaa6e | ||
|
|
9231f47123 | ||
|
|
c7da492872 | ||
|
|
8169da3701 | ||
|
|
26071a817b | ||
|
|
e82e897bd9 | ||
|
|
85a30c0897 | ||
|
|
96358368f5 | ||
|
|
517cde2517 | ||
|
|
d1b02c878a | ||
|
|
fc48b7eb89 | ||
|
|
59c4e69feb | ||
|
|
7c274029e7 | ||
|
|
6974fb4562 | ||
|
|
de9255eaea | ||
|
|
6fc4a5b70a | ||
|
|
1107b226ac | ||
|
|
ee718d6f9b | ||
|
|
1198a71d64 | ||
|
|
09b18bf6b8 | ||
|
|
332e4afc31 | ||
|
|
971d799e39 | ||
|
|
f4f0b38f73 | ||
|
|
762f6fb1f3 | ||
|
|
d86438db4e | ||
|
|
231913fd35 | ||
|
|
4996d36f5f | ||
|
|
fe49ccd701 | ||
|
|
8a77b68b10 | ||
|
|
b89eb58257 | ||
|
|
a72e61acbb | ||
|
|
f65c601dd4 | ||
|
|
6a8e4b9c4d | ||
|
|
610e5c9513 | ||
|
|
9a101943b8 | ||
|
|
9c7c4307d4 | ||
|
|
ed715056e2 | ||
|
|
174c916961 | ||
|
|
0daa5822f5 | ||
|
|
bd7c9a2b85 | ||
|
|
494e0f4474 | ||
|
|
ef92fc6a7b | ||
|
|
55495e1e97 | ||
|
|
743fa048e1 | ||
|
|
fae451d236 | ||
|
|
7f2b300dde | ||
|
|
8d70321d80 | ||
|
|
ffe2714b28 | ||
|
|
11668f1143 | ||
|
|
601081d50a | ||
|
|
93de7fcd5c | ||
|
|
fb398c387f | ||
|
|
b21d3c6728 | ||
|
|
71c400ae14 | ||
|
|
93c56a4b44 | ||
|
|
5600007dd3 | ||
|
|
7314b7d598 | ||
|
|
5db8be908b | ||
|
|
b471f56c52 | ||
|
|
8ed870d886 | ||
|
|
2c37571a40 | ||
|
|
d72d5c536e | ||
|
|
fb93023401 | ||
|
|
e44af986a0 | ||
|
|
2d31877aec | ||
|
|
53960c4643 | ||
|
|
0f0fa2b14f | ||
|
|
4dad8c2307 | ||
|
|
ef7e4c126e | ||
|
|
03913708db | ||
|
|
7b95a8a487 | ||
|
|
35e9696ada | ||
|
|
5bc113792b | ||
|
|
4d458ec3d6 | ||
|
|
e0dead1d7f | ||
|
|
2f60e23fd5 | ||
|
|
3dc8d6c97c | ||
|
|
351f08a54b | ||
|
|
2cca743e07 | ||
|
|
605a5f2db3 | ||
|
|
cfc5273275 | ||
|
|
ad530f6d02 | ||
|
|
8d27768097 | ||
|
|
544030099e | ||
|
|
3fb4b0e0ee | ||
|
|
7ca0aa07c5 | ||
|
|
88bff13b85 | ||
|
|
27c28944f2 | ||
|
|
61fa081cfe | ||
|
|
854f18be74 | ||
|
|
70c2836798 | ||
|
|
c457c45f55 | ||
|
|
3052568597 | ||
|
|
0abfe60f35 | ||
|
|
29618b7e27 | ||
|
|
f1f31d1b4c | ||
|
|
094db12a1a | ||
|
|
6d3e5d3899 | ||
|
|
0efa47880b | ||
|
|
9b202d1dbf | ||
|
|
f1e69a7658 | ||
|
|
bd04a1ab9a | ||
|
|
dba06a555e | ||
|
|
a55a52e0a9 | ||
|
|
76a1744d37 | ||
|
|
97dd0b63d7 | ||
|
|
4b6060aeeb | ||
|
|
7ed71a1501 | ||
|
|
172beccf6c | ||
|
|
fe7ec36fb7 | ||
|
|
4d65868208 | ||
|
|
b1521a3bb1 | ||
|
|
61a5268d65 | ||
|
|
f81138b3c7 | ||
|
|
7ec1080e16 | ||
|
|
2608b3dc55 | ||
|
|
4b6ba0aa3c | ||
|
|
5af845cdfc | ||
|
|
f1d909ae74 | ||
|
|
979fc1b5f5 | ||
|
|
4384d27f3e | ||
|
|
dbe59f83d9 | ||
|
|
62736ab48b | ||
|
|
b9dee63467 | ||
|
|
d2192fb850 | ||
|
|
b4d23795de | ||
|
|
5df49391a9 | ||
|
|
3af79394b4 | ||
|
|
2ad6591f31 | ||
|
|
695dc75037 | ||
|
|
e110a78de7 | ||
|
|
555c32015c | ||
|
|
287bbfeea3 | ||
|
|
243100b676 | ||
|
|
f272e156e8 | ||
|
|
d7aa94dc17 | ||
|
|
ca3efe2517 | ||
|
|
ffd1eb1875 | ||
|
|
fa4f6ca2ad | ||
|
|
bb1ebea711 | ||
|
|
af7d04cd04 | ||
|
|
8c3caed99f | ||
|
|
25e04988a1 | ||
|
|
6f36352265 | ||
|
|
91419f8ad3 | ||
|
|
58ad2a5760 | ||
|
|
659d7a9de1 | ||
|
|
bb1fc9cd87 | ||
|
|
200487d172 | ||
|
|
35188bff25 | ||
|
|
cf92bfaeee | ||
|
|
eae07f1977 | ||
|
|
58c5662f35 | ||
|
|
f32013aba5 | ||
|
|
d5c8188e99 | ||
|
|
b58816df05 | ||
|
|
55be1debaf | ||
|
|
0f8c23bddd | ||
|
|
03963ef535 | ||
|
|
73561c5c1a | ||
|
|
cfa5e9be58 | ||
|
|
ba1db2f406 | ||
|
|
d956ffb386 | ||
|
|
88c14f5d4b | ||
|
|
556918b298 | ||
|
|
432eff0f7d | ||
|
|
dd8ec29bb4 | ||
|
|
6edb5a3bef | ||
|
|
6ca32fbfb9 | ||
|
|
dcdad1e2e6 | ||
|
|
1d085f21c9 | ||
|
|
26b26f9783 | ||
|
|
1336c73e0c | ||
|
|
53c8917353 | ||
|
|
ba37313cb8 | ||
|
|
84710f266b | ||
|
|
59a93eab45 | ||
|
|
e38636c4ac | ||
|
|
9c3fccb073 | ||
|
|
12324873d3 | ||
|
|
3b62d2512c | ||
|
|
ca594f3198 | ||
|
|
5e9e177319 | ||
|
|
6aa07aa78b | ||
|
|
66aef98c40 | ||
|
|
835823809f | ||
|
|
58dcf63e7c | ||
|
|
6df612a364 | ||
|
|
779fdd5df6 | ||
|
|
6e29450d69 | ||
|
|
6e70cfa5ef | ||
|
|
ad5959e860 | ||
|
|
4e5d0766e1 | ||
|
|
af0a47ad2c | ||
|
|
f252bec18f | ||
|
|
26de9d3a69 | ||
|
|
7b29e44698 | ||
|
|
5f4f7cd45a | ||
|
|
a214974684 | ||
|
|
1963bb65e4 | ||
|
|
56e37ec309 | ||
|
|
5c8749c63e | ||
|
|
8798f6bbcd | ||
|
|
ca8c5cabe1 | ||
|
|
1a320d5577 | ||
|
|
17f79a744b | ||
|
|
5a6bb0bbc5 | ||
|
|
97cf9e925b | ||
|
|
0abdf67b8b | ||
|
|
72d7b66d2b | ||
|
|
311471024a | ||
|
|
dd0c4ad785 | ||
|
|
5538fbd20f | ||
|
|
aba4cec7d6 | ||
|
|
ccbd2d83c6 | ||
|
|
838db98400 | ||
|
|
2b24a0a7f5 | ||
|
|
f249af6266 | ||
|
|
f75d2d3582 | ||
|
|
f9391ad823 | ||
|
|
57560c3290 | ||
|
|
b5d85fc6e1 | ||
|
|
bfb49b594f | ||
|
|
c6c43afc87 | ||
|
|
65da34398d | ||
|
|
7d59b6b1a3 | ||
|
|
ecc1eeca8f | ||
|
|
43f2004b11 | ||
|
|
b8910c5bd5 | ||
|
|
1f62e9e2f2 | ||
|
|
1e52e1dc9f | ||
|
|
655460059a | ||
|
|
91f73e1802 | ||
|
|
33a99288f3 | ||
|
|
894d6b8d3b | ||
|
|
ffe50562dd | ||
|
|
cbca45e21c | ||
|
|
41758ab63f | ||
|
|
4a50be27de | ||
|
|
8142e69121 | ||
|
|
7c76e1bf32 | ||
|
|
7294e4fbaf | ||
|
|
507a23b708 | ||
|
|
60c9da598a | ||
|
|
2f267f5463 | ||
|
|
5a5b5d681b | ||
|
|
af88da1a9c | ||
|
|
6f3fbcb6bf | ||
|
|
f559838352 | ||
|
|
dccaaa383f | ||
|
|
9c23fc1dea | ||
|
|
3146c4c150 | ||
|
|
7703c9672d | ||
|
|
2db760a2c4 | ||
|
|
9c075a98d1 | ||
|
|
d41e7f2ca0 | ||
|
|
3c4972b9a3 | ||
|
|
9d9b5a629e | ||
|
|
adba90684d | ||
|
|
124cc28bac | ||
|
|
f2a3d51037 | ||
|
|
ec601f6a00 | ||
|
|
d67527932c | ||
|
|
979430ecd1 | ||
|
|
584a18ec11 | ||
|
|
d289eabc36 | ||
|
|
9020014160 | ||
|
|
695e5c2f37 | ||
|
|
c53c512831 | ||
|
|
0fe30e3db7 | ||
|
|
572499f598 | ||
|
|
2fb1de34f4 | ||
|
|
9d1e72a9f7 | ||
|
|
61b0df5fe9 | ||
|
|
c34be50ef1 | ||
|
|
5d753827c1 | ||
|
|
202c2a7a8b | ||
|
|
d7bffac0e6 | ||
|
|
b333a4b1cf | ||
|
|
c67d915250 | ||
|
|
2857b1dd1a | ||
|
|
602787bd03 | ||
|
|
ddb8fe9b1f | ||
|
|
6e932142f0 | ||
|
|
0bdef6cb2a | ||
|
|
49e6fff104 | ||
|
|
08b06c1d03 | ||
|
|
b72ce3decd | ||
|
|
b8395d9506 | ||
|
|
1e9c390dfa | ||
|
|
1d0c7fe68e | ||
|
|
7128eabfad | ||
|
|
74a8ebde41 | ||
|
|
13d0bb7b0f | ||
|
|
bf1f9c68d3 | ||
|
|
aeadaf536c | ||
|
|
8ec4c57910 | ||
|
|
9b3dbc272c | ||
|
|
994b119c32 | ||
|
|
fd211d53f8 | ||
|
|
993a16f17c | ||
|
|
79ebce2549 | ||
|
|
69bf5caa9d | ||
|
|
1565d540a8 | ||
|
|
840ff89450 | ||
|
|
814ccad1e3 | ||
|
|
cb346cf20b | ||
|
|
b74267901d | ||
|
|
b8d65f9b27 | ||
|
|
d9505bbbcc | ||
|
|
623c8bbeef | ||
|
|
da7a2bc4c6 | ||
|
|
e03fb8a916 | ||
|
|
5fdb7ab254 | ||
|
|
ec3f854a68 | ||
|
|
69fba08661 | ||
|
|
d75e25d29d | ||
|
|
2024e5f904 | ||
|
|
6eca8843f6 | ||
|
|
98d0f2522f | ||
|
|
e800765ffc | ||
|
|
ad7a8a59a6 | ||
|
|
e9fdccfa63 | ||
|
|
178f73d98a | ||
|
|
da1de80aa6 | ||
|
|
92cc9a5736 | ||
|
|
5233fceda7 | ||
|
|
d2d15afa3b | ||
|
|
afb1c3a0f8 | ||
|
|
80ee446f74 | ||
|
|
f23a8eced3 | ||
|
|
17b940c610 | ||
|
|
87161b5b7b | ||
|
|
ba4c920af7 | ||
|
|
eca47b3cff | ||
|
|
c937e8d178 | ||
|
|
ae522c843c | ||
|
|
f31cb6193b | ||
|
|
4a3a185857 | ||
|
|
bf995b3c4e | ||
|
|
b53b623c38 | ||
|
|
33e42f389a | ||
|
|
6b679862e7 | ||
|
|
10f9a3d2b0 | ||
|
|
3c5e815ddd | ||
|
|
68879ba255 | ||
|
|
3cd0860203 | ||
|
|
4d880e6ce8 | ||
|
|
89971c9036 | ||
|
|
a9b8b84e13 | ||
|
|
2318182c2c | ||
|
|
0c72e7ed1a | ||
|
|
e0c01fca01 | ||
|
|
6dfe88113e | ||
|
|
5efa9e2cdb | ||
|
|
8672c809bd | ||
|
|
cab6d19c5a | ||
|
|
15f3609eaf | ||
|
|
7a7687b3b8 | ||
|
|
a0ece60203 | ||
|
|
6d47171bdc | ||
|
|
16fd4bc2a0 | ||
|
|
6f89ad50f8 | ||
|
|
1acf950ce9 | ||
|
|
2f95fb254b | ||
|
|
ccfd24a682 | ||
|
|
868919107a | ||
|
|
7e2ddedfc1 | ||
|
|
c6f074ba96 | ||
|
|
e2a2557396 | ||
|
|
2d6c0f5f1a | ||
|
|
bd547418e9 | ||
|
|
0e37a1e9e9 | ||
|
|
0e40b6f7dd | ||
|
|
9cf4f5debb | ||
|
|
52354daa1e | ||
|
|
dfcb6f6cd3 | ||
|
|
0ea9467b56 | ||
|
|
362dfb51db | ||
|
|
5929bc10e7 | ||
|
|
7be31d0ba8 | ||
|
|
26b9fee648 | ||
|
|
18cc86a613 | ||
|
|
f93b4939f4 | ||
|
|
394f637c4e | ||
|
|
81a1eb2c6c | ||
|
|
b9cb5b22c8 | ||
|
|
9629d073cb | ||
|
|
ec58634a67 | ||
|
|
5dbdabcec2 | ||
|
|
18d31cd672 | ||
|
|
190b52c4cd | ||
|
|
43ca2c827b | ||
|
|
fbee88b63e | ||
|
|
6ff1be2127 | ||
|
|
2efbccf236 | ||
|
|
c82e1ff30f | ||
|
|
cbbe559f94 | ||
|
|
a5676ecd94 | ||
|
|
b1f4c38f8f | ||
|
|
4ac54cf6e1 | ||
|
|
d49439246c | ||
|
|
16330c2f65 | ||
|
|
306e51fa72 | ||
|
|
1130036bf3 | ||
|
|
af291c5a16 | ||
|
|
a676d34e5d | ||
|
|
cbc3a62db1 | ||
|
|
f8ed119d1b | ||
|
|
9b44e3b2b7 | ||
|
|
ecb51c3554 | ||
|
|
047f274270 | ||
|
|
92a6789013 | ||
|
|
7f698431b7 | ||
|
|
3d69c8b694 | ||
|
|
7a231cfb03 | ||
|
|
3cba76cc6f | ||
|
|
ca0d73875d | ||
|
|
5055f3d30b | ||
|
|
71b3a1ad6e | ||
|
|
fbcf966d20 | ||
|
|
00ad302e32 | ||
|
|
b6fb5829c0 | ||
|
|
32917a9c0a | ||
|
|
23f84a4e6a | ||
|
|
6a6ae42a97 | ||
|
|
5b0589c381 | ||
|
|
fd337dd0cc | ||
|
|
dadaee4cc0 | ||
|
|
bd8a46c3c8 | ||
|
|
1e329529a7 | ||
|
|
084c001c11 | ||
|
|
f4aa4edc94 | ||
|
|
b0737bd1a0 | ||
|
|
5744c67039 | ||
|
|
040db45ae4 | ||
|
|
8f19b078ff | ||
|
|
edba53c5da | ||
|
|
eb90b92c12 | ||
|
|
076fa3686c | ||
|
|
27b97c0fda | ||
|
|
0a09c8d8e7 | ||
|
|
c9f88e17a1 | ||
|
|
769eef20f7 | ||
|
|
d0fe1f8255 | ||
|
|
6354e94657 | ||
|
|
4b123ab583 | ||
|
|
cf9af4ee49 | ||
|
|
5c206b7815 | ||
|
|
3dd2257b57 | ||
|
|
43694183ff | ||
|
|
0c19124984 | ||
|
|
eeaad85151 | ||
|
|
6e84e757c7 | ||
|
|
c021a50768 | ||
|
|
88002bf977 | ||
|
|
7788c33da8 | ||
|
|
476c05cfb4 | ||
|
|
3c57861d6b | ||
|
|
ae04479968 | ||
|
|
f797d737d3 | ||
|
|
41b1455f04 | ||
|
|
08eb21aa9d | ||
|
|
8a75f5b45e | ||
|
|
655fdb569a | ||
|
|
fab08a3951 | ||
|
|
d7e0b926ac | ||
|
|
57b775bae2 | ||
|
|
f4bc39bf41 | ||
|
|
0502401a29 | ||
|
|
b289784359 | ||
|
|
2029e0c66f | ||
|
|
d11e7a1320 | ||
|
|
9cc31f6aad | ||
|
|
caa594eba8 | ||
|
|
f237d44339 | ||
|
|
ca6b768a67 | ||
|
|
4a5347e5ae | ||
|
|
3ec0b9376c | ||
|
|
dfb82f8893 | ||
|
|
bda739eb8f | ||
|
|
eece496351 | ||
|
|
fd0efd4a62 | ||
|
|
8fef257d16 | ||
|
|
d7c16d6d1a | ||
|
|
8e5d235cd2 | ||
|
|
d77c25224a | ||
|
|
d0357cf3aa | ||
|
|
79aeaa6287 | ||
|
|
301d692e8a | ||
|
|
b60d045537 | ||
|
|
cd53efb038 | ||
|
|
bb06d45a05 | ||
|
|
93494aad24 | ||
|
|
d498fcd48e | ||
|
|
fb6d9d2d20 | ||
|
|
705e037b12 | ||
|
|
36ee32f81a | ||
|
|
0afaf656fa | ||
|
|
7113d1418b | ||
|
|
5ac580a241 | ||
|
|
daa178b18f | ||
|
|
18e6e1bc7c | ||
|
|
fc15146bf2 | ||
|
|
30e715cff0 | ||
|
|
740b5b430d | ||
|
|
f01b73ab32 | ||
|
|
f7e8ec0a95 | ||
|
|
5129a37ec8 | ||
|
|
20ed5e1a52 | ||
|
|
d63157a41d | ||
|
|
9984e1bdcb | ||
|
|
9a7ffc38a1 | ||
|
|
af584bd474 | ||
|
|
7f9f907bc2 | ||
|
|
e6d079d87a | ||
|
|
4ff66d125f | ||
|
|
544bda197e | ||
|
|
edb62bd1cb | ||
|
|
7eeb46ab68 | ||
|
|
7dd1053d03 | ||
|
|
3f17e5e032 | ||
|
|
aca1eb40a8 | ||
|
|
d932cd8450 | ||
|
|
424a48714f | ||
|
|
c4bb23631b | ||
|
|
4bc522cd1e | ||
|
|
7945dd18fa | ||
|
|
67fb1330f8 | ||
|
|
2688de6500 | ||
|
|
d97876714c | ||
|
|
0a87c18e7e | ||
|
|
379066f069 | ||
|
|
d8f12035fc | ||
|
|
596733bacc | ||
|
|
688ebe2324 | ||
|
|
470dd8be05 | ||
|
|
2e1fa09166 | ||
|
|
e6d96333f7 | ||
|
|
f748ec1c59 | ||
|
|
391d066095 | ||
|
|
3f6109af52 | ||
|
|
b2089e8bb0 | ||
|
|
d593a8e4c9 | ||
|
|
f7c31885f5 | ||
|
|
db735ab224 | ||
|
|
4b5d3913d9 | ||
|
|
8e4bef9c90 | ||
|
|
ec48f04dd8 | ||
|
|
d171562002 | ||
|
|
3c1a61349f | ||
|
|
8bac5355dd | ||
|
|
2e39e56e17 | ||
|
|
b05ab6285d | ||
|
|
07a779c880 | ||
|
|
ac663d02a1 | ||
|
|
cf0c2dd9f2 | ||
|
|
8c1815fbea | ||
|
|
404dfba6e8 | ||
|
|
9941191cfc | ||
|
|
1b7a7a4be1 | ||
|
|
6fd2ea41c5 | ||
|
|
a98cd3837b | ||
|
|
6f04f3cb92 | ||
|
|
c2cead7089 | ||
|
|
693389ac10 | ||
|
|
16786c61e3 | ||
|
|
b28abd77b0 | ||
|
|
00af8b7ae1 | ||
|
|
e45a0943e8 | ||
|
|
27ccf67503 | ||
|
|
194faf56fb | ||
|
|
854cfe15ec | ||
|
|
3e16031877 | ||
|
|
367e14dcc0 | ||
|
|
fa1f9a1ff6 | ||
|
|
d9ec086beb | ||
|
|
ce6f7f2c84 | ||
|
|
67fd8ecd0e | ||
|
|
f05e432df8 | ||
|
|
942dcfa631 | ||
|
|
e3ff11eb46 | ||
|
|
9abb29f1d1 | ||
|
|
7762814eda | ||
|
|
75cc48e460 | ||
|
|
03eec8fab6 | ||
|
|
2ab522950f | ||
|
|
778ac87b37 | ||
|
|
204130477e | ||
|
|
be3f152d3c | ||
|
|
086e24c407 | ||
|
|
3e8e1c8844 | ||
|
|
3820c34f28 | ||
|
|
0e6719908b | ||
|
|
3dccc218df | ||
|
|
39761badb7 | ||
|
|
5e452dbb13 | ||
|
|
10baef235f | ||
|
|
5302930b09 | ||
|
|
0b301d8ff6 | ||
|
|
7b65174856 | ||
|
|
4dbeff47db | ||
|
|
d74e68a3fd | ||
|
|
b55400a0d5 | ||
|
|
b747573dc7 | ||
|
|
064b7c4b41 | ||
|
|
0a08ef00c2 | ||
|
|
a3f68b566d | ||
|
|
2766cd8822 | ||
|
|
332eed3596 | ||
|
|
24e7b20d04 | ||
|
|
29fad31ee5 | ||
|
|
a4d1c53ed3 | ||
|
|
1ba436041b | ||
|
|
f693040ced | ||
|
|
e886ef4f48 | ||
|
|
c9370e6fac | ||
|
|
71341b871e | ||
|
|
ae99d155b5 | ||
|
|
b8630c4230 | ||
|
|
ee3715e267 | ||
|
|
2714180227 | ||
|
|
40f230d6f0 | ||
|
|
4128b23f86 | ||
|
|
bc4c34f851 | ||
|
|
af9f744390 | ||
|
|
e9451f71f2 | ||
|
|
495de91e13 | ||
|
|
25b49f7879 | ||
|
|
ab028ab4e2 | ||
|
|
9c43e75691 | ||
|
|
5473befa13 | ||
|
|
3a0d05d15a | ||
|
|
bedaf12b0e | ||
|
|
c7d77d7664 | ||
|
|
be1639b452 | ||
|
|
c4c7fa236a | ||
|
|
09d2fff619 | ||
|
|
22d4ea3207 | ||
|
|
02a29920fc | ||
|
|
d3796b6531 | ||
|
|
12e4d3c822 | ||
|
|
23f2adb433 | ||
|
|
a78cae1c15 | ||
|
|
667ba72dbd | ||
|
|
1214f31d2c | ||
|
|
85afbd40ca | ||
|
|
ba5dbb05d5 | ||
|
|
17dda85c71 | ||
|
|
b3c055fa5f | ||
|
|
f20a681315 | ||
|
|
f372104163 | ||
|
|
b3b3f47876 | ||
|
|
c203ce837c | ||
|
|
e223b93d91 | ||
|
|
738885cc1a | ||
|
|
63262331c6 | ||
|
|
d97d017853 | ||
|
|
b67dbe668b | ||
|
|
e0d8e80b76 | ||
|
|
9bafef8d88 | ||
|
|
219d5657e8 | ||
|
|
0b962a3b3b | ||
|
|
386597af6e | ||
|
|
0d395733af | ||
|
|
c8c03fe2e0 | ||
|
|
2a33e28db9 | ||
|
|
e2e6c6cacc | ||
|
|
d0610be25c | ||
|
|
1e0272d006 | ||
|
|
3914cf7eac | ||
|
|
4bca43508b | ||
|
|
e933f505e2 | ||
|
|
08cfcc30b0 | ||
|
|
ec9a13a2c3 | ||
|
|
fa04c46cf7 | ||
|
|
22a0c4f99e | ||
|
|
f09c9a3764 | ||
|
|
d642b59300 | ||
|
|
10183ffd22 | ||
|
|
19672806d2 | ||
|
|
4669279589 | ||
|
|
7d20198520 | ||
|
|
d7aeb8fb5b | ||
|
|
2d4bdf28a1 | ||
|
|
1e2ccbf9ff | ||
|
|
abdc67ff4e | ||
|
|
2ebafcffaf | ||
|
|
e92de4d49e | ||
|
|
3f8068b760 | ||
|
|
2e5236561e | ||
|
|
f057b26afa | ||
|
|
99c2a0aaf5 | ||
|
|
de8efd6855 | ||
|
|
4ad52aba57 | ||
|
|
9ca2d3abfc | ||
|
|
762079d066 | ||
|
|
15981b743e | ||
|
|
f8b3ba9ab6 | ||
|
|
4179bb1918 | ||
|
|
f6a3ee94be | ||
|
|
271fbc7589 | ||
|
|
e4ca9245ec | ||
|
|
0b720d30cd | ||
|
|
f0acc73541 | ||
|
|
e2336b8b90 | ||
|
|
864a482e88 | ||
|
|
fe0396e392 | ||
|
|
9cc3dca98b | ||
|
|
31597117a2 | ||
|
|
377caecefe | ||
|
|
73448612af | ||
|
|
e0fab1c9a7 | ||
|
|
aa7d7171c8 | ||
|
|
2079016a04 | ||
|
|
c0493a91e0 | ||
|
|
61a0aba66e | ||
|
|
462d986633 | ||
|
|
51854f508c | ||
|
|
6a97e694ec | ||
|
|
a0cdc3e0d4 | ||
|
|
a3f573cdff | ||
|
|
20df0d785d | ||
|
|
c15fc93494 | ||
|
|
673986835a | ||
|
|
6f353013fd | ||
|
|
112b4c45e4 | ||
|
|
b223ec5780 | ||
|
|
1909518572 | ||
|
|
309cbd6635 | ||
|
|
50a42a5b97 | ||
|
|
b9c7bb89a7 | ||
|
|
5b767ec91e | ||
|
|
e5ba266420 | ||
|
|
86dac7a4bb | ||
|
|
b8a9a7d743 | ||
|
|
c449fe8561 | ||
|
|
2b8232b9ab | ||
|
|
b29860a93c | ||
|
|
dedfbb0ec8 | ||
|
|
56219ced36 | ||
|
|
f9f49cc0d0 | ||
|
|
8a3b8bb3c9 | ||
|
|
a56a217ca9 | ||
|
|
0286eeecdd | ||
|
|
a3431c8e4c | ||
|
|
3ff80e55c4 | ||
|
|
9b2246930e | ||
|
|
0f0c9abe24 | ||
|
|
d90ed8632a | ||
|
|
cd25d4af06 | ||
|
|
5c164c97b2 | ||
|
|
92cdc705cd | ||
|
|
21df72269a | ||
|
|
4e50bf7a8b | ||
|
|
220bef3490 | ||
|
|
1af29561e8 | ||
|
|
fbb924e3bb | ||
|
|
c401d69b4f | ||
|
|
17eff8863c | ||
|
|
d4d5c5495e | ||
|
|
e5d685a23d | ||
|
|
f85c91a04e | ||
|
|
7e26ce3471 | ||
|
|
9526d5debc | ||
|
|
790fc0da1e | ||
|
|
5dc68e68ca | ||
|
|
1e5658eeba | ||
|
|
877176c98f | ||
|
|
483c69dd03 | ||
|
|
2feedddbfe | ||
|
|
2a0ff6c5d0 | ||
|
|
8a579c3aab | ||
|
|
48621a7883 | ||
|
|
365d60ce4a | ||
|
|
aa8bb42d9f | ||
|
|
9fccd11fc7 | ||
|
|
854dc3aceb | ||
|
|
fabdf4214a | ||
|
|
9ce99b80d3 | ||
|
|
473965d3a6 | ||
|
|
c9689c74fb | ||
|
|
06a76f6470 | ||
|
|
14a9112dea | ||
|
|
4a5945e67d | ||
|
|
507991ac2b | ||
|
|
ab62855d80 | ||
|
|
36cb0ff5f9 | ||
|
|
9d7369e234 | ||
|
|
49ca2acf91 | ||
|
|
39a1e1fd11 | ||
|
|
edec0ae3da | ||
|
|
c6a7e2bf47 | ||
|
|
cd43b758d4 | ||
|
|
5a7c561d48 | ||
|
|
aaf2a2d4dd | ||
|
|
cc5545e8b4 | ||
|
|
4962f932fb | ||
|
|
b791951a45 | ||
|
|
30835317c2 | ||
|
|
1a72b81065 | ||
|
|
7b1999d8fb | ||
|
|
91aceadf4f | ||
|
|
4a03864bea | ||
|
|
1a7103c4c4 | ||
|
|
d3ddf40484 | ||
|
|
0ba0a10f74 | ||
|
|
30b0a20973 | ||
|
|
32cd8559b4 | ||
|
|
0cc811d1a6 | ||
|
|
b9f834dd57 | ||
|
|
4f7ad56d1b | ||
|
|
ab727defb7 | ||
|
|
6aae96e1e1 | ||
|
|
de537473a0 | ||
|
|
881ef6c319 | ||
|
|
dd34bfbf75 | ||
|
|
4e0750241c | ||
|
|
0fc0cabe02 | ||
|
|
88a4ae8043 | ||
|
|
4426599638 | ||
|
|
e1a58e18d9 | ||
|
|
979f1fa518 | ||
|
|
5a77ad7a1e | ||
|
|
28a9f981cb | ||
|
|
9e64da64f4 | ||
|
|
406b670418 | ||
|
|
8967e0f67f | ||
|
|
5a311cfbfe | ||
|
|
3cbdca1ef6 | ||
|
|
5aab7f9da0 | ||
|
|
ad36a4d1a5 | ||
|
|
b3c54f3fce | ||
|
|
119b57ff35 | ||
|
|
18003a21ab | ||
|
|
9205db8599 | ||
|
|
56a2f4283a | ||
|
|
580ae9537b | ||
|
|
c452264a11 | ||
|
|
047b7d2006 | ||
|
|
e71116be0a | ||
|
|
2761b66d6a | ||
|
|
84fd09c281 | ||
|
|
61760cc853 | ||
|
|
0977dd1c0b | ||
|
|
e2dc2c133a | ||
|
|
6634d185bb | ||
|
|
3ec00eb06c | ||
|
|
9e60b6e392 | ||
|
|
a58ac6926d | ||
|
|
831dbd31a4 | ||
|
|
7924d10fad | ||
|
|
b73d9f03fa | ||
|
|
67aa84ad76 | ||
|
|
30c2fc4c93 | ||
|
|
36a4eb208f | ||
|
|
7e4512fa68 | ||
|
|
dbf48890ac | ||
|
|
be55ba2955 | ||
|
|
ecb406b4ea | ||
|
|
63bad72a4c | ||
|
|
4457a3e327 | ||
|
|
759db4d7a7 | ||
|
|
bd4a48990e | ||
|
|
70ede60e30 | ||
|
|
e92b8ab76f | ||
|
|
d799098753 | ||
|
|
d6868037c8 | ||
|
|
3e547300b0 | ||
|
|
73ad4d0f83 | ||
|
|
f5c401fb8c | ||
|
|
a552a596fb | ||
|
|
b16bc53025 | ||
|
|
710745262d | ||
|
|
0344b1aee2 | ||
|
|
379bc51241 | ||
|
|
0ea0ebe103 | ||
|
|
42d83fce56 | ||
|
|
70cc04fe5f | ||
|
|
e05af04cce | ||
|
|
b08951a43e | ||
|
|
eec2a3c220 | ||
|
|
44f9cf9dd5 | ||
|
|
0b6090cfd6 | ||
|
|
1ca94ca86c | ||
|
|
2bf4393191 | ||
|
|
d6a4a2b422 | ||
|
|
8bc062da75 | ||
|
|
66378cc2d5 | ||
|
|
c4fb2bda0d | ||
|
|
d777e801fc |
64
.gitignore
vendored
Normal file
64
.gitignore
vendored
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
**/.deps/
|
||||||
|
**/.libs/
|
||||||
|
**/Makefile
|
||||||
|
**/Makefile.in
|
||||||
|
*.exe
|
||||||
|
*.la
|
||||||
|
*.lo
|
||||||
|
*.o
|
||||||
|
*~
|
||||||
|
.vs/
|
||||||
|
CMakeSettings.json
|
||||||
|
Doxyfile
|
||||||
|
INSTALL
|
||||||
|
aclocal.m4
|
||||||
|
ar-lib
|
||||||
|
autom4te.cache/
|
||||||
|
build
|
||||||
|
compile
|
||||||
|
config.guess
|
||||||
|
config.h
|
||||||
|
config.h.in
|
||||||
|
config.log
|
||||||
|
config.status
|
||||||
|
config.sub
|
||||||
|
configure
|
||||||
|
debian/
|
||||||
|
depcomp
|
||||||
|
examples/nfc-anticol
|
||||||
|
examples/nfc-dep-initiator
|
||||||
|
examples/nfc-dep-target
|
||||||
|
examples/nfc-emulate-forum-tag2
|
||||||
|
examples/nfc-emulate-tag
|
||||||
|
examples/nfc-emulate-uid
|
||||||
|
examples/nfc-mfsetuid
|
||||||
|
examples/nfc-poll
|
||||||
|
examples/nfc-relay
|
||||||
|
examples/pn53x-diagnose
|
||||||
|
examples/pn53x-sam
|
||||||
|
examples/pn53x-tamashell
|
||||||
|
examples/quick_start_example1
|
||||||
|
examples/quick_start_example2
|
||||||
|
install-sh
|
||||||
|
libnfc.pc
|
||||||
|
libtool
|
||||||
|
ltmain.sh
|
||||||
|
m4/libtool.m4
|
||||||
|
m4/ltoptions.m4
|
||||||
|
m4/ltsugar.m4
|
||||||
|
m4/ltversion.m4
|
||||||
|
m4/lt~obsolete.m4
|
||||||
|
missing
|
||||||
|
stamp-h1
|
||||||
|
test-driver
|
||||||
|
test/run-test.sh.log
|
||||||
|
test/run-test.sh.trs
|
||||||
|
test/test-suite.log
|
||||||
|
utils/nfc-emulate-forum-tag4
|
||||||
|
utils/nfc-jewel
|
||||||
|
utils/nfc-list
|
||||||
|
utils/nfc-mfclassic
|
||||||
|
utils/nfc-mfultralight
|
||||||
|
utils/nfc-read-forum-tag3
|
||||||
|
utils/nfc-relay-picc
|
||||||
|
utils/nfc-scan-device
|
||||||
81
.travis.yml
Normal file
81
.travis.yml
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
language: c
|
||||||
|
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- os: windows
|
||||||
|
compiler:
|
||||||
|
- clang
|
||||||
|
before_install:
|
||||||
|
- mkdir build && cd build && wget "https://sourceforge.net/projects/libusb-win32/files/libusb-win32-releases/1.2.6.0/libusb-win32-bin-1.2.6.0.zip" && 7z x libusb-win32-bin-1.2.6.0.zip -o"$PROGRAMFILES" && mv "$PROGRAMFILES/libusb-win32-bin-1.2.6.0" "$PROGRAMFILES/libusb-win32"
|
||||||
|
install:
|
||||||
|
choco install doxygen.install ninja
|
||||||
|
script:
|
||||||
|
cmake -GNinja .. && cmake --build .
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
dist: bionic
|
||||||
|
compiler:
|
||||||
|
- clang
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- libusb-dev
|
||||||
|
- doxygen
|
||||||
|
- cmake
|
||||||
|
script:
|
||||||
|
- mkdir build && cd build && cmake -DCMAKE_INSTALL_PREFIX=~/.local .. && make -j2 && make install
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
dist: bionic
|
||||||
|
compiler:
|
||||||
|
- clang
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- libusb-dev
|
||||||
|
- doxygen
|
||||||
|
script:
|
||||||
|
- autoreconf -vfi && mkdir build && cd build && ../configure --prefix=$HOME/.local/ && make -j2 && make install
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
dist: bionic
|
||||||
|
compiler:
|
||||||
|
- gcc
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- libusb-dev
|
||||||
|
- doxygen
|
||||||
|
- cmake
|
||||||
|
script:
|
||||||
|
- mkdir build && cd build && cmake -DCMAKE_INSTALL_PREFIX=~/.local .. && make -j2 && make install
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
dist: bionic
|
||||||
|
compiler:
|
||||||
|
- gcc
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- libusb-dev
|
||||||
|
- doxygen
|
||||||
|
script:
|
||||||
|
- autoreconf -vfi && mkdir build && cd build && ../configure --prefix=$HOME/.local/ && make -j2 && make install
|
||||||
|
|
||||||
|
- os: osx
|
||||||
|
osx_image: xcode12
|
||||||
|
compiler:
|
||||||
|
- clang
|
||||||
|
before_install:
|
||||||
|
- brew install doxygen libusb-compat
|
||||||
|
script:
|
||||||
|
- mkdir build && cd build && cmake -DCMAKE_INSTALL_PREFIX=~/.local .. && make -j2 && make install
|
||||||
|
|
||||||
|
- os: osx
|
||||||
|
osx_image: xcode12
|
||||||
|
compiler:
|
||||||
|
- clang
|
||||||
|
before_install:
|
||||||
|
- brew install doxygen libusb-compat m4
|
||||||
|
script:
|
||||||
|
- autoreconf -vfi && mkdir build && cd build && ../configure --prefix=$HOME/.local/ && make -j2 && make install
|
||||||
48
AUTHORS
48
AUTHORS
@ -1 +1,49 @@
|
|||||||
|
# Alphabetical cleaned output of "git shortlog -s -e|cut -c 8-" :
|
||||||
|
Adam Laurie <adam@algroup.co.uk>
|
||||||
|
Ahti Legonkov <ahti.legonkov@gmail.com>
|
||||||
|
Alex Lian <alian@alum.mit.edu>
|
||||||
|
Alexander Inyukhin <shurick@sectorb.msk.ru>
|
||||||
|
Anugrah Redja Kusuma <anugrah.redja@gmail.com>
|
||||||
|
Audrey Diacre <adiacre@il4p.fr>
|
||||||
|
Boris Moiseev <cyberbobs@gmail.com>
|
||||||
|
Christoph Gritschenberger <christoph.gritschenberger@gmail.com>
|
||||||
|
Dario Carluccio <dario.carluccio@gmail.com>
|
||||||
|
David Kreitschmann <david@kreitschmann.de>
|
||||||
|
Emanuele Bertoldi <emanuele.bertoldi@gmail.com>
|
||||||
|
Emmanuel Dreyfus <manu@netbsd.org>
|
||||||
|
Eugeny Boger <eugenyboger@gmail.com>
|
||||||
|
Francois Kooman <fkooman@tuxed.net>
|
||||||
|
Frank Morgner <frankmorgner@gmail.com>
|
||||||
|
Frédéric Bourgeois <bourgeoislab@gmail.com>
|
||||||
|
Hidde Wieringa <hidde@hiddewieringa.nl>
|
||||||
|
Jairo Andres Suarez <andres4005@gmail.com>
|
||||||
|
Jiapeng Li <gapleehit@gmail.com>
|
||||||
|
Jim Anastassiou <jim.anastassiou@gmail.com>
|
||||||
|
John Galt <centromere@users.noreply.github.com>
|
||||||
|
Julien Ehrhart <julien.ehrhart@live.com>
|
||||||
|
Julien Schueller <julien.schueller@gmail.com>
|
||||||
|
Laurent Latil <laurent@latil.nom.fr>
|
||||||
|
Ludovic Rousseau <ludovic.rousseau@gmail.com>
|
||||||
|
Marcello Morena <marcello.morena@gmail.com>
|
||||||
|
Marcos Vives Del Sol <socram8888@gmail.com>
|
||||||
|
Mati Vait <mativait@gmail.com>
|
||||||
|
Maxim Martyanov <llorephie@gmail.com>
|
||||||
|
Mike Auty <mike.auty@gmail.com>
|
||||||
|
Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
|
||||||
|
Olliver Schinagl <oliver@schinagl.nl>
|
||||||
|
Paul Menzel <paul.menzel@giantmonkey.de>
|
||||||
|
Peter Meerwald <pmeerw@pmeerw.net>
|
||||||
|
Philippe Teuwen <yobibe@gmail.com>
|
||||||
|
Pim 't Hart <pimmeyproductions@gmail.com>
|
||||||
|
Ray Lee <rayleesky@outlook.com>
|
||||||
Roel Verdult <roel@libnfc.org>
|
Roel Verdult <roel@libnfc.org>
|
||||||
|
Romain Tartiere <romain.tartiere@gmail.com>
|
||||||
|
Romuald Conty <romuald@libnfc.org>
|
||||||
|
Simon Yorkston <simon.yorkston@gmail.com>
|
||||||
|
bhack <s.fabri@email.it>
|
||||||
|
lego <lego@debian-fresh.prx>
|
||||||
|
quantum-x <simon.yorkston@gmail.com>
|
||||||
|
timzi <developers@make-gadget.ru>
|
||||||
|
xantares <xantares09@hotmail.com>
|
||||||
|
xaqq <kapp.arno@gmail.com>
|
||||||
|
yerzhanm <yerzhan.mukhamejan@gmail.com>
|
||||||
|
|||||||
328
CMakeLists.txt
Normal file
328
CMakeLists.txt
Normal file
@ -0,0 +1,328 @@
|
|||||||
|
cmake_minimum_required (VERSION 2.6)
|
||||||
|
|
||||||
|
if (NOT DEFINED CMAKE_BUILD_TYPE)
|
||||||
|
set (CMAKE_BUILD_TYPE Release CACHE STRING "Build type")
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
project (libnfc C)
|
||||||
|
|
||||||
|
SET(VERSION_MAJOR "1")
|
||||||
|
SET(VERSION_MINOR "8")
|
||||||
|
SET(VERSION_PATCH "0")
|
||||||
|
|
||||||
|
SET(VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
|
||||||
|
|
||||||
|
SET(PACKAGE_NAME "libnfc")
|
||||||
|
SET(PACKAGE_VERSION ${VERSION})
|
||||||
|
SET(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
|
||||||
|
|
||||||
|
# config.h
|
||||||
|
IF(WIN32)
|
||||||
|
SET(LIBNFC_SYSCONFDIR "./config" CACHE PATH "libnfc configuration directory")
|
||||||
|
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/cmake/config_windows.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
|
||||||
|
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/contrib/win32)
|
||||||
|
IF(NOT MINGW)
|
||||||
|
SET(CMAKE_C_FLAGS "-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE ${CMAKE_C_FLAGS}")
|
||||||
|
ENDIF(NOT MINGW)
|
||||||
|
ELSE(WIN32)
|
||||||
|
SET(_XOPEN_SOURCE 600)
|
||||||
|
SET(SYSCONFDIR "/etc" CACHE PATH "System configuration directory")
|
||||||
|
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/cmake/config_posix.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
|
||||||
|
ENDIF(WIN32)
|
||||||
|
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
|
||||||
|
ADD_DEFINITIONS("-DHAVE_CONFIG_H")
|
||||||
|
|
||||||
|
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||||
|
|
||||||
|
# make it easy to locate CMake modules for finding libraries
|
||||||
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/modules/")
|
||||||
|
|
||||||
|
# Options
|
||||||
|
option (LIBNFC_LOG "Enable log facility (errors, warning, info and debug messages)" ON)
|
||||||
|
IF(LIBNFC_LOG)
|
||||||
|
ADD_DEFINITIONS(-DLOG)
|
||||||
|
ENDIF(LIBNFC_LOG)
|
||||||
|
|
||||||
|
option (LIBNFC_ENVVARS "Enable envvars facility" ON)
|
||||||
|
IF(LIBNFC_ENVVARS)
|
||||||
|
ADD_DEFINITIONS(-DENVVARS)
|
||||||
|
ENDIF(LIBNFC_ENVVARS)
|
||||||
|
|
||||||
|
SET(LIBNFC_DEBUG_MODE OFF CACHE BOOL "Debug mode")
|
||||||
|
IF(LIBNFC_DEBUG_MODE)
|
||||||
|
ADD_DEFINITIONS(-DDEBUG)
|
||||||
|
SET(CMAKE_C_FLAGS "-g3 ${CMAKE_C_FLAGS}")
|
||||||
|
SET(WIN32_MODE "debug")
|
||||||
|
SET(CMAKE_RC_FLAGS "-D_DEBUG ${CMAKE_RC_FLAGS}")
|
||||||
|
ELSE(LIBNFC_DEBUG_MODE)
|
||||||
|
SET(WIN32_MODE "release")
|
||||||
|
ENDIF(LIBNFC_DEBUG_MODE)
|
||||||
|
|
||||||
|
option (LIBNFC_CONFFILES_MODE "Enable configuration files" ON)
|
||||||
|
IF(LIBNFC_CONFFILES_MODE)
|
||||||
|
ADD_DEFINITIONS(-DCONFFILES)
|
||||||
|
ENDIF(LIBNFC_CONFFILES_MODE)
|
||||||
|
|
||||||
|
option (BUILD_EXAMPLES "build examples ON/OFF" ON)
|
||||||
|
option (BUILD_UTILS "build utils ON/OFF" ON)
|
||||||
|
|
||||||
|
option (BUILD_DEBPKG "build debian package ON/OFF" OFF)
|
||||||
|
|
||||||
|
|
||||||
|
# Doxygen
|
||||||
|
SET(builddir "${CMAKE_BINARY_DIR}")
|
||||||
|
SET(top_srcdir "${CMAKE_SOURCE_DIR}")
|
||||||
|
INCLUDE(UseDoxygen)
|
||||||
|
|
||||||
|
IF(DEFINED CMAKE_INSTALL_LIBDIR)
|
||||||
|
SET(libdir ${CMAKE_INSTALL_LIBDIR})
|
||||||
|
ELSE(DEFINED CMAKE_INSTALL_LIBDIR)
|
||||||
|
SET(CMAKE_INSTALL_LIBDIR lib)
|
||||||
|
SET(libdir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR})
|
||||||
|
ENDIF(DEFINED CMAKE_INSTALL_LIBDIR)
|
||||||
|
|
||||||
|
IF(DEFINED INCLUDE_INSTALL_DIR)
|
||||||
|
SET(includedir ${INCLUDE_INSTALL_DIR})
|
||||||
|
ELSE(DEFINED INCLUDE_INSTALL_DIR)
|
||||||
|
SET(INCLUDE_INSTALL_DIR include)
|
||||||
|
SET(includedir ${CMAKE_INSTALL_PREFIX}/${INCLUDE_INSTALL_DIR})
|
||||||
|
ENDIF(DEFINED INCLUDE_INSTALL_DIR)
|
||||||
|
|
||||||
|
IF(NOT DEFINED SHARE_INSTALL_PREFIX)
|
||||||
|
SET(SHARE_INSTALL_PREFIX share)
|
||||||
|
ENDIF(NOT DEFINED SHARE_INSTALL_PREFIX)
|
||||||
|
|
||||||
|
# Additonnal GCC flags
|
||||||
|
IF(CMAKE_COMPILER_IS_GNUCC)
|
||||||
|
# Make sure we will not miss some warnings ;)
|
||||||
|
SET(CMAKE_C_FLAGS "-Wall -pedantic -std=c99 ${CMAKE_C_FLAGS}")
|
||||||
|
ENDIF(CMAKE_COMPILER_IS_GNUCC)
|
||||||
|
|
||||||
|
# Workarounds for libusb in C99
|
||||||
|
ADD_DEFINITIONS(-Du_int8_t=uint8_t -Du_int16_t=uint16_t)
|
||||||
|
|
||||||
|
IF(MINGW)
|
||||||
|
IF (CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
|
||||||
|
# force MinGW-w64 in 32bit mode
|
||||||
|
SET(CMAKE_C_FLAGS "-m32 ${CMAKE_C_FLAGS}")
|
||||||
|
SET(CMAKE_MODULE_LINKER_FLAGS "-m32 -Wl,--enable-stdcall-fixup ${CMAKE_SHARED_LINKER_FLAGS}")
|
||||||
|
SET(CMAKE_SHARED_LINKER_FLAGS "-m32 -Wl,--enable-stdcall-fixup ${CMAKE_SHARED_LINKER_FLAGS}")
|
||||||
|
SET(CMAKE_EXE_LINKER_FLAGS "-m32 -Wl,--enable-stdcall-fixup ${CMAKE_EXE_LINKER_FLAGS}")
|
||||||
|
SET(CMAKE_RC_FLAGS "--target=pe-i386 --output-format=coff ${CMAKE_RC_FLAGS}")
|
||||||
|
ELSE(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
|
||||||
|
IF(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86")
|
||||||
|
# force MinGW-w64 in 32bit mode
|
||||||
|
MESSAGE("Building 32-bit Windows DLL")
|
||||||
|
#SET(CMAKE_C_FLAGS "-m32 ${CMAKE_C_FLAGS}")
|
||||||
|
#SET(CMAKE_MODULE_LINKER_FLAGS "--Wl,--enable-stdcall-fixup ${CMAKE_SHARED_LINKER_FLAGS}")
|
||||||
|
#SET(CMAKE_SHARED_LINKER_FLAGS "--Wl,--enable-stdcall-fixup ${CMAKE_SHARED_LINKER_FLAGS}")
|
||||||
|
#SET(CMAKE_EXE_LINKER_FLAGS "--Wl,--enable-stdcall-fixup ${CMAKE_EXE_LINKER_FLAGS}")
|
||||||
|
SET(CMAKE_RC_FLAGS "--target=pe-i386 --output-format=coff ${CMAKE_RC_FLAGS}")
|
||||||
|
ELSEIF(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
|
||||||
|
MESSAGE("Building 64-bit Windows DLL")
|
||||||
|
SET(CMAKE_RC_FLAGS "--target=pe-x86-64 --output-format=coff ${CMAKE_RC_FLAGS}")
|
||||||
|
ELSE(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86")
|
||||||
|
MESSAGE(FATAL_ERROR "Unknown Processor: ${CMAKE_SYSTEM_PROCESSOR}")
|
||||||
|
ENDIF(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86")
|
||||||
|
ENDIF(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
|
||||||
|
|
||||||
|
FIND_PROGRAM(DLLTOOL dlltool CMAKE_FIND_ROOT_PATH_BOTH)
|
||||||
|
IF (NOT DLLTOOL)
|
||||||
|
MESSAGE(FATAL_ERROR "Could not find dlltool command")
|
||||||
|
ENDIF (NOT DLLTOOL)
|
||||||
|
ENDIF(MINGW)
|
||||||
|
|
||||||
|
IF(NOT WIN32)
|
||||||
|
# Set some pkg-config variables
|
||||||
|
SET(prefix ${CMAKE_INSTALL_PREFIX})
|
||||||
|
SET(exec_prefix ${CMAKE_INSTALL_PREFIX})
|
||||||
|
SET(PACKAGE "libnfc")
|
||||||
|
IF(LIBNFC_DRIVER_PN53X_USB)
|
||||||
|
SET(PKG_REQ ${PKG_REQ} "libusb")
|
||||||
|
ENDIF(LIBNFC_DRIVER_PN53X_USB)
|
||||||
|
IF(LIBNFC_DRIVER_ACR122_USB)
|
||||||
|
SET(PKG_REQ ${PKG_REQ} "libusb")
|
||||||
|
ENDIF(LIBNFC_DRIVER_ACR122_USB)
|
||||||
|
IF(LIBNFC_DRIVER_PCSC)
|
||||||
|
SET(PKG_REQ ${PKG_REQ} "libpcsclite")
|
||||||
|
ENDIF(LIBNFC_DRIVER_PCSC)
|
||||||
|
IF(LIBNFC_DRIVER_ACR122_PCSC)
|
||||||
|
SET(PKG_REQ ${PKG_REQ} "libpcsclite")
|
||||||
|
ENDIF(LIBNFC_DRIVER_ACR122_PCSC)
|
||||||
|
# CMake lists are separated by a semi colon, replace with colon
|
||||||
|
STRING(REPLACE ";" "," PKG_CONFIG_REQUIRES "${PKG_REQ}")
|
||||||
|
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/libnfc.pc.in ${CMAKE_CURRENT_BINARY_DIR}/libnfc.pc @ONLY)
|
||||||
|
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/libnfc.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
||||||
|
ENDIF(NOT WIN32)
|
||||||
|
|
||||||
|
INCLUDE(LibnfcDrivers)
|
||||||
|
|
||||||
|
IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||||
|
IF(I2C_REQUIRED)
|
||||||
|
# Inspired from http://cmake.3232098.n2.nabble.com/RFC-cmake-analog-to-AC-SEARCH-LIBS-td7585423.html
|
||||||
|
INCLUDE (CheckFunctionExists)
|
||||||
|
INCLUDE (CheckLibraryExists)
|
||||||
|
CHECK_FUNCTION_EXISTS (clock_gettime HAVE_CLOCK_GETTIME)
|
||||||
|
IF (NOT HAVE_CLOCK_GETTIME)
|
||||||
|
CHECK_LIBRARY_EXISTS (rt clock_gettime "" HAVE_CLOCK_GETTIME_IN_RT)
|
||||||
|
IF (HAVE_CLOCK_GETTIME_IN_RT)
|
||||||
|
SET(LIBRT_FOUND TRUE)
|
||||||
|
SET(LIBRT_LIBRARIES "rt")
|
||||||
|
ENDIF (HAVE_CLOCK_GETTIME_IN_RT)
|
||||||
|
ENDIF (NOT HAVE_CLOCK_GETTIME)
|
||||||
|
ENDIF(I2C_REQUIRED)
|
||||||
|
ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||||
|
|
||||||
|
IF(PCSC_INCLUDE_DIRS)
|
||||||
|
INCLUDE_DIRECTORIES(${PCSC_INCLUDE_DIRS})
|
||||||
|
LINK_DIRECTORIES(${PCSC_LIBRARY_DIRS})
|
||||||
|
ENDIF(PCSC_INCLUDE_DIRS)
|
||||||
|
|
||||||
|
IF(LIBUSB_INCLUDE_DIRS)
|
||||||
|
INCLUDE_DIRECTORIES(${LIBUSB_INCLUDE_DIRS})
|
||||||
|
LINK_DIRECTORIES(${LIBUSB_LIBRARY_DIRS})
|
||||||
|
SET(LIBUSB_FOUND TRUE)
|
||||||
|
ENDIF(LIBUSB_INCLUDE_DIRS)
|
||||||
|
|
||||||
|
# version.rc for Windows
|
||||||
|
IF(WIN32)
|
||||||
|
# Date for filling in rc file information
|
||||||
|
IF (CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
|
||||||
|
MACRO (GET_CURRENT_YEAR RESULT)
|
||||||
|
EXECUTE_PROCESS(COMMAND "cmd" " /C date /T" OUTPUT_VARIABLE ${RESULT})
|
||||||
|
STRING(REGEX REPLACE "\n" "" ${RESULT} ${${RESULT}})
|
||||||
|
STRING(REGEX REPLACE ".*(..)/(..)/(....).*" "\\3" ${RESULT} ${${RESULT}})
|
||||||
|
ENDMACRO (GET_CURRENT_YEAR)
|
||||||
|
ELSE(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
|
||||||
|
MACRO (GET_CURRENT_YEAR RESULT)
|
||||||
|
EXECUTE_PROCESS(COMMAND "date" "+%Y" OUTPUT_VARIABLE ${RESULT})
|
||||||
|
STRING(REGEX REPLACE "\n" "" ${RESULT} ${${RESULT}})
|
||||||
|
ENDMACRO (GET_CURRENT_YEAR)
|
||||||
|
ENDIF(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
|
||||||
|
GET_CURRENT_YEAR(CURRENT_YEAR)
|
||||||
|
MESSAGE("Year for copyright is " ${CURRENT_YEAR})
|
||||||
|
|
||||||
|
SET(prefix ${CMAKE_INSTALL_PREFIX})
|
||||||
|
SET(RC_COMMENT "${PACKAGE_NAME} library")
|
||||||
|
SET(RC_INTERNAL_NAME "${PACKAGE_NAME} ${WIN32_MODE}")
|
||||||
|
SET(RC_ORIGINAL_NAME ${PACKAGE_NAME}.dll)
|
||||||
|
# RC_FILE_TYPE: VFT_DLL
|
||||||
|
SET(RC_FILE_TYPE 0x00000002L)
|
||||||
|
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/contrib/win32/version.rc.in ${CMAKE_CURRENT_BINARY_DIR}/windows/libnfc.rc @ONLY)
|
||||||
|
ENDIF(WIN32)
|
||||||
|
|
||||||
|
ADD_SUBDIRECTORY(libnfc)
|
||||||
|
ADD_SUBDIRECTORY(include)
|
||||||
|
|
||||||
|
if (BUILD_UTILS)
|
||||||
|
add_subdirectory (utils)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
if (BUILD_EXAMPLES)
|
||||||
|
add_subdirectory (examples)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
if (NOT MSVC)
|
||||||
|
# config script install path
|
||||||
|
if ( NOT DEFINED LIBNFC_CMAKE_CONFIG_DIR )
|
||||||
|
set ( LIBNFC_CMAKE_CONFIG_DIR lib${LIB_SUFFIX}/cmake/libnfc )
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
set ( LIBNFC_INCLUDE_DIR ${includedir} )
|
||||||
|
set ( LIBNFC_INCLUDE_DIRS ${LIBNFC_INCLUDE_DIR} )
|
||||||
|
list ( APPEND LIBNFC_INCLUDE_DIRS ${LIBUSB_INCLUDE_DIRS} )
|
||||||
|
set ( LIBNFC_LIBRARY nfc )
|
||||||
|
set ( LIBNFC_LIBRARIES ${LIBNFC_LIBRARY} )
|
||||||
|
list ( APPEND LIBNFC_LIBRARIES ${LIBUSB_LIBRARIES} )
|
||||||
|
set ( LIBNFC_LIBRARY_DIRS ${libdir} )
|
||||||
|
set ( LIBNFC_ROOT_DIR ${prefix} )
|
||||||
|
set ( LIBNFC_VERSION_STRING ${VERSION} )
|
||||||
|
set ( LIBNFC_VERSION_MAJOR ${VERSION_MAJOR} )
|
||||||
|
set ( LIBNFC_VERSION_MINOR ${VERSION_MINOR} )
|
||||||
|
set ( LIBNFC_VERSION_PATCH ${VERSION_PATCH} )
|
||||||
|
|
||||||
|
set ( LIBNFC_USE_FILE ${CMAKE_INSTALL_PREFIX}/${LIBNFC_CMAKE_CONFIG_DIR}/UseLibNFC.cmake )
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if(CMAKE_VERSION VERSION_LESS 2.8.8)
|
||||||
|
configure_file ( cmake/LibNFCConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/LibNFCConfig.cmake @ONLY )
|
||||||
|
configure_file ( cmake/LibNFCConfigVersion.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/LibNFCConfigVersion.cmake @ONLY )
|
||||||
|
else ()
|
||||||
|
include(CMakePackageConfigHelpers)
|
||||||
|
configure_package_config_file (
|
||||||
|
cmake/LibNFCConfig.cmake.in
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/LibNFCConfig.cmake
|
||||||
|
INSTALL_DESTINATION ${LIBNFC_CMAKE_CONFIG_DIR}
|
||||||
|
PATH_VARS
|
||||||
|
LIBNFC_USE_FILE
|
||||||
|
LIBNFC_ROOT_DIR
|
||||||
|
LIBNFC_INCLUDE_DIR
|
||||||
|
LIBNFC_INCLUDE_DIRS
|
||||||
|
LIBNFC_LIBRARY_DIRS
|
||||||
|
NO_CHECK_REQUIRED_COMPONENTS_MACRO
|
||||||
|
)
|
||||||
|
write_basic_package_version_file (
|
||||||
|
LibNFCConfigVersion.cmake
|
||||||
|
VERSION ${LIBNFC_VERSION_STRING}
|
||||||
|
COMPATIBILITY AnyNewerVersion
|
||||||
|
)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
install ( FILES ${CMAKE_CURRENT_BINARY_DIR}/LibNFCConfig.cmake
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/LibNFCConfigVersion.cmake
|
||||||
|
cmake/UseLibNFC.cmake
|
||||||
|
DESTINATION ${LIBNFC_CMAKE_CONFIG_DIR}
|
||||||
|
)
|
||||||
|
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
# Binary Package
|
||||||
|
IF(WIN32)
|
||||||
|
SET(CPACK_GENERATOR "ZIP")
|
||||||
|
ELSE(WIN32)
|
||||||
|
SET(CPACK_GENERATOR "TBZ2")
|
||||||
|
IF(BUILD_DEBPKG)
|
||||||
|
SET(CPACK_GENERATOR "DEB")
|
||||||
|
ENDIF(BUILD_DEBPKG)
|
||||||
|
ENDIF(WIN32)
|
||||||
|
|
||||||
|
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Near Field Communication (NFC) library")
|
||||||
|
SET(CPACK_PACKAGE_VENDOR "Roel Verdult")
|
||||||
|
SET(CPACK_PACKAGE_CONTACT "Roel Verdult <roel@libnfc.org>")
|
||||||
|
|
||||||
|
#Readme file
|
||||||
|
IF(WIN32)
|
||||||
|
SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README-Windows.md")
|
||||||
|
ELSE(WIN32)
|
||||||
|
SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
|
||||||
|
ENDIF(WIN32)
|
||||||
|
|
||||||
|
SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING")
|
||||||
|
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "libnfc")
|
||||||
|
SET(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR})
|
||||||
|
SET(CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR})
|
||||||
|
SET(CPACK_PACKAGE_VERSION_PATCH ${VERSION_PATCH})
|
||||||
|
SET(CPACK_COMPONENT_LIBRARIES_DISPLAY_NAME "NFC Library")
|
||||||
|
SET(CPACK_COMPONENT_EXAMPLES_DISPLAY_NAME "Example Applications")
|
||||||
|
SET(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "Development Headers")
|
||||||
|
IF(NOT WIN32)
|
||||||
|
SET(CPACK_COMPONENT_MANUALS_DISPLAY_NAME "Example Applications Manuals")
|
||||||
|
SET(CPACK_COMPONENT_MANUALS_DISABLED TRUE)
|
||||||
|
SET(CPACK_COMPONENT_MANUALS_DEPENDS examples)
|
||||||
|
ENDIF(NOT WIN32)
|
||||||
|
SET(CPACK_COMPONENT_HEADERS_DISABLED TRUE)
|
||||||
|
SET(CPACK_COMPONENT_HEADERS_DEPENDS libraries)
|
||||||
|
SET(CPACK_COMPONENT_EXAMPLES_DEPENDS libraries)
|
||||||
|
|
||||||
|
# Source Package
|
||||||
|
IF(WIN32)
|
||||||
|
SET(CPACK_SOURCE_GENERATOR "ZIP")
|
||||||
|
ELSE(WIN32)
|
||||||
|
SET(CPACK_SOURCE_GENERATOR "ZIP;TBZ2")
|
||||||
|
ENDIF(WIN32)
|
||||||
|
|
||||||
|
SET(CPACK_SOURCE_PACKAGE_FILE_NAME "libnfc-${VERSION}")
|
||||||
|
SET(CPACK_SOURCE_IGNORE_FILES "~$" "/\\\\.git/" "bin/")
|
||||||
|
INCLUDE(CPack)
|
||||||
800
ChangeLog
800
ChangeLog
@ -1,13 +1,807 @@
|
|||||||
Jul 22, 2009 - 1.1.1
|
May 22, 2020 - 1.8.0
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
Fixes:
|
||||||
|
- Restore nfc_modulation_type enum order to keep compatibility with libnfc 1.7.1
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
- Bump revision due to changes in API introduced in v1.7.2
|
||||||
|
- Bump library version to 6.0.0
|
||||||
|
|
||||||
|
May 21, 2020 - 1.7.2 (avoid using it, incompatible with 1.7.1)
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
Fixes:
|
||||||
|
- Remove unreachable code
|
||||||
|
- nfc_emulate_uid: cleaner exit on interrupt
|
||||||
|
- Fix reporting of modulations and baud rates by nfc-scan-device -v
|
||||||
|
- Fix out-of-bounds access in nfc-mfultralight
|
||||||
|
- Several Cygwin compilation fixes
|
||||||
|
- Fix comparison when nfc_initiator_target_is_present() with a specified target
|
||||||
|
- Fix nfc_initiator_poll_target without tag on PN532
|
||||||
|
- Export iso14443b* symbols
|
||||||
|
- Fix udev rule which was executed too early
|
||||||
|
- Fix improper device name initialization
|
||||||
|
- Fix setenv()/unsetenv() for Windows
|
||||||
|
- Fix win32/nfc.def according to nfc.h
|
||||||
|
- Fix missing timeout in pn53x_initiator_select_passive_target()
|
||||||
|
- nfc-mfclassic: fix option to tolerate write errors
|
||||||
|
- nfc-poll: fix card removing check
|
||||||
|
- nfc-relay-picc: fix wrong open mode for file descriptor
|
||||||
|
|
||||||
|
Improvements:
|
||||||
|
- Allow ISO14443A to be used at higher baud rates
|
||||||
|
- nfc_initiator_select_passive_target() now checks against
|
||||||
|
reported modulations and baud rates for current device
|
||||||
|
- More serial devices on MAC OS X
|
||||||
|
- Add section to README to help to configure libnfc
|
||||||
|
- Various cmake improvements
|
||||||
|
- Drop PCRE dependency on Windows
|
||||||
|
- Remove deprecated readdir_r
|
||||||
|
- Markdown conversion of the text files
|
||||||
|
- Use hardcoded PN533 descriptors to be more robust on Windows
|
||||||
|
- Add support for SCL3712
|
||||||
|
- Add support for ACR1222U-C1
|
||||||
|
- Add support for NetBSD
|
||||||
|
- Add support for PN532 on RPi3 UART
|
||||||
|
- Add support for cross-compilation of 32b & 64b versions of the library for Windows
|
||||||
|
- Add pn533_usb to the kernel modules blacklist
|
||||||
|
- Add support for pn71xx NXP's NFC Controllers through Linux Libnfc-nci (untested)
|
||||||
|
- Add support for contactless PC/SC readers (only as initiator)
|
||||||
|
- Add support for Feitian R502 and bR500 into pcsc driver
|
||||||
|
- Add support for HID iClass (Picopass) support (nfc-iclass tool in external nfc-tools repo)
|
||||||
|
- Allows for sending empty data in nfc_initiator_transceive_bits
|
||||||
|
- driver i2c: respect proper timing specifications
|
||||||
|
- driver i2c: add retry on error mechanism
|
||||||
|
- nfc-mfclassic: improvements fo magic cards
|
||||||
|
- nfc-mfclassic: add option to specify UID
|
||||||
|
- nfc-mfclassic/nfc-mfsetuid: add support for new gen (1b) of magic 4K cards
|
||||||
|
- nfc-mfclassic: Add RATS support indicator
|
||||||
|
- nfc-mfsetuid: allow to write complete Block0, instead of only UID
|
||||||
|
- nfc-mfultralight: add automatic modes and --check-magic
|
||||||
|
- nfc-mfultralight: add support for magic gen2 cards
|
||||||
|
- nfc-mfultralight: add option to specify UID
|
||||||
|
- nfc-mfultralight: add support for Ultralight NTAG213/215/216
|
||||||
|
- nfc-barcode: new command to read and decode NFC Barcodes (Tag-Talks-First)
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
- nfc_device_get_supported_baud_rate() takes now a "mode" parameter
|
||||||
|
- New nfc_device_get_supported_baud_rate_target_mode()
|
||||||
|
- New NFC modulation type NMT_BARCODE and nfc_barcode_info struct to support Thinfilm NFC Barcode protocol
|
||||||
|
- New NFC modulation type NMT_ISO14443BICLASS and NMT_ISO14443BICLASS struct to support HID iClass (Picopass)
|
||||||
|
- pn53x_transceive() is now part of public API
|
||||||
|
|
||||||
|
Special thanks to:
|
||||||
|
- Jim Anastassiou, Frédéric Bourgeois, Dario Carluccio, Emmanuel Dreyfus,
|
||||||
|
Julien Ehrhart, S. Fabri, John Galt, Christoph Gritschenberger,
|
||||||
|
Alexander Inyukhin, Arnaud Kapp, David Kreitschmann, Adam Laurie, Ray Lee,
|
||||||
|
Maxim Martyanov, Paul Menzel, Boris Moiseev, Yerzhan Mukhamejan,
|
||||||
|
Olliver Shinagl, Jairo Andres Suarez, Mati Vait, Marcos Vives Del Sol,
|
||||||
|
Hidde Wieringa, Simon Yorkston, timzi, usk-johnny-s, xantares, Hanno
|
||||||
|
Heinrichs, jgeslin, Mikolaj Stawiski, rstular, Khem Raj, Frank Morgner, jpwidera,
|
||||||
|
Feitian Technologies
|
||||||
|
|
||||||
|
Feb 24, 2014 - 1.7.1
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
Fixes:
|
||||||
|
- Fix several issues reported by Coverity Scan
|
||||||
|
(mem leaks, buff overflows, reuse after free, etc)
|
||||||
|
- More robust when several conflicting uart drivers are in the config
|
||||||
|
- Fix racing condition with uart_flush_input()
|
||||||
|
- Silent pn53x_check_communication error messages when scanning
|
||||||
|
- Fix nfc_target_init(), was returning success in case of timeout
|
||||||
|
- Windows: fix several compilation issues
|
||||||
|
- On tag selection, save current target info also for ISO14443B*
|
||||||
|
- nfc-read-forum-tag3: fix incomplete NDEF retrieval and size of output file
|
||||||
|
|
||||||
|
Improvements:
|
||||||
|
- nfc-list: New option to choose which technologies to poll for
|
||||||
|
- UART: drivers now supported under kFreeBSD
|
||||||
|
- New LIBNFC_DEVICE env var to use one reader and exclude all other readers
|
||||||
|
while LIBNFC_DEFAULT_DEVICE only prepends it to the configured devices list
|
||||||
|
- New LIBNFC_AUTO_SCAN env var to enable(default)/disable auto scan
|
||||||
|
- On tag selection, save current target info even if pnt=NULL
|
||||||
|
- On tag selection, grant NP_INFINITE_SELECT also for ISO14443B*
|
||||||
|
- Save & restore NP_INFINITE_SELECT status when changing it internally
|
||||||
|
- nfc-mfclassic: add format/wipe command (thanks to Adam Laurie)
|
||||||
|
- nfc-jewel: new utility to read/write Topaz/Jewel tags (thanks to Pim 't Hart)
|
||||||
|
- nfc_initiator_select_passive_target() provides defaults if pbtInitData=NULL
|
||||||
|
- nfc-read-forum-tag3: add -q option, add full parsing of NDEF Attribute Block
|
||||||
|
|
||||||
|
Fixes & improvements specific to nfc_initiator_target_is_present():
|
||||||
|
- Supports fully PN532 & PN533, not tested on other chips
|
||||||
|
- Fix usage after nfc_initiator_poll_target()
|
||||||
|
- Set correctly last_error
|
||||||
|
- Fix issue when there was no saved target
|
||||||
|
- Allow NULL pointer to tag
|
||||||
|
- Fix issues in case of tear off conditions
|
||||||
|
- Now works with:
|
||||||
|
* MFUL, MFC, MFC Mini, MFC 7-byte (re-selection: you'll need to auth again)
|
||||||
|
* ISO14443-4A, ISO14443-4B
|
||||||
|
* ISO14443-4B', ASK CTx, ST SRx
|
||||||
|
* Jewel
|
||||||
|
* FeliCa
|
||||||
|
|
||||||
|
Sep 03, 2013 - 1.7.0
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
Fixes:
|
||||||
|
- pn53x: only create a current target when at least one have been found
|
||||||
|
- pn532_uart: fix 'operation abort' feature with this driver
|
||||||
|
- pn532_uart: let more time to PN532 to wake-up, this fix some specific cases
|
||||||
|
where PN532 shown one of two runs (Thanks to Marcello Morena)
|
||||||
|
- nfc-mfclassic: allow option f for read operation too
|
||||||
|
- Avoid clash with system's htole32 if it exists
|
||||||
|
- Include <stdlib.h>, required for getenv(3)
|
||||||
|
- usb: fix USB enumeration issue (Thanks to Mike Auty)
|
||||||
|
- acr122_pcsc: fix compilation on Mac OSX 10.8.4
|
||||||
|
- Fix pn53x_initiator_transceive_bytes_timed() measures for TypeB
|
||||||
|
- Various minor fixes: warnings, style, etc.
|
||||||
|
|
||||||
|
Improvements:
|
||||||
|
- New PN532 over I2C driver, see contrib/libnfc/pn532_i2c_on_rpi.conf.sample
|
||||||
|
- ACR122/Touchatag: misc improvements
|
||||||
|
- ReadMobib/ReadNavigo: improve shell script portability
|
||||||
|
- Add ISO14443-4 chaining support for RX (MI)
|
||||||
|
- UART: add support for BeagleBone serial ports (Thanks to Johan Henselmans)
|
||||||
|
- nfc-mfultralight: allow setting of UID for special 'chinese' ultralight cards
|
||||||
|
|
||||||
|
Special thanks to:
|
||||||
|
- Laurent Latil (new pn532_i2c driver for linux)
|
||||||
|
- Nobuhiro Iwamatsu (warning fixes and debian package)
|
||||||
|
|
||||||
|
Apr 05, 2013 - 1.7.0-rc7 (release candidate)
|
||||||
|
--------------------------------------------
|
||||||
|
|
||||||
|
Fixes:
|
||||||
|
- Fix bug when compiling without libusb
|
||||||
|
- Fix several memory leaks in error handling conditions
|
||||||
|
- Remove calls to exit() from the library
|
||||||
|
- Create safer snprint_nfc_*() instead of sprint_nfc_*() functions
|
||||||
|
- Fix warnings returned by cppcheck & clang/scan-build
|
||||||
|
- Obsolete function 'usleep' => nanosleep()
|
||||||
|
- Non reentrant function 'readdir' => readdir_r()
|
||||||
|
- Non reentrant function 'strtok' => new connstring_decode()
|
||||||
|
- Buffer may not be null-terminated after call to strncpy()
|
||||||
|
- scanf without field width limits can crash with huge input data
|
||||||
|
- Resource leaks: missing fclose()
|
||||||
|
- Dead code, unused vars & vars scopes warnings
|
||||||
|
- Unify copyright notices & update authors lists
|
||||||
|
- Windows: Fix compilation due to new usbbus file
|
||||||
|
- Windows: Clean up compiler/linker warnings
|
||||||
|
- Fixed the suppression of the auto-fixup for linking against MS built libs
|
||||||
|
- Fixed all the formatting warnings by shifting to inttypes.h specifiers
|
||||||
|
- shifted to %lu for DWORD printf
|
||||||
|
- nfc-anticol: fix ATS length
|
||||||
|
- nfc-mfclassic: fix reporting of processed blocks total
|
||||||
|
- nfc-mfclassic: detect MIFARE Plus 2K as 2K instead of 1K
|
||||||
|
- pn53x_usb/acr122_usb: check usb_open() returns before using it
|
||||||
|
|
||||||
|
Improvements:
|
||||||
|
- New PN532 over SPI driver, see contrib/libnfc/pn532_spi_on_rpi.conf.sample
|
||||||
|
- Devels HACKING file: introduce clang/scan-build & cppcheck for better code
|
||||||
|
- Better internal dependencies handling (bus <> drivers)
|
||||||
|
- Cleaner handling of portability patches
|
||||||
|
- Windows: logging via OutputDebugString(), ease debugging
|
||||||
|
- nfc-mfclassic: use smaller files for cards < 4k
|
||||||
|
- nfc-mfclassic: by defaut don't authorise wrong keyfile, use "f" to force
|
||||||
|
- quick_start_example1.c: remove err.h dependency, easier for Windowsians
|
||||||
|
- nfc-mfclassic: support some new magic cards with writeable sector #0
|
||||||
|
- nfc-anticol: add -t option to use timed functions
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
- Upon malloc error, nfc_init() doesn't force exit() anymore
|
||||||
|
so now you should test if context != NULL after nfc_init() call
|
||||||
|
- API: nfc_initiator_target_is_present() & str_nfc_target()
|
||||||
|
now take a pointer to nfc_target as argument instead of passing by value
|
||||||
|
|
||||||
|
Special thanks to:
|
||||||
|
- Eugeny Boger (new pn532_spi driver for linux)
|
||||||
|
|
||||||
|
Mar 03, 2013 - 1.7.0-rc6 (release candidate)
|
||||||
|
--------------------------------------------
|
||||||
|
|
||||||
|
Fixes:
|
||||||
|
- Fix several memory leaks (nfc_drivers, libusb, config parser)
|
||||||
|
- Fix stack smash while displaying long data transmission (LOG_HEX)
|
||||||
|
- pn53x-tamashell: allow larger commands up to full extended frame
|
||||||
|
- Add missing windows file in archive (version.rc.in)
|
||||||
|
- Fix compilation warnings & potential bugs
|
||||||
|
- Fix documentation
|
||||||
|
- Fix missing malloc() calls checks
|
||||||
|
- Fix missing free() calls in some error handlers
|
||||||
|
|
||||||
|
Improvements:
|
||||||
|
- Allow to disable conffils & envvar supports on embedded platforms
|
||||||
|
- Add option to nfc-mfclassic to tolerate RW errors
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
- Replace usb_set_debug() in applications by LIBNFC_LOG_LEVEL libusb group
|
||||||
|
|
||||||
|
Feb 16, 2013 - 1.7.0-rc5 (release candidate)
|
||||||
|
--------------------------------------------
|
||||||
|
|
||||||
|
Fixes:
|
||||||
|
- Add missing sample configuration file in archive
|
||||||
|
- Add missing windows files in archive
|
||||||
|
- Preserve error code while using pn53x_set_property_bool() with
|
||||||
|
NP_AUTO_ISO14443_4 flag
|
||||||
|
|
||||||
|
Improvements:
|
||||||
|
- New nfc_register_driver() function allowing to hook custom drivers
|
||||||
|
- New nfc_free() function to free allocated buffers
|
||||||
|
|
||||||
|
Special thanks to:
|
||||||
|
- Ahti Legonkov (new nfc_register_driver())
|
||||||
|
|
||||||
|
Feb 04, 2013 - 1.7.0-rc4 (release candidate)
|
||||||
|
--------------------------------------------
|
||||||
|
|
||||||
|
Fixes:
|
||||||
|
- Fix tag selection for nfc-mfclassic, nfc-mfultralight, nfc-read-forum-tag3
|
||||||
|
and nfc-relay-picc
|
||||||
|
- Fix crash in nfc-relay-picc -i/-t if fd3 or fd4 is missing
|
||||||
|
|
||||||
|
Improvements:
|
||||||
|
- Windows support build with CMake
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
- Configuration directory (ie. libnfc.conf) can now be set a compile-time
|
||||||
|
- Log can be enabled/disabled using CMake
|
||||||
|
|
||||||
|
Special thanks to:
|
||||||
|
- Alex Lian (Windows support improvements)
|
||||||
|
- Nobuhiro Iwamatsu (Debian package improvements)
|
||||||
|
|
||||||
|
Jan 31, 2013 - 1.7.0-rc3 (release candidate)
|
||||||
|
--------------------------------------------
|
||||||
|
|
||||||
|
Fixes:
|
||||||
|
- Fix pn53x_usb bulk write timeout
|
||||||
|
- Fix BCC in nfc-emulate-uid example
|
||||||
|
- Fix nfc-relay-picc example
|
||||||
|
- Fix a miss returned value within some internal functions (user program could
|
||||||
|
be affected)
|
||||||
|
- Fix nfc-scan-device -i option
|
||||||
|
- Remove wrong exit() calls in library
|
||||||
|
- Fix issue in driver acr122_usb affecting Touchatag
|
||||||
|
- Reenable some idle in all drivers, add selectively PowerDown when possible
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
- nfc_emulate_target() now takes timeout parameter
|
||||||
|
|
||||||
|
Special thanks to:
|
||||||
|
- Alex Lian (Windows support refresh)
|
||||||
|
|
||||||
|
Jan 20, 2013 - 1.7.0-rc2 (release candidate)
|
||||||
|
--------------------------------------------
|
||||||
|
|
||||||
|
Fixes:
|
||||||
|
- Fix API version in debian files
|
||||||
|
- Fix wrong condition to display a warning when user disables autoscan
|
||||||
|
- Fix unit tests
|
||||||
|
- Fix ISO14443B' ATS
|
||||||
|
|
||||||
|
Improvements:
|
||||||
|
- Allow device.optional=true to tolerate missing device
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
- pn532_uart driver is now enabled by default
|
||||||
|
|
||||||
|
Dec 09, 2012 - 1.7.0-rc1 (release candidate)
|
||||||
|
--------------------------------------------
|
||||||
|
|
||||||
|
Fixes:
|
||||||
|
- nfc_initiator_deselect_target() now returns 0 on success (as expected by caller)
|
||||||
|
- example/pn532-sam: Fix few bugs
|
||||||
|
- Fix ACR122S device detection when no ACR122S device available (endless UART receive)
|
||||||
|
- Suppress a lot of compiler warnings !.. which fixes many potential bugs
|
||||||
|
- Display right driver name while detecting PCSC
|
||||||
|
- Correctly handle PCSC header files on Mac OS X
|
||||||
|
- Fix nfc-emulation (now works with utils/nfc-emulate-forum-tag4 and Nexus S)
|
||||||
|
|
||||||
|
Improvements:
|
||||||
|
- New nfc_initiator_init_secure_element() function to set SAM as wired card (only relevant with a PN532 SAM-equipped)
|
||||||
|
- New str_nfc_target(), str_nfc_modulation_type(), str_nfc_baud_rate() function to convert some libnfc's types into allocated string
|
||||||
|
- New nfc_device_target_is_present() to check if passed target is in the field
|
||||||
|
- --enable-serial-autoprobe option at compile time to replace it with some run-time options
|
||||||
|
- New -i option to nfc-scan-device to allow intrusive scan
|
||||||
|
- New feature, libnfc now uses configuration files:
|
||||||
|
* main configuration file can be used to set options (ie. intrusive, autoscan, log-level)
|
||||||
|
* main configuration file can contains a device as default device, HIGHLY recommended for UART devices users
|
||||||
|
* multiple devices files can be used to declare multiple devices and ordered them
|
||||||
|
- UART port scan now includes ttyAMA* to detect UART-devices connected on Raspberry Pi (e.g. `nfc-scan-device -i`)
|
||||||
|
- Support for OpenPCD2 (with a dedicated firmware)
|
||||||
|
- Support for FTDI dongle under MacOS
|
||||||
|
- Enhance messages display
|
||||||
|
- Provides modprobe configuration file and instructions for Linux >3.1 with PN533 users.
|
||||||
|
- Greatly improve log facility with log level filter, configurable using conf file (ie. /etc/nfc/libnfc.conf) or environment var LIBNFC_LOG_LEVEL
|
||||||
|
- New man page for nfc-read-forum-tag3 utility (Thanks to UNFORGiVEN512)
|
||||||
|
- New man page for nfc-scan-device utility
|
||||||
|
- New man page for nfc-emulate-forum-tag2 example
|
||||||
|
- README: Add few words about device permissions and udev/devd rules available in package
|
||||||
|
- utils/nfc-emulate-forum-tag4: add support for v2.0 of the spec
|
||||||
|
- New "make style" command to have a beautiful code
|
||||||
|
- Code cleanup (indentation, white spaces, etc.)
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
- New nfc_device_get_information_about() now allocates returned string
|
||||||
|
- No more in/out paramaters in nfc_initiator_transceive_*() functions
|
||||||
|
- Rename nfc-probe to nfc-scan-device
|
||||||
|
- Rename abtUid from struct mifare_param_auth into abtAuthUid: this is not the UID while using 7-bytes UID MIFARE Classic tags.
|
||||||
|
- utils/nfc-list: always display the card type when a card is found
|
||||||
|
- nfc-utils: new fingerprinting method closer to AN10833, (Thanks to Balazs Bucsay)
|
||||||
|
|
||||||
|
See NEWS file for major changes (ie. API changes)
|
||||||
|
|
||||||
|
Special thanks to:
|
||||||
|
- Ludovic Rousseau (Code cleanup, tests under MacOS, etc.)
|
||||||
|
- Frank Morgner
|
||||||
|
|
||||||
|
Feb 27, 2012 - 1.6.0-rc1 (release candidate)
|
||||||
|
--------------------------------------------
|
||||||
|
|
||||||
|
Fixes:
|
||||||
|
- utils/nfc-mfclassic: use MIFARE instead of Mifare typo
|
||||||
|
- utils/nfc-list: continue to attempt to reach devices after a connection failure
|
||||||
|
- libnfc: avoid readline auto-detection when cross-compiling
|
||||||
|
- driver/pn53x_usb: fix path usage for FreeBSD
|
||||||
|
- doc: quick_start_example1.c fixed
|
||||||
|
- utils/*: verbose option back for nfc-list, and newly implemented in nfc-poll
|
||||||
|
|
||||||
|
Improvements:
|
||||||
|
- libnfc: enhanced documentation
|
||||||
|
- libnfc: debug facility back without external depends
|
||||||
|
- libnfc: add nfc_device_get_supported_modulation() and nfc_device_get_supported_baud_rate() functions
|
||||||
|
- libnfc: enhanced code indent
|
||||||
|
- drivers: implement driver for ACR122S device
|
||||||
|
- utils/nfc-mfclassic: remove non-conscistent "extract payload" option in nfc-mfclassic
|
||||||
|
- utils/nfc-emulate-forum-tag2: add missing manpage
|
||||||
|
- utils/nfc-read-forum-tag3: add missing manpage
|
||||||
|
- tests/*: fix some warnings in test
|
||||||
|
- tests/test_dep*: add some DEP tests (Active/Passive in several baud rates)
|
||||||
|
- doc: quick_start_example1 is now compiled when running make check or distcheck
|
||||||
|
- libnfc: a printf-based logging replaces log4c
|
||||||
|
- libnfc: various minor fixes/enhancements
|
||||||
|
- utils/*: nfc-probe example added to show devices connection strings
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
- PN53x specific errors are not public anymore;
|
||||||
|
- Timeouts are now integers instead of timeval structure
|
||||||
|
- Removes libusb types workaround (r200) as it seems to not be needed anymore but may disturb compiler
|
||||||
|
- Removes parse_args() from nfc-utils.[hc]
|
||||||
|
- Move nfc-emulate-forum-tag2 from utils to examples.
|
||||||
|
- contrib: move udev and devd files into contrib/
|
||||||
|
- debian: udev rules file renamed
|
||||||
|
|
||||||
|
See NEWS file for major changes (ie. API changes)
|
||||||
|
|
||||||
|
Special thanks to:
|
||||||
|
- Thomas Hood (Debian packages and various fixes/contributions)
|
||||||
|
- Anugrah Redja (ACR122S driver)
|
||||||
|
|
||||||
|
Oct 17, 2011 - 1.5.1 (unstable)
|
||||||
|
-------------------------------
|
||||||
|
|
||||||
|
Fixes:
|
||||||
|
- libnfc: fix invalid memory access when a new driver is probing for hardware and the number of requested devices was already reached
|
||||||
|
- chips/pn53x: fix bug in _timed fcts
|
||||||
|
- drivers/pn53x_usb: fix crash when usb_bulk_read() fails.
|
||||||
|
- drivers/pn53x_usb: continue to search a available device on usb errors (ie. Device Busy)
|
||||||
|
- drivers/pn53x_usb: make PN53x usb connection more stable
|
||||||
|
- examples/nfc-relay: fix UID problem
|
||||||
|
- windows: fix uart_receive() under Win32 platform
|
||||||
|
|
||||||
|
Improvements:
|
||||||
|
- libnfc: add logging facility using log4c.
|
||||||
|
- libnfc: abort mecanism is now implemented in driver layer, so it can use pipe-based mecanism (as PN532_UART or ARYGON driver does under POSIX system) or flag-based mecanism.
|
||||||
|
- libnfc: add ISO/IEC 14443 B' aka Type B' modulation partial support
|
||||||
|
- libnfc: add partial support (list) for ISO14443B-3 ST SRx & ASK CTx cards
|
||||||
|
- libnfc: compile unit tests only on demand unless using --enable-debug.
|
||||||
|
- libnfc: error handling improvements
|
||||||
|
- libnfc: new function nfc_idle() to set the NFC device in idle mode
|
||||||
|
- libnfc: add partial support for Sony S360 reader
|
||||||
|
- libnfc: some manual test reports have been added
|
||||||
|
- libnfc: list_targets support for ASK CTS512B (no anticol support yet)
|
||||||
|
- libnfc: nfc_disconnect() now switches NFC device into idle before disconnecting
|
||||||
|
- libnfc: nfc_initiator_poll_target() is now available for all devices
|
||||||
|
- libnfc: implement software polling for non-PN532 equipped device
|
||||||
|
- chips/pn53x: add pn53x_data_new() function to alloc and init pn53x_data structure
|
||||||
|
- chips/pn53x: add some SFR registers description
|
||||||
|
- chips/pn53x: implement WriteBack cache
|
||||||
|
- chips/pn53x: new pn53x_PowerDown wrapper for PowerDown (PN532) command
|
||||||
|
- chips/pn53x: prints a debug trace when reading PN53x registers
|
||||||
|
- chips/pn53x: set some parameters in ISO/IEC 14443A when using DEP mode (ie. SAK says ISO/IEC 18092 compliant) (Android NFC stack now detects the target as DEP)
|
||||||
|
- chips/pn53x: some optimisations in registers initialisation
|
||||||
|
- chips/pn53x: list_passive_targets() fixed for TypeB on LoGO
|
||||||
|
- chips/pn53x: pn53x_data now have a operating_mode enum to know the current running mode (initiator, target or idle)
|
||||||
|
- drivers/*: all commands are now abortable
|
||||||
|
- drivers/pn532_uart,arygon: make valgrind happy with UART-based drivers
|
||||||
|
- drivers/pn53x*: use shared pn53x_ack_frame[] and pn53x_nack_frame[] instead of local declaration
|
||||||
|
- drivers/pn53x_usb: all USB errors are now reported in text format
|
||||||
|
- drivers/pn53x_usb: enable progressive field on init to allow pn53x-tamashell to works (note: it does not distrib progressive field enabling when nfc_list_passive_target() is used)
|
||||||
|
- drivers/pn53x_usb: implement PN53x extended information frames with USB devices
|
||||||
|
- drivers/pn53x_usb: use progressive field on/off only for ISO14443 Type B target listing
|
||||||
|
- buses/uart: now provides an abort mecanism for windows users
|
||||||
|
- buses/uart: UART based drivers could now use uart_flush_input() to discard junk bytes on input.
|
||||||
|
- examples/nfc-anticol: add -f option to force RATS
|
||||||
|
- examples/nfc-mfclassic: handle 7-byte UID cards & MFC Mini
|
||||||
|
- examples/nfc-anticol: now use nfc_abort_command()
|
||||||
|
- examples/nfc-dep-*: disconnect from NFC device on error.
|
||||||
|
- examples/nfc-emulate-forum-tag2: add new example to emulate a NFC Forum Tag Type 2
|
||||||
|
- examples/nfc-emulate-forum-tag4: add document references.
|
||||||
|
- examples/nfc-emulate-forum-tag4: this example now fails with ENOTSUPP when used with a non-PN532 chip.
|
||||||
|
- examples/nfc-mfclassic: write special Mifare 1K cards, including Block 0 / UID
|
||||||
|
- examples/nfc-mfsetuid: add a new example to set UID of special Mifare 1K cards
|
||||||
|
- examples/nfc-read-forum-tag3: add new example to read a NFC Forum Tag Type 3
|
||||||
|
- examples/pn53x-tamashell-scripts: minor enhancements
|
||||||
|
- tests/test-dep: add a threaded DEP test to check DEP communication between two local devices
|
||||||
|
- debian: enable all drivers at compile time
|
||||||
|
- debian: improve debian packaging (Thanks to Thomas Hood)
|
||||||
|
- debian: use a numbering that allow to have libnfc pre-version and debian package pre-version too. (Thanks to Thomas Hood)
|
||||||
|
- freebsd: add FreeBSD devd(8) snippet configuration for Sony S330 readers.
|
||||||
|
- windows: implement abort mecanism in pn532_uart driver (Based on provided patch: many thanks to Edwin Evans)
|
||||||
|
- windows: USB drivers now relies on libusb-win32 with version >= 1.2.4.x (1.2.4.6 recommended) (Many thanks to Glenn)
|
||||||
|
- windows: implement automatic uart port detection and input flush (Thanks to Edwin Evans)
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
- libnfc: add 'struct timeval *timeout' parameter for pn53x_transceive(), pn53x_target_receive_bytes() and pn53x_target_send_bytes().
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Apr 29, 2011 - 1.5.0 (unstable)
|
||||||
|
-------------------------------
|
||||||
|
|
||||||
|
Fixes:
|
||||||
|
- libnfc: silent warnings with more strict CFLAGS
|
||||||
|
- libnfc: update devd(8) rules file for FreeBSD
|
||||||
|
- libnfc: make libnfc compile under Windows
|
||||||
|
- libnfc: fix nfc_pick_device() when called from nfc_connect with NULL nfc_device_desc_t parameter
|
||||||
|
- chips/pn53x: fix a bug when value is larger than mask when using WriteRegister
|
||||||
|
- chips/pn53x: adapt MaxRetries to avoid issue with 2 tags on PN531
|
||||||
|
- examples/nfc-mfclassic: UID was shown reverse-ordered
|
||||||
|
|
||||||
|
Improvements:
|
||||||
|
- libnfc: use a new way to handle drivers, introduce a real HAL
|
||||||
|
- libnfc: use absolute include path instead of relative ones
|
||||||
|
- libnfc: move some nfc_device_t members in a better place
|
||||||
|
- libnfc: improve nfc_driver_t struct to embedded HAL API
|
||||||
|
- libnfc: nfc_device_t now embeddeds driver data and chip data pointers (useful to be more generic)
|
||||||
|
- libnfc: use more readable variables instead of strange coding convention
|
||||||
|
- libnfc: move PRINT_HEX macro into nfc-internal.h
|
||||||
|
- libnfc: introduce an abort mecanism
|
||||||
|
- libnfc: suppress any PN53x references in nfc.c
|
||||||
|
- libnfc: nfc-mfclassic and nfc-mfcultralight examples are now compiled under Windows
|
||||||
|
- chips/pn53x: use the powerful C99 writing to construct PN53x commands
|
||||||
|
- chips/pn53x: remove almost all memcpy()
|
||||||
|
- chips/pn53x: WriteRegister, ReadRegister and SetParameters command wrappers are correctly named
|
||||||
|
- chips/pn53x: introduce chip state (SLEEP, NORMAL or EXECUTE)
|
||||||
|
- chips/pn53x: add SAMConfiguration command wrapper (need to be improved)
|
||||||
|
- chips/pn53x: remove almost all const arrays
|
||||||
|
- chips/pn53x: use human readable defines for commands instead of hex values
|
||||||
|
- chips/pn53x: in debug mode, the PN53x command is shown in human-readable string, awesome isn't it? ;-)
|
||||||
|
- chips/pn53x: try to determine IC version instead of hardcode it.
|
||||||
|
- chips/pn53x: new fonction to build frames instead of build them in each driver
|
||||||
|
- chips/pn53x: enable aborting blocking commands (e.g. TgInitAsTarget) and refactor *_check_communication() as pn53x_check_communication().
|
||||||
|
- chips/pn53x: add timed versions of transceive_bytes/bits, allow to detect emulated/non-emulated tags and more...
|
||||||
|
- chips/pn53x: support CRC auto-handling in ...transceive_bytes_timed
|
||||||
|
- drivers/pn53x_usb: ASK LoGO: enable progressive field feature.
|
||||||
|
- drivers/pn532_uart: major improvement of UART handling
|
||||||
|
- drivers/pn532_uart: check PN53x frames when received
|
||||||
|
- drivers/pn53x_usb: enhance ASK LoGO dedicated code
|
||||||
|
- drivers/pn53x_usb: add LEDs support for ASK LoGO and SCL3711
|
||||||
|
- drivers/pn532_uart: implement extended frame send/receive for PN532_UART driver.
|
||||||
|
- drivers/arygon: use the new way to drive UART (its far more stable)
|
||||||
|
- drivers/arygon: do not hard code PN532 chip type: pn53x_init() determine it and ARYGON device seems to not need to be waken up.
|
||||||
|
- drivers/arygon: reject too heavy payload (ARYGON does not support PN53x extended frame even with PN532 equipped device)
|
||||||
|
- drivers/pn532_uart & arygon: now runs almost twice faster than the previous stable release
|
||||||
|
- buses/uart: receive() is now based on expected bytes instead of calculated timeouts..
|
||||||
|
- buses/uart: simplify uart_send() on POSIX systems.
|
||||||
|
- examples/nfc-emulate-tag: minor comments improvements.
|
||||||
|
- examples: remove nfc-message.h usage from examples.
|
||||||
|
- examples/nfc-emulate-forum-tag4: fully reworked example: it now support all NFC-Forum device in read and write mode
|
||||||
|
- examples/pn53x-tamashell: add an example for LoGO LEDs
|
||||||
|
- examples/pn53x-tamashell: add a script to read Mobib card.
|
||||||
|
- examples/pn53x-tamashell: add a script to read Navigo card.
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
- libnfc: merge macros from nfc-messages.h into nfc-internal.h
|
||||||
|
- libnfc: remove useless files: nfc-messages.h, buses.h and chips.h
|
||||||
|
- API: new nfc_emulate_target() that ease target emulation for developer
|
||||||
|
- macros: show PRINT_HEX result on stderr in debug mode (that helps to sync with debug msg which are printed on standard error output.)
|
||||||
|
- drivers: split transceive() into send() and receive() to be able to handle more cases (differed replies, abort commands, etc) later
|
||||||
|
- drivers: use a const structure of functions instead of -dirty- callbacks array
|
||||||
|
- drivers/pn53x_usb: pn531_usb and pn533_usb drivers are now merged and use the pn53x IC version autodetection
|
||||||
|
- buses/uart: use a smart way to determine available ports on POSIX systems (tested on Linux and FreeBSD)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Feb 21, 2011 - 1.4.2
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
Fixes:
|
||||||
|
- libnfc: fgets instead of getline, bring MacOSX / BSD without glibc alive
|
||||||
|
- libnfc: add missing CMake files to generated tarball needed by windows users (Thanks to Glenn)
|
||||||
|
- drivers/pn532_uart: fix pn532 wakeup response handling
|
||||||
|
- buses/uart: prevent from retrieving more than buffer length (potential buffer overflow)
|
||||||
|
- buses/uart: intent to speed up interface
|
||||||
|
- nfc-emulate-uid: use a correct UID
|
||||||
|
- nfc-mfclassic: fixes a segfault when using only 1 argument
|
||||||
|
|
||||||
|
Improvements:
|
||||||
|
- libnfc: silent some compilation warnings
|
||||||
|
- drivers/pn533_usb: support new device: ASK / LoGO. (Thanks to ASK for sending one sample)
|
||||||
|
- chips/pn53x: set register directly if mask cover whole value.
|
||||||
|
- pn53x-tamashell: accepts script as arg, this makes shebang possible
|
||||||
|
- pn53x-tamashell: add pause command & doc
|
||||||
|
- documentation: add a README-Windows.txt file
|
||||||
|
- documentation: add more pcsc-lite related instruction in README
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Feb 1, 2011 - 1.4.1
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
Fixes:
|
||||||
|
- libnfc: fix missing pn53x-tamashell-scripts in generated tarball. (Thanks to usermeister)
|
||||||
|
- buses/uart: improved UART communication on POSIX systems: slower devices can be detected and high speed devices works better
|
||||||
|
- buses/uart: serial autoprobe now skips invalid devices but checks all ports in the list
|
||||||
|
- drivers/pn53x_usb: prevent from stack corruption when using PN533-based device and add errors handling for ReadRegister and WriteRegister
|
||||||
|
- drivers/arygon: fix polling on ARYGON devices
|
||||||
|
- examples/nfc-emulate-tag: switch off easy framing when we are not emulating a ISO14443-4 target
|
||||||
|
- examples/nfc-mfclassic: fix crash when file cannot be opened for writing
|
||||||
|
- examples/nfc-mfultralight: fix 7 bytes UID display
|
||||||
|
|
||||||
|
Improvements:
|
||||||
|
- libnfc: add a "troubleshooting" section in README to document ACR122 problems with pcsclite.
|
||||||
|
- libnfc: inform user if target UID can not be emulated
|
||||||
|
- example/nfc-mfultralight: handle lock page writing
|
||||||
|
- examples/nfc-emulate-tag: handle HALT & READ
|
||||||
|
- tests: add register access test
|
||||||
|
|
||||||
|
Experimental: Windows platform support (Thanks to Glenn Ergeerts)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Nov 17, 2010 - 1.4.0
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
Fixes:
|
||||||
|
- libnfc: fix Felica listing
|
||||||
|
- libnfc: fix storage of ISO14443B targets data
|
||||||
|
- libnfc: fix MacOS build
|
||||||
|
- libnfc: fix some errors string (ie. well-known "Invalid Parameter")
|
||||||
|
- libnfc: fix memory leak while using *_pick()
|
||||||
|
- drivers/pn53x_usb: fix ZLP USB issue
|
||||||
|
- drivers/pn53x_usb: workaround for PN532 toggle bit USB bug
|
||||||
|
- drivers/pn53x_usb: fix timeout problem in emulation mode
|
||||||
|
- drivers/pn53x_usb,pn532_uart,arygon: more robust recovery from unstable states such as interrupted emulation modes
|
||||||
|
- drivers/acr122: fix escape ioctl under Linux
|
||||||
|
- buses/uart: fix UART default serial ports under Linux.
|
||||||
|
- examples/nfc-anticol: fix bug preventing to run nfc-anticol after some other programs
|
||||||
|
- examples/nfc-anticol: fix display of UID
|
||||||
|
- ... and many other minor fixes
|
||||||
|
|
||||||
|
Improvements:
|
||||||
|
- libnfc: major emulation improvements: libnfc can now be used to emulate ISO/IEC 14443 type A tag (MIFARE, ISO14443-4), FeliCa and D.E.P. target
|
||||||
|
- libnfc: documentation improvements
|
||||||
|
- libnfc: decode select/initialization datas for almost all supported target types (ISO14443 A/B, Jewel/Topaz, FeliCa)
|
||||||
|
- libnfc: add ISO/IEC 14443B baud rates: 212, 424 and 847 kbps
|
||||||
|
- libnfc: cache some chip registers for faster communication
|
||||||
|
- libnfc: greatly improved D.E.P. support
|
||||||
|
- buses/uart: adjust UART's timeouts from baud rate: faster communication at high speed and more reliable at low speed (affect pn532_uart and arygon drivers)
|
||||||
|
- drivers/arygon: retrieve ARYGON µC firmware version
|
||||||
|
- examples/nfc-anticol: adds support for CL3
|
||||||
|
- examples/nfc-anticol: cascade based on SAK rather than CT, better for educational purpose
|
||||||
|
- examples/nfc-anticol: Computes CRC rather than hardcoded one.
|
||||||
|
- examples/nfc-utils: print_iso14443b_info() now displays many decoded information in verbose mode
|
||||||
|
- examples/nfc-utils: print_iso14443a_info() now displays many decoded information and shows attempt to determine tag name in verbose mode
|
||||||
|
- examples/nfc-list: new option -v for verbose mode
|
||||||
|
- examples/nfc-list: now support for Jewel/Topaz too
|
||||||
|
- examples/nfc-poll: now poll using all supported modulations
|
||||||
|
- examples/nfc-dep-target: add hack to allow to use two devices on the same machine (for tests/debug purpose)
|
||||||
|
- examples/pn53x-tamashell: New PN53x TAMA communication demonstration shell (support scripting)
|
||||||
|
- examples/nfc-relay-picc: New tool to relay ISO14443-4 communications (even over network... Enjoy!)
|
||||||
|
- examples/nfc-emulate-forum-tag4: New example to emulate a NFC Forum tag type 4
|
||||||
|
- examples/nfc-emulate-tag: New example to emulate tags
|
||||||
|
- examples: add missing man pages
|
||||||
|
- ... and many other minor improvements
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
- API: Many changes, see NEWS file for more info how to migrate
|
||||||
|
- buses/uart: split UART implementations: one file for POSIX and another one for Windows
|
||||||
|
- examples: nfcip-* renamed to nfc-dep-*
|
||||||
|
- examples: nfc-sam renamed to pn53x-sam
|
||||||
|
- examples: nfc-emulate renamed to nfc-emulate-uid
|
||||||
|
- examples: change examples license for the sake of consistency: LGPL covers library, re-usable examples code is now under BSD license.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Aug 31, 2010 - 1.3.9
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
Fixes:
|
||||||
|
- libnfc: fix ATS
|
||||||
|
- pn53x_usb: fix USB issues
|
||||||
|
- nfc-mfultralight: fix read and write counters
|
||||||
|
|
||||||
|
Improvments:
|
||||||
|
- libnfc: rearrange source code
|
||||||
|
- libnfc: enhance documentation
|
||||||
|
- libnfc: add regression tests (not as much as expected but its here!)
|
||||||
|
- build: configure script now supports --with-drivers option instead of --disable-pcsclite and --disable-libusb (see --help)
|
||||||
|
- nfc-mfultralight: we now can write OTP bytes if user want to
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
- API: nfc_initiator_select_tag() is now nfc_initiator_select_passive_target()
|
||||||
|
- API: nfc_initiator_deselect_tag() is now nfc_initiator_deselect_target()
|
||||||
|
- API: new function nfc_initiator_list_passive_targets() to list available targets in field
|
||||||
|
- API: new nfc_perror(), nfc_strerror() and nfc_strerror_r() functions to handle errors
|
||||||
|
- API: new types: nfc_target_type_t and nfc_target_t
|
||||||
|
- API: new configuration option NDO_AUTO_ISO14443_4 to enable/disable auto iso14443-4 mode.
|
||||||
|
- API: new configuration option NDO_EASY_FRAMING to enable/disable auto frames encapsulation and chaining
|
||||||
|
- API: nfc_initiator_transceive_dep_bytes(), nfc_target_receive_dep_bytes() and nfc_target_send_dep_bytes() have been removed (unset NDO_EASY_FRAMING instead of these functions)
|
||||||
|
- API: (experimental) new nfc_initiator_poll_targets() which allow to use hardware polling function
|
||||||
|
- examples: add draft of a new example: nfc-sam. It tests the comunication with a connected SAM (Secure Access Module)
|
||||||
|
- examples: add new example to show how to use new polling function
|
||||||
|
- examples: add new example to diagnose basic elements (communication, rom and ram) of pn53x
|
||||||
|
- nfc-mfultralight: on write failure, continue if authenticate works.
|
||||||
|
- nfc-mfclassic: take care of 16-blocks-long sectors of Mifare Classic 4K in the nfc-mfclassic example's blocks counting routine.
|
||||||
|
- nfc-mfclassic: now fails ealier when something goes wrong (this allow to prevent from false-success).
|
||||||
|
- nfc-mfclassic: disable ISO14443-4 auto-switching in order to read devices that emulate Mifare Classic with ISO14443-4 compliance.(e.g. Nokia 6212 Classic)
|
||||||
|
|
||||||
|
Note: This release will not install extra headers (like mifare.h), programs that depends on should copy theses files into their sources.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Apr 6, 2010 - 1.3.4
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
Fixes:
|
||||||
|
- Fix CT (Cascade Tag) byte when using 10 bytes long UID.
|
||||||
|
- Strip CT (Cascade Tag) from UIDs in nfc_initiator_select_tag().
|
||||||
|
- Fix CMake build (mainly on Windows related stuff)
|
||||||
|
- Minors fixes in documentation.
|
||||||
|
- Suppress almost all compilation warnings.
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
- API: Provide ISO14443A CRC function.
|
||||||
|
- Remove annoying info message when probing uart devices while serial autoprobing is disabled.
|
||||||
|
- Rename README-Windows.txt (compilation using CMake) into CMake-Windows.txt
|
||||||
|
- Add README for Windows compilation using win32/Makefile.
|
||||||
|
|
||||||
|
Note: Windows users could now take main tarball using CMake to build or Windows specific archive using MinGW GNU/Make.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Feb 17, 2010 - 1.3.3
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
Fixes:
|
||||||
|
- libnfc: Attempt to fix build on Windows using CMake;
|
||||||
|
- libnfc: Fix build on NetBSD;
|
||||||
|
- libnfc: Fix build on MacOS X;
|
||||||
|
- nfc-relay: fix usage of two devices that use the same driver.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Feb 01, 2010 - 1.3.2
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
Fixes:
|
||||||
|
- libnfc: Fix compilation issue under FreeBSD (should now compile on FreeBSD 6, 7 and 8).
|
||||||
|
|
||||||
|
Note: Experimental CMake files are provided with this release, issues reports are welcome.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Jan 20, 2010 - 1.3.1
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
Fixes:
|
||||||
|
- libnfc: Fix compilation issue under Windows;
|
||||||
|
- uart bus: Fix possible invalid file descriptor in uart_close();
|
||||||
|
- uart bus: Serial autoprobing is now DISABLED to avoid UART disturbing. (Feature can be enabled using –enable-serial-autoprobe option while configure).
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Jan 14, 2010 - 1.3.0
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
Fixes:
|
||||||
|
- build: Add workarounds for libusb when compiling using C99;
|
||||||
|
- build: Attempt to fix rpath issue on linux platform (it is already deprecated in main distributions. i.e. http://wiki.debian.org/RpathIssue);
|
||||||
|
- build: wrong paths in pkg-config file;
|
||||||
|
- libnfc: Remove warnings when compiling;
|
||||||
|
- libnfc: Various code fixes and cleanup;
|
||||||
|
- bus uart: Added support for recv/send of larger data chunks (>default_os_buffer);
|
||||||
|
- bus uart: Fix some some buffer synchronization problems under POSIX system;
|
||||||
|
- bus uart: Add configure option: --disable-serial-autoprobe to disable autoprobing;
|
||||||
|
- libnfc: Fix nfc_target_init doesn't correctly reset the parity during initalization;
|
||||||
|
- libnfc: added support for WUPA and 7,10 byte UID in nfc_initiator_select_tag();
|
||||||
|
- libnfc: Fix tag re-selection with UID length > 4 bytes (like DESFire or Ultralight);
|
||||||
|
- nfc-mfclassic: Fix authenticated only with KEYA;
|
||||||
|
|
||||||
|
Improvements:
|
||||||
|
- build: Build on FreeBSD;
|
||||||
|
- build: Add alternative build system (CMake);
|
||||||
|
- build: Add new files usefull for desktop GNU/Linux users: some rules for udev to allow non-root access to PN53x USB devices;
|
||||||
|
- build: Update msinttypes up to revision 26. (used when compiling under Windows);
|
||||||
|
- build: Add "make doc" directive: it will build API documentation using Doxygen. (--enable-doc flag is required at configure time);
|
||||||
|
- libnfc: Add C++ compatibility;
|
||||||
|
- libnfc: Add driver agnostic nfc_pick_device(), nfc_list_devices();
|
||||||
|
- libnfc: It is now possible to specify a wanted device using new struct "nfc_device_desc_t";
|
||||||
|
- libnfc: Add device name to device descriptions (nfc_device_desc_t) to select a given PCSC device;
|
||||||
|
- libnfc: Finally removed all dirty globals, it 'should' be thread-safe now;
|
||||||
|
- libnfc: Less confusing message for bitstreams display;
|
||||||
|
- libnfc: chips level introduction with pn53x.h/c;
|
||||||
|
- drivers: Add PN532 UART driver;
|
||||||
|
- drivers pn533_usb and pn531_usb: Lets search continuing to find other USB readers if any in PN531 and PN533 USB drivers;
|
||||||
|
- drivers pn533_usb and pn531_usb: Support for the generic vendorid/productid of the NXP chip;
|
||||||
|
- drivers pn533_usb and pn531_usb: Consolidate duplicated code;
|
||||||
|
- examples: Add MIFARE Ultratag tool;
|
||||||
|
- examples: Add man page for nfc-mfultool;
|
||||||
|
- examples: MIFARE examples (mftool and mfultool) have now a better help message;
|
||||||
|
- examples: Add NFCIP (NDEP) as experimental feature;
|
||||||
|
- examples: add quiet mode to improve timing of emulate, relay and anticol commands;
|
||||||
|
- nfc-list: List all devices in nfc-list(1);
|
||||||
|
- nfc-list: Simply turns off the RF field upon exit;
|
||||||
|
- nfc-emulate: allow UID to be specified;
|
||||||
|
- nfc-relay: Initialize initiator device explicitly;
|
||||||
|
- nfc-relay: Capture ctrl-c for quitting cleanly the relay attack application;
|
||||||
|
- nfc-relay: exit properly if emulator initialization failed;
|
||||||
|
- nfc-mfclassic: Add default keys tries;
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
- API: Rename tag_info to nfc_target_info_t;
|
||||||
|
- API: Rename init_modulation to nfc_modulation_t;
|
||||||
|
- API: Rename dev_config_option to nfc_device_option_t;
|
||||||
|
- API: Use NULL instead of INVALID_DEVICE_INFO to know if device is valid;
|
||||||
|
- API: Rename chip_type to nfc_chip_t;
|
||||||
|
- API: Rename dev_spec to nfc_device_spec_t;
|
||||||
|
- API: Rename dev_info struct to nfc_device_t;
|
||||||
|
- API: Variables have been renamed to match coding conventions;
|
||||||
|
- API: Changed length parmeters from uint32_t to size_t;
|
||||||
|
- Files: Remove defines.h public header;
|
||||||
|
- Files: Prefix messages.h and types.h headers by "nfc-";
|
||||||
|
- Files: Revamp libnfc source tree;
|
||||||
|
- Files: Move examples into src/examples subdirectory;
|
||||||
|
- Examples: Rename nfc-mftool to nfc-mfclassic;
|
||||||
|
- Examples: Rename nfc-mfultool to nfc-mfultralight;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Jul 24, 2009 - 1.2.1
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
- Fix ACR122 on 64 bits architecture under GNU/Linux.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Jul 22, 2009 - 1.2.0
|
||||||
|
--------------------
|
||||||
|
|
||||||
- License changed from GPLv3 to LGPLv3
|
- License changed from GPLv3 to LGPLv3
|
||||||
- ARYGON ADRA-USB/ADRB-USB reader support
|
- ARYGON ADRA-USB/ADRB-USB reader support
|
||||||
- PN533 support
|
- PN533 support
|
||||||
- C99 standard (all custom defined types have been renamed)
|
- C99 standard (all custom defined types have been renamed)
|
||||||
- Autotoolized for GNU/Linux, *BSD
|
- Autotoolized for GNU/Linux, *BSD and MacOSX
|
||||||
- nfc tools (emulate, relay, list, mftool) are now prefixed by nfc in GNU/Linux and *BSD
|
- nfc examples (anticol, emulate, list, mftool, relay) are now prefixed by "nfc-"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Mar 27, 2009 - 1.1.0
|
Mar 27, 2009 - 1.1.0
|
||||||
|
--------------------
|
||||||
|
|
||||||
- Next generation, support for ACR122v2 and PN531 USB devices
|
- Next generation, support for ACR122v2 and PN531 USB devices
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Feb 12, 2009 - 1.0.0
|
Feb 12, 2009 - 1.0.0
|
||||||
|
--------------------
|
||||||
|
|
||||||
- Initial release
|
- Initial release
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
2464
Doxyfile.in
Normal file
2464
Doxyfile.in
Normal file
File diff suppressed because it is too large
Load Diff
68
HACKING.md
Normal file
68
HACKING.md
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
Hello hackers!
|
||||||
|
|
||||||
|
General remarks about contributing
|
||||||
|
----------------------------------
|
||||||
|
|
||||||
|
Contributions to the libnfc are welcome!
|
||||||
|
Here are some directions to get you started:
|
||||||
|
|
||||||
|
1. Follow style conventions
|
||||||
|
The source code of the library trend to follow some conventions so that it
|
||||||
|
is consistent in style and thus easier to read.
|
||||||
|
Look around and respect the same style.
|
||||||
|
Don't use tabs. Increment unit is two spaces.
|
||||||
|
Don't leave dandling spaces or tabs at EOL.
|
||||||
|
Helper script to get some uniformity in the style:
|
||||||
|
$ make style
|
||||||
|
|
||||||
|
If you use vim see the [Vim: How to prevent trailing whitespaces](http://www.carbon-project.org/Vim__How_to_prevent_trailing_whitespaces.html).
|
||||||
|
|
||||||
|
2. Chase warnings: no warning should be introduced by your changes
|
||||||
|
Depending what you touch, you can check with:
|
||||||
|
|
||||||
|
2.1 When using autotools
|
||||||
|
|
||||||
|
$ autoreconf -Wall -vis
|
||||||
|
|
||||||
|
2.2 When compiling
|
||||||
|
|
||||||
|
2.2.1 Using extra flags:
|
||||||
|
|
||||||
|
$ export CFLAGS="-Wall -g -O2 -Wextra -pipe -funsigned-char -fstrict-aliasing \
|
||||||
|
-Wchar-subscripts -Wundef -Wshadow -Wcast-align -Wwrite-strings -Wunused \
|
||||||
|
-Wuninitialized -Wpointer-arith -Wredundant-decls -Winline -Wformat \
|
||||||
|
-Wformat-security -Wswitch-enum -Winit-self -Wmissing-include-dirs \
|
||||||
|
-Wmissing-prototypes -Wstrict-prototypes -Wold-style-definition \
|
||||||
|
-Wbad-function-cast -Wnested-externs -Wmissing-declarations"
|
||||||
|
$ ./configure
|
||||||
|
$ make clean
|
||||||
|
$ make
|
||||||
|
|
||||||
|
2.2.2 Using clang:
|
||||||
|
|
||||||
|
You can use same CFLAGS but also `-Wunreachable-code`
|
||||||
|
|
||||||
|
$ scan-build ./configure
|
||||||
|
$ make clean
|
||||||
|
$ scan-build make
|
||||||
|
|
||||||
|
2.2.3 Using `cppcheck` (v1.58 or higher):
|
||||||
|
|
||||||
|
$ make cppcheck
|
||||||
|
|
||||||
|
2.3 When Debianizing
|
||||||
|
|
||||||
|
$ lintian --info --display-info --display-experimental *deb
|
||||||
|
or (shorter version)
|
||||||
|
$ lintian -iIE *deb
|
||||||
|
|
||||||
|
3. Preserve cross-platform compatibility
|
||||||
|
|
||||||
|
The source code should remain compilable across various platforms,
|
||||||
|
including some you probably cannot test alone so keep it in mind.
|
||||||
|
Supported platforms:
|
||||||
|
|
||||||
|
- Linux
|
||||||
|
- FreeBSD
|
||||||
|
- Mac OS X
|
||||||
|
- Windows with MinGW
|
||||||
237
INSTALL
237
INSTALL
@ -1,237 +0,0 @@
|
|||||||
Installation Instructions
|
|
||||||
*************************
|
|
||||||
|
|
||||||
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
|
|
||||||
2006, 2007 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
This file is free documentation; the Free Software Foundation gives
|
|
||||||
unlimited permission to copy, distribute and modify it.
|
|
||||||
|
|
||||||
Basic Installation
|
|
||||||
==================
|
|
||||||
|
|
||||||
Briefly, the shell commands `./configure; make; make install' should
|
|
||||||
configure, build, and install this package. The following
|
|
||||||
more-detailed instructions are generic; see the `README' file for
|
|
||||||
instructions specific to this package.
|
|
||||||
|
|
||||||
The `configure' shell script attempts to guess correct values for
|
|
||||||
various system-dependent variables used during compilation. It uses
|
|
||||||
those values to create a `Makefile' in each directory of the package.
|
|
||||||
It may also create one or more `.h' files containing system-dependent
|
|
||||||
definitions. Finally, it creates a shell script `config.status' that
|
|
||||||
you can run in the future to recreate the current configuration, and a
|
|
||||||
file `config.log' containing compiler output (useful mainly for
|
|
||||||
debugging `configure').
|
|
||||||
|
|
||||||
It can also use an optional file (typically called `config.cache'
|
|
||||||
and enabled with `--cache-file=config.cache' or simply `-C') that saves
|
|
||||||
the results of its tests to speed up reconfiguring. Caching is
|
|
||||||
disabled by default to prevent problems with accidental use of stale
|
|
||||||
cache files.
|
|
||||||
|
|
||||||
If you need to do unusual things to compile the package, please try
|
|
||||||
to figure out how `configure' could check whether to do them, and mail
|
|
||||||
diffs or instructions to the address given in the `README' so they can
|
|
||||||
be considered for the next release. If you are using the cache, and at
|
|
||||||
some point `config.cache' contains results you don't want to keep, you
|
|
||||||
may remove or edit it.
|
|
||||||
|
|
||||||
The file `configure.ac' (or `configure.in') is used to create
|
|
||||||
`configure' by a program called `autoconf'. You need `configure.ac' if
|
|
||||||
you want to change it or regenerate `configure' using a newer version
|
|
||||||
of `autoconf'.
|
|
||||||
|
|
||||||
The simplest way to compile this package is:
|
|
||||||
|
|
||||||
1. `cd' to the directory containing the package's source code and type
|
|
||||||
`./configure' to configure the package for your system.
|
|
||||||
|
|
||||||
Running `configure' might take a while. While running, it prints
|
|
||||||
some messages telling which features it is checking for.
|
|
||||||
|
|
||||||
2. Type `make' to compile the package.
|
|
||||||
|
|
||||||
3. Optionally, type `make check' to run any self-tests that come with
|
|
||||||
the package.
|
|
||||||
|
|
||||||
4. Type `make install' to install the programs and any data files and
|
|
||||||
documentation.
|
|
||||||
|
|
||||||
5. You can remove the program binaries and object files from the
|
|
||||||
source code directory by typing `make clean'. To also remove the
|
|
||||||
files that `configure' created (so you can compile the package for
|
|
||||||
a different kind of computer), type `make distclean'. There is
|
|
||||||
also a `make maintainer-clean' target, but that is intended mainly
|
|
||||||
for the package's developers. If you use it, you may have to get
|
|
||||||
all sorts of other programs in order to regenerate files that came
|
|
||||||
with the distribution.
|
|
||||||
|
|
||||||
6. Often, you can also type `make uninstall' to remove the installed
|
|
||||||
files again.
|
|
||||||
|
|
||||||
Compilers and Options
|
|
||||||
=====================
|
|
||||||
|
|
||||||
Some systems require unusual options for compilation or linking that the
|
|
||||||
`configure' script does not know about. Run `./configure --help' for
|
|
||||||
details on some of the pertinent environment variables.
|
|
||||||
|
|
||||||
You can give `configure' initial values for configuration parameters
|
|
||||||
by setting variables in the command line or in the environment. Here
|
|
||||||
is an example:
|
|
||||||
|
|
||||||
./configure CC=c99 CFLAGS=-g LIBS=-lposix
|
|
||||||
|
|
||||||
*Note Defining Variables::, for more details.
|
|
||||||
|
|
||||||
Compiling For Multiple Architectures
|
|
||||||
====================================
|
|
||||||
|
|
||||||
You can compile the package for more than one kind of computer at the
|
|
||||||
same time, by placing the object files for each architecture in their
|
|
||||||
own directory. To do this, you can use GNU `make'. `cd' to the
|
|
||||||
directory where you want the object files and executables to go and run
|
|
||||||
the `configure' script. `configure' automatically checks for the
|
|
||||||
source code in the directory that `configure' is in and in `..'.
|
|
||||||
|
|
||||||
With a non-GNU `make', it is safer to compile the package for one
|
|
||||||
architecture at a time in the source code directory. After you have
|
|
||||||
installed the package for one architecture, use `make distclean' before
|
|
||||||
reconfiguring for another architecture.
|
|
||||||
|
|
||||||
Installation Names
|
|
||||||
==================
|
|
||||||
|
|
||||||
By default, `make install' installs the package's commands under
|
|
||||||
`/usr/local/bin', include files under `/usr/local/include', etc. You
|
|
||||||
can specify an installation prefix other than `/usr/local' by giving
|
|
||||||
`configure' the option `--prefix=PREFIX'.
|
|
||||||
|
|
||||||
You can specify separate installation prefixes for
|
|
||||||
architecture-specific files and architecture-independent files. If you
|
|
||||||
pass the option `--exec-prefix=PREFIX' to `configure', the package uses
|
|
||||||
PREFIX as the prefix for installing programs and libraries.
|
|
||||||
Documentation and other data files still use the regular prefix.
|
|
||||||
|
|
||||||
In addition, if you use an unusual directory layout you can give
|
|
||||||
options like `--bindir=DIR' to specify different values for particular
|
|
||||||
kinds of files. Run `configure --help' for a list of the directories
|
|
||||||
you can set and what kinds of files go in them.
|
|
||||||
|
|
||||||
If the package supports it, you can cause programs to be installed
|
|
||||||
with an extra prefix or suffix on their names by giving `configure' the
|
|
||||||
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
|
|
||||||
|
|
||||||
Optional Features
|
|
||||||
=================
|
|
||||||
|
|
||||||
Some packages pay attention to `--enable-FEATURE' options to
|
|
||||||
`configure', where FEATURE indicates an optional part of the package.
|
|
||||||
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
|
|
||||||
is something like `gnu-as' or `x' (for the X Window System). The
|
|
||||||
`README' should mention any `--enable-' and `--with-' options that the
|
|
||||||
package recognizes.
|
|
||||||
|
|
||||||
For packages that use the X Window System, `configure' can usually
|
|
||||||
find the X include and library files automatically, but if it doesn't,
|
|
||||||
you can use the `configure' options `--x-includes=DIR' and
|
|
||||||
`--x-libraries=DIR' to specify their locations.
|
|
||||||
|
|
||||||
Specifying the System Type
|
|
||||||
==========================
|
|
||||||
|
|
||||||
There may be some features `configure' cannot figure out automatically,
|
|
||||||
but needs to determine by the type of machine the package will run on.
|
|
||||||
Usually, assuming the package is built to be run on the _same_
|
|
||||||
architectures, `configure' can figure that out, but if it prints a
|
|
||||||
message saying it cannot guess the machine type, give it the
|
|
||||||
`--build=TYPE' option. TYPE can either be a short name for the system
|
|
||||||
type, such as `sun4', or a canonical name which has the form:
|
|
||||||
|
|
||||||
CPU-COMPANY-SYSTEM
|
|
||||||
|
|
||||||
where SYSTEM can have one of these forms:
|
|
||||||
|
|
||||||
OS KERNEL-OS
|
|
||||||
|
|
||||||
See the file `config.sub' for the possible values of each field. If
|
|
||||||
`config.sub' isn't included in this package, then this package doesn't
|
|
||||||
need to know the machine type.
|
|
||||||
|
|
||||||
If you are _building_ compiler tools for cross-compiling, you should
|
|
||||||
use the option `--target=TYPE' to select the type of system they will
|
|
||||||
produce code for.
|
|
||||||
|
|
||||||
If you want to _use_ a cross compiler, that generates code for a
|
|
||||||
platform different from the build platform, you should specify the
|
|
||||||
"host" platform (i.e., that on which the generated programs will
|
|
||||||
eventually be run) with `--host=TYPE'.
|
|
||||||
|
|
||||||
Sharing Defaults
|
|
||||||
================
|
|
||||||
|
|
||||||
If you want to set default values for `configure' scripts to share, you
|
|
||||||
can create a site shell script called `config.site' that gives default
|
|
||||||
values for variables like `CC', `cache_file', and `prefix'.
|
|
||||||
`configure' looks for `PREFIX/share/config.site' if it exists, then
|
|
||||||
`PREFIX/etc/config.site' if it exists. Or, you can set the
|
|
||||||
`CONFIG_SITE' environment variable to the location of the site script.
|
|
||||||
A warning: not all `configure' scripts look for a site script.
|
|
||||||
|
|
||||||
Defining Variables
|
|
||||||
==================
|
|
||||||
|
|
||||||
Variables not defined in a site shell script can be set in the
|
|
||||||
environment passed to `configure'. However, some packages may run
|
|
||||||
configure again during the build, and the customized values of these
|
|
||||||
variables may be lost. In order to avoid this problem, you should set
|
|
||||||
them in the `configure' command line, using `VAR=value'. For example:
|
|
||||||
|
|
||||||
./configure CC=/usr/local2/bin/gcc
|
|
||||||
|
|
||||||
causes the specified `gcc' to be used as the C compiler (unless it is
|
|
||||||
overridden in the site shell script).
|
|
||||||
|
|
||||||
Unfortunately, this technique does not work for `CONFIG_SHELL' due to
|
|
||||||
an Autoconf bug. Until the bug is fixed you can use this workaround:
|
|
||||||
|
|
||||||
CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
|
|
||||||
|
|
||||||
`configure' Invocation
|
|
||||||
======================
|
|
||||||
|
|
||||||
`configure' recognizes the following options to control how it operates.
|
|
||||||
|
|
||||||
`--help'
|
|
||||||
`-h'
|
|
||||||
Print a summary of the options to `configure', and exit.
|
|
||||||
|
|
||||||
`--version'
|
|
||||||
`-V'
|
|
||||||
Print the version of Autoconf used to generate the `configure'
|
|
||||||
script, and exit.
|
|
||||||
|
|
||||||
`--cache-file=FILE'
|
|
||||||
Enable the cache: use and save the results of the tests in FILE,
|
|
||||||
traditionally `config.cache'. FILE defaults to `/dev/null' to
|
|
||||||
disable caching.
|
|
||||||
|
|
||||||
`--config-cache'
|
|
||||||
`-C'
|
|
||||||
Alias for `--cache-file=config.cache'.
|
|
||||||
|
|
||||||
`--quiet'
|
|
||||||
`--silent'
|
|
||||||
`-q'
|
|
||||||
Do not print messages saying which checks are being made. To
|
|
||||||
suppress all normal output, redirect it to `/dev/null' (any error
|
|
||||||
messages will still be shown).
|
|
||||||
|
|
||||||
`--srcdir=DIR'
|
|
||||||
Look for the package's source code in directory DIR. Usually
|
|
||||||
`configure' can determine that directory automatically.
|
|
||||||
|
|
||||||
`configure' also accepts some other, not widely useful, options. Run
|
|
||||||
`configure --help' for more details.
|
|
||||||
|
|
||||||
165
LICENSE
165
LICENSE
@ -1,165 +0,0 @@
|
|||||||
GNU LESSER GENERAL PUBLIC LICENSE
|
|
||||||
Version 3, 29 June 2007
|
|
||||||
|
|
||||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
|
||||||
of this license document, but changing it is not allowed.
|
|
||||||
|
|
||||||
|
|
||||||
This version of the GNU Lesser General Public License incorporates
|
|
||||||
the terms and conditions of version 3 of the GNU General Public
|
|
||||||
License, supplemented by the additional permissions listed below.
|
|
||||||
|
|
||||||
0. Additional Definitions.
|
|
||||||
|
|
||||||
As used herein, "this License" refers to version 3 of the GNU Lesser
|
|
||||||
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
|
||||||
General Public License.
|
|
||||||
|
|
||||||
"The Library" refers to a covered work governed by this License,
|
|
||||||
other than an Application or a Combined Work as defined below.
|
|
||||||
|
|
||||||
An "Application" is any work that makes use of an interface provided
|
|
||||||
by the Library, but which is not otherwise based on the Library.
|
|
||||||
Defining a subclass of a class defined by the Library is deemed a mode
|
|
||||||
of using an interface provided by the Library.
|
|
||||||
|
|
||||||
A "Combined Work" is a work produced by combining or linking an
|
|
||||||
Application with the Library. The particular version of the Library
|
|
||||||
with which the Combined Work was made is also called the "Linked
|
|
||||||
Version".
|
|
||||||
|
|
||||||
The "Minimal Corresponding Source" for a Combined Work means the
|
|
||||||
Corresponding Source for the Combined Work, excluding any source code
|
|
||||||
for portions of the Combined Work that, considered in isolation, are
|
|
||||||
based on the Application, and not on the Linked Version.
|
|
||||||
|
|
||||||
The "Corresponding Application Code" for a Combined Work means the
|
|
||||||
object code and/or source code for the Application, including any data
|
|
||||||
and utility programs needed for reproducing the Combined Work from the
|
|
||||||
Application, but excluding the System Libraries of the Combined Work.
|
|
||||||
|
|
||||||
1. Exception to Section 3 of the GNU GPL.
|
|
||||||
|
|
||||||
You may convey a covered work under sections 3 and 4 of this License
|
|
||||||
without being bound by section 3 of the GNU GPL.
|
|
||||||
|
|
||||||
2. Conveying Modified Versions.
|
|
||||||
|
|
||||||
If you modify a copy of the Library, and, in your modifications, a
|
|
||||||
facility refers to a function or data to be supplied by an Application
|
|
||||||
that uses the facility (other than as an argument passed when the
|
|
||||||
facility is invoked), then you may convey a copy of the modified
|
|
||||||
version:
|
|
||||||
|
|
||||||
a) under this License, provided that you make a good faith effort to
|
|
||||||
ensure that, in the event an Application does not supply the
|
|
||||||
function or data, the facility still operates, and performs
|
|
||||||
whatever part of its purpose remains meaningful, or
|
|
||||||
|
|
||||||
b) under the GNU GPL, with none of the additional permissions of
|
|
||||||
this License applicable to that copy.
|
|
||||||
|
|
||||||
3. Object Code Incorporating Material from Library Header Files.
|
|
||||||
|
|
||||||
The object code form of an Application may incorporate material from
|
|
||||||
a header file that is part of the Library. You may convey such object
|
|
||||||
code under terms of your choice, provided that, if the incorporated
|
|
||||||
material is not limited to numerical parameters, data structure
|
|
||||||
layouts and accessors, or small macros, inline functions and templates
|
|
||||||
(ten or fewer lines in length), you do both of the following:
|
|
||||||
|
|
||||||
a) Give prominent notice with each copy of the object code that the
|
|
||||||
Library is used in it and that the Library and its use are
|
|
||||||
covered by this License.
|
|
||||||
|
|
||||||
b) Accompany the object code with a copy of the GNU GPL and this license
|
|
||||||
document.
|
|
||||||
|
|
||||||
4. Combined Works.
|
|
||||||
|
|
||||||
You may convey a Combined Work under terms of your choice that,
|
|
||||||
taken together, effectively do not restrict modification of the
|
|
||||||
portions of the Library contained in the Combined Work and reverse
|
|
||||||
engineering for debugging such modifications, if you also do each of
|
|
||||||
the following:
|
|
||||||
|
|
||||||
a) Give prominent notice with each copy of the Combined Work that
|
|
||||||
the Library is used in it and that the Library and its use are
|
|
||||||
covered by this License.
|
|
||||||
|
|
||||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
|
||||||
document.
|
|
||||||
|
|
||||||
c) For a Combined Work that displays copyright notices during
|
|
||||||
execution, include the copyright notice for the Library among
|
|
||||||
these notices, as well as a reference directing the user to the
|
|
||||||
copies of the GNU GPL and this license document.
|
|
||||||
|
|
||||||
d) Do one of the following:
|
|
||||||
|
|
||||||
0) Convey the Minimal Corresponding Source under the terms of this
|
|
||||||
License, and the Corresponding Application Code in a form
|
|
||||||
suitable for, and under terms that permit, the user to
|
|
||||||
recombine or relink the Application with a modified version of
|
|
||||||
the Linked Version to produce a modified Combined Work, in the
|
|
||||||
manner specified by section 6 of the GNU GPL for conveying
|
|
||||||
Corresponding Source.
|
|
||||||
|
|
||||||
1) Use a suitable shared library mechanism for linking with the
|
|
||||||
Library. A suitable mechanism is one that (a) uses at run time
|
|
||||||
a copy of the Library already present on the user's computer
|
|
||||||
system, and (b) will operate properly with a modified version
|
|
||||||
of the Library that is interface-compatible with the Linked
|
|
||||||
Version.
|
|
||||||
|
|
||||||
e) Provide Installation Information, but only if you would otherwise
|
|
||||||
be required to provide such information under section 6 of the
|
|
||||||
GNU GPL, and only to the extent that such information is
|
|
||||||
necessary to install and execute a modified version of the
|
|
||||||
Combined Work produced by recombining or relinking the
|
|
||||||
Application with a modified version of the Linked Version. (If
|
|
||||||
you use option 4d0, the Installation Information must accompany
|
|
||||||
the Minimal Corresponding Source and Corresponding Application
|
|
||||||
Code. If you use option 4d1, you must provide the Installation
|
|
||||||
Information in the manner specified by section 6 of the GNU GPL
|
|
||||||
for conveying Corresponding Source.)
|
|
||||||
|
|
||||||
5. Combined Libraries.
|
|
||||||
|
|
||||||
You may place library facilities that are a work based on the
|
|
||||||
Library side by side in a single library together with other library
|
|
||||||
facilities that are not Applications and are not covered by this
|
|
||||||
License, and convey such a combined library under terms of your
|
|
||||||
choice, if you do both of the following:
|
|
||||||
|
|
||||||
a) Accompany the combined library with a copy of the same work based
|
|
||||||
on the Library, uncombined with any other library facilities,
|
|
||||||
conveyed under the terms of this License.
|
|
||||||
|
|
||||||
b) Give prominent notice with the combined library that part of it
|
|
||||||
is a work based on the Library, and explaining where to find the
|
|
||||||
accompanying uncombined form of the same work.
|
|
||||||
|
|
||||||
6. Revised Versions of the GNU Lesser General Public License.
|
|
||||||
|
|
||||||
The Free Software Foundation may publish revised and/or new versions
|
|
||||||
of the GNU Lesser General Public License from time to time. Such new
|
|
||||||
versions will be similar in spirit to the present version, but may
|
|
||||||
differ in detail to address new problems or concerns.
|
|
||||||
|
|
||||||
Each version is given a distinguishing version number. If the
|
|
||||||
Library as you received it specifies that a certain numbered version
|
|
||||||
of the GNU Lesser General Public License "or any later version"
|
|
||||||
applies to it, you have the option of following the terms and
|
|
||||||
conditions either of that published version or of any later version
|
|
||||||
published by the Free Software Foundation. If the Library as you
|
|
||||||
received it does not specify a version number of the GNU Lesser
|
|
||||||
General Public License, you may choose any version of the GNU Lesser
|
|
||||||
General Public License ever published by the Free Software Foundation.
|
|
||||||
|
|
||||||
If the Library as you received it specifies that a proxy can decide
|
|
||||||
whether future versions of the GNU Lesser General Public License shall
|
|
||||||
apply, that proxy's public statement of acceptance of any version is
|
|
||||||
permanent authorization for you to choose that version for the
|
|
||||||
Library.
|
|
||||||
58
Makefile.am
58
Makefile.am
@ -1,5 +1,61 @@
|
|||||||
SUBDIRS = src
|
ACLOCAL_AMFLAGS = -I m4
|
||||||
|
|
||||||
|
AM_CFLAGS = $(LIBNFC_CFLAGS)
|
||||||
|
|
||||||
|
SUBDIRS = libnfc utils
|
||||||
|
|
||||||
|
if EXAMPLE_ENABLED
|
||||||
|
SUBDIRS += examples
|
||||||
|
endif
|
||||||
|
|
||||||
|
SUBDIRS += include contrib cmake test
|
||||||
|
|
||||||
pkgconfigdir = $(libdir)/pkgconfig
|
pkgconfigdir = $(libdir)/pkgconfig
|
||||||
pkgconfig_DATA = libnfc.pc
|
pkgconfig_DATA = libnfc.pc
|
||||||
|
|
||||||
|
EXTRA_DIST = \
|
||||||
|
CMakeLists.txt \
|
||||||
|
Doxyfile \
|
||||||
|
HACKING.md \
|
||||||
|
NEWS.md \
|
||||||
|
README.md \
|
||||||
|
README-Windows.md \
|
||||||
|
libnfc.conf.sample \
|
||||||
|
mingw-cross-compile.sh
|
||||||
|
|
||||||
|
CLEANFILES = Doxygen.log coverage.info libnfc.pc
|
||||||
|
|
||||||
|
clean-local: clean-local-doc clean-local-coverage
|
||||||
|
|
||||||
|
.PHONY: clean-local-coverage clean-local-doc doc style
|
||||||
|
clean-local-coverage:
|
||||||
|
-rm -rf coverage
|
||||||
|
|
||||||
|
clean-local-doc:
|
||||||
|
rm -rf doc
|
||||||
|
|
||||||
|
doc : Doxyfile
|
||||||
|
@DOXYGEN@ $(builddir)/Doxyfile
|
||||||
|
|
||||||
|
DISTCHECK_CONFIGURE_FLAGS="--with-drivers=all"
|
||||||
|
|
||||||
|
style:
|
||||||
|
find . -name "*.[ch]" -exec perl -pi -e 's/[ \t]+$$//' {} \;
|
||||||
|
find . -name "*.[ch]" -exec astyle --formatted --mode=c --suffix=none \
|
||||||
|
--indent=spaces=2 --indent-switches --indent-preprocessor \
|
||||||
|
--keep-one-line-blocks --max-instatement-indent=60 \
|
||||||
|
--style=linux --pad-oper --unpad-paren --pad-header \
|
||||||
|
--align-pointer=name {} \;
|
||||||
|
|
||||||
|
cppcheck:
|
||||||
|
cppcheck --quiet \
|
||||||
|
-I include -I libnfc -I libnfc/buses -I libnfc/chips -I libnfc/drivers \
|
||||||
|
--check-config .
|
||||||
|
cppcheck --quiet --enable=all --std=posix --std=c99 \
|
||||||
|
-I include -I libnfc -I libnfc/buses -I libnfc/chips -I libnfc/drivers \
|
||||||
|
-DLOG -D__linux__ \
|
||||||
|
-DDRIVER_PN53X_USB_ENABLED -DDRIVER_ACR122_PCSC_ENABLED \
|
||||||
|
-DDRIVER_ACR122_USB_ENABLED -DDRIVER_ACR122S_ENABLED \
|
||||||
|
-DDRIVER_PN532_UART_ENABLED -DDRIVER_ARYGON_ENABLED \
|
||||||
|
-DDRIVER_PN532_SPI_ENABLED -DDRIVER_PN532_I2C_ENABLED \
|
||||||
|
--force --inconclusive .
|
||||||
|
|||||||
394
NEWS.md
Normal file
394
NEWS.md
Normal file
@ -0,0 +1,394 @@
|
|||||||
|
New in 1.8.0:
|
||||||
|
|
||||||
|
API Changes:
|
||||||
|
- Restore nfc_modulation_type enum order to keep compatibility with libnfc 1.7.1
|
||||||
|
- Bump library version to 6.0.0
|
||||||
|
|
||||||
|
New in 1.7.2:
|
||||||
|
|
||||||
|
Drivers:
|
||||||
|
|
||||||
|
* New driver for pn71xx NXP's NFC Controllers through Linux Libnfc-nci (untested)
|
||||||
|
* New driver for contactless PC/SC readers (only as initiator)
|
||||||
|
|
||||||
|
API Changes:
|
||||||
|
|
||||||
|
* nfc_device_get_supported_baud_rate() now takes also "mode" as argument
|
||||||
|
* New nfc_device_get_supported_baud_rate_target_mode()
|
||||||
|
* New NFC modulation type NMT_BARCODE and nfc_barcode_info struct to support Thinfilm NFC Barcode protocol
|
||||||
|
* New NFC modulation type NMT_ISO14443BICLASS and NMT_ISO14443BICLASS struct to support HID iClass (Picopass)
|
||||||
|
* pn53x_transceive() is now part of public API
|
||||||
|
|
||||||
|
New in 1.7.1:
|
||||||
|
|
||||||
|
API Changes:
|
||||||
|
|
||||||
|
* nfc_initiator_select_passive_target() provides defaults if pbtInitData=NULL
|
||||||
|
* nfc_initiator_target_is_present() allow NULL pointer to tag
|
||||||
|
|
||||||
|
New in 1.7.0:
|
||||||
|
|
||||||
|
Drivers:
|
||||||
|
|
||||||
|
* New PN532 over I2C driver, see contrib/libnfc/pn532_i2c_on_rpi.conf.sample
|
||||||
|
|
||||||
|
API Changes:
|
||||||
|
|
||||||
|
* New function iso14443b_crc_append()
|
||||||
|
|
||||||
|
New in 1.7.0-rc7:
|
||||||
|
|
||||||
|
Drivers:
|
||||||
|
|
||||||
|
* New PN532 over SPI driver, see contrib/libnfc/pn532_spi_on_rpi.conf.sample
|
||||||
|
|
||||||
|
API Changes:
|
||||||
|
|
||||||
|
* Functions
|
||||||
|
- nfc_initiator_target_is_present() & str_nfc_target():
|
||||||
|
now take a pointer to nfc_target as argument
|
||||||
|
- nfc_init(): upon malloc error, doesn't force exit() anymore
|
||||||
|
so now you should test if context != NULL after nfc_init() call
|
||||||
|
|
||||||
|
New in 1.7.0-rc5:
|
||||||
|
|
||||||
|
API Changes:
|
||||||
|
|
||||||
|
* Functions
|
||||||
|
- New nfc_register_driver() function allowing to hook custom drivers.
|
||||||
|
|
||||||
|
New in 1.7.0-rc3:
|
||||||
|
|
||||||
|
API Changes:
|
||||||
|
|
||||||
|
* Functions
|
||||||
|
- Add timeout param to nfc_emulate_target()
|
||||||
|
|
||||||
|
New in 1.7.0-rc2:
|
||||||
|
|
||||||
|
Configuration:
|
||||||
|
libnfc can now use a configuration file for special setups, or features
|
||||||
|
activation. This file (/etc/nfc/libnfc.conf under GNU/Linux systems)
|
||||||
|
supports already some keywords:
|
||||||
|
- "allow_autoscan" to enable/disable device auto-detection feature;
|
||||||
|
- "allow_intrusive_scan" to enable/disable intrusive auto-detection
|
||||||
|
(ie. serial port probing);
|
||||||
|
- "log_level" to select library verbosity;
|
||||||
|
- "device.name" and "device.connstring" to define a user device,
|
||||||
|
this is the recommended method if user has a not easily detectable
|
||||||
|
device (ie. a serial one).
|
||||||
|
It is also possible to define devices using dedicated configuration files and
|
||||||
|
put them into device search directory (/etc/nfc/devices.d under GNU/Linux).
|
||||||
|
Example for the OpenPCD2: create /etc/nfc/devices.d/openpcd2.conf with:
|
||||||
|
name = "OpenPCD2"
|
||||||
|
connstring = "pn532_uart:/dev/ttyACM0"
|
||||||
|
optional = true
|
||||||
|
The keyword "optional" does not mandate the device to be present always
|
||||||
|
(it detects if the reader is indeed present before using it)
|
||||||
|
|
||||||
|
API Changes:
|
||||||
|
|
||||||
|
* Types
|
||||||
|
- New NFC_ESOFT error to handle software errors (allocations, pipe
|
||||||
|
creation, etc.)
|
||||||
|
|
||||||
|
* Functions
|
||||||
|
- Remove nfc_get_default_device() function: the default device is now the
|
||||||
|
first in nfc_list_devices() or could be open using NULL connstring with
|
||||||
|
nfc_open() function.
|
||||||
|
- New enum-to-string converter functions str_nfc_modulation_type() and
|
||||||
|
str_nfc_baud_rate()
|
||||||
|
- New str_nfc_target() to convert nfc_target struct into allocated string
|
||||||
|
- New nfc_device_get_information_about() function to retreive some device's
|
||||||
|
information
|
||||||
|
- No more in/out function parameter: nfc_initiator_transceive_*() now
|
||||||
|
take a constant size for Rx buffer
|
||||||
|
- New nfc_initiator_target_is_present() to test is the previously selected
|
||||||
|
target is available in the field
|
||||||
|
- nfc_initiator_transceive_bytes() returns NFC_EMFCAUTHFAIL when AUTH
|
||||||
|
command failed on a Mifare Classic
|
||||||
|
- New nfc_initiator_init_secure_element() to initiate a connection with
|
||||||
|
secure element (Only supported with a PN532 with SAM equipped)
|
||||||
|
|
||||||
|
New in 1.6.0-rc1:
|
||||||
|
|
||||||
|
API Changes:
|
||||||
|
|
||||||
|
* Types
|
||||||
|
- '_t' suffix removed from all types (e.g. nfc_device_t is now nfc_device)
|
||||||
|
- All errors removed in flavour of NFC_EIO, NFC_EINVARG, NFC_EDEVNOTSUPP,
|
||||||
|
NFC_ENOTSUCHDEV, NFC_EOVFLOW, NFC_ETIMEOUT, NFC_EOPABORTED, NFC_ENOTIMPL,
|
||||||
|
NFC_ETGRELEASED, NFC_ERFTRANS, NFC_ECHIP and NFC_SUCCESS
|
||||||
|
- nfc_device_desc_t replaced by nfc_connstring: libnfc now uses connection
|
||||||
|
strings to describe a device
|
||||||
|
- byte_t typedef removed, libnfc now uses uint8_t from C99
|
||||||
|
- nfc_device is now an opaque type
|
||||||
|
- nfc_properties replaces nfc_options
|
||||||
|
|
||||||
|
* Functions
|
||||||
|
- New nfc_get_default_device() function that allows to grab the connstring
|
||||||
|
stored in LIBNFC_DEFAULT_DEVICE environnement variable or returns the
|
||||||
|
first available device if not set
|
||||||
|
- New nfc_device_get_connstring() accessor function to know the device
|
||||||
|
connstring
|
||||||
|
- New nfc_device_set_property_bool() function that replace nfc_configure()
|
||||||
|
- New nfc_device_set_property_int() function to set integer property
|
||||||
|
- nfc_device_name() renamed to nfc_device_get_name() for the sake of
|
||||||
|
consistency
|
||||||
|
- New nfc_device_get_last_error() function, an accessor to last error occured
|
||||||
|
- Whole libnfc's functions now return 0 (NFC_SUCCESS) or positive value if
|
||||||
|
appropriated on success and libnfc's error code on failure
|
||||||
|
- nfc_connect(), nfc_disconnect() renamed to nfc_open(), nfc_close()
|
||||||
|
respectively
|
||||||
|
- Add 2 new functions: initialization and deinitialization functions:
|
||||||
|
nfc_init() and nfc_exit()
|
||||||
|
- New nfc_device_get_supported_modulation() and
|
||||||
|
nfc_device_get_supported_baud_rate() functions
|
||||||
|
|
||||||
|
* Dependencies
|
||||||
|
- log4c is not anymore used for debugging facility. It was a bad choice,
|
||||||
|
sorry for inconvenience.
|
||||||
|
|
||||||
|
New in 1.5.1:
|
||||||
|
|
||||||
|
API Changes
|
||||||
|
|
||||||
|
* Types
|
||||||
|
- Communication-level errors DEIO and DETIMEOUT are now know as ECOMIO,
|
||||||
|
ECOMTIMEOUT respectively
|
||||||
|
- Common device-level errors DEINVAL and DEABORT are now know as EINVALARG,
|
||||||
|
EOPABORT respectively
|
||||||
|
- New errors: EFRAACKMISMATCH, EFRAISERRFRAME, EDEVNOTSUP and ENOTIMPL
|
||||||
|
|
||||||
|
* Functions
|
||||||
|
- nfc_abort_command() returns a boolean
|
||||||
|
- timeout (struct timeval) pointer added to
|
||||||
|
nfc_initiator_transceive_bytes(), nfc_target_send_bytes() and
|
||||||
|
nfc_target_receive_bytes()
|
||||||
|
- timed functions nfc_initiator_transceive_bytes_timed() and
|
||||||
|
nfc_initiator_transceive_bits_timed() now takes uint32_t as cycles
|
||||||
|
pointer
|
||||||
|
- nfc_initiator_poll_targets() renamed to nfc_initiator_poll_target() and
|
||||||
|
only return one target
|
||||||
|
|
||||||
|
New in 1.5.0:
|
||||||
|
|
||||||
|
Installed files
|
||||||
|
- nfc-message.h have been removed, internal macros are not part of API.
|
||||||
|
- New nfc-emulation.h file offers a middle level API to handle emulation (see
|
||||||
|
nfc-emulate-forum-tag4 example)
|
||||||
|
|
||||||
|
API Changes
|
||||||
|
|
||||||
|
* Types
|
||||||
|
- New error: DEABORT raised when operation is aborted by user (using
|
||||||
|
nfc_abort_command())
|
||||||
|
- nfc_chip_t type removed from public API (have been renamed to pn53x_type
|
||||||
|
in chips/pn53x)
|
||||||
|
- nfc_device_spec_t removed, each driver can use his own way to keep a
|
||||||
|
connection pointer
|
||||||
|
|
||||||
|
* Structures
|
||||||
|
- nfc_device_t now have a nfc_driver_t struct pointer (named .driver) and
|
||||||
|
void pointer (.driver_data) to handle device specific wrapping
|
||||||
|
- nfc_device_t now have a void pointer (.chip_data) to keep some chip
|
||||||
|
specific data
|
||||||
|
- nfc_device_t now have an file descriptor array to manage to abort request
|
||||||
|
- nfc_device_t does have .nc member (nfc_chip_t) anymore (different chips
|
||||||
|
handling in now in chip level)
|
||||||
|
- nfc_device_t does have .nds member (nfc_device_spec_t) anymore, each
|
||||||
|
driver handle its communication using driver_data pointer
|
||||||
|
- nfc_device_t does have .bActive member (bool) anymore, this variable was
|
||||||
|
almost not used and was not efficient
|
||||||
|
- nfc_device_t does have chip's register caches anymore, this is handle in
|
||||||
|
chip level (using chip_data pointer)
|
||||||
|
- driver_callbacks structure have been removed from public API
|
||||||
|
- New nfc_emulator structure used by the new emulation API (see
|
||||||
|
nfc_emulate_target())
|
||||||
|
- New nfc_emulation_state_machine structure used by the new emulation API,
|
||||||
|
it handles an I/O function and data pointer to create a software based
|
||||||
|
state-machine.
|
||||||
|
|
||||||
|
* Functions
|
||||||
|
- New nfc_abort_command() function to abort current running command.
|
||||||
|
- New nfc_initiator_transceive_bits_timed() and
|
||||||
|
nfc_initiator_transceive_bytes_timed() to transceive bits/bytes and
|
||||||
|
measure the time to have a reply
|
||||||
|
- New nfc_emulate_target() function to start a target emulation using an
|
||||||
|
nfc_emulator structure (it contains a custom state-machine
|
||||||
|
(nfc_emulation_state_machine struct) and a custom target (nfc_target_t)
|
||||||
|
(see nfc-emulate-forum-tag4 to have a look on how-to use it)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
New in 1.4.1:
|
||||||
|
|
||||||
|
API Changes
|
||||||
|
|
||||||
|
* Types
|
||||||
|
- New error: ETGUIDNOTSUP raised when UID is not 4 bytes long or does not
|
||||||
|
start with 0x08 (Security restriction present in the NXP PN53x chips)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
New in 1.4.0:
|
||||||
|
|
||||||
|
API Changes
|
||||||
|
|
||||||
|
* Types
|
||||||
|
- New nfc_device_option value (enum): NDO_FORCE_ISO14443_A to force the
|
||||||
|
chip to switch in ISO14443-A
|
||||||
|
- New nfc_dep_mode_t (enum) for DEP mode:
|
||||||
|
NDM_UNDEFINED, NDM_PASSIVE, NDM_ACTIVE
|
||||||
|
- New nfc_modulation_type_t (enum) that lists modulation types:
|
||||||
|
NMT_ISO14443A, NMT_ISO14443B, NMT_FELICA, NMT_JEWEL, NMT_DEP
|
||||||
|
- New nfc_baud_rate_t (enum): list of baud rates:
|
||||||
|
NBR_UNDEFINED, NBR_106, NBR_212, NBR_424, NBR_847
|
||||||
|
- nfc_target_type_t have been removed from API (use nfc_modulation_t
|
||||||
|
instead)
|
||||||
|
|
||||||
|
* Structures
|
||||||
|
- nfc_device_t now have a boolean bAutoIso14443_4 to keep the locally the
|
||||||
|
state of NDO_AUTO_ISO14443_4 (should not be directly set, use
|
||||||
|
nfc_configure() with NDO_AUTO_ISO14443_4)
|
||||||
|
- nfc_device_t now have an uint8_t ui8Parameters to cache PN53x parameters
|
||||||
|
- nfc_device_t now have a byte_t btSupportByte to cache supported
|
||||||
|
modulations
|
||||||
|
- nfc_dep_info_t have completely changed, please see API documentation
|
||||||
|
- nfc_iso14443b_info_t have completely changed, please see API
|
||||||
|
documentation
|
||||||
|
- nfc_modulation_t have completely changed: it now contains a
|
||||||
|
nfc_modulation_type_t and nfc_baud_rate_t couple. Initialization example:
|
||||||
|
nfc_modulation_t nm = {
|
||||||
|
.nmt = NMT_ISO14443A,
|
||||||
|
.nbr = NBR_106,
|
||||||
|
};
|
||||||
|
- nfc_target_t now contains new nfc_modulation_t instead of
|
||||||
|
nfc_target_type_t. Initialization example:
|
||||||
|
nfc_target_t nt = {
|
||||||
|
.nm.nmt = NMT_ISO14443A,
|
||||||
|
.nm.nbr = NBR_UNDEFINED,
|
||||||
|
.nti.nai.abtAtqa = { 0x03, 0x44 },
|
||||||
|
.nti.nai.abtUid = { 0x08, 0xab, 0xcd, 0xef },
|
||||||
|
.nti.nai.btSak = 0x20,
|
||||||
|
.nti.nai.szUidLen = 4,
|
||||||
|
.nti.nai.abtAts = { 0x75, 0x77, 0x81, 0x02, 0x80 },
|
||||||
|
.nti.nai.szAtsLen = 5,
|
||||||
|
};
|
||||||
|
|
||||||
|
* Functions
|
||||||
|
- nfc_initiator_select_passive_target() now use new nfc_modulation_t and
|
||||||
|
nfc_target_t instead of nfc_target_info_t
|
||||||
|
- nfc_initiator_list_passive_targets() now use new nfc_modulation_t and
|
||||||
|
nfc_target_t instead of nfc_target_info_t
|
||||||
|
- nfc_initiator_poll_targets() use new nfc_modulation_t instead of
|
||||||
|
nfc_target_type_t
|
||||||
|
- nfc_initiator_select_dep_target() completely changed, use now
|
||||||
|
nfc_dep_mode_t, nfc_baudrate_t, nfc_dep_info_t and nfc_target_t, please
|
||||||
|
see API documentation
|
||||||
|
- nfc_target_init() have an additional argument: nfc_target_t to describe
|
||||||
|
the wanted target
|
||||||
|
- append_iso14443a_crc() was renamed to iso14443a_crc_append()
|
||||||
|
- New iso14443a_locate_historical_bytes() to locate historical bytes in ATS
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
New in 1.3.9 (since 1.3.4):
|
||||||
|
|
||||||
|
Installed files
|
||||||
|
|
||||||
|
- mifaretag.h and mifareultag.h are removed, Mifare features are not a part
|
||||||
|
of libnfc API anymore (these features are always available in examples/)
|
||||||
|
|
||||||
|
API Changes
|
||||||
|
|
||||||
|
* Types
|
||||||
|
- New nfc_device_option_t value (enum): NDO_AUTO_14443_4, an option to
|
||||||
|
enable/disable auto-switching to ISO/IEC 14443-4 if device is compliliant
|
||||||
|
- New nfc_device_option_t value (enum): NDO_EASY_FRAMING, an option to
|
||||||
|
enable/disable automatic frames encapsulation and chaining
|
||||||
|
- New nfc_target_type_t (enum), with values like NTT_MIFARE,
|
||||||
|
NTT_ISO14443B_106, NTT_DEP_ACTIVE_424, etc.
|
||||||
|
- Mifare related types have been removed from API: mifare_cmd,
|
||||||
|
mifare_param_auth, mifare_param_data, mifare_param_value, mifare_param
|
||||||
|
|
||||||
|
* Structures
|
||||||
|
- nfc_device_t now have boolean bEasyFraming to enable/disable "easy
|
||||||
|
framing" feature (should not be directly set, use nfc_configure() with
|
||||||
|
NDO_EASY_FRAMING)
|
||||||
|
- nfc_device_t now have integer iLastError to handle last error
|
||||||
|
- New chip_callbacks to handle error lookup per chip
|
||||||
|
- driver_callbacks now have a pointer to chip_callbacks
|
||||||
|
- New nfc_target_t that contains nfc_target_info_t and nfc_target_type_t
|
||||||
|
|
||||||
|
* Functions
|
||||||
|
- nfc_initiator_select_tag() became nfc_initiator_select_passive_target()
|
||||||
|
- New nfc_initiator_list_passive_targets() returns a list of detected
|
||||||
|
target on desired modulation
|
||||||
|
- (experimental) New nfc_initiator_poll_targets() returns targets that are
|
||||||
|
detected during hardware polling (available only with PN532)
|
||||||
|
- nfc_initiator_transceive_dep_bytes(), nfc_target_receive_dep_bytes() and
|
||||||
|
nfc_target_send_dep_bytes() have been removed from API, use
|
||||||
|
NDO_EASY_FRAMING option to switch from raw mode to "easy framing"
|
||||||
|
- nfc_initiator_mifare_cmd() have been removed: no more Mifare related
|
||||||
|
stuff in libnfc's API
|
||||||
|
- New nfc_strerror(), nfc_strerror_r() and nfc_perror() to report errors
|
||||||
|
- New append_iso14443a_crc() to append iso14443a_crc() to a string
|
||||||
|
|
||||||
|
|
||||||
|
New in 1.3.4 (since 1.2.1):
|
||||||
|
|
||||||
|
Installed files
|
||||||
|
|
||||||
|
- Headers are now installed in include/nfc instead of include/libnfc
|
||||||
|
- libnfc.h have been renamed to nfc.h
|
||||||
|
- defines.h and types.h have been merge into nfc-types.h
|
||||||
|
- bitutils.h is not installed anymore, some functions are now in
|
||||||
|
examples/nfc-utils.c
|
||||||
|
- devices.h, dev_acr122.h, dev_arygon.h, dev_pn531.h, dev_pn533.h and rs232.h
|
||||||
|
are not installed anymore
|
||||||
|
- New header mifareultag.h, like mifaretag.h for Mifare UltraLight
|
||||||
|
- New header nfc-messages.h with messages macros (DBG, ERR, INFO)
|
||||||
|
|
||||||
|
API Changes
|
||||||
|
|
||||||
|
* Types
|
||||||
|
- uint32_t which was used as size now are size_t
|
||||||
|
- chip_type became nfc_chip_t (enum)
|
||||||
|
- init_modulation became nfc_modulation_t (enum), and now have
|
||||||
|
NM_ACTIVE_DEP and NM_PASSIVE_DEP modulation values added
|
||||||
|
|
||||||
|
* Structures
|
||||||
|
- dev_info became nfc_device_t
|
||||||
|
- dev_config_option became nfc_device_option_t
|
||||||
|
- New nfc_device_desc_t to describe the way to access to a NFC device.
|
||||||
|
Initialisation example:
|
||||||
|
nfc_device_desc_t ndd = {
|
||||||
|
ndd.pcDriver = "ARYGON";
|
||||||
|
ndd.pcPort = "/dev/ttyUSB0";
|
||||||
|
ndd.uiSpeed = 115200;
|
||||||
|
};
|
||||||
|
- dev_callbacks became driver_callbacks and now have two function pointers
|
||||||
|
more: pick_device() and list_devices()
|
||||||
|
- New nfc_dep_info_t to handle DEP targets info
|
||||||
|
- tag_info_iso14443a became nfc_iso14443a_info_t
|
||||||
|
- tag_info_iso14443b became nfc_iso14443b_info_t
|
||||||
|
- tag_info_felica became nfc_felica_info_t
|
||||||
|
- tag_info_jewel became nfc_jewel_info_t
|
||||||
|
- tag_info became nfc_target_info_t, and now have extended union to
|
||||||
|
nfc_dep_info_t
|
||||||
|
|
||||||
|
* Functions
|
||||||
|
- nfc_connect() now takes 1 nfc_devive_desc_t argument (can be NULL)
|
||||||
|
- New nfc_list_devices(), it find available NFC devices using all know
|
||||||
|
drivers
|
||||||
|
- (experimental) New nfc_initiator_select_dep(), it looks for DEP targets
|
||||||
|
- (experimental) New nfc_initiator_transceive_dep_bytes(), like
|
||||||
|
nfc_initiator_transceive_bytes() for DEP targets
|
||||||
|
- (experimental) New nfc_target_receive_dep_bytes() and
|
||||||
|
nfc_target_send_dep_bytes(), to receive/send bytes to DEP target
|
||||||
|
(configured as initiator) while local NFC device is configured as target
|
||||||
|
- New nfc_device_name() returns the device's name
|
||||||
|
- New iso14443a_crc() computes CRC as described in ISO/IEC 14443
|
||||||
|
- New nfc_version() returns the actual version of libnfc (with SVN
|
||||||
|
revision, if available)
|
||||||
24
README
24
README
@ -1,24 +0,0 @@
|
|||||||
------------------------------------------------------------------------
|
|
||||||
Public platform independent Near Field Communication (NFC) library
|
|
||||||
Copyright (C) 2009, Roel Verdult
|
|
||||||
|
|
||||||
------------------------------------------------------------------------
|
|
||||||
Welcome to the developers community of libnfc.
|
|
||||||
|
|
||||||
Since it is hard to keep all information up to date
|
|
||||||
we decided to only maintain the online documentation.
|
|
||||||
Please visit the official website for more info:
|
|
||||||
http://www.libnfc.org
|
|
||||||
|
|
||||||
If you have questions, remarks, bug-reports, we encourage you to
|
|
||||||
post this in the developers community:
|
|
||||||
http://www.libnfc.org/community
|
|
||||||
|
|
||||||
------------------------------------------------------------------------
|
|
||||||
Proprietary Notes:
|
|
||||||
|
|
||||||
FeliCa is s registered trademark of Sony Corporation. MIFARE is a
|
|
||||||
trademark of NXP Semiconductors. Jewel Topaz is a trademark of Innovision
|
|
||||||
Research & Technology. All other trademarks are the property of their
|
|
||||||
respective owners.
|
|
||||||
|
|
||||||
70
README-Windows.md
Normal file
70
README-Windows.md
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
*-
|
||||||
|
* Free/Libre Near Field Communication (NFC) library
|
||||||
|
*
|
||||||
|
* Libnfc historical contributors:
|
||||||
|
* Copyright (C) 2009 Roel Verdult
|
||||||
|
* Copyright (C) 2009-2013 Romuald Conty
|
||||||
|
* Copyright (C) 2010-2012 Romain Tartière
|
||||||
|
* Copyright (C) 2010-2013 Philippe Teuwen
|
||||||
|
* Copyright (C) 2012-2013 Ludovic Rousseau
|
||||||
|
* Additional contributors of Windows-specific parts:
|
||||||
|
* Copyright (C) 2010 Glenn Ergeerts
|
||||||
|
* Copyright (C) 2013 Alex Lian
|
||||||
|
-*
|
||||||
|
|
||||||
|
Requirements
|
||||||
|
============
|
||||||
|
|
||||||
|
- MinGW-w64 compiler toolchain [1]
|
||||||
|
- LibUsb-Win32 1.2.5.0 (or greater) [2]
|
||||||
|
- CMake 2.8 [3]
|
||||||
|
|
||||||
|
This was tested on Windows 7 64 bit, but should work on Windows Vista and
|
||||||
|
Windows XP and 32 bit as well.
|
||||||
|
Only the ACS ACR122 and the ASK Logo readers are tested at the moment, so any feedback about other devices is very welcome.
|
||||||
|
|
||||||
|
Community forum: http://www.libnfc.org/community/
|
||||||
|
|
||||||
|
Building
|
||||||
|
========
|
||||||
|
|
||||||
|
To build the distribution the MinGW Makefiles generator of CMake was used. Here
|
||||||
|
is an example of how to generate a distribution with the above mentioned
|
||||||
|
requirements fulfilled (it is assumed the CMake binaries are in the system
|
||||||
|
path, this is optional during installation of CMake):
|
||||||
|
|
||||||
|
- Add the following directories to your PATH:
|
||||||
|
|
||||||
|
c:\MinGW64\bin;c:\MinGW64\x86_64-w64-mingw32\lib32;c:\MinGW64\x86_64-w64-mingw32\include
|
||||||
|
|
||||||
|
- Now it is possible to run CMake and mingw32-make:
|
||||||
|
|
||||||
|
C:\dev\libnfc-read-only> mkdir ..\libnfc-build
|
||||||
|
C:\dev\libnfc-read-only> cd ..\libnfc-build
|
||||||
|
C:\dev\libnfc-build> cmake-gui .
|
||||||
|
|
||||||
|
Now you can configure the build. Press "Configure", specify "MinGW32 Makefiles"
|
||||||
|
and then you have the opportunity to set some configuration variables. If you
|
||||||
|
don't want a Debug build change the variable CMAKE_BUILD_TYPE to "Release".
|
||||||
|
|
||||||
|
If a non-GUI solution is preferred one can use:
|
||||||
|
|
||||||
|
C:\dev\libnfc-build> cmake -G "MinGW Makefiles"
|
||||||
|
-DCMAKE_BUILD_TYPE=Release ..\libnfc-read-only
|
||||||
|
|
||||||
|
Now run mingw32-make to build:
|
||||||
|
|
||||||
|
C:\dev\libnfc-read-only\bin> mingw32-make
|
||||||
|
|
||||||
|
The build will create a shared library for Windows (nfc.dll) to link your applications against. It will compile
|
||||||
|
the tools against this shared library.
|
||||||
|
|
||||||
|
References
|
||||||
|
==========
|
||||||
|
[1] the easiest way is to use the TDM-GCC installer.
|
||||||
|
Make sure to select MinGW-w64 in the installer, the regular MinGW does not contain headers for PCSC.
|
||||||
|
http://sourceforge.net/projects/tdm-gcc/files/TDM-GCC%20Installer/tdm64-gcc-4.5.1.exe/download
|
||||||
|
|
||||||
|
[2] http://sourceforge.net/projects/libusb-win32/files/
|
||||||
|
|
||||||
|
[3] http://www.cmake.org
|
||||||
250
README.md
Normal file
250
README.md
Normal file
@ -0,0 +1,250 @@
|
|||||||
|
```
|
||||||
|
*-
|
||||||
|
* Free/Libre Near Field Communication (NFC) library
|
||||||
|
*
|
||||||
|
* Libnfc historical contributors:
|
||||||
|
* Copyright (C) 2009 Roel Verdult
|
||||||
|
* Copyright (C) 2009-2015 Romuald Conty
|
||||||
|
* Copyright (C) 2010-2012 Romain Tartière
|
||||||
|
* Copyright (C) 2010-2013 Philippe Teuwen
|
||||||
|
* Copyright (C) 2012-2013 Ludovic Rousseau
|
||||||
|
* Additional contributors:
|
||||||
|
* See AUTHORS file
|
||||||
|
-*
|
||||||
|
```
|
||||||
|
|
||||||
|
General Information
|
||||||
|
===================
|
||||||
|
|
||||||
|
libnfc is a library which allows userspace application access to NFC devices.
|
||||||
|
|
||||||
|
The official web site is:
|
||||||
|
http://www.nfc-tools.org/
|
||||||
|
|
||||||
|
The official forum site is:
|
||||||
|
http://www.libnfc.org/community/
|
||||||
|
|
||||||
|
The official development site is:
|
||||||
|
https://github.com/nfc-tools/libnfc
|
||||||
|
|
||||||
|
Important note: this file covers POSIX systems, for Windows please read README-Windows.md
|
||||||
|
|
||||||
|
Requirements
|
||||||
|
============
|
||||||
|
|
||||||
|
Some NFC drivers depend on third party software:
|
||||||
|
|
||||||
|
* pn53x_usb & acr122_usb:
|
||||||
|
|
||||||
|
- libusb-0.1 http://libusb.sf.net
|
||||||
|
|
||||||
|
* acr122_pcsc:
|
||||||
|
|
||||||
|
- pcsc-lite https://pcsclite.apdu.fr/
|
||||||
|
- pcsc:
|
||||||
|
|
||||||
|
- Support build with pcsc driver, which can be using all compatible readers, Feitian R502 and bR500 already passed the test.
|
||||||
|
|
||||||
|
The regression test suite depends on the cutter framework:
|
||||||
|
http://cutter.sf.net
|
||||||
|
|
||||||
|
Building
|
||||||
|
========
|
||||||
|
|
||||||
|
Note: If working directly from a git clone of the repository, some of the files need to be generated first. To do this run
|
||||||
|
`autoreconf -vis`
|
||||||
|
|
||||||
|
Alternatively use a .tar.bz2 version of a packaged release (which already contains ./configure):
|
||||||
|
https://github.com/nfc-tools/libnfc/releases/
|
||||||
|
|
||||||
|
The build should be as simple as running these commands:
|
||||||
|
|
||||||
|
./configure
|
||||||
|
make
|
||||||
|
|
||||||
|
|
||||||
|
To build with specific driver(s), see option `--with-drivers=...` detailed in `./configure --help`.
|
||||||
|
|
||||||
|
Installation
|
||||||
|
============
|
||||||
|
|
||||||
|
make install
|
||||||
|
|
||||||
|
You may need to grant permissions to your user to drive your device.
|
||||||
|
Under GNU/Linux systems, if you use udev, you could use the provided udev rules.
|
||||||
|
e.g. under Debian, Ubuntu, etc.
|
||||||
|
|
||||||
|
sudo cp contrib/udev/93-pn53x.rules /lib/udev/rules.d/
|
||||||
|
|
||||||
|
Under FreeBSD, if you use devd, there is also a rules file: contrib/devd/pn53x.conf.
|
||||||
|
|
||||||
|
Configuration
|
||||||
|
=============
|
||||||
|
|
||||||
|
In order to change the default behavior of the library, the libnfc uses a
|
||||||
|
configuration file located in sysconfdir (as provided to ./configure).
|
||||||
|
|
||||||
|
A sample commented file is available in sources: libnfc.conf.sample
|
||||||
|
|
||||||
|
If you have compiled using:
|
||||||
|
|
||||||
|
./configure --prefix=/usr --sysconfdir=/etc
|
||||||
|
|
||||||
|
you can make configuration directory and copy the sample file:
|
||||||
|
|
||||||
|
sudo mkdir /etc/nfc
|
||||||
|
sudo cp libnfc.conf.sample /etc/nfc/libnfc.conf
|
||||||
|
|
||||||
|
To configure multiple devices, you can either modify libnfc.conf or create a
|
||||||
|
file per device in a nfc/devices.d directory:
|
||||||
|
|
||||||
|
sudo mkdir -p /etc/nfc/devices.d
|
||||||
|
printf 'name = "My first device"\nconnstring = "pn532_uart:/dev/ttyACM0"\n' | sudo tee /etc/nfc/devices.d/first.conf
|
||||||
|
printf 'name = "My second device"\nconnstring = "pn532_uart:/dev/ttyACM1"\n' | sudo tee /etc/nfc/devices.d/second.conf
|
||||||
|
|
||||||
|
Environment Variables
|
||||||
|
=====================
|
||||||
|
You can override certain configuration options at runtime using the following environment variables:
|
||||||
|
+ `LIBNFC_DEFAULT_DEVICE=<connstring>`: `LIBNFC_DEFAULT_DEVICE=pn532_uart:/dev/ttyACM0` will use pn532 on /dev/ttyACM0 as default device
|
||||||
|
+ `LIBNFC_DEVICE=<connstring>` will ignore all devices in the config files and use only the one defined in the variable
|
||||||
|
+ `LIBNFC_AUTO_SCAN=<true|false>` overrides `allow_autoscan` option in the config file
|
||||||
|
+ `LIBNFC_INTRUSIVE_SCAN=<true|false>` overrides `allow_intrusive_scan` option in the config file
|
||||||
|
+ `LIBNFC_LOG_LEVEL=<0|1|2|3>` overrides `log_level` option in the config file
|
||||||
|
|
||||||
|
To obtain the connstring of a recognized device, you can use `nfc-scan-device`: `LIBNFC_AUTO_SCAN=true nfc-scan-device` will show the names & connstrings of all found devices.
|
||||||
|
|
||||||
|
How to report bugs
|
||||||
|
==================
|
||||||
|
|
||||||
|
To report a bug, visit https://github.com/nfc-tools/libnfc/issues and fill
|
||||||
|
out a bug report form.
|
||||||
|
|
||||||
|
If you have questions, remarks, we encourage you to post this in the developers
|
||||||
|
community:
|
||||||
|
http://www.libnfc.org/community
|
||||||
|
|
||||||
|
Please make sure to include:
|
||||||
|
|
||||||
|
* The version of libnfc
|
||||||
|
|
||||||
|
* Information about your system. For instance:
|
||||||
|
|
||||||
|
- What operating system and version
|
||||||
|
- For Linux, what version of the C library
|
||||||
|
|
||||||
|
And anything else you think is relevant.
|
||||||
|
|
||||||
|
* A trace with debug activated.
|
||||||
|
|
||||||
|
Reproduce the bug with debug, e.g. if it was:
|
||||||
|
|
||||||
|
$ nfc-list -v
|
||||||
|
|
||||||
|
run it as:
|
||||||
|
|
||||||
|
$ LIBNFC_LOG_LEVEL=3 nfc-list -v
|
||||||
|
|
||||||
|
* How to reproduce the bug.
|
||||||
|
|
||||||
|
Please include a short test program that exhibits the behavior.
|
||||||
|
|
||||||
|
As a last resort, you can also provide a pointer to a larger piece
|
||||||
|
|
||||||
|
of software that can be downloaded.
|
||||||
|
|
||||||
|
* If the bug was a crash, the exact text that was printed out
|
||||||
|
|
||||||
|
when the crash occured.
|
||||||
|
|
||||||
|
* Further information such as stack traces may be useful, but
|
||||||
|
|
||||||
|
is not necessary.
|
||||||
|
|
||||||
|
Patches
|
||||||
|
=======
|
||||||
|
|
||||||
|
Patches can be posted to https://github.com/nfc-tools/libnfc/issues
|
||||||
|
|
||||||
|
If the patch fixes a bug, it is usually a good idea to include
|
||||||
|
all the information described in "How to Report Bugs".
|
||||||
|
|
||||||
|
Troubleshooting
|
||||||
|
===============
|
||||||
|
|
||||||
|
Touchatag/ACR122:
|
||||||
|
-----------------
|
||||||
|
|
||||||
|
If your Touchatag or ACR122 device fails being detected by libnfc, make sure
|
||||||
|
that PCSC-lite daemon (`pcscd`) is installed and is running.
|
||||||
|
|
||||||
|
If your Touchatag or ACR122 device fails being detected by PCSC-lite daemon
|
||||||
|
(`pcsc_scan` doesn't see anything) then try removing the bogus firmware detection
|
||||||
|
of libccid: edit libccid_Info.plist configuration file (usually
|
||||||
|
`/etc/libccid_Info.plist`) and locate `<key>ifdDriverOptions</key>`, turn
|
||||||
|
`<string>0x0000</string>` value into `0x0004` to allow bogus devices and restart
|
||||||
|
pcscd daemon.
|
||||||
|
|
||||||
|
ACR122:
|
||||||
|
-------
|
||||||
|
|
||||||
|
Using an ACR122 device with libnfc and without tag (e.g. to use NFCIP modes or
|
||||||
|
card emulation) needs yet another PCSC-lite tweak: You need to allow usage of
|
||||||
|
CCID Exchange command. To do this, edit `libccid_Info.plist` configuration file
|
||||||
|
(usually `/etc/libccid_Info.plist`) and locate `<key>ifdDriverOptions</key>`,
|
||||||
|
turn `<string>0x0000</string>` value into `0x0001` to allow CCID exchange or
|
||||||
|
`0x0005` to allow CCID exchange and bogus devices (cf previous remark) and
|
||||||
|
restart pcscd daemon.
|
||||||
|
|
||||||
|
Warning: if you use ACS CCID drivers (acsccid), configuration file is located
|
||||||
|
in something like: `/usr/lib/pcsc/drivers/ifd-acsccid.bundle/Contents/Info.plist`
|
||||||
|
|
||||||
|
SCL3711:
|
||||||
|
--------
|
||||||
|
|
||||||
|
Libnfc cannot be used concurrently with the PCSC proprietary driver of SCL3711.
|
||||||
|
Two possible solutions:
|
||||||
|
|
||||||
|
* Either you don't install SCL3711 driver at all
|
||||||
|
* Or you stop the PCSC daemon when you want to use libnfc-based tools
|
||||||
|
|
||||||
|
PN533 USB device on Linux >= 3.1:
|
||||||
|
---------------------------------
|
||||||
|
|
||||||
|
Since Linux kernel version 3.1, a few kernel-modules must not be loaded in order
|
||||||
|
to use libnfc : "nfc", "pn533" and "pn533_usb".
|
||||||
|
To prevent kernel from loading automatically these modules, you can blacklist
|
||||||
|
them in a modprobe conf file. This file is provided within libnfc archive:
|
||||||
|
|
||||||
|
sudo cp contrib/linux/blacklist-libnfc.conf /etc/modprobe.d/blacklist-libnfc.conf
|
||||||
|
|
||||||
|
FEITIAN bR500 and R502:
|
||||||
|
-----------------------
|
||||||
|
|
||||||
|
Libnfc can work with PCSC proprietary driver of bR500 and R502, which is already available on most Linux setups.
|
||||||
|
To activate the PCSC support: `./configure --with-drivers=pcsc`.
|
||||||
|
Readers known to work:
|
||||||
|
|
||||||
|
- Feitian bR500
|
||||||
|
- Feitian R502 Dual interface reader
|
||||||
|
- Feitian R502 CL(Contactless) reader
|
||||||
|
|
||||||
|
These readers are support by CCID since v1.4.25, make sure your CCID driver version higher or equal to 1.4.25.
|
||||||
|
|
||||||
|
On MacOS, you can check your CCID version with the following command, and if required, you can install latest CCID driver from [https://github.com/martinpaljak/osx-ccid-installer/releases](https://github.com/martinpaljak/osx-ccid-installer/releases)
|
||||||
|
|
||||||
|
```
|
||||||
|
grep -A 1 CFBundleShortVersionString /usr/local/libexec/SmartCardServices/drivers/ifd-ccid.bundle/Contents/Info.plist
|
||||||
|
```
|
||||||
|
|
||||||
|
On Linux, you can check your CCID version with the following command, and if required, you can install latest CCID driver from [https://ccid.apdu.fr/](https://ccid.apdu.fr/)
|
||||||
|
|
||||||
|
```
|
||||||
|
grep -A 1 CFBundleShortVersionString /usr/lib/pcsc/drivers/ifd-ccid.bundle/Contents/Info.plist
|
||||||
|
```
|
||||||
|
|
||||||
|
Proprietary Notes
|
||||||
|
=================
|
||||||
|
FeliCa is a registered trademark of the Sony Corporation.
|
||||||
|
MIFARE is a trademark of NXP Semiconductors.
|
||||||
|
Jewel Topaz is a trademark of Innovision Research & Technology.
|
||||||
|
All other trademarks are the property of their respective owners.
|
||||||
28
autogen.sh
28
autogen.sh
@ -1,28 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
rm -rf autom4te.cache
|
|
||||||
rm -f aclocal.m4 ltmain.sh
|
|
||||||
|
|
||||||
touch README
|
|
||||||
|
|
||||||
LIBTOOLIZE=libtoolize
|
|
||||||
case `uname -s` in
|
|
||||||
Darwin)
|
|
||||||
LIBTOOLIZE=glibtoolize
|
|
||||||
ACLOCAL_ARGS="-I /opt/local/share/aclocal/"
|
|
||||||
# SKIP_PCSC="1"
|
|
||||||
;;
|
|
||||||
FreeBSD)
|
|
||||||
ACLOCAL_ARGS="-I /usr/local/share/aclocal/"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
echo "Running aclocal..." ; aclocal $ACLOCAL_ARGS || exit 1
|
|
||||||
echo "Running autoheader..." ; autoheader || exit 1
|
|
||||||
echo "Running autoconf..." ; autoconf || exit 1
|
|
||||||
echo "Running libtoolize..." ; $LIBTOOLIZE --copy --automake || exit 1
|
|
||||||
echo "Running automake..." ; automake --add-missing --copy --gnu || exit 1
|
|
||||||
|
|
||||||
if [ -z "$NOCONFIGURE" ]; then
|
|
||||||
./configure "$@"
|
|
||||||
fi
|
|
||||||
11
cmake/FixBundle.cmake.in
Normal file
11
cmake/FixBundle.cmake.in
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
INCLUDE(BundleUtilities)
|
||||||
|
|
||||||
|
# set bundle to the full path of the executable already existing in the install tree
|
||||||
|
SET(bundle "${CMAKE_INSTALL_PREFIX}/bin/nfc-list@CMAKE_EXECUTABLE_SUFFIX@")
|
||||||
|
|
||||||
|
# set other_libs to a list of additional libs that cannot be reached by dependency analysis
|
||||||
|
SET(other_libs "")
|
||||||
|
|
||||||
|
SET(dirs "@LIBUSB_LIBRARY_DIR@")
|
||||||
|
|
||||||
|
fixup_bundle("${bundle}" "${other_libs}" "${dirs}")
|
||||||
34
cmake/LibNFCConfig.cmake.in
Normal file
34
cmake/LibNFCConfig.cmake.in
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
# -*- cmake -*-
|
||||||
|
|
||||||
|
|
||||||
|
# Use the following variables to compile and link against LibNFC:
|
||||||
|
# LIBNFC_FOUND - True if LibNFC was found on your system
|
||||||
|
# LIBNFC_USE_FILE - The file making LibNFC usable
|
||||||
|
# LIBNFC_DEFINITIONS - Definitions needed to build with LibNFC
|
||||||
|
# LIBNFC_INCLUDE_DIR - Directory where nfc/nfc.h can be found
|
||||||
|
# LIBNFC_INCLUDE_DIRS - List of directories of LibNFC and it's dependencies
|
||||||
|
# LIBNFC_LIBRARY - LibNFC library location
|
||||||
|
# LIBNFC_LIBRARIES - List of libraries to link against LibNFC library
|
||||||
|
# LIBNFC_LIBRARY_DIRS - List of directories containing LibNFC' libraries
|
||||||
|
# LIBNFC_ROOT_DIR - The base directory of LibNFC
|
||||||
|
# LIBNFC_VERSION_STRING - A human-readable string containing the version
|
||||||
|
# LIBNFC_VERSION_MAJOR - The major version of LibNFC
|
||||||
|
# LIBNFC_VERSION_MINOR - The minor version of LibNFC
|
||||||
|
# LIBNFC_VERSION_PATCH - The patch version of LibNFC
|
||||||
|
|
||||||
|
set ( LIBNFC_FOUND 1 )
|
||||||
|
set ( LIBNFC_USE_FILE "@LIBNFC_USE_FILE@" )
|
||||||
|
|
||||||
|
set ( LIBNFC_DEFINITIONS "@LIBNFC_DEFINITIONS@" )
|
||||||
|
set ( LIBNFC_INCLUDE_DIR "@LIBNFC_INCLUDE_DIR@" )
|
||||||
|
set ( LIBNFC_INCLUDE_DIRS "@LIBNFC_INCLUDE_DIRS@" )
|
||||||
|
set ( LIBNFC_LIBRARY "@LIBNFC_LIBRARY@" )
|
||||||
|
set ( LIBNFC_LIBRARIES "@LIBNFC_LIBRARIES@" )
|
||||||
|
set ( LIBNFC_LIBRARY_DIRS "@LIBNFC_LIBRARY_DIRS@" )
|
||||||
|
set ( LIBNFC_ROOT_DIR "@LIBNFC_ROOT_DIR@" )
|
||||||
|
|
||||||
|
set ( LIBNFC_VERSION_STRING "@LIBNFC_VERSION_STRING@" )
|
||||||
|
set ( LIBNFC_VERSION_MAJOR "@LIBNFC_VERSION_MAJOR@" )
|
||||||
|
set ( LIBNFC_VERSION_MINOR "@LIBNFC_VERSION_MINOR@" )
|
||||||
|
set ( LIBNFC_VERSION_PATCH "@LIBNFC_VERSION_PATCH@" )
|
||||||
|
|
||||||
31
cmake/LibNFCConfigVersion.cmake.in
Normal file
31
cmake/LibNFCConfigVersion.cmake.in
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
# This is a basic version file for the Config-mode of find_package().
|
||||||
|
# It is used by write_basic_package_version_file() as input file for configure_file()
|
||||||
|
# to create a version-file which can be installed along a config.cmake file.
|
||||||
|
#
|
||||||
|
# The created file sets PACKAGE_VERSION_EXACT if the current version string and
|
||||||
|
# the requested version string are exactly the same and it sets
|
||||||
|
# PACKAGE_VERSION_COMPATIBLE if the current version is >= requested version.
|
||||||
|
# The variable CVF_VERSION must be set before calling configure_file().
|
||||||
|
|
||||||
|
set(PACKAGE_VERSION "@LIBNFC_VERSION_STRING@")
|
||||||
|
|
||||||
|
if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" )
|
||||||
|
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||||
|
else()
|
||||||
|
set(PACKAGE_VERSION_COMPATIBLE TRUE)
|
||||||
|
if( "${PACKAGE_FIND_VERSION}" STREQUAL "${PACKAGE_VERSION}")
|
||||||
|
set(PACKAGE_VERSION_EXACT TRUE)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
|
||||||
|
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "8" STREQUAL "")
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# check that the installed version has the same 32/64bit-ness as the one which is currently searching:
|
||||||
|
if(NOT "${CMAKE_SIZEOF_VOID_P}" STREQUAL "8")
|
||||||
|
math(EXPR installedBits "8 * 8")
|
||||||
|
set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
|
||||||
|
set(PACKAGE_VERSION_UNSUITABLE TRUE)
|
||||||
|
endif()
|
||||||
9
cmake/Makefile.am
Normal file
9
cmake/Makefile.am
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
SUBDIRS = modules
|
||||||
|
|
||||||
|
EXTRA_DIST = \
|
||||||
|
FixBundle.cmake.in \
|
||||||
|
config_posix.h.cmake \
|
||||||
|
config_windows.h.cmake \
|
||||||
|
LibNFCConfig.cmake.in \
|
||||||
|
LibNFCConfigVersion.cmake.in \
|
||||||
|
UseLibNFC.cmake
|
||||||
5
cmake/UseLibNFC.cmake
Normal file
5
cmake/UseLibNFC.cmake
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# -*- cmake -*-
|
||||||
|
|
||||||
|
add_definitions ( ${LIBNFC_DEFINITIONS} )
|
||||||
|
include_directories ( ${LIBNFC_INCLUDE_DIRS} )
|
||||||
|
link_directories ( ${LIBNFC_LIBRARY_DIRS} )
|
||||||
5
cmake/config_posix.h.cmake
Normal file
5
cmake/config_posix.h.cmake
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#cmakedefine PACKAGE_NAME "@PACKAGE_NAME@"
|
||||||
|
#cmakedefine PACKAGE_VERSION "@PACKAGE_VERSION@"
|
||||||
|
#cmakedefine PACKAGE_STRING "@PACKAGE_STRING@"
|
||||||
|
#cmakedefine _XOPEN_SOURCE @_XOPEN_SOURCE@
|
||||||
|
#cmakedefine SYSCONFDIR "@SYSCONFDIR@"
|
||||||
6
cmake/config_windows.h.cmake
Normal file
6
cmake/config_windows.h.cmake
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#include "contrib/windows.h"
|
||||||
|
|
||||||
|
#cmakedefine PACKAGE_NAME "@PACKAGE_NAME@"
|
||||||
|
#cmakedefine PACKAGE_VERSION "@PACKAGE_VERSION@"
|
||||||
|
#cmakedefine PACKAGE_STRING "@PACKAGE_STRING@"
|
||||||
|
#cmakedefine LIBNFC_SYSCONFDIR "@LIBNFC_SYSCONFDIR@"
|
||||||
22
cmake/modules/COPYING-CMAKE-SCRIPTS
Normal file
22
cmake/modules/COPYING-CMAKE-SCRIPTS
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions
|
||||||
|
are met:
|
||||||
|
|
||||||
|
1. Redistributions of source code must retain the copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
2. Redistributions in binary form must reproduce the copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
3. The name of the author may not be used to endorse or promote products
|
||||||
|
derived from this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||||
|
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||||
|
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||||
|
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
|
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
63
cmake/modules/FindLIBUSB.cmake
Normal file
63
cmake/modules/FindLIBUSB.cmake
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
# This CMake script wants to use libusb functionality, therefore it looks
|
||||||
|
# for libusb include files and libraries.
|
||||||
|
#
|
||||||
|
# Operating Systems Supported:
|
||||||
|
# - Unix (requires pkg-config)
|
||||||
|
# Tested with Ubuntu 9.04 and Fedora 11
|
||||||
|
# - Windows (requires MinGW)
|
||||||
|
# Tested with Windows XP/Windows 7
|
||||||
|
#
|
||||||
|
# This should work for both 32 bit and 64 bit systems.
|
||||||
|
#
|
||||||
|
# Author: F. Kooman <fkooman@tuxed.net>
|
||||||
|
#
|
||||||
|
|
||||||
|
# FreeBSD has built-in libusb since 800069
|
||||||
|
IF(CMAKE_SYSTEM_NAME MATCHES FreeBSD)
|
||||||
|
EXEC_PROGRAM(sysctl ARGS -n kern.osreldate OUTPUT_VARIABLE FREEBSD_VERSION)
|
||||||
|
SET(MIN_FREEBSD_VERSION 800068)
|
||||||
|
IF(FREEBSD_VERSION GREATER ${MIN_FREEBSD_VERSION})
|
||||||
|
SET(LIBUSB_FOUND TRUE)
|
||||||
|
SET(LIBUSB_INCLUDE_DIRS "/usr/include")
|
||||||
|
SET(LIBUSB_LIBRARIES "usb")
|
||||||
|
SET(LIBUSB_LIBRARY_DIRS "/usr/lib/")
|
||||||
|
ENDIF(FREEBSD_VERSION GREATER ${MIN_FREEBSD_VERSION})
|
||||||
|
ENDIF(CMAKE_SYSTEM_NAME MATCHES FreeBSD)
|
||||||
|
|
||||||
|
IF(NOT LIBUSB_FOUND)
|
||||||
|
IF(WIN32)
|
||||||
|
IF(MINGW)
|
||||||
|
FIND_PATH(LIBUSB_INCLUDE_DIRS lusb0_usb.h "${CMAKE_CURRENT_BINARY_DIR}/LibUSB-Win32/include" NO_SYSTEM_ENVIRONMENT_PATH)
|
||||||
|
FIND_LIBRARY(LIBUSB_LIBRARIES NAMES libusb PATHS "${CMAKE_CURRENT_BINARY_DIR}/LibUSB-Win32/lib/gcc")
|
||||||
|
SET(LIBUSB_LIBRARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/LibUSB-Win32/bin/x86/")
|
||||||
|
ELSE(MINGW)
|
||||||
|
FIND_PATH(LIBUSB_INCLUDE_DIRS lusb0_usb.h "$ENV{ProgramW6432}/libusb-win32/include" NO_SYSTEM_ENVIRONMENT_PATH)
|
||||||
|
FIND_LIBRARY(LIBUSB_LIBRARIES NAMES libusb PATHS "$ENV{ProgramW6432}/libusb-win32/lib/msvc_x64")
|
||||||
|
SET(LIBUSB_LIBRARY_DIR "$ENV{ProgramW6432}/libusb-win32/bin/amd64/")
|
||||||
|
ENDIF(MINGW)
|
||||||
|
# Must fix up variable to avoid backslashes during packaging
|
||||||
|
STRING(REGEX REPLACE "\\\\" "/" LIBUSB_LIBRARY_DIR ${LIBUSB_LIBRARY_DIR})
|
||||||
|
ELSE(WIN32)
|
||||||
|
# If not under Windows we use PkgConfig
|
||||||
|
FIND_PACKAGE (PkgConfig)
|
||||||
|
IF(PKG_CONFIG_FOUND)
|
||||||
|
PKG_CHECK_MODULES(LIBUSB REQUIRED libusb)
|
||||||
|
ELSE(PKG_CONFIG_FOUND)
|
||||||
|
MESSAGE(FATAL_ERROR "Could not find PkgConfig")
|
||||||
|
ENDIF(PKG_CONFIG_FOUND)
|
||||||
|
ENDIF(WIN32)
|
||||||
|
|
||||||
|
IF(LIBUSB_INCLUDE_DIRS AND LIBUSB_LIBRARIES)
|
||||||
|
SET(LIBUSB_FOUND TRUE)
|
||||||
|
ENDIF(LIBUSB_INCLUDE_DIRS AND LIBUSB_LIBRARIES)
|
||||||
|
ENDIF(NOT LIBUSB_FOUND)
|
||||||
|
|
||||||
|
IF(LIBUSB_FOUND)
|
||||||
|
IF(NOT LIBUSB_FIND_QUIETLY)
|
||||||
|
MESSAGE(STATUS "Found LIBUSB: ${LIBUSB_LIBRARIES} ${LIBUSB_INCLUDE_DIRS}")
|
||||||
|
ENDIF (NOT LIBUSB_FIND_QUIETLY)
|
||||||
|
ELSE(LIBUSB_FOUND)
|
||||||
|
IF(LIBUSB_FIND_REQUIRED)
|
||||||
|
MESSAGE(FATAL_ERROR "Could not find LIBUSB")
|
||||||
|
ENDIF(LIBUSB_FIND_REQUIRED)
|
||||||
|
ENDIF(LIBUSB_FOUND)
|
||||||
31
cmake/modules/FindPCSC.cmake
Normal file
31
cmake/modules/FindPCSC.cmake
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
# - Try to find the PC/SC smart card library
|
||||||
|
# Once done this will define
|
||||||
|
#
|
||||||
|
# PCSC_FOUND - system has the PC/SC library
|
||||||
|
# PCSC_INCLUDE_DIRS - the PC/SC include directory
|
||||||
|
# PCSC_LIBRARIES - The libraries needed to use PC/SC
|
||||||
|
#
|
||||||
|
# Author: F. Kooman <fkooman@tuxed.net>
|
||||||
|
# Version: 20101019
|
||||||
|
#
|
||||||
|
|
||||||
|
FIND_PACKAGE (PkgConfig)
|
||||||
|
IF(PKG_CONFIG_FOUND)
|
||||||
|
# Will find PC/SC library on Linux/BSDs using PkgConfig
|
||||||
|
PKG_CHECK_MODULES(PCSC libpcsclite)
|
||||||
|
# PKG_CHECK_MODULES(PCSC QUIET libpcsclite) # IF CMake >= 2.8.2?
|
||||||
|
ENDIF(PKG_CONFIG_FOUND)
|
||||||
|
|
||||||
|
IF(NOT PCSC_FOUND)
|
||||||
|
# Will find PC/SC headers both on Mac and Windows
|
||||||
|
FIND_PATH(PCSC_INCLUDE_DIRS WinSCard.h)
|
||||||
|
# PCSC library is for Mac, WinSCard library is for Windows
|
||||||
|
FIND_LIBRARY(PCSC_LIBRARIES NAMES PCSC libwinscard)
|
||||||
|
ENDIF(NOT PCSC_FOUND)
|
||||||
|
|
||||||
|
INCLUDE(FindPackageHandleStandardArgs)
|
||||||
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PCSC DEFAULT_MSG
|
||||||
|
PCSC_LIBRARIES
|
||||||
|
PCSC_INCLUDE_DIRS
|
||||||
|
)
|
||||||
|
MARK_AS_ADVANCED(PCSC_INCLUDE_DIRS PCSC_LIBRARIES)
|
||||||
78
cmake/modules/LibnfcDrivers.cmake
Normal file
78
cmake/modules/LibnfcDrivers.cmake
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
SET(LIBNFC_DRIVER_PCSC OFF CACHE BOOL "Enable PC/SC reader support (Depends on PC/SC)")
|
||||||
|
SET(LIBNFC_DRIVER_ACR122_PCSC OFF CACHE BOOL "Enable ACR122 support (Depends on PC/SC)")
|
||||||
|
SET(LIBNFC_DRIVER_ACR122_USB ON CACHE BOOL "Enable ACR122 support (Direct USB connection)")
|
||||||
|
SET(LIBNFC_DRIVER_ACR122S ON CACHE BOOL "Enable ACR122S support (Use serial port)")
|
||||||
|
SET(LIBNFC_DRIVER_ARYGON ON CACHE BOOL "Enable ARYGON support (Use serial port)")
|
||||||
|
IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||||
|
SET(LIBNFC_DRIVER_PN532_I2C ON CACHE BOOL "Enable PN532 I2C support (Use I2C bus)")
|
||||||
|
SET(LIBNFC_DRIVER_PN532_SPI ON CACHE BOOL "Enable PN532 SPI support (Use SPI bus)")
|
||||||
|
ELSE(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||||
|
SET(LIBNFC_DRIVER_PN532_I2C OFF CACHE BOOL "Enable PN532 I2C support (Use I2C bus)")
|
||||||
|
SET(LIBNFC_DRIVER_PN532_SPI OFF CACHE BOOL "Enable PN532 SPI support (Use SPI bus)")
|
||||||
|
ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||||
|
SET(LIBNFC_DRIVER_PN532_UART ON CACHE BOOL "Enable PN532 UART support (Use serial port)")
|
||||||
|
SET(LIBNFC_DRIVER_PN53X_USB ON CACHE BOOL "Enable PN531 and PN531 USB support (Depends on libusb)")
|
||||||
|
|
||||||
|
IF(LIBNFC_DRIVER_PCSC)
|
||||||
|
FIND_PACKAGE(PCSC REQUIRED)
|
||||||
|
ADD_DEFINITIONS("-DDRIVER_PCSC_ENABLED")
|
||||||
|
SET(DRIVERS_SOURCES ${DRIVERS_SOURCES} "drivers/pcsc")
|
||||||
|
ENDIF(LIBNFC_DRIVER_PCSC)
|
||||||
|
|
||||||
|
IF(LIBNFC_DRIVER_ACR122_PCSC)
|
||||||
|
FIND_PACKAGE(PCSC REQUIRED)
|
||||||
|
ADD_DEFINITIONS("-DDRIVER_ACR122_PCSC_ENABLED")
|
||||||
|
SET(DRIVERS_SOURCES ${DRIVERS_SOURCES} "drivers/acr122_pcsc")
|
||||||
|
ENDIF(LIBNFC_DRIVER_ACR122_PCSC)
|
||||||
|
|
||||||
|
IF(LIBNFC_DRIVER_ACR122_USB)
|
||||||
|
FIND_PACKAGE(LIBUSB REQUIRED)
|
||||||
|
ADD_DEFINITIONS("-DDRIVER_ACR122_USB_ENABLED")
|
||||||
|
SET(DRIVERS_SOURCES ${DRIVERS_SOURCES} "drivers/acr122_usb")
|
||||||
|
ENDIF(LIBNFC_DRIVER_ACR122_USB)
|
||||||
|
|
||||||
|
IF(LIBNFC_DRIVER_ACR122S)
|
||||||
|
ADD_DEFINITIONS("-DDRIVER_ACR122S_ENABLED")
|
||||||
|
SET(DRIVERS_SOURCES ${DRIVERS_SOURCES} "drivers/acr122s")
|
||||||
|
SET(UART_REQUIRED TRUE)
|
||||||
|
ENDIF(LIBNFC_DRIVER_ACR122S)
|
||||||
|
|
||||||
|
IF(LIBNFC_DRIVER_ARYGON)
|
||||||
|
ADD_DEFINITIONS("-DDRIVER_ARYGON_ENABLED")
|
||||||
|
SET(DRIVERS_SOURCES ${DRIVERS_SOURCES} "drivers/arygon")
|
||||||
|
SET(UART_REQUIRED TRUE)
|
||||||
|
ENDIF(LIBNFC_DRIVER_ARYGON)
|
||||||
|
|
||||||
|
IF(LIBNFC_DRIVER_PN532_I2C)
|
||||||
|
ADD_DEFINITIONS("-DDRIVER_PN532_I2C_ENABLED")
|
||||||
|
SET(DRIVERS_SOURCES ${DRIVERS_SOURCES} "drivers/pn532_i2c")
|
||||||
|
SET(I2C_REQUIRED TRUE)
|
||||||
|
ENDIF(LIBNFC_DRIVER_PN532_I2C)
|
||||||
|
|
||||||
|
IF(LIBNFC_DRIVER_PN532_SPI)
|
||||||
|
ADD_DEFINITIONS("-DDRIVER_PN532_SPI_ENABLED")
|
||||||
|
SET(DRIVERS_SOURCES ${DRIVERS_SOURCES} "drivers/pn532_spi")
|
||||||
|
SET(SPI_REQUIRED TRUE)
|
||||||
|
ENDIF(LIBNFC_DRIVER_PN532_SPI)
|
||||||
|
|
||||||
|
IF(LIBNFC_DRIVER_PN532_UART)
|
||||||
|
ADD_DEFINITIONS("-DDRIVER_PN532_UART_ENABLED")
|
||||||
|
SET(DRIVERS_SOURCES ${DRIVERS_SOURCES} "drivers/pn532_uart")
|
||||||
|
SET(UART_REQUIRED TRUE)
|
||||||
|
ENDIF(LIBNFC_DRIVER_PN532_UART)
|
||||||
|
|
||||||
|
IF(LIBNFC_DRIVER_PN53X_USB)
|
||||||
|
FIND_PACKAGE(LIBUSB REQUIRED)
|
||||||
|
ADD_DEFINITIONS("-DDRIVER_PN53X_USB_ENABLED")
|
||||||
|
SET(DRIVERS_SOURCES ${DRIVERS_SOURCES} "drivers/pn53x_usb")
|
||||||
|
SET(USB_REQUIRED TRUE)
|
||||||
|
ENDIF(LIBNFC_DRIVER_PN53X_USB)
|
||||||
|
|
||||||
|
IF(LIBNFC_DRIVER_ACR122_USB)
|
||||||
|
FIND_PACKAGE(LIBUSB REQUIRED)
|
||||||
|
ADD_DEFINITIONS("-DDRIVER_ACR122_USB_ENABLED")
|
||||||
|
SET(DRIVERS_SOURCES ${DRIVERS_SOURCES} "drivers/acr122_usb")
|
||||||
|
SET(USB_REQUIRED TRUE)
|
||||||
|
ENDIF(LIBNFC_DRIVER_ACR122_USB)
|
||||||
|
|
||||||
|
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/libnfc/drivers)
|
||||||
6
cmake/modules/Makefile.am
Normal file
6
cmake/modules/Makefile.am
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
EXTRA_DIST = \
|
||||||
|
COPYING-CMAKE-SCRIPTS \
|
||||||
|
FindLIBUSB.cmake \
|
||||||
|
FindPCSC.cmake \
|
||||||
|
UseDoxygen.cmake \
|
||||||
|
LibnfcDrivers.cmake
|
||||||
99
cmake/modules/UseDoxygen.cmake
Normal file
99
cmake/modules/UseDoxygen.cmake
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
# - Run Doxygen
|
||||||
|
#
|
||||||
|
# Adds a doxygen target that runs doxygen to generate the html
|
||||||
|
# and optionally the LaTeX API documentation.
|
||||||
|
# The doxygen target is added to the doc target as dependency.
|
||||||
|
# i.e.: the API documentation is built with:
|
||||||
|
# make doc
|
||||||
|
#
|
||||||
|
# USAGE: GLOBAL INSTALL
|
||||||
|
#
|
||||||
|
# Install it with:
|
||||||
|
# cmake ./ && sudo make install
|
||||||
|
# Add the following to the CMakeLists.txt of your project:
|
||||||
|
# include(UseDoxygen OPTIONAL)
|
||||||
|
# Optionally copy Doxyfile.in in the directory of CMakeLists.txt and edit it.
|
||||||
|
#
|
||||||
|
# USAGE: INCLUDE IN PROJECT
|
||||||
|
#
|
||||||
|
# set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
# include(UseDoxygen)
|
||||||
|
# Add the Doxyfile.in and UseDoxygen.cmake files to the projects source directory.
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# Variables you may define are:
|
||||||
|
# DOXYFILE_OUTPUT_DIR - Path where the Doxygen output is stored. Defaults to "doc".
|
||||||
|
#
|
||||||
|
# DOXYFILE_LATEX_DIR - Directory where the Doxygen LaTeX output is stored. Defaults to "latex".
|
||||||
|
#
|
||||||
|
# DOXYFILE_HTML_DIR - Directory where the Doxygen html output is stored. Defaults to "html".
|
||||||
|
#
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright (c) 2009 Tobias Rautenkranz <tobias@rautenkranz.ch>
|
||||||
|
#
|
||||||
|
# Redistribution and use is allowed according to the terms of the New
|
||||||
|
# BSD license.
|
||||||
|
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||||
|
#
|
||||||
|
|
||||||
|
macro(usedoxygen_set_default name value)
|
||||||
|
if(NOT DEFINED "${name}")
|
||||||
|
set("${name}" "${value}")
|
||||||
|
endif()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
find_package(Doxygen)
|
||||||
|
|
||||||
|
if(DOXYGEN_FOUND)
|
||||||
|
find_file(DOXYFILE_IN "Doxyfile.in"
|
||||||
|
PATHS "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_ROOT}/Modules/")
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
find_package_handle_standard_args(Doxyfile.in DEFAULT_MSG DOXYFILE_IN)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(DOXYGEN_FOUND AND DOXYFILE_IN)
|
||||||
|
add_custom_target(doxygen ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
|
||||||
|
|
||||||
|
usedoxygen_set_default(DOXYFILE_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/doc")
|
||||||
|
usedoxygen_set_default(DOXYFILE_HTML_DIR "html")
|
||||||
|
|
||||||
|
set_property(DIRECTORY APPEND PROPERTY
|
||||||
|
ADDITIONAL_MAKE_CLEAN_FILES "${DOXYFILE_OUTPUT_DIR}/${DOXYFILE_HTML_DIR}")
|
||||||
|
|
||||||
|
set(DOXYFILE_LATEX "NO")
|
||||||
|
set(DOXYFILE_PDFLATEX "NO")
|
||||||
|
set(DOXYFILE_DOT "NO")
|
||||||
|
|
||||||
|
find_package(LATEX)
|
||||||
|
if(LATEX_COMPILER AND MAKEINDEX_COMPILER)
|
||||||
|
set(DOXYFILE_LATEX "YES")
|
||||||
|
usedoxygen_set_default(DOXYFILE_LATEX_DIR "latex")
|
||||||
|
|
||||||
|
set_property(DIRECTORY APPEND PROPERTY
|
||||||
|
ADDITIONAL_MAKE_CLEAN_FILES
|
||||||
|
"${DOXYFILE_OUTPUT_DIR}/${DOXYFILE_LATEX_DIR}")
|
||||||
|
|
||||||
|
if(PDFLATEX_COMPILER)
|
||||||
|
set(DOXYFILE_PDFLATEX "YES")
|
||||||
|
endif()
|
||||||
|
if(DOXYGEN_DOT_EXECUTABLE)
|
||||||
|
set(DOXYFILE_DOT "YES")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_custom_command(TARGET doxygen
|
||||||
|
POST_BUILD
|
||||||
|
COMMAND ${CMAKE_MAKE_PROGRAM}
|
||||||
|
WORKING_DIRECTORY "${DOXYFILE_OUTPUT_DIR}/${DOXYFILE_LATEX_DIR}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
configure_file(${DOXYFILE_IN} Doxyfile ESCAPE_QUOTES IMMEDIATE @ONLY)
|
||||||
|
|
||||||
|
if(NOT TARGET doc)
|
||||||
|
add_custom_target(doc)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_dependencies(doc doxygen)
|
||||||
|
endif()
|
||||||
243
configure.ac
243
configure.ac
@ -1,20 +1,61 @@
|
|||||||
AC_INIT(libnfc, 1.2.0, info@libnfc.org)
|
# General init
|
||||||
|
|
||||||
|
# /!\ Don't forget to update 'CMakeLists.txt' too /!\
|
||||||
|
AC_INIT([libnfc],[1.8.0],[nfc-tools@googlegroups.com])
|
||||||
|
|
||||||
|
AC_CONFIG_MACRO_DIR([m4])
|
||||||
|
|
||||||
AC_CONFIG_HEADER(config.h)
|
AC_CONFIG_HEADER(config.h)
|
||||||
AM_INIT_AUTOMAKE
|
|
||||||
|
|
||||||
AC_LANG_C
|
# GIT revison
|
||||||
|
GIT_REVISION=`which git > /dev/null && git describe`
|
||||||
|
if test x"$GIT_REVISION" != x""; then
|
||||||
|
AC_DEFINE_UNQUOTED([GIT_REVISION], ["$GIT_REVISION"], [GIT revision])
|
||||||
|
fi
|
||||||
|
|
||||||
|
AM_INIT_AUTOMAKE(subdir-objects dist-bzip2 no-dist-gzip foreign)
|
||||||
|
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
|
||||||
|
|
||||||
|
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
|
||||||
|
|
||||||
|
AC_LANG([C])
|
||||||
AC_PROG_CC
|
AC_PROG_CC
|
||||||
AC_PROG_MAKE_SET
|
AC_PROG_MAKE_SET
|
||||||
AC_PROG_LIBTOOL
|
|
||||||
AC_PROG_RANLIB
|
|
||||||
|
|
||||||
AC_PATH_PROG(PKG_CONFIG, pkg-config)
|
WITH_POSIX_ONLY_EXAMPLES=1
|
||||||
|
# Libtool
|
||||||
|
LT_INIT
|
||||||
|
case "$host" in
|
||||||
|
*-pc-linux-gnu)
|
||||||
|
AC_MSG_RESULT([Fixing libtool for -rpath problems.])
|
||||||
|
sed -i -r 's/(hardcode_into_libs)=.*$/\1=no/' libtool
|
||||||
|
;;
|
||||||
|
*-pc-mingw32msvc)
|
||||||
|
WITH_POSIX_ONLY_EXAMPLES=0
|
||||||
|
AC_MSG_RESULT([Disable extended examples due to target Windows system.])
|
||||||
|
# Undefine __STRICT_ANSI__ to allow to use strdup, putenv, etc. without warnings
|
||||||
|
CFLAGS="$CFLAGS -U__STRICT_ANSI__"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
AM_CONDITIONAL(POSIX_ONLY_EXAMPLES_ENABLED, [test "$WITH_POSIX_ONLY_EXAMPLES" = "1"])
|
||||||
|
|
||||||
|
PKG_PROG_PKG_CONFIG
|
||||||
|
|
||||||
# Checks for header files.
|
# Checks for header files.
|
||||||
AC_HEADER_STDC
|
AC_HEADER_STDC
|
||||||
AC_HEADER_STDBOOL
|
AC_HEADER_STDBOOL
|
||||||
AC_CHECK_HEADERS([stdio.h stdlib.h stdint.h stddef.h stdbool.h usb.h])
|
AC_CHECK_HEADERS([fcntl.h limits.h stdio.h stdlib.h stdint.h stddef.h stdbool.h sys/ioctl.h sys/param.h sys/time.h termios.h])
|
||||||
|
AC_CHECK_HEADERS([linux/spi/spidev.h], [spi_available="yes"])
|
||||||
|
AC_CHECK_HEADERS([linux/i2c-dev.h], [i2c_available="yes"])
|
||||||
|
AC_CHECK_HEADERS([linux_nfc_api.h], [nfc_nci_available="yes"])
|
||||||
|
AC_CHECK_FUNCS([memmove memset select strdup strerror strstr strtol usleep],
|
||||||
|
[AC_DEFINE([_XOPEN_SOURCE], [600], [Enable POSIX extensions if present])])
|
||||||
|
|
||||||
|
AC_DEFINE(_NETBSD_SOURCE, 1, [Define on NetBSD to activate all library features])
|
||||||
|
AC_DEFINE(_DARWIN_C_SOURCE, 1, [Define on Darwin to activate all library features])
|
||||||
|
|
||||||
|
# Note: malloc function should be tested but it produces some error while cross-compiling with MinGW
|
||||||
|
# AC_FUNC_MALLOC
|
||||||
|
|
||||||
# Checks for types
|
# Checks for types
|
||||||
AC_TYPE_SIZE_T
|
AC_TYPE_SIZE_T
|
||||||
@ -22,79 +63,167 @@ AC_TYPE_UINT8_T
|
|||||||
AC_TYPE_UINT16_T
|
AC_TYPE_UINT16_T
|
||||||
AC_TYPE_UINT32_T
|
AC_TYPE_UINT32_T
|
||||||
AC_TYPE_UINT64_T
|
AC_TYPE_UINT64_T
|
||||||
|
AC_TYPE_INT16_T
|
||||||
AC_TYPE_INT32_T
|
AC_TYPE_INT32_T
|
||||||
|
AC_TYPE_OFF_T
|
||||||
|
|
||||||
# --enable-pcsc-lite support (default: yes)
|
LIBNFC_CFLAGS='-I$(top_srcdir)/libnfc -I$(top_builddir)/include -I$(top_srcdir)/include'
|
||||||
AC_ARG_ENABLE([pcsc-lite],AS_HELP_STRING([--enable-pcsc-lite],[pcsc-lite feature flag]),[enable_pcsc_lite=$enableval],[enable_pcsc_lite="yes"])
|
AC_SUBST(LIBNFC_CFLAGS)
|
||||||
|
|
||||||
|
# Log support (default:yes)
|
||||||
|
AC_ARG_ENABLE([log],AS_HELP_STRING([--disable-log],[Disable any logs]),[enable_log=$enableval],[enable_log="yes"])
|
||||||
|
AC_MSG_CHECKING(for log flag)
|
||||||
|
AC_MSG_RESULT($enable_log)
|
||||||
|
AM_CONDITIONAL([WITH_LOG], [test "$enable_log" != "no"])
|
||||||
|
|
||||||
AC_MSG_CHECKING(for pcsc-lite support)
|
if test x"$enable_log" = "xyes"
|
||||||
AC_MSG_RESULT($enable_pcsc_lite)
|
|
||||||
|
|
||||||
if test x"$enable_pcsc_lite" = "xno"
|
|
||||||
then
|
then
|
||||||
WITH_PCSC=0
|
AC_DEFINE([LOG], [1], [Enable log])
|
||||||
fi
|
fi
|
||||||
AM_CONDITIONAL(PCSC_LITE_ENABLED, [test x"$enable_pcsc_lite" = xyes])
|
|
||||||
|
|
||||||
# --enable-debug support (default:no)
|
# Conffiles support (default:yes)
|
||||||
AC_ARG_ENABLE([debug],AS_HELP_STRING([--enable-debug],[Debug flags]),[enable_debug=$enableval],[enable_debug="no"])
|
AC_ARG_ENABLE([conffiles],AS_HELP_STRING([--disable-conffiles],[Disable use of config files]),[enable_conffiles=$enableval],[enable_conffiles="yes"])
|
||||||
|
AC_MSG_CHECKING(for conffiles flag)
|
||||||
|
AC_MSG_RESULT($enable_conffiles)
|
||||||
|
AM_CONDITIONAL([WITH_CONFFILES], [test "$enable_conffiles" != "no"])
|
||||||
|
|
||||||
|
if test x"$enable_conffiles" = "xyes"
|
||||||
|
then
|
||||||
|
AC_DEFINE([CONFFILES], [1], [Enable conffiles])
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Envvars support (default:yes)
|
||||||
|
AC_ARG_ENABLE([envvars],AS_HELP_STRING([--disable-envvars],[Disable use of environment variables]),[enable_envvars=$enableval],[enable_envvars="yes"])
|
||||||
|
AC_MSG_CHECKING(for envvars flag)
|
||||||
|
AC_MSG_RESULT($enable_envvars)
|
||||||
|
AM_CONDITIONAL([WITH_ENVVARS], [test "$enable_envvars" != "no"])
|
||||||
|
|
||||||
|
if test x"$enable_envvars" = "xyes"
|
||||||
|
then
|
||||||
|
AC_DEFINE([ENVVARS], [1], [Enable envvars])
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Debug support (default:no)
|
||||||
|
AC_ARG_ENABLE([debug],AS_HELP_STRING([--enable-debug],[Enable debug mode]),[enable_debug=$enableval],[enable_debug="no"])
|
||||||
AC_MSG_CHECKING(for debug flag)
|
AC_MSG_CHECKING(for debug flag)
|
||||||
AC_MSG_RESULT($enable_debug)
|
AC_MSG_RESULT($enable_debug)
|
||||||
|
AM_CONDITIONAL([WITH_DEBUG], [test "$enable_debug" != "no"])
|
||||||
|
|
||||||
if test x"$enable_debug" = "xyes"
|
if test x"$enable_debug" = "xyes"
|
||||||
then
|
then
|
||||||
CFLAGS="$CFLAGS -g -Wall -DDEBUG -pedantic"
|
AC_DEFINE([DEBUG], [1], [Enable debug flag])
|
||||||
fi
|
CFLAGS="$CFLAGS -g -O0 -ggdb"
|
||||||
AC_SUBST([DEBUG_CFLAGS])
|
|
||||||
|
|
||||||
## libusb
|
|
||||||
if test x"$PKG_CONFIG" = "x"; then
|
|
||||||
AC_PATH_PROG(LIBUSB_CONFIG,libusb-config)
|
|
||||||
if test x"$LIBUSB_CONFIG" = "x" ; then
|
|
||||||
WITH_USB=0
|
|
||||||
else
|
|
||||||
LIBUSB_CFLAGS=`$LIBUSB_CONFIG --cflags`
|
|
||||||
LIBUSB_LIBS=`$LIBUSB_CONFIG --libs`
|
|
||||||
WITH_USB=1
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
PKG_CHECK_MODULES(LIBUSB, libusb, [WITH_USB=1], [WITH_USB=0])
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test x"$WITH_USB" = "x0"; then
|
# Handle --with-drivers option
|
||||||
AC_MSG_ERROR([libusb is mandatory.])
|
LIBNFC_ARG_WITH_DRIVERS
|
||||||
fi
|
|
||||||
AC_SUBST(LIBUSB_LIBS)
|
|
||||||
AC_SUBST(LIBUSB_CFLAGS)
|
|
||||||
|
|
||||||
## libpcsclite
|
# Enable UART if
|
||||||
if test "x$enable_pcsc_lite" = "xyes"
|
AM_CONDITIONAL(UART_ENABLED, [test x"$uart_required" = x"yes"])
|
||||||
|
|
||||||
|
# Enable SPI if
|
||||||
|
AM_CONDITIONAL(SPI_ENABLED, [test x"$spi_required" = x"yes"])
|
||||||
|
|
||||||
|
# Enable I2C if
|
||||||
|
AM_CONDITIONAL(I2C_ENABLED, [test x"$i2c_required" = x"yes"])
|
||||||
|
if test x"$i2c_required" = x"yes"
|
||||||
then
|
then
|
||||||
case "$host" in
|
AC_SEARCH_LIBS([clock_gettime], [rt])
|
||||||
*darwin*)
|
|
||||||
AC_MSG_WARN(Using darwin PCSC Framework)
|
|
||||||
LIBPCSCLITE_LIBS="-Wl,-framework,PCSC"
|
|
||||||
LIBPCSCLITE_CFLAGS="-I/System/Library/Frameworks/PCSC.framework/Headers"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
PKG_CHECK_MODULES(LIBPCSCLITE, libpcsclite, [WITH_PCSC=1], [WITH_PCSC=0])
|
|
||||||
if test "$WITH_PCSC" = "0" ; then
|
|
||||||
AC_MSG_ERROR([libpcsclite is mandatory.])
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
AC_SUBST(LIBPCSCLITE_LIBS)
|
|
||||||
AC_SUBST(LIBPCSCLITE_CFLAGS)
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Set C standard to C99
|
# Enable Libnfc-NCI if required
|
||||||
|
if test x"$nfc_nci_required" = x"yes"
|
||||||
|
then
|
||||||
|
PKG_CHECK_MODULES([LIBNFC_NCI], [libnfc-nci],
|
||||||
|
[AC_MSG_NOTICE([libnfc-nci present])],
|
||||||
|
[AC_MSG_ERROR([libnfc-nci not present but required for some drivers configuration])]
|
||||||
|
)
|
||||||
|
CFLAGS="$CFLAGS $LIBNFC_NCI_CFLAGS"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Documentation (default: no)
|
||||||
|
AC_ARG_ENABLE([doc],AS_HELP_STRING([--enable-doc],[Enable documentation generation.]),[enable_doc=$enableval],[enable_doc="no"])
|
||||||
|
|
||||||
|
AC_MSG_CHECKING(for documentation request)
|
||||||
|
AC_MSG_RESULT($enable_doc)
|
||||||
|
|
||||||
|
if test x"$enable_doc" = "xyes"
|
||||||
|
then
|
||||||
|
AC_PATH_PROG([DOXYGEN], [doxygen])
|
||||||
|
if test x$DOXYGEN = x
|
||||||
|
then
|
||||||
|
AC_MSG_ERROR([doxygen is mandatory.])
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
AM_CONDITIONAL(DOC_ENABLED, [test x"$enable_doc" = xyes])
|
||||||
|
|
||||||
|
# Example build (default: yes)
|
||||||
|
AC_ARG_ENABLE([example],AS_HELP_STRING([--enable-example],[Enable example build.]),[enable_example=$enableval],[enable_example="yes"])
|
||||||
|
|
||||||
|
AC_MSG_CHECKING(for example build)
|
||||||
|
AC_MSG_RESULT($enable_example)
|
||||||
|
|
||||||
|
AM_CONDITIONAL(EXAMPLE_ENABLED, [test x"$enable_example" = xyes])
|
||||||
|
|
||||||
|
# Dependencies
|
||||||
|
PKG_CONFIG_REQUIRES=""
|
||||||
|
|
||||||
|
LIBNFC_CHECK_LIBUSB
|
||||||
|
LIBNFC_CHECK_PCSC
|
||||||
|
|
||||||
|
AC_SUBST(PKG_CONFIG_REQUIRES)
|
||||||
|
|
||||||
|
AM_CONDITIONAL(LIBUSB_ENABLED, [test "$HAVE_LIBUSB" = "1"])
|
||||||
|
AM_CONDITIONAL(PCSC_ENABLED, [test "$HAVE_PCSC" = "1"])
|
||||||
|
|
||||||
|
CUTTER_REQUIRED_VERSION=1.1.7
|
||||||
|
m4_ifdef([AC_CHECK_CUTTER], [AC_CHECK_CUTTER([>= $CUTTER_REQUIRED_VERSION])], [ac_cv_use_cutter="no"])
|
||||||
|
if test x$ac_cv_with_cutter = xyes -a x$ac_cv_use_cutter = xno; then
|
||||||
|
AC_MSG_ERROR([cutter >= $CUTTER_REQUIRED_VERSION is mandatory.])
|
||||||
|
fi
|
||||||
|
AM_CONDITIONAL([WITH_CUTTER], [test "$ac_cv_use_cutter" != "no"])
|
||||||
|
|
||||||
|
if test x"$enable_example" = "xyes"
|
||||||
|
then
|
||||||
|
AC_CHECK_READLINE
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Help us to write great code ;-)
|
||||||
|
CFLAGS="$CFLAGS -Wall -pedantic -Wextra"
|
||||||
|
|
||||||
|
# Defines and C flags
|
||||||
CFLAGS="$CFLAGS -std=c99"
|
CFLAGS="$CFLAGS -std=c99"
|
||||||
|
|
||||||
|
# Workarounds for libusb in c99
|
||||||
|
CFLAGS="$CFLAGS -Du_int8_t=uint8_t -Du_int16_t=uint16_t"
|
||||||
|
|
||||||
AC_CONFIG_FILES([
|
AC_CONFIG_FILES([
|
||||||
|
Doxyfile
|
||||||
Makefile
|
Makefile
|
||||||
src/Makefile
|
cmake/Makefile
|
||||||
|
cmake/modules/Makefile
|
||||||
|
contrib/Makefile
|
||||||
|
contrib/devd/Makefile
|
||||||
|
contrib/libnfc/Makefile
|
||||||
|
contrib/linux/Makefile
|
||||||
|
contrib/udev/Makefile
|
||||||
|
contrib/win32/Makefile
|
||||||
|
contrib/win32/sys/Makefile
|
||||||
|
contrib/win32/libnfc/Makefile
|
||||||
|
contrib/win32/libnfc/buses/Makefile
|
||||||
|
examples/Makefile
|
||||||
|
examples/pn53x-tamashell-scripts/Makefile
|
||||||
|
include/Makefile
|
||||||
|
include/nfc/Makefile
|
||||||
libnfc.pc
|
libnfc.pc
|
||||||
|
libnfc/Makefile
|
||||||
|
libnfc/buses/Makefile
|
||||||
|
libnfc/chips/Makefile
|
||||||
|
libnfc/drivers/Makefile
|
||||||
|
test/Makefile
|
||||||
|
utils/Makefile
|
||||||
])
|
])
|
||||||
|
|
||||||
AC_OUTPUT
|
AC_OUTPUT
|
||||||
|
|
||||||
|
LIBNFC_DRIVERS_SUMMARY
|
||||||
|
|||||||
9
contrib/Makefile.am
Normal file
9
contrib/Makefile.am
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
SUBDIRS = \
|
||||||
|
devd \
|
||||||
|
libnfc \
|
||||||
|
linux \
|
||||||
|
udev \
|
||||||
|
win32
|
||||||
|
|
||||||
|
EXTRA_DIST = \
|
||||||
|
windows.h
|
||||||
2
contrib/devd/Makefile.am
Normal file
2
contrib/devd/Makefile.am
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
EXTRA_DIST = \
|
||||||
|
pn53x.conf
|
||||||
36
contrib/devd/pn53x.conf
Normal file
36
contrib/devd/pn53x.conf
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
# FreeBSD devd(8) rules for PN531 & PN533 devices.
|
||||||
|
|
||||||
|
attach 110 {
|
||||||
|
match "vendor" "0x04cc";
|
||||||
|
match "product" "(0x0531|0x2533)";
|
||||||
|
action "/usr/bin/chgrp nfc /dev/$device-name";
|
||||||
|
action "/bin/chmod g+rw /dev/$device-name";
|
||||||
|
};
|
||||||
|
|
||||||
|
attach 110 {
|
||||||
|
match "vendor" "0x04e6";
|
||||||
|
match "product" "0x5591";
|
||||||
|
action "/usr/bin/chgrp nfc /dev/$device-name";
|
||||||
|
action "/bin/chmod g+rw /dev/$device-name";
|
||||||
|
};
|
||||||
|
|
||||||
|
attach 110 {
|
||||||
|
match "vendor" "0x054c";
|
||||||
|
match "product" "0x0193";
|
||||||
|
action "/usr/bin/chgrp nfc /dev/$device-name";
|
||||||
|
action "/bin/chmod g+rw /dev/$device-name";
|
||||||
|
};
|
||||||
|
|
||||||
|
attach 110 {
|
||||||
|
match "vendor" "0x1fd3";
|
||||||
|
match "product" "0x0608";
|
||||||
|
action "/usr/bin/chgrp nfc /dev/$device-name";
|
||||||
|
action "/bin/chmod g+rw /dev/$device-name";
|
||||||
|
};
|
||||||
|
|
||||||
|
attach 110 {
|
||||||
|
match "vendor" "0x054c";
|
||||||
|
match "product" "0x02e1";
|
||||||
|
action "/usr/bin/chgrp nfc /dev/$device-name";
|
||||||
|
action "/bin/chmod g+rw /dev/$device-name";
|
||||||
|
};
|
||||||
7
contrib/libnfc/Makefile.am
Normal file
7
contrib/libnfc/Makefile.am
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
EXTRA_DIST = \
|
||||||
|
arygon.conf.sample \
|
||||||
|
pn532_i2c_on_rpi.conf.sample \
|
||||||
|
pn532_spi_on_rpi.conf.sample \
|
||||||
|
pn532_uart_on_rpi_3.conf.sample \
|
||||||
|
pn532_uart_on_rpi.conf.sample \
|
||||||
|
pn532_via_uart2usb.conf.sample
|
||||||
3
contrib/libnfc/arygon.conf.sample
Normal file
3
contrib/libnfc/arygon.conf.sample
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
## Typical configuration file for Arygon/IDentive device (with Arygon-MCU on board)
|
||||||
|
name = "IDentive"
|
||||||
|
connstring = arygon:/dev/ttyS0
|
||||||
12
contrib/libnfc/pn532_i2c_on_rpi.conf.sample
Normal file
12
contrib/libnfc/pn532_i2c_on_rpi.conf.sample
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
## Typical configuration file for PN532 device on R-Pi connected using I2C
|
||||||
|
## Note: to use SPI port on R-Pi, you have to load kernel modules i2c-bcm2708 and i2c-dev:
|
||||||
|
## Edit /etc/modprobe.d/raspi-blacklist.conf and comment: #blacklist i2c-bcm2708
|
||||||
|
## Edit /etc/modules and add a new line: i2c-dev
|
||||||
|
name = "PN532 board via I2C"
|
||||||
|
connstring = pn532_i2c:/dev/i2c-0
|
||||||
|
|
||||||
|
# Note: If you have an R-Pi revision 2.0, the I2C bus #1 is now routed to connector P1
|
||||||
|
# (instead of the I2C bus #0 routed on same connector on initial board revision), so
|
||||||
|
# the configuration to use would probably be:
|
||||||
|
|
||||||
|
# connstring = pn532_i2c:/dev/i2c-1
|
||||||
5
contrib/libnfc/pn532_spi_on_rpi.conf.sample
Normal file
5
contrib/libnfc/pn532_spi_on_rpi.conf.sample
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
## Typical configuration file for PN532 device on R-Pi connected using SPI
|
||||||
|
## Note: to use SPI port on R-Pi, you have to load kernel module spi-bcm2708:
|
||||||
|
## Edit /etc/modprobe.d/raspi-blacklist.conf and comment: #blacklist spi-bcm2708
|
||||||
|
name = "PN532 board via SPI"
|
||||||
|
connstring = pn532_spi:/dev/spidev0.0:500000
|
||||||
5
contrib/libnfc/pn532_uart_on_rpi.conf.sample
Normal file
5
contrib/libnfc/pn532_uart_on_rpi.conf.sample
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
## Typical configuration file for PN532 device on R-Pi connected using UART
|
||||||
|
## Note: to use UART port on R-Pi, you have to disable linux serial console:
|
||||||
|
## http://learn.adafruit.com/adafruit-nfc-rfid-on-raspberry-pi/freeing-uart-on-the-pi
|
||||||
|
name = "PN532 board via UART"
|
||||||
|
connstring = pn532_uart:/dev/ttyAMA0
|
||||||
22
contrib/libnfc/pn532_uart_on_rpi_3.conf.sample
Normal file
22
contrib/libnfc/pn532_uart_on_rpi_3.conf.sample
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
## Typical configuration file for PN532 device on R-Pi 3 connected using miniUART
|
||||||
|
## Note: Changes have been made to R-Pi 3 with the addition of Bluetooth LE
|
||||||
|
## The UART is now being used by the BLE module. Instead of disabling it, you can
|
||||||
|
## use the PN532 device with the "mini UART", which is still hijacked by the linux kernel
|
||||||
|
## as a serial console
|
||||||
|
##
|
||||||
|
## Tested recipe with PN532 breakout from Adafruit
|
||||||
|
##
|
||||||
|
## To enable uart on GPIO, add this line to bottom of /boot/config.txt
|
||||||
|
## enable_uart=1
|
||||||
|
##
|
||||||
|
## Stop and disable serial console:
|
||||||
|
## $ sudo systemctl stop serial-getty@ttyS0.service
|
||||||
|
## $ sudo systemctl disable serial-getty@ttyS0.service
|
||||||
|
##
|
||||||
|
## Remove console from /boot/cmdline.txt by removing:
|
||||||
|
## console=serial0,115200 Save and reboot for changes to take effect.
|
||||||
|
##
|
||||||
|
name = "PN532 board via UART"
|
||||||
|
connstring = pn532_uart:/dev/ttyS0
|
||||||
|
allow_intrusive_scan = true
|
||||||
|
|
||||||
3
contrib/libnfc/pn532_via_uart2usb.conf.sample
Normal file
3
contrib/libnfc/pn532_via_uart2usb.conf.sample
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
## Typical configuration file for PN532 board (ie. microbuilder.eu / Adafruit) device
|
||||||
|
name = "Adafruit PN532 board via UART"
|
||||||
|
connstring = pn532_uart:/dev/ttyUSB0
|
||||||
2
contrib/linux/Makefile.am
Normal file
2
contrib/linux/Makefile.am
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
EXTRA_DIST = \
|
||||||
|
blacklist-libnfc.conf
|
||||||
3
contrib/linux/blacklist-libnfc.conf
Normal file
3
contrib/linux/blacklist-libnfc.conf
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
blacklist nfc
|
||||||
|
blacklist pn533
|
||||||
|
blacklist pn533_usb
|
||||||
22
contrib/udev/93-pn53x.rules
Normal file
22
contrib/udev/93-pn53x.rules
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
# udev rules file for PN531 and PN533 devices (for udev 0.98 version)
|
||||||
|
# to be installed in /etc/udev/rules.d
|
||||||
|
|
||||||
|
SUBSYSTEM!="usb|usb_device", GOTO="pn53x_rules_end"
|
||||||
|
ACTION!="add", GOTO="pn53x_rules_end"
|
||||||
|
|
||||||
|
# PN531
|
||||||
|
ATTRS{idVendor}=="04cc", ATTRS{idProduct}=="0531", MODE="0664", GROUP="plugdev"
|
||||||
|
ATTRS{idVendor}=="054c", ATTRS{idProduct}=="0193", MODE="0664", GROUP="plugdev"
|
||||||
|
|
||||||
|
# PN533
|
||||||
|
ATTRS{idVendor}=="04cc", ATTRS{idProduct}=="2533", MODE="0664", GROUP="plugdev"
|
||||||
|
ATTRS{idVendor}=="04e6", ATTRS{idProduct}=="5591", MODE="0664", GROUP="plugdev"
|
||||||
|
ATTRS{idVendor}=="04e6", ATTRS{idProduct}=="5594", MODE="0664", GROUP="plugdev"
|
||||||
|
ATTRS{idVendor}=="1fd3", ATTRS{idProduct}=="0608", MODE="0664", GROUP="plugdev"
|
||||||
|
ATTRS{idVendor}=="054c", ATTRS{idProduct}=="02e1", MODE="0664", GROUP="plugdev"
|
||||||
|
|
||||||
|
# ACR122 / Touchatag
|
||||||
|
ATTRS{idVendor}=="072f", ATTRS{idProduct}=="2200", MODE="0664", GROUP="plugdev"
|
||||||
|
ATTRS{idVendor}=="072f", ATTRS{idProduct}=="90cc", MODE="0664", GROUP="plugdev"
|
||||||
|
|
||||||
|
LABEL="pn53x_rules_end"
|
||||||
2
contrib/udev/Makefile.am
Normal file
2
contrib/udev/Makefile.am
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
EXTRA_DIST = \
|
||||||
|
93-pn53x.rules
|
||||||
8
contrib/win32/Makefile.am
Normal file
8
contrib/win32/Makefile.am
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
SUBDIRS = libnfc sys .
|
||||||
|
|
||||||
|
EXTRA_DIST = \
|
||||||
|
err.h \
|
||||||
|
nfc.def \
|
||||||
|
stdlib.c \
|
||||||
|
unistd.h \
|
||||||
|
version.rc.in
|
||||||
870
contrib/win32/dirent.h
Normal file
870
contrib/win32/dirent.h
Normal file
@ -0,0 +1,870 @@
|
|||||||
|
/*
|
||||||
|
* Dirent interface for Microsoft Visual Studio
|
||||||
|
*
|
||||||
|
* Copyright (C) 2006-2012 Toni Ronkko
|
||||||
|
* This file is part of dirent. Dirent may be freely distributed
|
||||||
|
* under the MIT license. For all details and documentation, see
|
||||||
|
* https://github.com/tronkko/dirent
|
||||||
|
*/
|
||||||
|
#ifndef DIRENT_H
|
||||||
|
#define DIRENT_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Include windows.h without Windows Sockets 1.1 to prevent conflicts with
|
||||||
|
* Windows Sockets 2.0.
|
||||||
|
*/
|
||||||
|
#ifndef WIN32_LEAN_AND_MEAN
|
||||||
|
# define WIN32_LEAN_AND_MEAN
|
||||||
|
#endif
|
||||||
|
#include <windows.h>
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <wchar.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <malloc.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
/* Indicates that d_type field is available in dirent structure */
|
||||||
|
#define _DIRENT_HAVE_D_TYPE
|
||||||
|
|
||||||
|
/* Indicates that d_namlen field is available in dirent structure */
|
||||||
|
#define _DIRENT_HAVE_D_NAMLEN
|
||||||
|
|
||||||
|
/* Entries missing from MSVC 6.0 */
|
||||||
|
#if !defined(FILE_ATTRIBUTE_DEVICE)
|
||||||
|
# define FILE_ATTRIBUTE_DEVICE 0x40
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* File type and permission flags for stat(), general mask */
|
||||||
|
#if !defined(S_IFMT)
|
||||||
|
# define S_IFMT _S_IFMT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Directory bit */
|
||||||
|
#if !defined(S_IFDIR)
|
||||||
|
# define S_IFDIR _S_IFDIR
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Character device bit */
|
||||||
|
#if !defined(S_IFCHR)
|
||||||
|
# define S_IFCHR _S_IFCHR
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Pipe bit */
|
||||||
|
#if !defined(S_IFFIFO)
|
||||||
|
# define S_IFFIFO _S_IFFIFO
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Regular file bit */
|
||||||
|
#if !defined(S_IFREG)
|
||||||
|
# define S_IFREG _S_IFREG
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Read permission */
|
||||||
|
#if !defined(S_IREAD)
|
||||||
|
# define S_IREAD _S_IREAD
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Write permission */
|
||||||
|
#if !defined(S_IWRITE)
|
||||||
|
# define S_IWRITE _S_IWRITE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Execute permission */
|
||||||
|
#if !defined(S_IEXEC)
|
||||||
|
# define S_IEXEC _S_IEXEC
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Pipe */
|
||||||
|
#if !defined(S_IFIFO)
|
||||||
|
# define S_IFIFO _S_IFIFO
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Block device */
|
||||||
|
#if !defined(S_IFBLK)
|
||||||
|
# define S_IFBLK 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Link */
|
||||||
|
#if !defined(S_IFLNK)
|
||||||
|
# define S_IFLNK 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Socket */
|
||||||
|
#if !defined(S_IFSOCK)
|
||||||
|
# define S_IFSOCK 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Read user permission */
|
||||||
|
#if !defined(S_IRUSR)
|
||||||
|
# define S_IRUSR S_IREAD
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Write user permission */
|
||||||
|
#if !defined(S_IWUSR)
|
||||||
|
# define S_IWUSR S_IWRITE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Execute user permission */
|
||||||
|
#if !defined(S_IXUSR)
|
||||||
|
# define S_IXUSR 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Read group permission */
|
||||||
|
#if !defined(S_IRGRP)
|
||||||
|
# define S_IRGRP 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Write group permission */
|
||||||
|
#if !defined(S_IWGRP)
|
||||||
|
# define S_IWGRP 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Execute group permission */
|
||||||
|
#if !defined(S_IXGRP)
|
||||||
|
# define S_IXGRP 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Read others permission */
|
||||||
|
#if !defined(S_IROTH)
|
||||||
|
# define S_IROTH 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Write others permission */
|
||||||
|
#if !defined(S_IWOTH)
|
||||||
|
# define S_IWOTH 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Execute others permission */
|
||||||
|
#if !defined(S_IXOTH)
|
||||||
|
# define S_IXOTH 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Maximum length of file name */
|
||||||
|
#if !defined(PATH_MAX)
|
||||||
|
# define PATH_MAX MAX_PATH
|
||||||
|
#endif
|
||||||
|
#if !defined(FILENAME_MAX)
|
||||||
|
# define FILENAME_MAX MAX_PATH
|
||||||
|
#endif
|
||||||
|
#if !defined(NAME_MAX)
|
||||||
|
# define NAME_MAX FILENAME_MAX
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* File type flags for d_type */
|
||||||
|
#define DT_UNKNOWN 0
|
||||||
|
#define DT_REG S_IFREG
|
||||||
|
#define DT_DIR S_IFDIR
|
||||||
|
#define DT_FIFO S_IFIFO
|
||||||
|
#define DT_SOCK S_IFSOCK
|
||||||
|
#define DT_CHR S_IFCHR
|
||||||
|
#define DT_BLK S_IFBLK
|
||||||
|
#define DT_LNK S_IFLNK
|
||||||
|
|
||||||
|
/* Macros for converting between st_mode and d_type */
|
||||||
|
#define IFTODT(mode) ((mode) & S_IFMT)
|
||||||
|
#define DTTOIF(type) (type)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* File type macros. Note that block devices, sockets and links cannot be
|
||||||
|
* distinguished on Windows and the macros S_ISBLK, S_ISSOCK and S_ISLNK are
|
||||||
|
* only defined for compatibility. These macros should always return false
|
||||||
|
* on Windows.
|
||||||
|
*/
|
||||||
|
#if !defined(S_ISFIFO)
|
||||||
|
# define S_ISFIFO(mode) (((mode) & S_IFMT) == S_IFIFO)
|
||||||
|
#endif
|
||||||
|
#if !defined(S_ISDIR)
|
||||||
|
# define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
|
||||||
|
#endif
|
||||||
|
#if !defined(S_ISREG)
|
||||||
|
# define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
|
||||||
|
#endif
|
||||||
|
#if !defined(S_ISLNK)
|
||||||
|
# define S_ISLNK(mode) (((mode) & S_IFMT) == S_IFLNK)
|
||||||
|
#endif
|
||||||
|
#if !defined(S_ISSOCK)
|
||||||
|
# define S_ISSOCK(mode) (((mode) & S_IFMT) == S_IFSOCK)
|
||||||
|
#endif
|
||||||
|
#if !defined(S_ISCHR)
|
||||||
|
# define S_ISCHR(mode) (((mode) & S_IFMT) == S_IFCHR)
|
||||||
|
#endif
|
||||||
|
#if !defined(S_ISBLK)
|
||||||
|
# define S_ISBLK(mode) (((mode) & S_IFMT) == S_IFBLK)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Return the exact length of the file name without zero terminator */
|
||||||
|
#define _D_EXACT_NAMLEN(p) ((p)->d_namlen)
|
||||||
|
|
||||||
|
/* Return the maximum size of a file name */
|
||||||
|
#define _D_ALLOC_NAMLEN(p) ((PATH_MAX)+1)
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* Wide-character version */
|
||||||
|
struct _wdirent {
|
||||||
|
/* Always zero */
|
||||||
|
long d_ino;
|
||||||
|
|
||||||
|
/* File position within stream */
|
||||||
|
long d_off;
|
||||||
|
|
||||||
|
/* Structure size */
|
||||||
|
unsigned short d_reclen;
|
||||||
|
|
||||||
|
/* Length of name without \0 */
|
||||||
|
size_t d_namlen;
|
||||||
|
|
||||||
|
/* File type */
|
||||||
|
int d_type;
|
||||||
|
|
||||||
|
/* File name */
|
||||||
|
wchar_t d_name[PATH_MAX+1];
|
||||||
|
};
|
||||||
|
typedef struct _wdirent _wdirent;
|
||||||
|
|
||||||
|
struct _WDIR {
|
||||||
|
/* Current directory entry */
|
||||||
|
struct _wdirent ent;
|
||||||
|
|
||||||
|
/* Private file data */
|
||||||
|
WIN32_FIND_DATAW data;
|
||||||
|
|
||||||
|
/* True if data is valid */
|
||||||
|
int cached;
|
||||||
|
|
||||||
|
/* Win32 search handle */
|
||||||
|
HANDLE handle;
|
||||||
|
|
||||||
|
/* Initial directory name */
|
||||||
|
wchar_t *patt;
|
||||||
|
};
|
||||||
|
typedef struct _WDIR _WDIR;
|
||||||
|
|
||||||
|
/* Multi-byte character version */
|
||||||
|
struct dirent {
|
||||||
|
/* Always zero */
|
||||||
|
long d_ino;
|
||||||
|
|
||||||
|
/* File position within stream */
|
||||||
|
long d_off;
|
||||||
|
|
||||||
|
/* Structure size */
|
||||||
|
unsigned short d_reclen;
|
||||||
|
|
||||||
|
/* Length of name without \0 */
|
||||||
|
size_t d_namlen;
|
||||||
|
|
||||||
|
/* File type */
|
||||||
|
int d_type;
|
||||||
|
|
||||||
|
/* File name */
|
||||||
|
char d_name[PATH_MAX+1];
|
||||||
|
};
|
||||||
|
typedef struct dirent dirent;
|
||||||
|
|
||||||
|
struct DIR {
|
||||||
|
struct dirent ent;
|
||||||
|
struct _WDIR *wdirp;
|
||||||
|
};
|
||||||
|
typedef struct DIR DIR;
|
||||||
|
|
||||||
|
|
||||||
|
/* Dirent functions */
|
||||||
|
static DIR *opendir (const char *dirname);
|
||||||
|
static _WDIR *_wopendir (const wchar_t *dirname);
|
||||||
|
|
||||||
|
static struct dirent *readdir (DIR *dirp);
|
||||||
|
|
||||||
|
static int readdir_r(
|
||||||
|
DIR *dirp, struct dirent *entry, struct dirent **result);
|
||||||
|
|
||||||
|
static int closedir (DIR *dirp);
|
||||||
|
static int _wclosedir (_WDIR *dirp);
|
||||||
|
|
||||||
|
/* For compatibility with Symbian */
|
||||||
|
#define wdirent _wdirent
|
||||||
|
#define WDIR _WDIR
|
||||||
|
#define wopendir _wopendir
|
||||||
|
#define wreaddir _wreaddir
|
||||||
|
#define wclosedir _wclosedir
|
||||||
|
#define wrewinddir _wrewinddir
|
||||||
|
|
||||||
|
|
||||||
|
/* Internal utility functions */
|
||||||
|
static WIN32_FIND_DATAW *dirent_first (_WDIR *dirp);
|
||||||
|
static WIN32_FIND_DATAW *dirent_next (_WDIR *dirp);
|
||||||
|
|
||||||
|
static int dirent_mbstowcs_s(
|
||||||
|
size_t *pReturnValue,
|
||||||
|
wchar_t *wcstr,
|
||||||
|
size_t sizeInWords,
|
||||||
|
const char *mbstr,
|
||||||
|
size_t count);
|
||||||
|
|
||||||
|
static int dirent_wcstombs_s(
|
||||||
|
size_t *pReturnValue,
|
||||||
|
char *mbstr,
|
||||||
|
size_t sizeInBytes,
|
||||||
|
const wchar_t *wcstr,
|
||||||
|
size_t count);
|
||||||
|
|
||||||
|
static void dirent_set_errno (int error);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Open directory stream DIRNAME for read and return a pointer to the
|
||||||
|
* internal working area that is used to retrieve individual directory
|
||||||
|
* entries.
|
||||||
|
*/
|
||||||
|
static _WDIR*
|
||||||
|
_wopendir(
|
||||||
|
const wchar_t *dirname)
|
||||||
|
{
|
||||||
|
_WDIR *dirp = NULL;
|
||||||
|
int error;
|
||||||
|
|
||||||
|
/* Must have directory name */
|
||||||
|
if (dirname == NULL || dirname[0] == '\0') {
|
||||||
|
dirent_set_errno (ENOENT);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Allocate new _WDIR structure */
|
||||||
|
dirp = (_WDIR*) malloc (sizeof (struct _WDIR));
|
||||||
|
if (dirp != NULL) {
|
||||||
|
DWORD n;
|
||||||
|
|
||||||
|
/* Reset _WDIR structure */
|
||||||
|
dirp->handle = INVALID_HANDLE_VALUE;
|
||||||
|
dirp->patt = NULL;
|
||||||
|
dirp->cached = 0;
|
||||||
|
|
||||||
|
/* Compute the length of full path plus zero terminator
|
||||||
|
*
|
||||||
|
* Note that on WinRT there's no way to convert relative paths
|
||||||
|
* into absolute paths, so just assume it is an absolute path.
|
||||||
|
*/
|
||||||
|
# if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP)
|
||||||
|
n = wcslen(dirname);
|
||||||
|
# else
|
||||||
|
n = GetFullPathNameW (dirname, 0, NULL, NULL);
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/* Allocate room for absolute directory name and search pattern */
|
||||||
|
dirp->patt = (wchar_t*) malloc (sizeof (wchar_t) * n + 16);
|
||||||
|
if (dirp->patt) {
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Convert relative directory name to an absolute one. This
|
||||||
|
* allows rewinddir() to function correctly even when current
|
||||||
|
* working directory is changed between opendir() and rewinddir().
|
||||||
|
*
|
||||||
|
* Note that on WinRT there's no way to convert relative paths
|
||||||
|
* into absolute paths, so just assume it is an absolute path.
|
||||||
|
*/
|
||||||
|
# if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP)
|
||||||
|
wcsncpy_s(dirp->patt, n+1, dirname, n);
|
||||||
|
# else
|
||||||
|
n = GetFullPathNameW (dirname, n, dirp->patt, NULL);
|
||||||
|
# endif
|
||||||
|
if (n > 0) {
|
||||||
|
wchar_t *p;
|
||||||
|
|
||||||
|
/* Append search pattern \* to the directory name */
|
||||||
|
p = dirp->patt + n;
|
||||||
|
if (dirp->patt < p) {
|
||||||
|
switch (p[-1]) {
|
||||||
|
case '\\':
|
||||||
|
case '/':
|
||||||
|
case ':':
|
||||||
|
/* Directory ends in path separator, e.g. c:\temp\ */
|
||||||
|
/*NOP*/;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
/* Directory name doesn't end in path separator */
|
||||||
|
*p++ = '\\';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*p++ = '*';
|
||||||
|
*p = '\0';
|
||||||
|
|
||||||
|
/* Open directory stream and retrieve the first entry */
|
||||||
|
if (dirent_first (dirp)) {
|
||||||
|
/* Directory stream opened successfully */
|
||||||
|
error = 0;
|
||||||
|
} else {
|
||||||
|
/* Cannot retrieve first entry */
|
||||||
|
error = 1;
|
||||||
|
dirent_set_errno (ENOENT);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
/* Cannot retrieve full path name */
|
||||||
|
dirent_set_errno (ENOENT);
|
||||||
|
error = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
/* Cannot allocate memory for search pattern */
|
||||||
|
error = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
/* Cannot allocate _WDIR structure */
|
||||||
|
error = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Clean up in case of error */
|
||||||
|
if (error && dirp) {
|
||||||
|
_wclosedir (dirp);
|
||||||
|
dirp = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return dirp;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Close directory stream opened by opendir() function. This invalidates the
|
||||||
|
* DIR structure as well as any directory entry read previously by
|
||||||
|
* _wreaddir().
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
_wclosedir(
|
||||||
|
_WDIR *dirp)
|
||||||
|
{
|
||||||
|
int ok;
|
||||||
|
if (dirp) {
|
||||||
|
|
||||||
|
/* Release search handle */
|
||||||
|
if (dirp->handle != INVALID_HANDLE_VALUE) {
|
||||||
|
FindClose (dirp->handle);
|
||||||
|
dirp->handle = INVALID_HANDLE_VALUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Release search pattern */
|
||||||
|
if (dirp->patt) {
|
||||||
|
free (dirp->patt);
|
||||||
|
dirp->patt = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Release directory structure */
|
||||||
|
free (dirp);
|
||||||
|
ok = /*success*/0;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
/* Invalid directory stream */
|
||||||
|
dirent_set_errno (EBADF);
|
||||||
|
ok = /*failure*/-1;
|
||||||
|
|
||||||
|
}
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get first directory entry (internal) */
|
||||||
|
static WIN32_FIND_DATAW*
|
||||||
|
dirent_first(
|
||||||
|
_WDIR *dirp)
|
||||||
|
{
|
||||||
|
WIN32_FIND_DATAW *datap;
|
||||||
|
|
||||||
|
/* Open directory and retrieve the first entry */
|
||||||
|
dirp->handle = FindFirstFileExW(
|
||||||
|
dirp->patt, FindExInfoStandard, &dirp->data,
|
||||||
|
FindExSearchNameMatch, NULL, 0);
|
||||||
|
if (dirp->handle != INVALID_HANDLE_VALUE) {
|
||||||
|
|
||||||
|
/* a directory entry is now waiting in memory */
|
||||||
|
datap = &dirp->data;
|
||||||
|
dirp->cached = 1;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
/* Failed to re-open directory: no directory entry in memory */
|
||||||
|
dirp->cached = 0;
|
||||||
|
datap = NULL;
|
||||||
|
|
||||||
|
}
|
||||||
|
return datap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Get next directory entry (internal).
|
||||||
|
*
|
||||||
|
* Returns
|
||||||
|
*/
|
||||||
|
static WIN32_FIND_DATAW*
|
||||||
|
dirent_next(
|
||||||
|
_WDIR *dirp)
|
||||||
|
{
|
||||||
|
WIN32_FIND_DATAW *p;
|
||||||
|
|
||||||
|
/* Get next directory entry */
|
||||||
|
if (dirp->cached != 0) {
|
||||||
|
|
||||||
|
/* A valid directory entry already in memory */
|
||||||
|
p = &dirp->data;
|
||||||
|
dirp->cached = 0;
|
||||||
|
|
||||||
|
} else if (dirp->handle != INVALID_HANDLE_VALUE) {
|
||||||
|
|
||||||
|
/* Get the next directory entry from stream */
|
||||||
|
if (FindNextFileW (dirp->handle, &dirp->data) != FALSE) {
|
||||||
|
/* Got a file */
|
||||||
|
p = &dirp->data;
|
||||||
|
} else {
|
||||||
|
/* The very last entry has been processed or an error occurred */
|
||||||
|
FindClose (dirp->handle);
|
||||||
|
dirp->handle = INVALID_HANDLE_VALUE;
|
||||||
|
p = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
/* End of directory stream reached */
|
||||||
|
p = NULL;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Open directory stream using plain old C-string.
|
||||||
|
*/
|
||||||
|
static DIR*
|
||||||
|
opendir(
|
||||||
|
const char *dirname)
|
||||||
|
{
|
||||||
|
struct DIR *dirp;
|
||||||
|
int error;
|
||||||
|
|
||||||
|
/* Must have directory name */
|
||||||
|
if (dirname == NULL || dirname[0] == '\0') {
|
||||||
|
dirent_set_errno (ENOENT);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Allocate memory for DIR structure */
|
||||||
|
dirp = (DIR*) malloc (sizeof (struct DIR));
|
||||||
|
if (dirp) {
|
||||||
|
wchar_t wname[PATH_MAX + 1];
|
||||||
|
size_t n;
|
||||||
|
|
||||||
|
/* Convert directory name to wide-character string */
|
||||||
|
error = dirent_mbstowcs_s(
|
||||||
|
&n, wname, PATH_MAX + 1, dirname, PATH_MAX + 1);
|
||||||
|
if (!error) {
|
||||||
|
|
||||||
|
/* Open directory stream using wide-character name */
|
||||||
|
dirp->wdirp = _wopendir (wname);
|
||||||
|
if (dirp->wdirp) {
|
||||||
|
/* Directory stream opened */
|
||||||
|
error = 0;
|
||||||
|
} else {
|
||||||
|
/* Failed to open directory stream */
|
||||||
|
error = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
/*
|
||||||
|
* Cannot convert file name to wide-character string. This
|
||||||
|
* occurs if the string contains invalid multi-byte sequences or
|
||||||
|
* the output buffer is too small to contain the resulting
|
||||||
|
* string.
|
||||||
|
*/
|
||||||
|
error = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
/* Cannot allocate DIR structure */
|
||||||
|
error = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Clean up in case of error */
|
||||||
|
if (error && dirp) {
|
||||||
|
free (dirp);
|
||||||
|
dirp = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return dirp;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Read next directory entry.
|
||||||
|
*/
|
||||||
|
static struct dirent*
|
||||||
|
readdir(
|
||||||
|
DIR *dirp)
|
||||||
|
{
|
||||||
|
struct dirent *entry;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Read directory entry to buffer. We can safely ignore the return value
|
||||||
|
* as entry will be set to NULL in case of error.
|
||||||
|
*/
|
||||||
|
(void) readdir_r (dirp, &dirp->ent, &entry);
|
||||||
|
|
||||||
|
/* Return pointer to statically allocated directory entry */
|
||||||
|
return entry;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Read next directory entry into called-allocated buffer.
|
||||||
|
*
|
||||||
|
* Returns zero on success. If the end of directory stream is reached, then
|
||||||
|
* sets result to NULL and returns zero.
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
readdir_r(
|
||||||
|
DIR *dirp,
|
||||||
|
struct dirent *entry,
|
||||||
|
struct dirent **result)
|
||||||
|
{
|
||||||
|
WIN32_FIND_DATAW *datap;
|
||||||
|
|
||||||
|
/* Read next directory entry */
|
||||||
|
datap = dirent_next (dirp->wdirp);
|
||||||
|
if (datap) {
|
||||||
|
size_t n;
|
||||||
|
int error;
|
||||||
|
|
||||||
|
/* Attempt to convert file name to multi-byte string */
|
||||||
|
error = dirent_wcstombs_s(
|
||||||
|
&n, entry->d_name, PATH_MAX + 1, datap->cFileName, PATH_MAX + 1);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If the file name cannot be represented by a multi-byte string,
|
||||||
|
* then attempt to use old 8+3 file name. This allows traditional
|
||||||
|
* Unix-code to access some file names despite of unicode
|
||||||
|
* characters, although file names may seem unfamiliar to the user.
|
||||||
|
*
|
||||||
|
* Be ware that the code below cannot come up with a short file
|
||||||
|
* name unless the file system provides one. At least
|
||||||
|
* VirtualBox shared folders fail to do this.
|
||||||
|
*/
|
||||||
|
if (error && datap->cAlternateFileName[0] != '\0') {
|
||||||
|
error = dirent_wcstombs_s(
|
||||||
|
&n, entry->d_name, PATH_MAX + 1,
|
||||||
|
datap->cAlternateFileName, PATH_MAX + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!error) {
|
||||||
|
DWORD attr;
|
||||||
|
|
||||||
|
/* Length of file name excluding zero terminator */
|
||||||
|
entry->d_namlen = n - 1;
|
||||||
|
|
||||||
|
/* File attributes */
|
||||||
|
attr = datap->dwFileAttributes;
|
||||||
|
if ((attr & FILE_ATTRIBUTE_DEVICE) != 0) {
|
||||||
|
entry->d_type = DT_CHR;
|
||||||
|
} else if ((attr & FILE_ATTRIBUTE_DIRECTORY) != 0) {
|
||||||
|
entry->d_type = DT_DIR;
|
||||||
|
} else {
|
||||||
|
entry->d_type = DT_REG;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Reset dummy fields */
|
||||||
|
entry->d_ino = 0;
|
||||||
|
entry->d_off = 0;
|
||||||
|
entry->d_reclen = sizeof (struct dirent);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Cannot convert file name to multi-byte string so construct
|
||||||
|
* an erroneous directory entry and return that. Note that
|
||||||
|
* we cannot return NULL as that would stop the processing
|
||||||
|
* of directory entries completely.
|
||||||
|
*/
|
||||||
|
entry->d_name[0] = '?';
|
||||||
|
entry->d_name[1] = '\0';
|
||||||
|
entry->d_namlen = 1;
|
||||||
|
entry->d_type = DT_UNKNOWN;
|
||||||
|
entry->d_ino = 0;
|
||||||
|
entry->d_off = -1;
|
||||||
|
entry->d_reclen = 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Return pointer to directory entry */
|
||||||
|
*result = entry;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
/* No more directory entries */
|
||||||
|
*result = NULL;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return /*OK*/0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Close directory stream.
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
closedir(
|
||||||
|
DIR *dirp)
|
||||||
|
{
|
||||||
|
int ok;
|
||||||
|
if (dirp) {
|
||||||
|
|
||||||
|
/* Close wide-character directory stream */
|
||||||
|
ok = _wclosedir (dirp->wdirp);
|
||||||
|
dirp->wdirp = NULL;
|
||||||
|
|
||||||
|
/* Release multi-byte character version */
|
||||||
|
free (dirp);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
/* Invalid directory stream */
|
||||||
|
dirent_set_errno (EBADF);
|
||||||
|
ok = /*failure*/-1;
|
||||||
|
|
||||||
|
}
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Convert multi-byte string to wide character string */
|
||||||
|
static int
|
||||||
|
dirent_mbstowcs_s(
|
||||||
|
size_t *pReturnValue,
|
||||||
|
wchar_t *wcstr,
|
||||||
|
size_t sizeInWords,
|
||||||
|
const char *mbstr,
|
||||||
|
size_t count)
|
||||||
|
{
|
||||||
|
int error;
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && _MSC_VER >= 1400
|
||||||
|
|
||||||
|
/* Microsoft Visual Studio 2005 or later */
|
||||||
|
error = mbstowcs_s (pReturnValue, wcstr, sizeInWords, mbstr, count);
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
/* Older Visual Studio or non-Microsoft compiler */
|
||||||
|
size_t n;
|
||||||
|
|
||||||
|
/* Convert to wide-character string (or count characters) */
|
||||||
|
n = mbstowcs (wcstr, mbstr, sizeInWords);
|
||||||
|
if (!wcstr || n < count) {
|
||||||
|
|
||||||
|
/* Zero-terminate output buffer */
|
||||||
|
if (wcstr && sizeInWords) {
|
||||||
|
if (n >= sizeInWords) {
|
||||||
|
n = sizeInWords - 1;
|
||||||
|
}
|
||||||
|
wcstr[n] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Length of resulting multi-byte string WITH zero terminator */
|
||||||
|
if (pReturnValue) {
|
||||||
|
*pReturnValue = n + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Success */
|
||||||
|
error = 0;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
/* Could not convert string */
|
||||||
|
error = 1;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Convert wide-character string to multi-byte string */
|
||||||
|
static int
|
||||||
|
dirent_wcstombs_s(
|
||||||
|
size_t *pReturnValue,
|
||||||
|
char *mbstr,
|
||||||
|
size_t sizeInBytes, /* max size of mbstr */
|
||||||
|
const wchar_t *wcstr,
|
||||||
|
size_t count)
|
||||||
|
{
|
||||||
|
int error;
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && _MSC_VER >= 1400
|
||||||
|
|
||||||
|
/* Microsoft Visual Studio 2005 or later */
|
||||||
|
error = wcstombs_s (pReturnValue, mbstr, sizeInBytes, wcstr, count);
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
/* Older Visual Studio or non-Microsoft compiler */
|
||||||
|
size_t n;
|
||||||
|
|
||||||
|
/* Convert to multi-byte string (or count the number of bytes needed) */
|
||||||
|
n = wcstombs (mbstr, wcstr, sizeInBytes);
|
||||||
|
if (!mbstr || n < count) {
|
||||||
|
|
||||||
|
/* Zero-terminate output buffer */
|
||||||
|
if (mbstr && sizeInBytes) {
|
||||||
|
if (n >= sizeInBytes) {
|
||||||
|
n = sizeInBytes - 1;
|
||||||
|
}
|
||||||
|
mbstr[n] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Length of resulting multi-bytes string WITH zero-terminator */
|
||||||
|
if (pReturnValue) {
|
||||||
|
*pReturnValue = n + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Success */
|
||||||
|
error = 0;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
/* Cannot convert string */
|
||||||
|
error = 1;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set errno variable */
|
||||||
|
static void
|
||||||
|
dirent_set_errno(
|
||||||
|
int error)
|
||||||
|
{
|
||||||
|
#if defined(_MSC_VER) && _MSC_VER >= 1400
|
||||||
|
|
||||||
|
/* Microsoft Visual Studio 2005 and later */
|
||||||
|
_set_errno (error);
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
/* Non-Microsoft compiler or older Microsoft compiler */
|
||||||
|
errno = error;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /*DIRENT_H*/
|
||||||
|
|
||||||
19
contrib/win32/err.h
Normal file
19
contrib/win32/err.h
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
#ifndef _ERR_H_
|
||||||
|
#define _ERR_H_
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#define warnx(...) do { \
|
||||||
|
fprintf (stderr, __VA_ARGS__); \
|
||||||
|
fprintf (stderr, "\n"); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define errx(code, ...) do { \
|
||||||
|
fprintf (stderr, __VA_ARGS__); \
|
||||||
|
fprintf (stderr, "\n"); \
|
||||||
|
exit (code); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define err errx
|
||||||
|
|
||||||
|
#endif /* !_ERR_H_ */
|
||||||
106
contrib/win32/getopt.c
Normal file
106
contrib/win32/getopt.c
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
#include "getopt.h" // make sure you construct the header file as dictated above
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 1987, 1993, 1994
|
||||||
|
* The Regents of the University of California. All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* 3. All advertising materials mentioning features or use of this software
|
||||||
|
* must display the following acknowledgement:
|
||||||
|
* This product includes software developed by the University of
|
||||||
|
* California, Berkeley and its contributors.
|
||||||
|
* 4. Neither the name of the University nor the names of its contributors
|
||||||
|
* may be used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||||
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int opterr = 1, /* if error message should be printed */
|
||||||
|
optind = 1, /* index into parent argv vector */
|
||||||
|
optopt, /* character checked for validity */
|
||||||
|
optreset; /* reset getopt */
|
||||||
|
char *optarg; /* argument associated with option */
|
||||||
|
|
||||||
|
#define BADCH (int)'?'
|
||||||
|
#define BADARG (int)':'
|
||||||
|
#define EMSG ""
|
||||||
|
|
||||||
|
/*
|
||||||
|
* getopt --
|
||||||
|
* Parse argc/argv argument vector.
|
||||||
|
*/
|
||||||
|
int getopt(int nargc, char * const nargv[], const char *ostr)
|
||||||
|
{
|
||||||
|
static char *place = EMSG; /* option letter processing */
|
||||||
|
const char *oli; /* option letter list index */
|
||||||
|
|
||||||
|
if (optreset || !*place) { /* update scanning pointer */
|
||||||
|
optreset = 0;
|
||||||
|
if (optind >= nargc || *(place = nargv[optind]) != '-') {
|
||||||
|
place = EMSG;
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
if (place[1] && *++place == '-') { /* found "--" */
|
||||||
|
++optind;
|
||||||
|
place = EMSG;
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
} /* option letter okay? */
|
||||||
|
if ((optopt = (int)*place++) == (int)':' ||
|
||||||
|
!(oli = strchr(ostr, optopt))) {
|
||||||
|
/*
|
||||||
|
* if the user didn't specify '-' as an option,
|
||||||
|
* assume it means -1.
|
||||||
|
*/
|
||||||
|
if (optopt == (int)'-')
|
||||||
|
return (-1);
|
||||||
|
if (!*place)
|
||||||
|
++optind;
|
||||||
|
if (opterr && *ostr != ':')
|
||||||
|
(void)printf("illegal option -- %c\n", optopt);
|
||||||
|
return (BADCH);
|
||||||
|
}
|
||||||
|
if (*++oli != ':') { /* don't need argument */
|
||||||
|
optarg = NULL;
|
||||||
|
if (!*place)
|
||||||
|
++optind;
|
||||||
|
}
|
||||||
|
else { /* need an argument */
|
||||||
|
if (*place) /* no white space */
|
||||||
|
optarg = place;
|
||||||
|
else if (nargc <= ++optind) { /* no arg */
|
||||||
|
place = EMSG;
|
||||||
|
if (*ostr == ':')
|
||||||
|
return (BADARG);
|
||||||
|
if (opterr)
|
||||||
|
(void)printf("option requires an argument -- %c\n", optopt);
|
||||||
|
return (BADCH);
|
||||||
|
}
|
||||||
|
else /* white space */
|
||||||
|
optarg = nargv[optind];
|
||||||
|
place = EMSG;
|
||||||
|
++optind;
|
||||||
|
}
|
||||||
|
return (optopt); /* dump back option letter */
|
||||||
|
}
|
||||||
13
contrib/win32/getopt.h
Normal file
13
contrib/win32/getopt.h
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#ifndef GETOPT_H
|
||||||
|
|
||||||
|
#define GETOPT_H
|
||||||
|
|
||||||
|
extern int opterr; /* if error message should be printed */
|
||||||
|
extern int optind; /* index into parent argv vector */
|
||||||
|
extern int optopt; /* character checked for validity */
|
||||||
|
extern int optreset; /* reset getopt */
|
||||||
|
extern char *optarg; /* argument associated with option */
|
||||||
|
|
||||||
|
int getopt(int nargc, char * const nargv[], const char *ostr);
|
||||||
|
|
||||||
|
#endif
|
||||||
4
contrib/win32/libnfc/Makefile.am
Normal file
4
contrib/win32/libnfc/Makefile.am
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
SUBDIRS = buses .
|
||||||
|
|
||||||
|
EXTRA_DIST = \
|
||||||
|
log-internal.c
|
||||||
2
contrib/win32/libnfc/buses/Makefile.am
Normal file
2
contrib/win32/libnfc/buses/Makefile.am
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
EXTRA_DIST = \
|
||||||
|
uart.c
|
||||||
284
contrib/win32/libnfc/buses/uart.c
Normal file
284
contrib/win32/libnfc/buses/uart.c
Normal file
@ -0,0 +1,284 @@
|
|||||||
|
/*-
|
||||||
|
* Free/Libre Near Field Communication (NFC) library
|
||||||
|
*
|
||||||
|
* Libnfc historical contributors:
|
||||||
|
* Copyright (C) 2009 Roel Verdult
|
||||||
|
* Copyright (C) 2009-2013 Romuald Conty
|
||||||
|
* Copyright (C) 2010-2012 Romain Tartière
|
||||||
|
* Copyright (C) 2010-2013 Philippe Teuwen
|
||||||
|
* Copyright (C) 2012-2013 Ludovic Rousseau
|
||||||
|
* See AUTHORS file for a more comprehensive list of contributors.
|
||||||
|
* Additional contributors of this file:
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
* Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
* option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file uart.c
|
||||||
|
* @brief Windows UART driver
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include "config.h"
|
||||||
|
#endif // HAVE_CONFIG_H
|
||||||
|
|
||||||
|
#include "uart.h"
|
||||||
|
|
||||||
|
#include <nfc/nfc.h>
|
||||||
|
#include "nfc-internal.h"
|
||||||
|
|
||||||
|
#include <inttypes.h>
|
||||||
|
#include "log.h"
|
||||||
|
|
||||||
|
#define LOG_GROUP NFC_LOG_GROUP_COM
|
||||||
|
#define LOG_CATEGORY "libnfc.bus.uart_win32"
|
||||||
|
|
||||||
|
// Handle platform specific includes
|
||||||
|
#include "contrib/windows.h"
|
||||||
|
#define delay_ms( X ) Sleep( X )
|
||||||
|
|
||||||
|
struct serial_port_windows {
|
||||||
|
HANDLE hPort; // Serial port handle
|
||||||
|
DCB dcb; // Device control settings
|
||||||
|
COMMTIMEOUTS ct; // Serial port time-out configuration
|
||||||
|
};
|
||||||
|
|
||||||
|
serial_port
|
||||||
|
uart_open(const char *pcPortName)
|
||||||
|
{
|
||||||
|
char acPortName[255];
|
||||||
|
struct serial_port_windows *sp = malloc(sizeof(struct serial_port_windows));
|
||||||
|
|
||||||
|
if (sp == 0)
|
||||||
|
return INVALID_SERIAL_PORT;
|
||||||
|
|
||||||
|
// Copy the input "com?" to "\\.\COM?" format
|
||||||
|
sprintf(acPortName, "\\\\.\\%s", pcPortName);
|
||||||
|
_strupr(acPortName);
|
||||||
|
|
||||||
|
// Try to open the serial port
|
||||||
|
sp->hPort = CreateFileA(acPortName, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
|
||||||
|
if (sp->hPort == INVALID_HANDLE_VALUE) {
|
||||||
|
uart_close(sp);
|
||||||
|
return INVALID_SERIAL_PORT;
|
||||||
|
}
|
||||||
|
// Prepare the device control
|
||||||
|
memset(&sp->dcb, 0, sizeof(DCB));
|
||||||
|
sp->dcb.DCBlength = sizeof(DCB);
|
||||||
|
if (!BuildCommDCBA("baud=9600 data=8 parity=N stop=1", &sp->dcb)) {
|
||||||
|
uart_close(sp);
|
||||||
|
return INVALID_SERIAL_PORT;
|
||||||
|
}
|
||||||
|
// Update the active serial port
|
||||||
|
if (!SetCommState(sp->hPort, &sp->dcb)) {
|
||||||
|
uart_close(sp);
|
||||||
|
return INVALID_SERIAL_PORT;
|
||||||
|
}
|
||||||
|
|
||||||
|
sp->ct.ReadIntervalTimeout = 30;
|
||||||
|
sp->ct.ReadTotalTimeoutMultiplier = 0;
|
||||||
|
sp->ct.ReadTotalTimeoutConstant = 30;
|
||||||
|
sp->ct.WriteTotalTimeoutMultiplier = 30;
|
||||||
|
sp->ct.WriteTotalTimeoutConstant = 0;
|
||||||
|
|
||||||
|
if (!SetCommTimeouts(sp->hPort, &sp->ct)) {
|
||||||
|
uart_close(sp);
|
||||||
|
return INVALID_SERIAL_PORT;
|
||||||
|
}
|
||||||
|
|
||||||
|
PurgeComm(sp->hPort, PURGE_RXABORT | PURGE_RXCLEAR);
|
||||||
|
|
||||||
|
return sp;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
uart_close(const serial_port sp)
|
||||||
|
{
|
||||||
|
if (((struct serial_port_windows *) sp)->hPort != INVALID_HANDLE_VALUE) {
|
||||||
|
CloseHandle(((struct serial_port_windows *) sp)->hPort);
|
||||||
|
}
|
||||||
|
free(sp);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
uart_flush_input(const serial_port sp, bool wait)
|
||||||
|
{
|
||||||
|
PurgeComm(((struct serial_port_windows *) sp)->hPort, PURGE_RXABORT | PURGE_RXCLEAR);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
uart_set_speed(serial_port sp, const uint32_t uiPortSpeed)
|
||||||
|
{
|
||||||
|
struct serial_port_windows *spw;
|
||||||
|
|
||||||
|
log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_DEBUG, "Serial port speed requested to be set to %d baud.", uiPortSpeed);
|
||||||
|
// Set port speed (Input and Output)
|
||||||
|
switch (uiPortSpeed) {
|
||||||
|
case 9600:
|
||||||
|
case 19200:
|
||||||
|
case 38400:
|
||||||
|
case 57600:
|
||||||
|
case 115200:
|
||||||
|
case 230400:
|
||||||
|
case 460800:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_ERROR, "Unable to set serial port speed to %d baud. Speed value must be one of these constants: 9600 (default), 19200, 38400, 57600, 115200, 230400 or 460800.", uiPortSpeed);
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
spw = (struct serial_port_windows *) sp;
|
||||||
|
|
||||||
|
// Set baud rate
|
||||||
|
spw->dcb.BaudRate = uiPortSpeed;
|
||||||
|
if (!SetCommState(spw->hPort, &spw->dcb)) {
|
||||||
|
log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_ERROR, "%s", "Unable to apply new speed settings.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
PurgeComm(spw->hPort, PURGE_RXABORT | PURGE_RXCLEAR);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t
|
||||||
|
uart_get_speed(const serial_port sp)
|
||||||
|
{
|
||||||
|
const struct serial_port_windows *spw = (struct serial_port_windows *) sp;
|
||||||
|
if (!GetCommState(spw->hPort, (serial_port) & spw->dcb))
|
||||||
|
return spw->dcb.BaudRate;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
uart_receive(serial_port sp, uint8_t *pbtRx, const size_t szRx, void *abort_p, int timeout)
|
||||||
|
{
|
||||||
|
DWORD dwBytesToGet = (DWORD)szRx;
|
||||||
|
DWORD dwBytesReceived = 0;
|
||||||
|
DWORD dwTotalBytesReceived = 0;
|
||||||
|
BOOL res;
|
||||||
|
|
||||||
|
// XXX Put this part into uart_win32_timeouts () ?
|
||||||
|
DWORD timeout_ms = timeout;
|
||||||
|
COMMTIMEOUTS timeouts;
|
||||||
|
timeouts.ReadIntervalTimeout = 0;
|
||||||
|
timeouts.ReadTotalTimeoutMultiplier = 0;
|
||||||
|
timeouts.ReadTotalTimeoutConstant = timeout_ms;
|
||||||
|
timeouts.WriteTotalTimeoutMultiplier = 0;
|
||||||
|
timeouts.WriteTotalTimeoutConstant = timeout_ms;
|
||||||
|
|
||||||
|
if (!SetCommTimeouts(((struct serial_port_windows *) sp)->hPort, &timeouts)) {
|
||||||
|
log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_ERROR, "Unable to apply new timeout settings.");
|
||||||
|
return NFC_EIO;
|
||||||
|
}
|
||||||
|
log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_DEBUG, "Timeouts are set to %lu ms", timeout_ms);
|
||||||
|
|
||||||
|
// TODO Enhance the reception method
|
||||||
|
// - According to MSDN, it could be better to implement nfc_abort_command() mechanism using Cancello()
|
||||||
|
volatile bool *abort_flag_p = (volatile bool *)abort_p;
|
||||||
|
do {
|
||||||
|
log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_DEBUG, "ReadFile");
|
||||||
|
res = ReadFile(((struct serial_port_windows *) sp)->hPort, pbtRx + dwTotalBytesReceived,
|
||||||
|
dwBytesToGet,
|
||||||
|
&dwBytesReceived, NULL);
|
||||||
|
|
||||||
|
dwTotalBytesReceived += dwBytesReceived;
|
||||||
|
|
||||||
|
if (!res) {
|
||||||
|
DWORD err = GetLastError();
|
||||||
|
log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_ERROR, "ReadFile error: %lu", err);
|
||||||
|
return NFC_EIO;
|
||||||
|
} else if (dwBytesReceived == 0) {
|
||||||
|
return NFC_ETIMEOUT;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (((DWORD)szRx) > dwTotalBytesReceived) {
|
||||||
|
dwBytesToGet -= dwBytesReceived;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (abort_flag_p != NULL && (*abort_flag_p) && dwTotalBytesReceived == 0) {
|
||||||
|
return NFC_EOPABORTED;
|
||||||
|
}
|
||||||
|
} while (((DWORD)szRx) > dwTotalBytesReceived);
|
||||||
|
LOG_HEX(LOG_GROUP, "RX", pbtRx, szRx);
|
||||||
|
|
||||||
|
return (dwTotalBytesReceived == (DWORD) szRx) ? 0 : NFC_EIO;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
uart_send(serial_port sp, const uint8_t *pbtTx, const size_t szTx, int timeout)
|
||||||
|
{
|
||||||
|
DWORD dwTxLen = 0;
|
||||||
|
|
||||||
|
COMMTIMEOUTS timeouts;
|
||||||
|
timeouts.ReadIntervalTimeout = 0;
|
||||||
|
timeouts.ReadTotalTimeoutMultiplier = 0;
|
||||||
|
timeouts.ReadTotalTimeoutConstant = timeout;
|
||||||
|
timeouts.WriteTotalTimeoutMultiplier = 0;
|
||||||
|
timeouts.WriteTotalTimeoutConstant = timeout;
|
||||||
|
|
||||||
|
if (!SetCommTimeouts(((struct serial_port_windows *) sp)->hPort, &timeouts)) {
|
||||||
|
log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_ERROR, "Unable to apply new timeout settings.");
|
||||||
|
return NFC_EIO;
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG_HEX(LOG_GROUP, "TX", pbtTx, szTx);
|
||||||
|
if (!WriteFile(((struct serial_port_windows *) sp)->hPort, pbtTx, szTx, &dwTxLen, NULL)) {
|
||||||
|
return NFC_EIO;
|
||||||
|
}
|
||||||
|
if (!dwTxLen)
|
||||||
|
return NFC_EIO;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL is_port_available(int nPort)
|
||||||
|
{
|
||||||
|
TCHAR szPort[15];
|
||||||
|
COMMCONFIG cc;
|
||||||
|
DWORD dwCCSize;
|
||||||
|
|
||||||
|
sprintf(szPort, "COM%d", nPort);
|
||||||
|
|
||||||
|
// Check if this port is available
|
||||||
|
dwCCSize = sizeof(cc);
|
||||||
|
return GetDefaultCommConfig(szPort, &cc, &dwCCSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Path to the serial port is OS-dependant.
|
||||||
|
// Try to guess what we should use.
|
||||||
|
#define MAX_SERIAL_PORT_WIN 255
|
||||||
|
char **
|
||||||
|
uart_list_ports(void)
|
||||||
|
{
|
||||||
|
char **availablePorts = malloc((1 + MAX_SERIAL_PORT_WIN) * sizeof(char *));
|
||||||
|
if (!availablePorts) {
|
||||||
|
perror("malloc");
|
||||||
|
return availablePorts;
|
||||||
|
}
|
||||||
|
int curIndex = 0;
|
||||||
|
int i;
|
||||||
|
for (i = 1; i <= MAX_SERIAL_PORT_WIN; i++) {
|
||||||
|
if (is_port_available(i)) {
|
||||||
|
availablePorts[curIndex] = (char *)malloc(10);
|
||||||
|
if (!availablePorts[curIndex]) {
|
||||||
|
perror("malloc");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
sprintf(availablePorts[curIndex], "COM%d", i);
|
||||||
|
// printf("found candidate port: %s\n", availablePorts[curIndex]);
|
||||||
|
curIndex++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
availablePorts[curIndex] = NULL;
|
||||||
|
|
||||||
|
return availablePorts;
|
||||||
|
}
|
||||||
61
contrib/win32/libnfc/log-internal.c
Normal file
61
contrib/win32/libnfc/log-internal.c
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
/*-
|
||||||
|
* Free/Libre Near Field Communication (NFC) library
|
||||||
|
*
|
||||||
|
* Libnfc historical contributors:
|
||||||
|
* Copyright (C) 2009 Roel Verdult
|
||||||
|
* Copyright (C) 2009-2013 Romuald Conty
|
||||||
|
* Copyright (C) 2010-2012 Romain Tartière
|
||||||
|
* Copyright (C) 2010-2013 Philippe Teuwen
|
||||||
|
* Copyright (C) 2012-2013 Ludovic Rousseau
|
||||||
|
* See AUTHORS file for a more comprehensive list of contributors.
|
||||||
|
* Additional contributors of this file:
|
||||||
|
* Copyright (C) 2013 Alex Lian
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
* Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
* option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "log-internal.h"
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <strsafe.h>
|
||||||
|
|
||||||
|
static void
|
||||||
|
log_output_debug(const char *format, va_list args)
|
||||||
|
{
|
||||||
|
char buffer[1024];
|
||||||
|
HRESULT hr = StringCbVPrintf(buffer, sizeof(buffer), format, args);
|
||||||
|
// Spew what we got, even if the buffer is not sized large enough
|
||||||
|
if ((STRSAFE_E_INSUFFICIENT_BUFFER == hr) || (S_OK == hr))
|
||||||
|
OutputDebugString(buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
log_vput_internal(const char *format, va_list args)
|
||||||
|
{
|
||||||
|
vfprintf(stderr, format, args);
|
||||||
|
// Additional windows output to the debug window for debugging purposes
|
||||||
|
log_output_debug(format, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
log_put_internal(const char *format, ...)
|
||||||
|
{
|
||||||
|
va_list va;
|
||||||
|
va_start(va, format);
|
||||||
|
vfprintf(stderr, format, va);
|
||||||
|
// Additional windows output to the debug window for debugging purposes
|
||||||
|
log_output_debug(format, va);
|
||||||
|
va_end(va);
|
||||||
|
}
|
||||||
57
contrib/win32/nfc.def
Normal file
57
contrib/win32/nfc.def
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
LIBRARY libnfc
|
||||||
|
VERSION 1.7
|
||||||
|
|
||||||
|
EXPORTS
|
||||||
|
nfc_init
|
||||||
|
nfc_exit
|
||||||
|
nfc_register_driver
|
||||||
|
nfc_open
|
||||||
|
nfc_close
|
||||||
|
nfc_abort_command
|
||||||
|
nfc_list_devices
|
||||||
|
nfc_idle
|
||||||
|
nfc_initiator_init
|
||||||
|
nfc_initiator_init_secure_element
|
||||||
|
nfc_initiator_select_passive_target
|
||||||
|
nfc_initiator_list_passive_targets
|
||||||
|
nfc_initiator_poll_target
|
||||||
|
nfc_initiator_select_dep_target
|
||||||
|
nfc_initiator_poll_dep_target
|
||||||
|
nfc_initiator_deselect_target
|
||||||
|
nfc_initiator_transceive_bytes
|
||||||
|
nfc_initiator_transceive_bits
|
||||||
|
nfc_initiator_transceive_bytes_timed
|
||||||
|
nfc_initiator_transceive_bits_timed
|
||||||
|
nfc_initiator_target_is_present
|
||||||
|
nfc_target_init
|
||||||
|
nfc_target_send_bytes
|
||||||
|
nfc_target_receive_bytes
|
||||||
|
nfc_target_send_bits
|
||||||
|
nfc_target_receive_bits
|
||||||
|
nfc_strerror
|
||||||
|
nfc_strerror_r
|
||||||
|
nfc_perror
|
||||||
|
nfc_device_get_last_error
|
||||||
|
nfc_device_get_name
|
||||||
|
nfc_device_get_connstring
|
||||||
|
nfc_device_get_supported_modulation
|
||||||
|
nfc_device_get_supported_baud_rate
|
||||||
|
nfc_device_get_supported_baud_rate_target_mode
|
||||||
|
nfc_device_set_property_int
|
||||||
|
nfc_device_set_property_bool
|
||||||
|
nfc_emulate_target
|
||||||
|
iso14443a_crc
|
||||||
|
iso14443a_crc_append
|
||||||
|
iso14443b_crc
|
||||||
|
iso14443b_crc_append
|
||||||
|
iso14443a_locate_historical_bytes
|
||||||
|
nfc_free
|
||||||
|
nfc_version
|
||||||
|
nfc_device_get_information_about
|
||||||
|
str_nfc_modulation_type
|
||||||
|
str_nfc_baud_rate
|
||||||
|
str_nfc_target
|
||||||
|
pn53x_transceive
|
||||||
|
pn532_SAMConfiguration
|
||||||
|
pn53x_read_register
|
||||||
|
pn53x_write_register
|
||||||
57
contrib/win32/nfc_msvc.def
Normal file
57
contrib/win32/nfc_msvc.def
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
LIBRARY nfc
|
||||||
|
VERSION 1.7
|
||||||
|
|
||||||
|
EXPORTS
|
||||||
|
nfc_init
|
||||||
|
nfc_exit
|
||||||
|
nfc_register_driver
|
||||||
|
nfc_open
|
||||||
|
nfc_close
|
||||||
|
nfc_abort_command
|
||||||
|
nfc_list_devices
|
||||||
|
nfc_idle
|
||||||
|
nfc_initiator_init
|
||||||
|
nfc_initiator_init_secure_element
|
||||||
|
nfc_initiator_select_passive_target
|
||||||
|
nfc_initiator_list_passive_targets
|
||||||
|
nfc_initiator_poll_target
|
||||||
|
nfc_initiator_select_dep_target
|
||||||
|
nfc_initiator_poll_dep_target
|
||||||
|
nfc_initiator_deselect_target
|
||||||
|
nfc_initiator_transceive_bytes
|
||||||
|
nfc_initiator_transceive_bits
|
||||||
|
nfc_initiator_transceive_bytes_timed
|
||||||
|
nfc_initiator_transceive_bits_timed
|
||||||
|
nfc_initiator_target_is_present
|
||||||
|
nfc_target_init
|
||||||
|
nfc_target_send_bytes
|
||||||
|
nfc_target_receive_bytes
|
||||||
|
nfc_target_send_bits
|
||||||
|
nfc_target_receive_bits
|
||||||
|
nfc_strerror
|
||||||
|
nfc_strerror_r
|
||||||
|
nfc_perror
|
||||||
|
nfc_device_get_last_error
|
||||||
|
nfc_device_get_name
|
||||||
|
nfc_device_get_connstring
|
||||||
|
nfc_device_get_supported_modulation
|
||||||
|
nfc_device_get_supported_baud_rate
|
||||||
|
nfc_device_get_supported_baud_rate_target_mode
|
||||||
|
nfc_device_set_property_int
|
||||||
|
nfc_device_set_property_bool
|
||||||
|
nfc_emulate_target
|
||||||
|
iso14443a_crc
|
||||||
|
iso14443a_crc_append
|
||||||
|
iso14443b_crc
|
||||||
|
iso14443b_crc_append
|
||||||
|
iso14443a_locate_historical_bytes
|
||||||
|
nfc_free
|
||||||
|
nfc_version
|
||||||
|
nfc_device_get_information_about
|
||||||
|
str_nfc_modulation_type
|
||||||
|
str_nfc_baud_rate
|
||||||
|
str_nfc_target
|
||||||
|
pn53x_transceive
|
||||||
|
pn532_SAMConfiguration
|
||||||
|
pn53x_read_register
|
||||||
|
pn53x_write_register
|
||||||
57
contrib/win32/stdlib.c
Normal file
57
contrib/win32/stdlib.c
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
/*-
|
||||||
|
* Free/Libre Near Field Communication (NFC) library
|
||||||
|
*
|
||||||
|
* Libnfc historical contributors:
|
||||||
|
* Copyright (C) 2009 Roel Verdult
|
||||||
|
* Copyright (C) 2009-2013 Romuald Conty
|
||||||
|
* Copyright (C) 2010-2012 Romain Tartière
|
||||||
|
* Copyright (C) 2010-2013 Philippe Teuwen
|
||||||
|
* Copyright (C) 2012-2013 Ludovic Rousseau
|
||||||
|
* See AUTHORS file for a more comprehensive list of contributors.
|
||||||
|
* Additional contributors of this file:
|
||||||
|
* Copyright (C) 2013 Alex Lian
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
* Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
* option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file stdlib.c
|
||||||
|
* @brief Windows System compatibility
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Handle platform specific includes
|
||||||
|
#include "contrib/windows.h"
|
||||||
|
|
||||||
|
//There is no setenv()and unsetenv() in windows,but we can use putenv() instead.
|
||||||
|
int setenv(const char *name, const char *value, int overwrite)
|
||||||
|
{
|
||||||
|
char *env = getenv(name);
|
||||||
|
if ((env && overwrite) || (!env)) {
|
||||||
|
char *str[32];
|
||||||
|
strcpy(str, name);
|
||||||
|
strcat(str, "=");
|
||||||
|
strcat(str, value);
|
||||||
|
return putenv(str);
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void unsetenv(const char *name)
|
||||||
|
{
|
||||||
|
char *str[32];
|
||||||
|
strcpy(str, name);
|
||||||
|
strcat(str, "=");
|
||||||
|
putenv(str);
|
||||||
|
}
|
||||||
2
contrib/win32/sys/Makefile.am
Normal file
2
contrib/win32/sys/Makefile.am
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
EXTRA_DIST = \
|
||||||
|
select.h
|
||||||
29
contrib/win32/sys/select.h
Normal file
29
contrib/win32/sys/select.h
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
/*-
|
||||||
|
* Free/Libre Near Field Communication (NFC) library
|
||||||
|
*
|
||||||
|
* Libnfc historical contributors:
|
||||||
|
* Copyright (C) 2009 Roel Verdult
|
||||||
|
* Copyright (C) 2009-2013 Romuald Conty
|
||||||
|
* Copyright (C) 2010-2012 Romain Tartière
|
||||||
|
* Copyright (C) 2010-2013 Philippe Teuwen
|
||||||
|
* Copyright (C) 2012-2013 Ludovic Rousseau
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
* Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
* option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file select.h
|
||||||
|
* @brief Dummy file to make the code compile under Windows
|
||||||
|
*/
|
||||||
|
|
||||||
48
contrib/win32/unistd.h
Normal file
48
contrib/win32/unistd.h
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
/*-
|
||||||
|
* Free/Libre Near Field Communication (NFC) library
|
||||||
|
*
|
||||||
|
* Libnfc historical contributors:
|
||||||
|
* Copyright (C) 2009 Roel Verdult
|
||||||
|
* Copyright (C) 2009-2013 Romuald Conty
|
||||||
|
* Copyright (C) 2010-2012 Romain Tartière
|
||||||
|
* Copyright (C) 2010-2013 Philippe Teuwen
|
||||||
|
* Copyright (C) 2012-2013 Ludovic Rousseau
|
||||||
|
* See AUTHORS file for a more comprehensive list of contributors.
|
||||||
|
* Additional contributors of this file:
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
* Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
* option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file unistd.h
|
||||||
|
* @brief This file intended to serve as a drop-in replacement for unistd.h on Windows
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _UNISTD_H_
|
||||||
|
#define _UNISTD_H_
|
||||||
|
|
||||||
|
#include "contrib/windows.h"
|
||||||
|
|
||||||
|
// Needed by Sleep() under Windows
|
||||||
|
# include <winbase.h>
|
||||||
|
# define sleep(X) Sleep( X * 1000)
|
||||||
|
|
||||||
|
// With MinGW, getopt(3) is provided as separate header
|
||||||
|
#if defined(WIN32) && defined(__GNUC__) /* mingw compiler */
|
||||||
|
#include <getopt.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* _UNISTD_H_ */
|
||||||
|
|
||||||
29
contrib/win32/version.rc.in
Normal file
29
contrib/win32/version.rc.in
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
1 VERSIONINFO
|
||||||
|
FILEVERSION @VERSION_MAJOR@,@VERSION_MINOR@,@VERSION_PATCH@,0
|
||||||
|
PRODUCTVERSION @VERSION_MAJOR@,@VERSION_MINOR@,@VERSION_PATCH@,0
|
||||||
|
FILEFLAGSMASK 0x3fL
|
||||||
|
FILEFLAGS 0x0L
|
||||||
|
FILEOS 0x00040004L
|
||||||
|
FILETYPE @RC_FILE_TYPE@
|
||||||
|
FILESUBTYPE 0x0L
|
||||||
|
BEGIN
|
||||||
|
BLOCK "StringFileInfo"
|
||||||
|
BEGIN
|
||||||
|
BLOCK "040904e4"
|
||||||
|
BEGIN
|
||||||
|
VALUE "Comments", "@RC_COMMENT@\0"
|
||||||
|
VALUE "CompanyName", "libnfc.org\0"
|
||||||
|
VALUE "FileDescription", "\0"
|
||||||
|
VALUE "FileVersion", "@VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@.0\0"
|
||||||
|
VALUE "InternalName", "@RC_INTERNAL_NAME@ @WIN32_MODE@\0"
|
||||||
|
VALUE "LegalCopyright", "Copyright (C) @CURRENT_YEAR@\0"
|
||||||
|
VALUE "OriginalFilename", "@RC_ORIGINAL_NAME@\0"
|
||||||
|
VALUE "ProductName", "@PACKAGE_NAME@ @WIN32_MODE@\0"
|
||||||
|
VALUE "ProductVersion", "@VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@.0\0"
|
||||||
|
END
|
||||||
|
END
|
||||||
|
BLOCK "VarFileInfo"
|
||||||
|
BEGIN
|
||||||
|
VALUE "Translation", 0x0409, 1252
|
||||||
|
END
|
||||||
|
END
|
||||||
64
contrib/windows.h
Normal file
64
contrib/windows.h
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
/*-
|
||||||
|
* Free/Libre Near Field Communication (NFC) library
|
||||||
|
*
|
||||||
|
* Libnfc historical contributors:
|
||||||
|
* Copyright (C) 2009 Roel Verdult
|
||||||
|
* Copyright (C) 2009-2013 Romuald Conty
|
||||||
|
* Copyright (C) 2010-2012 Romain Tartière
|
||||||
|
* Copyright (C) 2010-2013 Philippe Teuwen
|
||||||
|
* Copyright (C) 2012-2013 Ludovic Rousseau
|
||||||
|
* See AUTHORS file for a more comprehensive list of contributors.
|
||||||
|
* Additional contributors of this file:
|
||||||
|
* Copyright (C) 2011 Glenn Ergeerts
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
* Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
* option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file windows.h
|
||||||
|
* @brief Provide some windows related hacks due to lack of POSIX compat
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __WINDOWS_H__
|
||||||
|
#define __WINDOWS_H__
|
||||||
|
|
||||||
|
# include <windows.h>
|
||||||
|
# include <winerror.h>
|
||||||
|
# include "win32/err.h"
|
||||||
|
# if defined (__MINGW32__)
|
||||||
|
/*
|
||||||
|
* Cheating here on the snprintf to incorporate the format argument
|
||||||
|
* into the VA_ARGS. Else we get MinGW errors regarding number of arguments
|
||||||
|
* if doing a fixed string with no arguments.
|
||||||
|
*/
|
||||||
|
# define snprintf(S, n, ...) sprintf(S, __VA_ARGS__)
|
||||||
|
# define pipe(fds) _pipe(fds, 5000, _O_BINARY)
|
||||||
|
# define ETIMEDOUT WSAETIMEDOUT
|
||||||
|
# define ENOTSUP WSAEOPNOTSUPP
|
||||||
|
# define ECONNABORTED WSAECONNABORTED
|
||||||
|
# else
|
||||||
|
#ifndef _MSC_VER
|
||||||
|
# define snprintf sprintf_s
|
||||||
|
#endif
|
||||||
|
# define strdup _strdup
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* setenv and unsetenv are not Windows compliant nor implemented in MinGW.
|
||||||
|
* These declarations get rid of the "implicit declaration warning."
|
||||||
|
*/
|
||||||
|
int setenv(const char *name, const char *value, int overwrite);
|
||||||
|
void unsetenv(const char *name);
|
||||||
|
|
||||||
|
#endif
|
||||||
12
debian/changelog
vendored
12
debian/changelog
vendored
@ -1,12 +0,0 @@
|
|||||||
libnfc (1.2.0-0) unstable; urgency=low
|
|
||||||
|
|
||||||
* New upstream version.
|
|
||||||
|
|
||||||
-- Romuald Conty <rconty@il4p.fr> Thu, 23 Jul 2009 15:42:42 +0100
|
|
||||||
|
|
||||||
libnfc (1.1.0-0) unstable; urgency=low
|
|
||||||
|
|
||||||
* Initial debian package.
|
|
||||||
|
|
||||||
-- Romuald Conty <rconty@il4p.fr> Wed, 22 Apr 2009 10:42:42 +0100
|
|
||||||
|
|
||||||
1
debian/compat
vendored
1
debian/compat
vendored
@ -1 +0,0 @@
|
|||||||
5
|
|
||||||
30
debian/control
vendored
30
debian/control
vendored
@ -1,30 +0,0 @@
|
|||||||
Source: libnfc
|
|
||||||
Section: devel
|
|
||||||
Priority: optional
|
|
||||||
Maintainer: Romuald Conty <romuald.conty@free.fr>
|
|
||||||
Build-Depends: debhelper (>= 5.0.37.2), cdbs (>= 0.4.43), libusb-dev, libpcsclite-dev
|
|
||||||
Standards-Version: 3.7.3
|
|
||||||
Homepage: http://www.libnfc.org/
|
|
||||||
|
|
||||||
Package: libnfc0
|
|
||||||
Architecture: any
|
|
||||||
Depends: ${shlibs:Depends}, libusb-0.1-4, libpcsclite1 (>= 1.5), libccid (>= 1.3.10)
|
|
||||||
Description: Near Field Communication (NFC) library
|
|
||||||
libnfc is a Free Software NFC library. The supported NFC hardware devices are
|
|
||||||
the ACS ACR122(U) NFC reader and various NFC-dongles. In principle all
|
|
||||||
hardware based on the NXP PN53x NFC Controller chip is supported.
|
|
||||||
|
|
||||||
Package: libnfc-dev
|
|
||||||
Architecture: any
|
|
||||||
Depends: libnfc0, libusb-dev, libpcsclite-dev
|
|
||||||
Description: Near Field Communication library (development files)
|
|
||||||
libnfc is a Free Software NFC library. The supported NFC hardware devices are
|
|
||||||
the ACS ACR122(U) NFC reader and various NFC-dongles. In principle all
|
|
||||||
hardware based on the NXP PN53x NFC Controller chip is supported.
|
|
||||||
|
|
||||||
Package: nfc-tools
|
|
||||||
Architecture: any
|
|
||||||
Depends: libnfc0
|
|
||||||
Description: Near Field Communication tools
|
|
||||||
NFC tools are provide by libnfc team to be able to use NFC devices
|
|
||||||
"out-of-the-box".
|
|
||||||
27
debian/copyright
vendored
27
debian/copyright
vendored
@ -1,27 +0,0 @@
|
|||||||
This package was debianized by Romuald Conty <romuald.conty@free.fr> on
|
|
||||||
Wed, 22 Apr 2009 10:42:42 +0100.
|
|
||||||
|
|
||||||
It was downloaded from: http://www.libnfc.org/
|
|
||||||
|
|
||||||
Copyright (C) 2009 by Roel Verdult <roel@libnfc.org>
|
|
||||||
|
|
||||||
License: GNU Lesser General Public License version 3
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License version 3
|
|
||||||
as published by the Free Software Foundation
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
On Debian GNU/Linux systems, the complete text of the GNU General Public
|
|
||||||
License, version 3, can be found in `/usr/share/common-licenses/LGPL-3'.
|
|
||||||
|
|
||||||
The Debian packaging is (C) 2009, Romuald Conty <romuald.conty@free.fr> and
|
|
||||||
is licensed under the GPL, see `/usr/share/common-licenses/GPL'.
|
|
||||||
3
debian/libnfc-dev.install
vendored
3
debian/libnfc-dev.install
vendored
@ -1,3 +0,0 @@
|
|||||||
debian/tmp/usr/include/libnfc
|
|
||||||
debian/tmp/usr/lib/libnfc.{a,la,so}
|
|
||||||
debian/tmp/usr/lib/pkgconfig/libnfc.pc
|
|
||||||
1
debian/libnfc0.install
vendored
1
debian/libnfc0.install
vendored
@ -1 +0,0 @@
|
|||||||
debian/tmp/usr/lib/libnfc.so.*
|
|
||||||
2
debian/nfc-tools.install
vendored
2
debian/nfc-tools.install
vendored
@ -1,2 +0,0 @@
|
|||||||
debian/tmp/usr/bin/nfc-*
|
|
||||||
debian/tmp/usr/share/man/man1/nfc-*
|
|
||||||
4
debian/rules
vendored
4
debian/rules
vendored
@ -1,4 +0,0 @@
|
|||||||
#!/usr/bin/make -f
|
|
||||||
include /usr/share/cdbs/1/rules/debhelper.mk
|
|
||||||
include /usr/share/cdbs/1/class/autotools.mk
|
|
||||||
|
|
||||||
55
examples/CMakeLists.txt
Normal file
55
examples/CMakeLists.txt
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
SET(EXAMPLES-SOURCES
|
||||||
|
nfc-anticol
|
||||||
|
nfc-dep-initiator
|
||||||
|
nfc-dep-target
|
||||||
|
nfc-emulate-forum-tag2
|
||||||
|
nfc-emulate-tag
|
||||||
|
nfc-emulate-uid
|
||||||
|
nfc-mfsetuid
|
||||||
|
nfc-poll
|
||||||
|
nfc-relay
|
||||||
|
nfc-st25tb
|
||||||
|
pn53x-diagnose
|
||||||
|
pn53x-sam
|
||||||
|
pn53x-tamashell
|
||||||
|
)
|
||||||
|
|
||||||
|
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../libnfc)
|
||||||
|
|
||||||
|
# Examples
|
||||||
|
FOREACH(source ${EXAMPLES-SOURCES})
|
||||||
|
SET (TARGETS ${source}.c)
|
||||||
|
|
||||||
|
IF(WIN32)
|
||||||
|
SET(RC_COMMENT "${PACKAGE_NAME} example")
|
||||||
|
SET(RC_INTERNAL_NAME ${source})
|
||||||
|
SET(RC_ORIGINAL_NAME ${source}.exe)
|
||||||
|
# RC_FILE_TYPE: VFT_APP
|
||||||
|
SET(RC_FILE_TYPE 0x00000001L)
|
||||||
|
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/../contrib/win32/version.rc.in ${CMAKE_CURRENT_BINARY_DIR}/../windows/${source}.rc @ONLY)
|
||||||
|
LIST(APPEND TARGETS ${CMAKE_CURRENT_BINARY_DIR}/../windows/${source}.rc)
|
||||||
|
|
||||||
|
|
||||||
|
IF(${source} MATCHES "nfc-st25tb")
|
||||||
|
LIST(APPEND TARGETS ${CMAKE_CURRENT_SOURCE_DIR}/../contrib/win32/getopt.c)
|
||||||
|
ENDIF()
|
||||||
|
ENDIF(WIN32)
|
||||||
|
|
||||||
|
ADD_EXECUTABLE(${source} ${TARGETS})
|
||||||
|
TARGET_LINK_LIBRARIES(${source} nfc)
|
||||||
|
TARGET_LINK_LIBRARIES(${source} nfcutils)
|
||||||
|
INSTALL(TARGETS ${source} RUNTIME DESTINATION bin COMPONENT examples)
|
||||||
|
ENDFOREACH(source)
|
||||||
|
|
||||||
|
#install required libraries
|
||||||
|
IF(WIN32)
|
||||||
|
INCLUDE(InstallRequiredSystemLibraries)
|
||||||
|
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/cmake/FixBundle.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/FixBundle.cmake @ONLY)
|
||||||
|
INSTALL(SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/FixBundle.cmake)
|
||||||
|
ENDIF(WIN32)
|
||||||
|
|
||||||
|
IF(NOT WIN32)
|
||||||
|
# Manuals for the examples
|
||||||
|
FILE(GLOB manuals "${CMAKE_CURRENT_SOURCE_DIR}/*.1")
|
||||||
|
INSTALL(FILES ${manuals} DESTINATION ${SHARE_INSTALL_PREFIX}/man/man1 COMPONENT manuals)
|
||||||
|
ENDIF(NOT WIN32)
|
||||||
107
examples/Makefile.am
Normal file
107
examples/Makefile.am
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
SUBDIRS = pn53x-tamashell-scripts
|
||||||
|
|
||||||
|
bin_PROGRAMS = \
|
||||||
|
nfc-anticol \
|
||||||
|
nfc-dep-initiator \
|
||||||
|
nfc-dep-target \
|
||||||
|
nfc-emulate-forum-tag2 \
|
||||||
|
nfc-emulate-tag \
|
||||||
|
nfc-emulate-uid \
|
||||||
|
nfc-mfsetuid \
|
||||||
|
nfc-poll \
|
||||||
|
nfc-relay \
|
||||||
|
nfc-st25tb \
|
||||||
|
pn53x-diagnose \
|
||||||
|
pn53x-sam
|
||||||
|
|
||||||
|
if POSIX_ONLY_EXAMPLES_ENABLED
|
||||||
|
bin_PROGRAMS += \
|
||||||
|
pn53x-tamashell
|
||||||
|
endif
|
||||||
|
|
||||||
|
check_PROGRAMS = \
|
||||||
|
quick_start_example1 \
|
||||||
|
quick_start_example2
|
||||||
|
|
||||||
|
# set the include path found by configure
|
||||||
|
AM_CPPFLAGS = $(all_includes) $(LIBNFC_CFLAGS)
|
||||||
|
|
||||||
|
AM_CFLAGS = -I$(top_srcdir)/libnfc -I$(top_srcdir)
|
||||||
|
|
||||||
|
nfc_poll_SOURCES = nfc-poll.c
|
||||||
|
nfc_poll_LDADD = $(top_builddir)/libnfc/libnfc.la \
|
||||||
|
$(top_builddir)/utils/libnfcutils.la
|
||||||
|
|
||||||
|
nfc_anticol_SOURCES = nfc-anticol.c
|
||||||
|
nfc_anticol_LDADD = $(top_builddir)/libnfc/libnfc.la \
|
||||||
|
$(top_builddir)/utils/libnfcutils.la
|
||||||
|
|
||||||
|
nfc_relay_SOURCES = nfc-relay.c
|
||||||
|
nfc_relay_LDADD = $(top_builddir)/libnfc/libnfc.la \
|
||||||
|
$(top_builddir)/utils/libnfcutils.la
|
||||||
|
|
||||||
|
nfc_emulate_forum_tag2_SOURCES = nfc-emulate-forum-tag2.c
|
||||||
|
nfc_emulate_forum_tag2_LDADD = $(top_builddir)/libnfc/libnfc.la \
|
||||||
|
$(top_builddir)/utils/libnfcutils.la
|
||||||
|
|
||||||
|
nfc_emulate_tag_SOURCES = nfc-emulate-tag.c
|
||||||
|
nfc_emulate_tag_LDADD = $(top_builddir)/libnfc/libnfc.la \
|
||||||
|
$(top_builddir)/utils/libnfcutils.la
|
||||||
|
|
||||||
|
nfc_emulate_uid_SOURCES = nfc-emulate-uid.c
|
||||||
|
nfc_emulate_uid_LDADD = $(top_builddir)/libnfc/libnfc.la \
|
||||||
|
$(top_builddir)/utils/libnfcutils.la
|
||||||
|
|
||||||
|
nfc_dep_target_SOURCES = nfc-dep-target.c
|
||||||
|
nfc_dep_target_LDADD = $(top_builddir)/libnfc/libnfc.la \
|
||||||
|
$(top_builddir)/utils/libnfcutils.la
|
||||||
|
|
||||||
|
nfc_dep_initiator_SOURCES = nfc-dep-initiator.c
|
||||||
|
nfc_dep_initiator_LDADD = $(top_builddir)/libnfc/libnfc.la \
|
||||||
|
$(top_builddir)/utils/libnfcutils.la
|
||||||
|
|
||||||
|
nfc_mfsetuid_SOURCES = nfc-mfsetuid.c
|
||||||
|
nfc_mfsetuid_LDADD = $(top_builddir)/libnfc/libnfc.la \
|
||||||
|
$(top_builddir)/utils/libnfcutils.la
|
||||||
|
|
||||||
|
nfc_st25tb_SOURCES = nfc-st25tb.c
|
||||||
|
nfc_st25tb_LDADD = $(top_builddir)/libnfc/libnfc.la
|
||||||
|
|
||||||
|
pn53x_diagnose_SOURCES = pn53x-diagnose.c
|
||||||
|
pn53x_diagnose_LDADD = $(top_builddir)/libnfc/libnfc.la \
|
||||||
|
$(top_builddir)/utils/libnfcutils.la
|
||||||
|
|
||||||
|
pn53x_sam_SOURCES = pn53x-sam.c
|
||||||
|
pn53x_sam_LDADD = $(top_builddir)/libnfc/libnfc.la \
|
||||||
|
$(top_builddir)/utils/libnfcutils.la
|
||||||
|
|
||||||
|
pn53x_tamashell_SOURCES = pn53x-tamashell.c
|
||||||
|
pn53x_tamashell_LDADD = $(top_builddir)/libnfc/libnfc.la \
|
||||||
|
$(top_builddir)/utils/libnfcutils.la
|
||||||
|
pn53x_tamashell_CFLAGS = @READLINE_INCLUDES@ -I$(top_srcdir)
|
||||||
|
pn53x_tamashell_LDFLAGS = @READLINE_LIBS@
|
||||||
|
|
||||||
|
quick_start_example1_SOURCES = doc/quick_start_example1.c
|
||||||
|
quick_start_example1_LDADD = $(top_builddir)/libnfc/libnfc.la \
|
||||||
|
$(top_builddir)/utils/libnfcutils.la
|
||||||
|
|
||||||
|
quick_start_example2_SOURCES = doc/quick_start_example2.c
|
||||||
|
quick_start_example2_LDADD = $(top_builddir)/libnfc/libnfc.la \
|
||||||
|
$(top_builddir)/utils/libnfcutils.la
|
||||||
|
|
||||||
|
|
||||||
|
dist_man_MANS = \
|
||||||
|
nfc-anticol.1 \
|
||||||
|
nfc-dep-initiator.1 \
|
||||||
|
nfc-dep-target.1 \
|
||||||
|
nfc-emulate-tag.1 \
|
||||||
|
nfc-emulate-uid.1 \
|
||||||
|
nfc-poll.1 \
|
||||||
|
nfc-relay.1 \
|
||||||
|
nfc-mfsetuid.1 \
|
||||||
|
pn53x-diagnose.1 \
|
||||||
|
pn53x-sam.1 \
|
||||||
|
pn53x-tamashell.1 \
|
||||||
|
nfc-emulate-forum-tag2.1
|
||||||
|
|
||||||
|
EXTRA_DIST = CMakeLists.txt
|
||||||
86
examples/doc/quick_start_example1.c
Normal file
86
examples/doc/quick_start_example1.c
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
/**
|
||||||
|
* @file quick_start_example1.c
|
||||||
|
* @brief Quick start example that presents how to use libnfc
|
||||||
|
*/
|
||||||
|
|
||||||
|
// To compile this simple example:
|
||||||
|
// $ gcc -o quick_start_example1 quick_start_example1.c -lnfc
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <nfc/nfc.h>
|
||||||
|
|
||||||
|
static void
|
||||||
|
print_hex(const uint8_t *pbtData, const size_t szBytes)
|
||||||
|
{
|
||||||
|
size_t szPos;
|
||||||
|
|
||||||
|
for (szPos = 0; szPos < szBytes; szPos++) {
|
||||||
|
printf("%02x ", pbtData[szPos]);
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
main(int argc, const char *argv[])
|
||||||
|
{
|
||||||
|
nfc_device *pnd;
|
||||||
|
nfc_target nt;
|
||||||
|
|
||||||
|
// Allocate only a pointer to nfc_context
|
||||||
|
nfc_context *context;
|
||||||
|
|
||||||
|
// Initialize libnfc and set the nfc_context
|
||||||
|
nfc_init(&context);
|
||||||
|
if (context == NULL) {
|
||||||
|
printf("Unable to init libnfc (malloc)\n");
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Display libnfc version
|
||||||
|
const char *acLibnfcVersion = nfc_version();
|
||||||
|
(void)argc;
|
||||||
|
printf("%s uses libnfc %s\n", argv[0], acLibnfcVersion);
|
||||||
|
|
||||||
|
// Open, using the first available NFC device which can be in order of selection:
|
||||||
|
// - default device specified using environment variable or
|
||||||
|
// - first specified device in libnfc.conf (/etc/nfc) or
|
||||||
|
// - first specified device in device-configuration directory (/etc/nfc/devices.d) or
|
||||||
|
// - first auto-detected (if feature is not disabled in libnfc.conf) device
|
||||||
|
pnd = nfc_open(context, NULL);
|
||||||
|
|
||||||
|
if (pnd == NULL) {
|
||||||
|
printf("ERROR: %s\n", "Unable to open NFC device.");
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
// Set opened NFC device to initiator mode
|
||||||
|
if (nfc_initiator_init(pnd) < 0) {
|
||||||
|
nfc_perror(pnd, "nfc_initiator_init");
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("NFC reader: %s opened\n", nfc_device_get_name(pnd));
|
||||||
|
|
||||||
|
// Poll for a ISO14443A (MIFARE) tag
|
||||||
|
const nfc_modulation nmMifare = {
|
||||||
|
.nmt = NMT_ISO14443A,
|
||||||
|
.nbr = NBR_106,
|
||||||
|
};
|
||||||
|
if (nfc_initiator_select_passive_target(pnd, nmMifare, NULL, 0, &nt) > 0) {
|
||||||
|
printf("The following (NFC) ISO14443A tag was found:\n");
|
||||||
|
printf(" ATQA (SENS_RES): ");
|
||||||
|
print_hex(nt.nti.nai.abtAtqa, 2);
|
||||||
|
printf(" UID (NFCID%c): ", (nt.nti.nai.abtUid[0] == 0x08 ? '3' : '1'));
|
||||||
|
print_hex(nt.nti.nai.abtUid, nt.nti.nai.szUidLen);
|
||||||
|
printf(" SAK (SEL_RES): ");
|
||||||
|
print_hex(&nt.nti.nai.btSak, 1);
|
||||||
|
if (nt.nti.nai.szAtsLen) {
|
||||||
|
printf(" ATS (ATR): ");
|
||||||
|
print_hex(nt.nti.nai.abtAts, nt.nti.nai.szAtsLen);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Close NFC device
|
||||||
|
nfc_close(pnd);
|
||||||
|
// Release the context
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_SUCCESS);
|
||||||
|
}
|
||||||
83
examples/doc/quick_start_example2.c
Normal file
83
examples/doc/quick_start_example2.c
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
/**
|
||||||
|
* @file quick_start_example2.c
|
||||||
|
* @brief Quick start example that presents how to use libnfc
|
||||||
|
*/
|
||||||
|
|
||||||
|
// This is same example as quick_start_example1.c but using
|
||||||
|
// some helper functions existing in libnfc.
|
||||||
|
// Those functions are not available yet in a library
|
||||||
|
// so binary object must be linked statically:
|
||||||
|
// $ gcc -o quick_start_example2 -lnfc -I../.. quick_start_example2.c ../../utils/nfc-utils.o
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include "config.h"
|
||||||
|
#endif // HAVE_CONFIG_H
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <nfc/nfc.h>
|
||||||
|
#include "utils/nfc-utils.h"
|
||||||
|
|
||||||
|
int
|
||||||
|
main(int argc, const char *argv[])
|
||||||
|
{
|
||||||
|
nfc_device *pnd;
|
||||||
|
nfc_target nt;
|
||||||
|
|
||||||
|
// Allocate only a pointer to nfc_context
|
||||||
|
nfc_context *context;
|
||||||
|
|
||||||
|
// Initialize libnfc and set the nfc_context
|
||||||
|
nfc_init(&context);
|
||||||
|
if (context == NULL) {
|
||||||
|
ERR("Unable to init libnfc (malloc)");
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Display libnfc version
|
||||||
|
const char *acLibnfcVersion = nfc_version();
|
||||||
|
(void)argc;
|
||||||
|
printf("%s uses libnfc %s\n", argv[0], acLibnfcVersion);
|
||||||
|
|
||||||
|
// Open, using the first available NFC device which can be in order of selection:
|
||||||
|
// - default device specified using environment variable or
|
||||||
|
// - first specified device in libnfc.conf (/etc/nfc) or
|
||||||
|
// - first specified device in device-configuration directory (/etc/nfc/devices.d) or
|
||||||
|
// - first auto-detected (if feature is not disabled in libnfc.conf) device
|
||||||
|
pnd = nfc_open(context, NULL);
|
||||||
|
|
||||||
|
if (pnd == NULL) {
|
||||||
|
ERR("%s", "Unable to open NFC device.");
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
// Set opened NFC device to initiator mode
|
||||||
|
if (nfc_initiator_init(pnd) < 0) {
|
||||||
|
nfc_perror(pnd, "nfc_initiator_init");
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("NFC reader: %s opened\n", nfc_device_get_name(pnd));
|
||||||
|
|
||||||
|
// Poll for a ISO14443A (MIFARE) tag
|
||||||
|
const nfc_modulation nmMifare = {
|
||||||
|
.nmt = NMT_ISO14443A,
|
||||||
|
.nbr = NBR_106,
|
||||||
|
};
|
||||||
|
if (nfc_initiator_select_passive_target(pnd, nmMifare, NULL, 0, &nt) > 0) {
|
||||||
|
printf("The following (NFC) ISO14443A tag was found:\n");
|
||||||
|
printf(" ATQA (SENS_RES): ");
|
||||||
|
print_hex(nt.nti.nai.abtAtqa, 2);
|
||||||
|
printf(" UID (NFCID%c): ", (nt.nti.nai.abtUid[0] == 0x08 ? '3' : '1'));
|
||||||
|
print_hex(nt.nti.nai.abtUid, nt.nti.nai.szUidLen);
|
||||||
|
printf(" SAK (SEL_RES): ");
|
||||||
|
print_hex(&nt.nti.nai.btSak, 1);
|
||||||
|
if (nt.nti.nai.szAtsLen) {
|
||||||
|
printf(" ATS (ATR): ");
|
||||||
|
print_hex(nt.nti.nai.abtAts, nt.nti.nai.szAtsLen);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Close NFC device
|
||||||
|
nfc_close(pnd);
|
||||||
|
// Release the context
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_SUCCESS);
|
||||||
|
}
|
||||||
39
examples/nfc-anticol.1
Normal file
39
examples/nfc-anticol.1
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
.TH nfc-anticol 1 "June 26, 2009" "libnfc" "libnfc's examples"
|
||||||
|
.SH NAME
|
||||||
|
nfc-anticol \- Demonstration of NFC anti-collision command line tool based on libnfc
|
||||||
|
.SH SYNOPSIS
|
||||||
|
.B nfc-anticol
|
||||||
|
.SH DESCRIPTION
|
||||||
|
.B nfc-anticol
|
||||||
|
is an anti-collision demonstration tool for ISO/IEC 14443-A tags, performed by
|
||||||
|
custom constructed frames. The first frame must be a short frame which is only
|
||||||
|
7 bits long. Commercial SDK's often don't support a feature to send frames that
|
||||||
|
are not a multiple of 8 bits (1 byte) long. This makes it impossible to do the
|
||||||
|
anti-collision yourself. The developer has to rely on closed proprietary
|
||||||
|
software and should hope it does not contain vulnerabilities during the
|
||||||
|
anti-collision phase. Performing the anti-collision using custom frames could
|
||||||
|
protect against a malicious tag that, for example, violates the standard by
|
||||||
|
sending frames with unsupported lengths.
|
||||||
|
Note that this is only a demonstration tool, which can not handle multiple tags
|
||||||
|
as real life anti-collisions with multiple tags generate "messy" bits which
|
||||||
|
are neither 0 nor 1.
|
||||||
|
|
||||||
|
.SH BUGS
|
||||||
|
Please report any bugs on the
|
||||||
|
.B libnfc
|
||||||
|
issue tracker at:
|
||||||
|
.br
|
||||||
|
.BR https://github.com/nfc-tools/libnfc/issues
|
||||||
|
.SH LICENCE
|
||||||
|
.B libnfc
|
||||||
|
is licensed under the GNU Lesser General Public License (LGPL), version 3.
|
||||||
|
.br
|
||||||
|
.B libnfc-utils
|
||||||
|
and
|
||||||
|
.B libnfc-examples
|
||||||
|
are covered by the the BSD 2-Clause license.
|
||||||
|
.SH AUTHORS
|
||||||
|
Roel Verdult <roel@libnfc.org>
|
||||||
|
.PP
|
||||||
|
This manual page was written by Romuald Conty <romuald@libnfc.org>.
|
||||||
|
It is licensed under the terms of the GNU GPL (version 2 or later).
|
||||||
364
examples/nfc-anticol.c
Normal file
364
examples/nfc-anticol.c
Normal file
@ -0,0 +1,364 @@
|
|||||||
|
/*-
|
||||||
|
* Free/Libre Near Field Communication (NFC) library
|
||||||
|
*
|
||||||
|
* Libnfc historical contributors:
|
||||||
|
* Copyright (C) 2009 Roel Verdult
|
||||||
|
* Copyright (C) 2009-2013 Romuald Conty
|
||||||
|
* Copyright (C) 2010-2012 Romain Tartière
|
||||||
|
* Copyright (C) 2010-2013 Philippe Teuwen
|
||||||
|
* Copyright (C) 2012-2013 Ludovic Rousseau
|
||||||
|
* See AUTHORS file for a more comprehensive list of contributors.
|
||||||
|
* Additional contributors of this file:
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* 1) Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* 2 )Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* Note that this license only applies on the examples, NFC library itself is under LGPL
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file nfc-anticol.c
|
||||||
|
* @brief Generates one ISO14443-A anti-collision process "by-hand"
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include "config.h"
|
||||||
|
#endif // HAVE_CONFIG_H
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <nfc/nfc.h>
|
||||||
|
|
||||||
|
#include "utils/nfc-utils.h"
|
||||||
|
|
||||||
|
#define SAK_FLAG_ATS_SUPPORTED 0x20
|
||||||
|
|
||||||
|
#define MAX_FRAME_LEN 264
|
||||||
|
|
||||||
|
static uint8_t abtRx[MAX_FRAME_LEN];
|
||||||
|
static int szRxBits;
|
||||||
|
static size_t szRx = sizeof(abtRx);
|
||||||
|
static uint8_t abtRawUid[12];
|
||||||
|
static uint8_t abtAtqa[2];
|
||||||
|
static uint8_t abtSak;
|
||||||
|
static uint8_t abtAts[MAX_FRAME_LEN];
|
||||||
|
static uint8_t szAts = 0;
|
||||||
|
static size_t szCL = 1;//Always start with Cascade Level 1 (CL1)
|
||||||
|
static nfc_device *pnd;
|
||||||
|
|
||||||
|
bool quiet_output = false;
|
||||||
|
bool force_rats = false;
|
||||||
|
bool timed = false;
|
||||||
|
bool iso_ats_supported = false;
|
||||||
|
|
||||||
|
// ISO14443A Anti-Collision Commands
|
||||||
|
uint8_t abtReqa[1] = { 0x26 };
|
||||||
|
uint8_t abtSelectAll[2] = { 0x93, 0x20 };
|
||||||
|
uint8_t abtSelectTag[9] = { 0x93, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
||||||
|
uint8_t abtRats[4] = { 0xe0, 0x50, 0x00, 0x00 };
|
||||||
|
uint8_t abtHalt[4] = { 0x50, 0x00, 0x00, 0x00 };
|
||||||
|
#define CASCADE_BIT 0x04
|
||||||
|
|
||||||
|
static bool
|
||||||
|
transmit_bits(const uint8_t *pbtTx, const size_t szTxBits)
|
||||||
|
{
|
||||||
|
uint32_t cycles = 0;
|
||||||
|
// Show transmitted command
|
||||||
|
if (!quiet_output) {
|
||||||
|
printf("Sent bits: ");
|
||||||
|
print_hex_bits(pbtTx, szTxBits);
|
||||||
|
}
|
||||||
|
// Transmit the bit frame command, we don't use the arbitrary parity feature
|
||||||
|
if (timed) {
|
||||||
|
if ((szRxBits = nfc_initiator_transceive_bits_timed(pnd, pbtTx, szTxBits, NULL, abtRx, sizeof(abtRx), NULL, &cycles)) < 0)
|
||||||
|
return false;
|
||||||
|
if ((!quiet_output) && (szRxBits > 0)) {
|
||||||
|
printf("Response after %u cycles\n", cycles);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ((szRxBits = nfc_initiator_transceive_bits(pnd, pbtTx, szTxBits, NULL, abtRx, sizeof(abtRx), NULL)) < 0)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// Show received answer
|
||||||
|
if (!quiet_output) {
|
||||||
|
printf("Received bits: ");
|
||||||
|
print_hex_bits(abtRx, szRxBits);
|
||||||
|
}
|
||||||
|
// Succesful transfer
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static bool
|
||||||
|
transmit_bytes(const uint8_t *pbtTx, const size_t szTx)
|
||||||
|
{
|
||||||
|
uint32_t cycles = 0;
|
||||||
|
// Show transmitted command
|
||||||
|
if (!quiet_output) {
|
||||||
|
printf("Sent bits: ");
|
||||||
|
print_hex(pbtTx, szTx);
|
||||||
|
}
|
||||||
|
int res;
|
||||||
|
// Transmit the command bytes
|
||||||
|
if (timed) {
|
||||||
|
if ((res = nfc_initiator_transceive_bytes_timed(pnd, pbtTx, szTx, abtRx, sizeof(abtRx), &cycles)) < 0)
|
||||||
|
return false;
|
||||||
|
if ((!quiet_output) && (res > 0)) {
|
||||||
|
printf("Response after %u cycles\n", cycles);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ((res = nfc_initiator_transceive_bytes(pnd, pbtTx, szTx, abtRx, sizeof(abtRx), 0)) < 0)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
szRx = res;
|
||||||
|
// Show received answer
|
||||||
|
if (!quiet_output) {
|
||||||
|
printf("Received bits: ");
|
||||||
|
print_hex(abtRx, szRx);
|
||||||
|
}
|
||||||
|
// Succesful transfer
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
print_usage(char *argv[])
|
||||||
|
{
|
||||||
|
printf("Usage: %s [OPTIONS]\n", argv[0]);
|
||||||
|
printf("Options:\n");
|
||||||
|
printf("\t-h\tHelp. Print this message.\n");
|
||||||
|
printf("\t-q\tQuiet mode. Suppress output of READER and EMULATOR data (improves timing).\n");
|
||||||
|
printf("\t-f\tForce RATS.\n");
|
||||||
|
printf("\t-t\tMeasure response time (in cycles).\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
int arg;
|
||||||
|
|
||||||
|
// Get commandline options
|
||||||
|
for (arg = 1; arg < argc; arg++) {
|
||||||
|
if (0 == strcmp(argv[arg], "-h")) {
|
||||||
|
print_usage(argv);
|
||||||
|
exit(EXIT_SUCCESS);
|
||||||
|
} else if (0 == strcmp(argv[arg], "-q")) {
|
||||||
|
quiet_output = true;
|
||||||
|
} else if (0 == strcmp(argv[arg], "-f")) {
|
||||||
|
force_rats = true;
|
||||||
|
} else if (0 == strcmp(argv[arg], "-t")) {
|
||||||
|
timed = true;
|
||||||
|
} else {
|
||||||
|
ERR("%s is not supported option.", argv[arg]);
|
||||||
|
print_usage(argv);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
nfc_context *context;
|
||||||
|
nfc_init(&context);
|
||||||
|
if (context == NULL) {
|
||||||
|
ERR("Unable to init libnfc (malloc)");
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Try to open the NFC reader
|
||||||
|
pnd = nfc_open(context, NULL);
|
||||||
|
|
||||||
|
if (pnd == NULL) {
|
||||||
|
ERR("Error opening NFC reader");
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initialise NFC device as "initiator"
|
||||||
|
if (nfc_initiator_init(pnd) < 0) {
|
||||||
|
nfc_perror(pnd, "nfc_initiator_init");
|
||||||
|
nfc_close(pnd);
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Configure the CRC
|
||||||
|
if (nfc_device_set_property_bool(pnd, NP_HANDLE_CRC, false) < 0) {
|
||||||
|
nfc_perror(pnd, "nfc_device_set_property_bool");
|
||||||
|
nfc_close(pnd);
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
// Use raw send/receive methods
|
||||||
|
if (nfc_device_set_property_bool(pnd, NP_EASY_FRAMING, false) < 0) {
|
||||||
|
nfc_perror(pnd, "nfc_device_set_property_bool");
|
||||||
|
nfc_close(pnd);
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
// Disable 14443-4 autoswitching
|
||||||
|
if (nfc_device_set_property_bool(pnd, NP_AUTO_ISO14443_4, false) < 0) {
|
||||||
|
nfc_perror(pnd, "nfc_device_set_property_bool");
|
||||||
|
nfc_close(pnd);
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("NFC reader: %s opened\n\n", nfc_device_get_name(pnd));
|
||||||
|
|
||||||
|
// Send the 7 bits request command specified in ISO 14443A (0x26)
|
||||||
|
if (!transmit_bits(abtReqa, 7)) {
|
||||||
|
printf("Error: No tag available\n");
|
||||||
|
nfc_close(pnd);
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
memcpy(abtAtqa, abtRx, 2);
|
||||||
|
|
||||||
|
// Anti-collision
|
||||||
|
transmit_bytes(abtSelectAll, 2);
|
||||||
|
|
||||||
|
// Check answer
|
||||||
|
if ((abtRx[0] ^ abtRx[1] ^ abtRx[2] ^ abtRx[3] ^ abtRx[4]) != 0) {
|
||||||
|
printf("WARNING: BCC check failed!\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save the UID CL1
|
||||||
|
memcpy(abtRawUid, abtRx, 4);
|
||||||
|
|
||||||
|
//Prepare and send CL1 Select-Command
|
||||||
|
memcpy(abtSelectTag + 2, abtRx, 5);
|
||||||
|
iso14443a_crc_append(abtSelectTag, 7);
|
||||||
|
transmit_bytes(abtSelectTag, 9);
|
||||||
|
abtSak = abtRx[0];
|
||||||
|
|
||||||
|
// Test if we are dealing with a CL2
|
||||||
|
if (abtSak & CASCADE_BIT) {
|
||||||
|
szCL = 2;//or more
|
||||||
|
// Check answer
|
||||||
|
if (abtRawUid[0] != 0x88) {
|
||||||
|
printf("WARNING: Cascade bit set but CT != 0x88!\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (szCL == 2) {
|
||||||
|
// We have to do the anti-collision for cascade level 2
|
||||||
|
|
||||||
|
// Prepare CL2 commands
|
||||||
|
abtSelectAll[0] = 0x95;
|
||||||
|
|
||||||
|
// Anti-collision
|
||||||
|
transmit_bytes(abtSelectAll, 2);
|
||||||
|
|
||||||
|
// Check answer
|
||||||
|
if ((abtRx[0] ^ abtRx[1] ^ abtRx[2] ^ abtRx[3] ^ abtRx[4]) != 0) {
|
||||||
|
printf("WARNING: BCC check failed!\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save UID CL2
|
||||||
|
memcpy(abtRawUid + 4, abtRx, 4);
|
||||||
|
|
||||||
|
// Selection
|
||||||
|
abtSelectTag[0] = 0x95;
|
||||||
|
memcpy(abtSelectTag + 2, abtRx, 5);
|
||||||
|
iso14443a_crc_append(abtSelectTag, 7);
|
||||||
|
transmit_bytes(abtSelectTag, 9);
|
||||||
|
abtSak = abtRx[0];
|
||||||
|
|
||||||
|
// Test if we are dealing with a CL3
|
||||||
|
if (abtSak & CASCADE_BIT) {
|
||||||
|
szCL = 3;
|
||||||
|
// Check answer
|
||||||
|
if (abtRawUid[0] != 0x88) {
|
||||||
|
printf("WARNING: Cascade bit set but CT != 0x88!\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (szCL == 3) {
|
||||||
|
// We have to do the anti-collision for cascade level 3
|
||||||
|
|
||||||
|
// Prepare and send CL3 AC-Command
|
||||||
|
abtSelectAll[0] = 0x97;
|
||||||
|
transmit_bytes(abtSelectAll, 2);
|
||||||
|
|
||||||
|
// Check answer
|
||||||
|
if ((abtRx[0] ^ abtRx[1] ^ abtRx[2] ^ abtRx[3] ^ abtRx[4]) != 0) {
|
||||||
|
printf("WARNING: BCC check failed!\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save UID CL3
|
||||||
|
memcpy(abtRawUid + 8, abtRx, 4);
|
||||||
|
|
||||||
|
// Prepare and send final Select-Command
|
||||||
|
abtSelectTag[0] = 0x97;
|
||||||
|
memcpy(abtSelectTag + 2, abtRx, 5);
|
||||||
|
iso14443a_crc_append(abtSelectTag, 7);
|
||||||
|
transmit_bytes(abtSelectTag, 9);
|
||||||
|
abtSak = abtRx[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Request ATS, this only applies to tags that support ISO 14443A-4
|
||||||
|
if (abtRx[0] & SAK_FLAG_ATS_SUPPORTED) {
|
||||||
|
iso_ats_supported = true;
|
||||||
|
}
|
||||||
|
if ((abtRx[0] & SAK_FLAG_ATS_SUPPORTED) || force_rats) {
|
||||||
|
iso14443a_crc_append(abtRats, 2);
|
||||||
|
if (transmit_bytes(abtRats, 4)) {
|
||||||
|
memcpy(abtAts, abtRx, szRx);
|
||||||
|
szAts = szRx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Done, halt the tag now
|
||||||
|
iso14443a_crc_append(abtHalt, 2);
|
||||||
|
transmit_bytes(abtHalt, 4);
|
||||||
|
|
||||||
|
printf("\nFound tag with\n UID: ");
|
||||||
|
switch (szCL) {
|
||||||
|
case 1:
|
||||||
|
printf("%02x%02x%02x%02x", abtRawUid[0], abtRawUid[1], abtRawUid[2], abtRawUid[3]);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
printf("%02x%02x%02x", abtRawUid[1], abtRawUid[2], abtRawUid[3]);
|
||||||
|
printf("%02x%02x%02x%02x", abtRawUid[4], abtRawUid[5], abtRawUid[6], abtRawUid[7]);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
printf("%02x%02x%02x", abtRawUid[1], abtRawUid[2], abtRawUid[3]);
|
||||||
|
printf("%02x%02x%02x", abtRawUid[5], abtRawUid[6], abtRawUid[7]);
|
||||||
|
printf("%02x%02x%02x%02x", abtRawUid[8], abtRawUid[9], abtRawUid[10], abtRawUid[11]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
printf("ATQA: %02x%02x\n SAK: %02x\n", abtAtqa[1], abtAtqa[0], abtSak);
|
||||||
|
if (szAts > 1) { // if = 1, it's not actual ATS but error code
|
||||||
|
if (force_rats && ! iso_ats_supported) {
|
||||||
|
printf(" RATS forced\n");
|
||||||
|
}
|
||||||
|
printf(" ATS: ");
|
||||||
|
print_hex(abtAts, szAts);
|
||||||
|
}
|
||||||
|
|
||||||
|
nfc_close(pnd);
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_SUCCESS);
|
||||||
|
}
|
||||||
36
examples/nfc-dep-initiator.1
Normal file
36
examples/nfc-dep-initiator.1
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
.TH nfc-dep-initiator 1 "October 8, 2010" "libnfc" "libnfc's examples"
|
||||||
|
.SH NAME
|
||||||
|
nfc-dep-initiator \- Demonstration tool to send/received data as D.E.P. initiator
|
||||||
|
.SH SYNOPSIS
|
||||||
|
.B nfc-dep-initiator
|
||||||
|
.SH DESCRIPTION
|
||||||
|
.B nfc-dep-initiator
|
||||||
|
is a demonstration tool for putting NFC device in D.E.P. initiator mode.
|
||||||
|
|
||||||
|
This example will attempt to select a passive D.E.P. target and exchange a
|
||||||
|
simple "Hello" data with target.
|
||||||
|
|
||||||
|
Note: this example is designed to work with a D.E.P. target driven by
|
||||||
|
\fBnfc-dep-target\fP
|
||||||
|
|
||||||
|
.SH BUGS
|
||||||
|
Please report any bugs on the
|
||||||
|
.B libnfc
|
||||||
|
issue tracker at:
|
||||||
|
.br
|
||||||
|
.BR https://github.com/nfc-tools/libnfc/issues
|
||||||
|
.SH LICENCE
|
||||||
|
.B libnfc
|
||||||
|
is licensed under the GNU Lesser General Public License (LGPL), version 3.
|
||||||
|
.br
|
||||||
|
.B libnfc-utils
|
||||||
|
and
|
||||||
|
.B libnfc-examples
|
||||||
|
are covered by the the BSD 2-Clause license.
|
||||||
|
.SH AUTHORS
|
||||||
|
Roel Verdult <roel@libnfc.org>,
|
||||||
|
.br
|
||||||
|
Romuald Conty <romuald@libnfc.org>.
|
||||||
|
.PP
|
||||||
|
This manual page was written by Romuald Conty <romuald@libnfc.org>.
|
||||||
|
It is licensed under the terms of the GNU GPL (version 2 or later).
|
||||||
136
examples/nfc-dep-initiator.c
Normal file
136
examples/nfc-dep-initiator.c
Normal file
@ -0,0 +1,136 @@
|
|||||||
|
/*-
|
||||||
|
* Free/Libre Near Field Communication (NFC) library
|
||||||
|
*
|
||||||
|
* Libnfc historical contributors:
|
||||||
|
* Copyright (C) 2009 Roel Verdult
|
||||||
|
* Copyright (C) 2009-2013 Romuald Conty
|
||||||
|
* Copyright (C) 2010-2012 Romain Tartière
|
||||||
|
* Copyright (C) 2010-2013 Philippe Teuwen
|
||||||
|
* Copyright (C) 2012-2013 Ludovic Rousseau
|
||||||
|
* See AUTHORS file for a more comprehensive list of contributors.
|
||||||
|
* Additional contributors of this file:
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* 1) Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* 2 )Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* Note that this license only applies on the examples, NFC library itself is under LGPL
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file nfc-dep-initiator.c
|
||||||
|
* @brief Turns the NFC device into a D.E.P. initiator (see NFCIP-1)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include "config.h"
|
||||||
|
#endif // HAVE_CONFIG_H
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <signal.h>
|
||||||
|
|
||||||
|
#include <nfc/nfc.h>
|
||||||
|
|
||||||
|
#include "utils/nfc-utils.h"
|
||||||
|
|
||||||
|
#define MAX_FRAME_LEN 264
|
||||||
|
|
||||||
|
static nfc_device *pnd;
|
||||||
|
static nfc_context *context;
|
||||||
|
|
||||||
|
static void stop_dep_communication(int sig)
|
||||||
|
{
|
||||||
|
(void) sig;
|
||||||
|
if (pnd != NULL) {
|
||||||
|
nfc_abort_command(pnd);
|
||||||
|
} else {
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
main(int argc, const char *argv[])
|
||||||
|
{
|
||||||
|
nfc_target nt;
|
||||||
|
uint8_t abtRx[MAX_FRAME_LEN];
|
||||||
|
uint8_t abtTx[] = "Hello World!";
|
||||||
|
|
||||||
|
if (argc > 1) {
|
||||||
|
printf("Usage: %s\n", argv[0]);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
nfc_init(&context);
|
||||||
|
if (context == NULL) {
|
||||||
|
ERR("Unable to init libnfc (malloc)");
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
pnd = nfc_open(context, NULL);
|
||||||
|
if (pnd == NULL) {
|
||||||
|
ERR("Unable to open NFC device.");
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
printf("NFC device: %s\n opened", nfc_device_get_name(pnd));
|
||||||
|
|
||||||
|
signal(SIGINT, stop_dep_communication);
|
||||||
|
|
||||||
|
if (nfc_initiator_init(pnd) < 0) {
|
||||||
|
nfc_perror(pnd, "nfc_initiator_init");
|
||||||
|
nfc_close(pnd);
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nfc_initiator_select_dep_target(pnd, NDM_PASSIVE, NBR_212, NULL, &nt, 1000) < 0) {
|
||||||
|
nfc_perror(pnd, "nfc_initiator_select_dep_target");
|
||||||
|
nfc_close(pnd);
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
print_nfc_target(&nt, false);
|
||||||
|
|
||||||
|
printf("Sending: %s\n", abtTx);
|
||||||
|
int res;
|
||||||
|
if ((res = nfc_initiator_transceive_bytes(pnd, abtTx, sizeof(abtTx), abtRx, sizeof(abtRx), 0)) < 0) {
|
||||||
|
nfc_perror(pnd, "nfc_initiator_transceive_bytes");
|
||||||
|
nfc_close(pnd);
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
abtRx[res] = 0;
|
||||||
|
printf("Received: %s\n", abtRx);
|
||||||
|
|
||||||
|
if (nfc_initiator_deselect_target(pnd) < 0) {
|
||||||
|
nfc_perror(pnd, "nfc_initiator_deselect_target");
|
||||||
|
nfc_close(pnd);
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
nfc_close(pnd);
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_SUCCESS);
|
||||||
|
}
|
||||||
36
examples/nfc-dep-target.1
Normal file
36
examples/nfc-dep-target.1
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
.TH nfc-dep-target 1 "October 8, 2010" "libnfc" "libnfc's examples"
|
||||||
|
.SH NAME
|
||||||
|
nfc-dep-target \- Demonstration tool to send/received data as D.E.P. target
|
||||||
|
.SH SYNOPSIS
|
||||||
|
.B nfc-dep-target
|
||||||
|
.SH DESCRIPTION
|
||||||
|
.B nfc-dep-target
|
||||||
|
is a demonstration tool for putting NFC device in D.E.P. target mode.
|
||||||
|
|
||||||
|
This example will listen for a D.E.P. initiator and exchange a simple "Hello"
|
||||||
|
data with initiator.
|
||||||
|
|
||||||
|
Note: this example is designed to work with a D.E.P. initiator driven by
|
||||||
|
\fBnfc-dep-initiator\fP.
|
||||||
|
|
||||||
|
.SH BUGS
|
||||||
|
Please report any bugs on the
|
||||||
|
.B libnfc
|
||||||
|
issue tracker at:
|
||||||
|
.br
|
||||||
|
.BR https://github.com/nfc-tools/libnfc/issues
|
||||||
|
.SH LICENCE
|
||||||
|
.B libnfc
|
||||||
|
is licensed under the GNU Lesser General Public License (LGPL), version 3.
|
||||||
|
.br
|
||||||
|
.B libnfc-utils
|
||||||
|
and
|
||||||
|
.B libnfc-examples
|
||||||
|
are covered by the the BSD 2-Clause license.
|
||||||
|
.SH AUTHORS
|
||||||
|
Roel Verdult <roel@libnfc.org>,
|
||||||
|
.br
|
||||||
|
Romuald Conty <romuald@libnfc.org>.
|
||||||
|
.PP
|
||||||
|
This manual page was written by Romuald Conty <romuald@libnfc.org>.
|
||||||
|
It is licensed under the terms of the GNU GPL (version 2 or later).
|
||||||
167
examples/nfc-dep-target.c
Normal file
167
examples/nfc-dep-target.c
Normal file
@ -0,0 +1,167 @@
|
|||||||
|
/*-
|
||||||
|
* Free/Libre Near Field Communication (NFC) library
|
||||||
|
*
|
||||||
|
* Libnfc historical contributors:
|
||||||
|
* Copyright (C) 2009 Roel Verdult
|
||||||
|
* Copyright (C) 2009-2013 Romuald Conty
|
||||||
|
* Copyright (C) 2010-2012 Romain Tartière
|
||||||
|
* Copyright (C) 2010-2013 Philippe Teuwen
|
||||||
|
* Copyright (C) 2012-2013 Ludovic Rousseau
|
||||||
|
* See AUTHORS file for a more comprehensive list of contributors.
|
||||||
|
* Additional contributors of this file:
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* 1) Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* 2 )Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* Note that this license only applies on the examples, NFC library itself is under LGPL
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file nfc-dep-target.c
|
||||||
|
* @brief Turns the NFC device into a D.E.P. target (see NFCIP-1)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include "config.h"
|
||||||
|
#endif // HAVE_CONFIG_H
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <signal.h>
|
||||||
|
|
||||||
|
#include <nfc/nfc.h>
|
||||||
|
|
||||||
|
#include "utils/nfc-utils.h"
|
||||||
|
|
||||||
|
#define MAX_FRAME_LEN 264
|
||||||
|
|
||||||
|
static nfc_device *pnd;
|
||||||
|
static nfc_context *context;
|
||||||
|
|
||||||
|
static void stop_dep_communication(int sig)
|
||||||
|
{
|
||||||
|
(void) sig;
|
||||||
|
if (pnd != NULL) {
|
||||||
|
nfc_abort_command(pnd);
|
||||||
|
} else {
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
main(int argc, const char *argv[])
|
||||||
|
{
|
||||||
|
uint8_t abtRx[MAX_FRAME_LEN];
|
||||||
|
int szRx;
|
||||||
|
uint8_t abtTx[] = "Hello Mars!";
|
||||||
|
|
||||||
|
if (argc > 1) {
|
||||||
|
printf("Usage: %s\n", argv[0]);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
nfc_init(&context);
|
||||||
|
if (context == NULL) {
|
||||||
|
ERR("Unable to init libnfc (malloc)");
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
#define MAX_DEVICE_COUNT 2
|
||||||
|
nfc_connstring connstrings[MAX_DEVICE_COUNT];
|
||||||
|
size_t szDeviceFound = nfc_list_devices(context, connstrings, MAX_DEVICE_COUNT);
|
||||||
|
// Little hack to allow using nfc-dep-initiator & nfc-dep-target from
|
||||||
|
// the same machine: if there is more than one readers opened
|
||||||
|
// nfc-dep-target will open the second reader
|
||||||
|
// (we hope they're always detected in the same order)
|
||||||
|
if (szDeviceFound == 1) {
|
||||||
|
pnd = nfc_open(context, connstrings[0]);
|
||||||
|
} else if (szDeviceFound > 1) {
|
||||||
|
pnd = nfc_open(context, connstrings[1]);
|
||||||
|
} else {
|
||||||
|
printf("No device found.\n");
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
nfc_target nt = {
|
||||||
|
.nm = {
|
||||||
|
.nmt = NMT_DEP,
|
||||||
|
.nbr = NBR_UNDEFINED
|
||||||
|
},
|
||||||
|
.nti = {
|
||||||
|
.ndi = {
|
||||||
|
.abtNFCID3 = { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xff, 0x00, 0x00 },
|
||||||
|
.szGB = 4,
|
||||||
|
.abtGB = { 0x12, 0x34, 0x56, 0x78 },
|
||||||
|
.ndm = NDM_UNDEFINED,
|
||||||
|
/* These bytes are not used by nfc_target_init: the chip will provide them automatically to the initiator */
|
||||||
|
.btDID = 0x00,
|
||||||
|
.btBS = 0x00,
|
||||||
|
.btBR = 0x00,
|
||||||
|
.btTO = 0x00,
|
||||||
|
.btPP = 0x01,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
if (pnd == NULL) {
|
||||||
|
printf("Unable to open NFC device.\n");
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
printf("NFC device: %s opened\n", nfc_device_get_name(pnd));
|
||||||
|
|
||||||
|
signal(SIGINT, stop_dep_communication);
|
||||||
|
|
||||||
|
printf("NFC device will now act as: ");
|
||||||
|
print_nfc_target(&nt, false);
|
||||||
|
|
||||||
|
printf("Waiting for initiator request...\n");
|
||||||
|
if ((szRx = nfc_target_init(pnd, &nt, abtRx, sizeof(abtRx), 0)) < 0) {
|
||||||
|
nfc_perror(pnd, "nfc_target_init");
|
||||||
|
nfc_close(pnd);
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("Initiator request received. Waiting for data...\n");
|
||||||
|
if ((szRx = nfc_target_receive_bytes(pnd, abtRx, sizeof(abtRx), 0)) < 0) {
|
||||||
|
nfc_perror(pnd, "nfc_target_receive_bytes");
|
||||||
|
nfc_close(pnd);
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
abtRx[(size_t) szRx] = '\0';
|
||||||
|
printf("Received: %s\n", abtRx);
|
||||||
|
|
||||||
|
printf("Sending: %s\n", abtTx);
|
||||||
|
if (nfc_target_send_bytes(pnd, abtTx, sizeof(abtTx), 0) < 0) {
|
||||||
|
nfc_perror(pnd, "nfc_target_send_bytes");
|
||||||
|
nfc_close(pnd);
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
printf("Data sent.\n");
|
||||||
|
|
||||||
|
nfc_close(pnd);
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_SUCCESS);
|
||||||
|
}
|
||||||
52
examples/nfc-emulate-forum-tag2.1
Normal file
52
examples/nfc-emulate-forum-tag2.1
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
.Dd September 19, 2012
|
||||||
|
.Dt NFC-EMULATE-FORUM-TAG2 1 URM
|
||||||
|
.Sh NAME
|
||||||
|
.Nm nfc-emulate-forum-tag2
|
||||||
|
.Nd NFC Forum tag type 2 emulation command line demonstration tool
|
||||||
|
.Sh SYNOPSIS
|
||||||
|
.Nm
|
||||||
|
.Sh DESCRIPTION
|
||||||
|
.Nm
|
||||||
|
is a demonstration tool that emulates a NFC-Forum Tag Type 2 with NDEF content.
|
||||||
|
.Pp
|
||||||
|
Some devices compliant with NFC-Forum Tag Type 2 can be used with this example,
|
||||||
|
in read mode only.
|
||||||
|
.Sh IMPORTANT
|
||||||
|
This example has been developed using PN533 USB hardware as target and Google
|
||||||
|
Nexus S phone as initiator.
|
||||||
|
.Pp
|
||||||
|
This is know to NOT work with Nokia 6212 Classic and could fail with several
|
||||||
|
NFC Forum compliant devices due to the following reasons:
|
||||||
|
.Pp
|
||||||
|
- The emulated target has only a 4-byte UID while most devices assume a
|
||||||
|
Tag Type 2 has always a 7-byte UID (as a real Mifare Ultralight tag);
|
||||||
|
.Pp
|
||||||
|
- The chip is emulating an ISO/IEC 14443-3 tag, without any hardware helper.
|
||||||
|
If the initiator have too strict timeouts for software-based emulation
|
||||||
|
(which is usually the case), this example will fail.
|
||||||
|
This is not a bug and we can't do anything using this hardware (PN531/PN533).
|
||||||
|
.Pp
|
||||||
|
ACR122 devices (like touchatag, etc.) can be used by this example, but if
|
||||||
|
something goes wrong, you will have to unplug/replug your device.
|
||||||
|
This is not a
|
||||||
|
.Em libnfc's
|
||||||
|
bug, this problem is due to ACR122's internal MCU in front of NFC chip (PN532).
|
||||||
|
.Sh BUGS
|
||||||
|
Please report any bugs on the
|
||||||
|
.Em libnfc
|
||||||
|
issue tracker at:
|
||||||
|
.Em https://github.com/nfc-tools/libnfc/issues
|
||||||
|
.Sh LICENCE
|
||||||
|
.Em libnfc
|
||||||
|
is licensed under the GNU Lesser General Public License (LGPL), version 3.
|
||||||
|
.Em libnfc-utils
|
||||||
|
and
|
||||||
|
.Em libnfc-examples
|
||||||
|
are covered by the BSD 2-Clause license.
|
||||||
|
.Sh AUTHORS
|
||||||
|
.An Roel Verdult Aq roel@libnfc.org
|
||||||
|
.An Romain Tartière Aq romain@libnfc.org
|
||||||
|
.An Romuald Conty Aq romuald@libnfc.org
|
||||||
|
.Pp
|
||||||
|
This manual page was written by Romuald Conty.
|
||||||
|
It is licensed under the terms of the GNU GPL (version 2 or later).
|
||||||
223
examples/nfc-emulate-forum-tag2.c
Normal file
223
examples/nfc-emulate-forum-tag2.c
Normal file
@ -0,0 +1,223 @@
|
|||||||
|
/*-
|
||||||
|
* Free/Libre Near Field Communication (NFC) library
|
||||||
|
*
|
||||||
|
* Libnfc historical contributors:
|
||||||
|
* Copyright (C) 2009 Roel Verdult
|
||||||
|
* Copyright (C) 2009-2013 Romuald Conty
|
||||||
|
* Copyright (C) 2010-2012 Romain Tartière
|
||||||
|
* Copyright (C) 2010-2013 Philippe Teuwen
|
||||||
|
* Copyright (C) 2012-2013 Ludovic Rousseau
|
||||||
|
* See AUTHORS file for a more comprehensive list of contributors.
|
||||||
|
* Additional contributors of this file:
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* 1) Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* 2 )Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* Note that this license only applies on the examples, NFC library itself is under LGPL
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file nfc-emulate-forum-tag2.c
|
||||||
|
* @brief Emulates a NFC-Forum Tag Type 2 with a NDEF message
|
||||||
|
* This example allow to emulate an NFC-Forum Tag Type 2 that contains
|
||||||
|
* a read-only NDEF message.
|
||||||
|
*
|
||||||
|
* This example has been developed using PN533 USB hardware as target and
|
||||||
|
* Google Nexus S phone as initiator.
|
||||||
|
*
|
||||||
|
* This is know to NOT work with Nokia 6212 Classic and could fail with
|
||||||
|
* several NFC Forum compliant devices due to the following reasons:
|
||||||
|
* - The emulated target has only a 4-byte UID while most devices assume a Tag
|
||||||
|
* Type 2 has always a 7-byte UID (as a real Mifare Ultralight tag);
|
||||||
|
* - The chip is emulating an ISO/IEC 14443-3 tag, without any hardware helper.
|
||||||
|
* If the initiator has too strict timeouts for software-based emulation
|
||||||
|
* (which is usually the case), this example will fail. This is not a bug
|
||||||
|
* and we can't do anything using this hardware (PN531/PN533).
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This implementation was written based on information provided by the
|
||||||
|
* following documents:
|
||||||
|
*
|
||||||
|
* NFC Forum Type 2 Tag Operation
|
||||||
|
* Technical Specification
|
||||||
|
* NFCForum-TS-Type-2-Tag_1.0 - 2007-07-09
|
||||||
|
*
|
||||||
|
* ISO/IEC 14443-3
|
||||||
|
* First edition - 2001-02-01
|
||||||
|
* Identification cards — Contactless integrated circuit(s) cards — Proximity cards
|
||||||
|
* Part 3: Initialization and anticollision
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include "config.h"
|
||||||
|
#endif // HAVE_CONFIG_H
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
#include <signal.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include <nfc/nfc.h>
|
||||||
|
#include <nfc/nfc-emulation.h>
|
||||||
|
|
||||||
|
#include "utils/nfc-utils.h"
|
||||||
|
|
||||||
|
static nfc_device *pnd;
|
||||||
|
static nfc_context *context;
|
||||||
|
|
||||||
|
static void
|
||||||
|
stop_emulation(int sig)
|
||||||
|
{
|
||||||
|
(void)sig;
|
||||||
|
if (pnd != NULL) {
|
||||||
|
nfc_abort_command(pnd);
|
||||||
|
} else {
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static uint8_t __nfcforum_tag2_memory_area[] = {
|
||||||
|
0x00, 0x00, 0x00, 0x00, // Block 0
|
||||||
|
0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0xFF, 0xFF, // Block 2 (Static lock bytes: CC area and data area are read-only locked)
|
||||||
|
0xE1, 0x10, 0x06, 0x0F, // Block 3 (CC - NFC-Forum Tag Type 2 version 1.0, Data area (from block 4 to the end) is 48 bytes, Read-only mode)
|
||||||
|
|
||||||
|
0x03, 33, 0xd1, 0x02, // Block 4 (NDEF)
|
||||||
|
0x1c, 0x53, 0x70, 0x91,
|
||||||
|
0x01, 0x09, 0x54, 0x02,
|
||||||
|
0x65, 0x6e, 0x4c, 0x69,
|
||||||
|
|
||||||
|
0x62, 0x6e, 0x66, 0x63,
|
||||||
|
0x51, 0x01, 0x0b, 0x55,
|
||||||
|
0x03, 0x6c, 0x69, 0x62,
|
||||||
|
0x6e, 0x66, 0x63, 0x2e,
|
||||||
|
|
||||||
|
0x6f, 0x72, 0x67, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00,
|
||||||
|
};
|
||||||
|
|
||||||
|
#define READ 0x30
|
||||||
|
#define WRITE 0xA2
|
||||||
|
#define SECTOR_SELECT 0xC2
|
||||||
|
|
||||||
|
#define HALT 0x50
|
||||||
|
static int
|
||||||
|
nfcforum_tag2_io(struct nfc_emulator *emulator, const uint8_t *data_in, const size_t data_in_len, uint8_t *data_out, const size_t data_out_len)
|
||||||
|
{
|
||||||
|
int res = 0;
|
||||||
|
|
||||||
|
uint8_t *nfcforum_tag2_memory_area = (uint8_t *)(emulator->user_data);
|
||||||
|
|
||||||
|
printf(" In: ");
|
||||||
|
print_hex(data_in, data_in_len);
|
||||||
|
|
||||||
|
switch (data_in[0]) {
|
||||||
|
case READ:
|
||||||
|
if (data_out_len >= 16) {
|
||||||
|
memcpy(data_out, nfcforum_tag2_memory_area + (data_in[1] * 4), 16);
|
||||||
|
res = 16;
|
||||||
|
} else {
|
||||||
|
res = -ENOSPC;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case HALT:
|
||||||
|
printf("HALT sent\n");
|
||||||
|
res = -ECONNABORTED;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
printf("Unknown command: 0x%02x\n", data_in[0]);
|
||||||
|
res = -ENOTSUP;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (res < 0) {
|
||||||
|
ERR("%s (%d)", strerror(-res), -res);
|
||||||
|
} else {
|
||||||
|
printf(" Out: ");
|
||||||
|
print_hex(data_out, res);
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
(void)argc;
|
||||||
|
(void)argv;
|
||||||
|
|
||||||
|
nfc_target nt = {
|
||||||
|
.nm = {
|
||||||
|
.nmt = NMT_ISO14443A,
|
||||||
|
.nbr = NBR_UNDEFINED, // Will be updated by nfc_target_init()
|
||||||
|
},
|
||||||
|
.nti = {
|
||||||
|
.nai = {
|
||||||
|
.abtAtqa = { 0x00, 0x04 },
|
||||||
|
.abtUid = { 0x08, 0x00, 0xb0, 0x0b },
|
||||||
|
.szUidLen = 4,
|
||||||
|
.btSak = 0x00,
|
||||||
|
.szAtsLen = 0,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct nfc_emulation_state_machine state_machine = {
|
||||||
|
.io = nfcforum_tag2_io
|
||||||
|
};
|
||||||
|
|
||||||
|
struct nfc_emulator emulator = {
|
||||||
|
.target = &nt,
|
||||||
|
.state_machine = &state_machine,
|
||||||
|
.user_data = __nfcforum_tag2_memory_area,
|
||||||
|
};
|
||||||
|
|
||||||
|
signal(SIGINT, stop_emulation);
|
||||||
|
|
||||||
|
nfc_init(&context);
|
||||||
|
if (context == NULL) {
|
||||||
|
ERR("Unable to init libnfc (malloc)");
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
pnd = nfc_open(context, NULL);
|
||||||
|
|
||||||
|
if (pnd == NULL) {
|
||||||
|
ERR("Unable to open NFC device");
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("NFC device: %s opened\n", nfc_device_get_name(pnd));
|
||||||
|
printf("Emulating NDEF tag now, please touch it with a second NFC device\n");
|
||||||
|
|
||||||
|
if (nfc_emulate_target(pnd, &emulator, 0) < 0) {
|
||||||
|
nfc_perror(pnd, argv[0]);
|
||||||
|
nfc_close(pnd);
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
nfc_close(pnd);
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_SUCCESS);
|
||||||
|
}
|
||||||
55
examples/nfc-emulate-tag.1
Normal file
55
examples/nfc-emulate-tag.1
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
.TH nfc-emulate-tag 1 "October 8, 2010" "libnfc" "libnfc's examples"
|
||||||
|
.SH NAME
|
||||||
|
nfc-emulate-tag \- Simple tag emulation command line demonstration tool
|
||||||
|
.SH SYNOPSIS
|
||||||
|
.B nfc-emulate-tag
|
||||||
|
.SH DESCRIPTION
|
||||||
|
.B nfc-emulate-tag
|
||||||
|
is a simple tag emulation tool that demonstrates how emulation can be done
|
||||||
|
using libnfc.
|
||||||
|
|
||||||
|
Currently, this tool partially emulates a Mifare Mini: it is detected as
|
||||||
|
Mifare Mini but internal MIFARE proprietary commands are not yet implemented.
|
||||||
|
|
||||||
|
To be able to emulate a target, there are two main parts:
|
||||||
|
- communication: handle modulation, anticollision, etc.
|
||||||
|
- computation: process commands (input) and produce results (output).
|
||||||
|
|
||||||
|
This demonstration tool proposes a logical structure to handle communication and
|
||||||
|
a simple function to deal with computation.
|
||||||
|
|
||||||
|
To improve the target capabilities, we can now implement more allowed commands
|
||||||
|
in a single function: target_io()
|
||||||
|
|
||||||
|
Please note that, due to timing issues, it is very difficult to implement an
|
||||||
|
ISO14443-4 tag this way: RATS request expects a quick ATS answer. By the way,
|
||||||
|
even if you implement another kind of tag, timing issues are often the source of
|
||||||
|
problems like CRC or parity errors.
|
||||||
|
The OmniKey CardMan 5321 is known to be very large on timings and is a good
|
||||||
|
choice if you want to experiment with this emulator with a tolerant reader.
|
||||||
|
|
||||||
|
.SH IMPORTANT
|
||||||
|
ACR122 devices (like touchatag, etc.) can be used by this example (with
|
||||||
|
probably timing issue), but if something goes wrong, you will have to
|
||||||
|
unplug/replug your device. This is not a
|
||||||
|
.B libnfc's
|
||||||
|
bug, this problem is due to ACR122's internal MCU in front of NFC chip (PN532).
|
||||||
|
.SH BUGS
|
||||||
|
Please report any bugs on the
|
||||||
|
.B libnfc
|
||||||
|
issue tracker at:
|
||||||
|
.br
|
||||||
|
.BR https://github.com/nfc-tools/libnfc/issues
|
||||||
|
.SH LICENCE
|
||||||
|
.B libnfc
|
||||||
|
is licensed under the GNU Lesser General Public License (LGPL), version 3.
|
||||||
|
.br
|
||||||
|
.B libnfc-utils
|
||||||
|
and
|
||||||
|
.B libnfc-examples
|
||||||
|
are covered by the the BSD 2-Clause license.
|
||||||
|
.SH AUTHORS
|
||||||
|
Romuald Conty <romuald@libnfc.org>
|
||||||
|
.PP
|
||||||
|
This manual page was written by Romuald Conty <romuald@libnfc.org>.
|
||||||
|
It is licensed under the terms of the GNU GPL (version 2 or later).
|
||||||
302
examples/nfc-emulate-tag.c
Normal file
302
examples/nfc-emulate-tag.c
Normal file
@ -0,0 +1,302 @@
|
|||||||
|
/*-
|
||||||
|
* Free/Libre Near Field Communication (NFC) library
|
||||||
|
*
|
||||||
|
* Libnfc historical contributors:
|
||||||
|
* Copyright (C) 2009 Roel Verdult
|
||||||
|
* Copyright (C) 2009-2013 Romuald Conty
|
||||||
|
* Copyright (C) 2010-2012 Romain Tartière
|
||||||
|
* Copyright (C) 2010-2013 Philippe Teuwen
|
||||||
|
* Copyright (C) 2012-2013 Ludovic Rousseau
|
||||||
|
* See AUTHORS file for a more comprehensive list of contributors.
|
||||||
|
* Additional contributors of this file:
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* 1) Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* 2 )Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* Note that this license only applies on the examples, NFC library itself is under LGPL
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file nfc-emulate-tag.c
|
||||||
|
* @brief Emulates a simple tag
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Note that depending on the device (initiator) you'll use against, this
|
||||||
|
// emulator it might work or not. Some readers are very strict on responses
|
||||||
|
// timings, e.g. a Nokia NFC and will drop communication too soon for us.
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include "config.h"
|
||||||
|
#endif // HAVE_CONFIG_H
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <signal.h>
|
||||||
|
|
||||||
|
#include <nfc/nfc.h>
|
||||||
|
|
||||||
|
#include "utils/nfc-utils.h"
|
||||||
|
|
||||||
|
#define MAX_FRAME_LEN (264)
|
||||||
|
#define SAK_ISO14443_4_COMPLIANT 0x20
|
||||||
|
|
||||||
|
static uint8_t abtRx[MAX_FRAME_LEN];
|
||||||
|
static int szRx;
|
||||||
|
static nfc_context *context;
|
||||||
|
static nfc_device *pnd;
|
||||||
|
static bool quiet_output = false;
|
||||||
|
static bool init_mfc_auth = false;
|
||||||
|
|
||||||
|
static void
|
||||||
|
intr_hdlr(int sig)
|
||||||
|
{
|
||||||
|
(void) sig;
|
||||||
|
printf("\nQuitting...\n");
|
||||||
|
if (pnd != NULL) {
|
||||||
|
nfc_abort_command(pnd);
|
||||||
|
}
|
||||||
|
nfc_close(pnd);
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool
|
||||||
|
target_io(nfc_target *pnt, const uint8_t *pbtInput, const size_t szInput, uint8_t *pbtOutput, size_t *pszOutput)
|
||||||
|
{
|
||||||
|
bool loop = true;
|
||||||
|
*pszOutput = 0;
|
||||||
|
|
||||||
|
// Show transmitted command
|
||||||
|
if (!quiet_output) {
|
||||||
|
printf(" In: ");
|
||||||
|
print_hex(pbtInput, szInput);
|
||||||
|
}
|
||||||
|
if (szInput) {
|
||||||
|
switch (pbtInput[0]) {
|
||||||
|
case 0x30: // Mifare read
|
||||||
|
// block address is in pbtInput[1]
|
||||||
|
*pszOutput = 15;
|
||||||
|
strcpy((char *)pbtOutput, "You read block ");
|
||||||
|
pbtOutput[15] = pbtInput[1];
|
||||||
|
break;
|
||||||
|
case 0x50: // HLTA (ISO14443-3)
|
||||||
|
if (!quiet_output) {
|
||||||
|
printf("Initiator HLTA me. Bye!\n");
|
||||||
|
}
|
||||||
|
loop = false;
|
||||||
|
break;
|
||||||
|
case 0x60: // Mifare authA
|
||||||
|
case 0x61: // Mifare authB
|
||||||
|
// Let's give back a very random nonce...
|
||||||
|
*pszOutput = 2;
|
||||||
|
pbtOutput[0] = 0x12;
|
||||||
|
pbtOutput[1] = 0x34;
|
||||||
|
// Next commands will be without CRC
|
||||||
|
init_mfc_auth = true;
|
||||||
|
break;
|
||||||
|
case 0xe0: // RATS (ISO14443-4)
|
||||||
|
// Send ATS
|
||||||
|
*pszOutput = pnt->nti.nai.szAtsLen + 1;
|
||||||
|
pbtOutput[0] = pnt->nti.nai.szAtsLen + 1; // ISO14443-4 says that ATS contains ATS_Length as first byte
|
||||||
|
if (pnt->nti.nai.szAtsLen) {
|
||||||
|
memcpy(pbtOutput + 1, pnt->nti.nai.abtAts, pnt->nti.nai.szAtsLen);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 0xc2: // S-block DESELECT
|
||||||
|
if (!quiet_output) {
|
||||||
|
printf("Initiator DESELECT me. Bye!\n");
|
||||||
|
}
|
||||||
|
loop = false;
|
||||||
|
break;
|
||||||
|
default: // Unknown
|
||||||
|
if (!quiet_output) {
|
||||||
|
printf("Unknown frame, emulated target abort.\n");
|
||||||
|
}
|
||||||
|
loop = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Show transmitted command
|
||||||
|
if ((!quiet_output) && *pszOutput) {
|
||||||
|
printf(" Out: ");
|
||||||
|
print_hex(pbtOutput, *pszOutput);
|
||||||
|
}
|
||||||
|
return loop;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool
|
||||||
|
nfc_target_emulate_tag(nfc_device *dev, nfc_target *pnt)
|
||||||
|
{
|
||||||
|
size_t szTx;
|
||||||
|
uint8_t abtTx[MAX_FRAME_LEN];
|
||||||
|
bool loop = true;
|
||||||
|
|
||||||
|
if ((szRx = nfc_target_init(dev, pnt, abtRx, sizeof(abtRx), 0)) < 0) {
|
||||||
|
nfc_perror(dev, "nfc_target_init");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (loop) {
|
||||||
|
loop = target_io(pnt, abtRx, (size_t) szRx, abtTx, &szTx);
|
||||||
|
if (szTx) {
|
||||||
|
if (nfc_target_send_bytes(dev, abtTx, szTx, 0) < 0) {
|
||||||
|
nfc_perror(dev, "nfc_target_send_bytes");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (loop) {
|
||||||
|
if (init_mfc_auth) {
|
||||||
|
if (nfc_device_set_property_bool(dev, NP_HANDLE_CRC, false) < 0) {
|
||||||
|
nfc_perror(pnd, "nfc_target_emulate_tag");
|
||||||
|
nfc_close(pnd);
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
init_mfc_auth = false;
|
||||||
|
}
|
||||||
|
if ((szRx = nfc_target_receive_bytes(dev, abtRx, sizeof(abtRx), 0)) < 0) {
|
||||||
|
nfc_perror(dev, "nfc_target_receive_bytes");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
(void) argc;
|
||||||
|
const char *acLibnfcVersion;
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
signal(SIGINT, (void (__cdecl *)(int)) intr_hdlr);
|
||||||
|
#else
|
||||||
|
signal(SIGINT, intr_hdlr);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
nfc_init(&context);
|
||||||
|
if (context == NULL) {
|
||||||
|
ERR("Unable to init libnfc (malloc)");
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Display libnfc version
|
||||||
|
acLibnfcVersion = nfc_version();
|
||||||
|
printf("%s uses libnfc %s\n", argv[0], acLibnfcVersion);
|
||||||
|
|
||||||
|
// Try to open the NFC reader
|
||||||
|
pnd = nfc_open(context, NULL);
|
||||||
|
|
||||||
|
if (pnd == NULL) {
|
||||||
|
ERR("Unable to open NFC device");
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("NFC device: %s opened\n", nfc_device_get_name(pnd));
|
||||||
|
|
||||||
|
// Notes for ISO14443-A emulated tags:
|
||||||
|
// * Only short UIDs are supported
|
||||||
|
// If your UID is longer it will be truncated
|
||||||
|
// Therefore e.g. an UltraLight can only have short UID, which is
|
||||||
|
// typically badly handled by readers who still try to send their "0x95"
|
||||||
|
// * First byte of UID will be masked by 0x08 by the PN53x firmware
|
||||||
|
// as security countermeasure against real UID emulation
|
||||||
|
|
||||||
|
// Example of a Mifare Classic Mini
|
||||||
|
// Note that crypto1 is not implemented in this example
|
||||||
|
nfc_target nt = {
|
||||||
|
.nm = {
|
||||||
|
.nmt = NMT_ISO14443A,
|
||||||
|
.nbr = NBR_UNDEFINED,
|
||||||
|
},
|
||||||
|
.nti = {
|
||||||
|
.nai = {
|
||||||
|
.abtAtqa = { 0x00, 0x04 },
|
||||||
|
.abtUid = { 0x08, 0xab, 0xcd, 0xef },
|
||||||
|
.btSak = 0x09,
|
||||||
|
.szUidLen = 4,
|
||||||
|
.szAtsLen = 0,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
/*
|
||||||
|
// Example of a FeliCa
|
||||||
|
nfc_target nt = {
|
||||||
|
.nm = {
|
||||||
|
.nmt = NMT_FELICA,
|
||||||
|
.nbr = NBR_UNDEFINED,
|
||||||
|
},
|
||||||
|
.nti = {
|
||||||
|
.nfi = {
|
||||||
|
.abtId = { 0x01, 0xFE, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xFF },
|
||||||
|
.abtPad = { 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xFF },
|
||||||
|
.abtSysCode = { 0xFF, 0xFF },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
// Example of a ISO14443-4 (DESfire)
|
||||||
|
nfc_target nt = {
|
||||||
|
.nm = {
|
||||||
|
.nmt = NMT_ISO14443A,
|
||||||
|
.nbr = NBR_UNDEFINED,
|
||||||
|
},
|
||||||
|
.nti = {
|
||||||
|
.nai = {
|
||||||
|
.abtAtqa = { 0x03, 0x44 },
|
||||||
|
.abtUid = { 0x08, 0xab, 0xcd, 0xef },
|
||||||
|
.btSak = 0x20,
|
||||||
|
.szUidLen = 4,
|
||||||
|
.abtAts = { 0x75, 0x77, 0x81, 0x02, 0x80 },
|
||||||
|
.szAtsLen = 5,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
*/
|
||||||
|
|
||||||
|
printf("%s will emulate this ISO14443-A tag:\n", argv[0]);
|
||||||
|
print_nfc_target(&nt, true);
|
||||||
|
|
||||||
|
// Switch off NP_EASY_FRAMING if target is not ISO14443-4
|
||||||
|
if (nfc_device_set_property_bool(pnd, NP_EASY_FRAMING, (nt.nti.nai.btSak & SAK_ISO14443_4_COMPLIANT)) < 0) {
|
||||||
|
nfc_perror(pnd, "nfc_target_emulate_tag");
|
||||||
|
nfc_close(pnd);
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
printf("NFC device (configured as target) is now emulating the tag, please touch it with a second NFC device (initiator)\n");
|
||||||
|
if (!nfc_target_emulate_tag(pnd, &nt)) {
|
||||||
|
nfc_perror(pnd, "nfc_target_emulate_tag");
|
||||||
|
nfc_close(pnd);
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
nfc_close(pnd);
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
70
examples/nfc-emulate-uid.1
Normal file
70
examples/nfc-emulate-uid.1
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
.TH nfc-emulate-uid 1 "June 26, 2009" "libnfc" "libnfc's examples"
|
||||||
|
.SH NAME
|
||||||
|
nfc-emulate-uid \- NFC target emulation command line tool based on libnfc
|
||||||
|
.SH SYNOPSIS
|
||||||
|
.B nfc-emulate-uid
|
||||||
|
.RI [ OPTIONS ]
|
||||||
|
.RI [ UID ]
|
||||||
|
.SH DESCRIPTION
|
||||||
|
.B nfc-emulate-uid
|
||||||
|
is a tag emulation tool that allows one to choose any tag UID. Tag emulation is one
|
||||||
|
of the main added features in NFC. But to avoid abuse of existing systems,
|
||||||
|
manufacturers of the NFC controller intentionally did not support emulation of
|
||||||
|
fully customized UID but only of "random" UIDs, which always start with 0x08.
|
||||||
|
The nfc-emulate-uid tool demonstrates that this can still be done using
|
||||||
|
transmission of raw frames, and the desired UID can be optionally specified.
|
||||||
|
|
||||||
|
This makes it a serious threat for security systems that rely only on the
|
||||||
|
uniqueness of the UID.
|
||||||
|
|
||||||
|
Unfortunately, this example can't directly start in fully customisable
|
||||||
|
target mode. Just after launching this example, you will have to go through
|
||||||
|
the hardcoded initial anti-collision with the 0x08-prefixed UID.
|
||||||
|
To achieve it, you can e.g. send a RATS (Request for Answer To Select) command
|
||||||
|
by using a second NFC device (placed in target's field) and launching nfc-list
|
||||||
|
or nfc-anticol. After this first step, you now have a NFC device (configured
|
||||||
|
as target) that really emulates a custom UID.
|
||||||
|
You could view it using the second NFC device with nfc-list.
|
||||||
|
|
||||||
|
Timing control is very important for a successful anti-collision sequence:
|
||||||
|
|
||||||
|
- The emulator must be very fast to react:
|
||||||
|
Using the ACR122 device gives many timing issues, "PN53x only" USB
|
||||||
|
devices also give some timing issues but an embedded microprocessor
|
||||||
|
would probably improve greatly the situation.
|
||||||
|
|
||||||
|
- The reader should not be too strict on timing (the standard is very
|
||||||
|
strict). The OmniKey CardMan 5321 is known to be very large on
|
||||||
|
timings and is a good choice if you want to experiment with this
|
||||||
|
emulator with a tolerant reader.
|
||||||
|
Nokia NFC 6212 and Pegoda readers are much too strict and won't be fooled.
|
||||||
|
|
||||||
|
.SH OPTIONS
|
||||||
|
.IR UID
|
||||||
|
8 hex digits format that represents desired UID (default is DEADBEEF).
|
||||||
|
|
||||||
|
.SH IMPORTANT
|
||||||
|
ACR122 devices (like touchatag, etc.) can be used by this example (with timing
|
||||||
|
issues), but if something goes wrong, you will have to unplug/replug your
|
||||||
|
device. This is not a
|
||||||
|
.B libnfc's
|
||||||
|
bug, this problem is due to ACR122's internal MCU in front of NFC chip (PN532).
|
||||||
|
.SH BUGS
|
||||||
|
Please report any bugs on the
|
||||||
|
.B libnfc
|
||||||
|
issue tracker at:
|
||||||
|
.br
|
||||||
|
.BR https://github.com/nfc-tools/libnfc/issues
|
||||||
|
.SH LICENCE
|
||||||
|
.B libnfc
|
||||||
|
is licensed under the GNU Lesser General Public License (LGPL), version 3.
|
||||||
|
.br
|
||||||
|
.B libnfc-utils
|
||||||
|
and
|
||||||
|
.B libnfc-examples
|
||||||
|
are covered by the the BSD 2-Clause license.
|
||||||
|
.SH AUTHORS
|
||||||
|
Roel Verdult <roel@libnfc.org>
|
||||||
|
.PP
|
||||||
|
This manual page was written by Romuald Conty <romuald@libnfc.org>.
|
||||||
|
It is licensed under the terms of the GNU GPL (version 2 or later).
|
||||||
243
examples/nfc-emulate-uid.c
Normal file
243
examples/nfc-emulate-uid.c
Normal file
@ -0,0 +1,243 @@
|
|||||||
|
/*-
|
||||||
|
* Free/Libre Near Field Communication (NFC) library
|
||||||
|
*
|
||||||
|
* Libnfc historical contributors:
|
||||||
|
* Copyright (C) 2009 Roel Verdult
|
||||||
|
* Copyright (C) 2009-2013 Romuald Conty
|
||||||
|
* Copyright (C) 2010-2012 Romain Tartière
|
||||||
|
* Copyright (C) 2010-2013 Philippe Teuwen
|
||||||
|
* Copyright (C) 2012-2013 Ludovic Rousseau
|
||||||
|
* See AUTHORS file for a more comprehensive list of contributors.
|
||||||
|
* Additional contributors of this file:
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* 1) Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* 2 )Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* Note that this license only applies on the examples, NFC library itself is under LGPL
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file nfc-emulate-uid.c
|
||||||
|
* @brief Emulates a tag which which have a "really" custom UID
|
||||||
|
*
|
||||||
|
* NFC devices are able to emulate passive tags but manufacturers restrict the
|
||||||
|
* customization of UID. With PN53x, UID is only 4-byte long and the first
|
||||||
|
* byte of emulated UID is hard-wired to 0x08 which is the standard way to say
|
||||||
|
* this is a random UID. This example shows how to emulate a fully customized
|
||||||
|
* UID by "manually" replying to anti-collision process sent by the initiator.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include "config.h"
|
||||||
|
#endif // HAVE_CONFIG_H
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <signal.h>
|
||||||
|
|
||||||
|
#include <nfc/nfc.h>
|
||||||
|
|
||||||
|
#include "utils/nfc-utils.h"
|
||||||
|
|
||||||
|
#define MAX_FRAME_LEN 264
|
||||||
|
|
||||||
|
static uint8_t abtRecv[MAX_FRAME_LEN];
|
||||||
|
static int szRecvBits;
|
||||||
|
static nfc_device *pnd;
|
||||||
|
static nfc_context *context;
|
||||||
|
|
||||||
|
// ISO14443A Anti-Collision response
|
||||||
|
uint8_t abtAtqa[2] = { 0x04, 0x00 };
|
||||||
|
uint8_t abtUidBcc[5] = { 0xDE, 0xAD, 0xBE, 0xEF, 0x22 };
|
||||||
|
uint8_t abtSak[9] = { 0x08, 0xb6, 0xdd };
|
||||||
|
|
||||||
|
static void
|
||||||
|
intr_hdlr(int sig)
|
||||||
|
{
|
||||||
|
(void) sig;
|
||||||
|
if (pnd != NULL) {
|
||||||
|
printf("\nAborting current command...\n");
|
||||||
|
nfc_abort_command(pnd);
|
||||||
|
nfc_close(pnd);
|
||||||
|
}
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
print_usage(char *argv[])
|
||||||
|
{
|
||||||
|
printf("Usage: %s [OPTIONS] [UID]\n", argv[0]);
|
||||||
|
printf("Options:\n");
|
||||||
|
printf("\t-h\tHelp. Print this message.\n");
|
||||||
|
printf("\t-q\tQuiet mode. Silent output: received and sent frames will not be shown (improves timing).\n");
|
||||||
|
printf("\n");
|
||||||
|
printf("\t[UID]\tUID to emulate, specified as 8 HEX digits (default is DEADBEEF).\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
uint8_t *pbtTx = NULL;
|
||||||
|
size_t szTxBits;
|
||||||
|
bool quiet_output = false;
|
||||||
|
|
||||||
|
int arg,
|
||||||
|
i;
|
||||||
|
|
||||||
|
// Get commandline options
|
||||||
|
for (arg = 1; arg < argc; arg++) {
|
||||||
|
if (0 == strcmp(argv[arg], "-h")) {
|
||||||
|
print_usage(argv);
|
||||||
|
exit(EXIT_SUCCESS);
|
||||||
|
} else if (0 == strcmp(argv[arg], "-q")) {
|
||||||
|
printf("Quiet mode.\n");
|
||||||
|
quiet_output = true;
|
||||||
|
} else if ((arg == argc - 1) && (strlen(argv[arg]) == 8)) { // See if UID was specified as HEX string
|
||||||
|
uint8_t abtTmp[3] = { 0x00, 0x00, 0x00 };
|
||||||
|
printf("[+] Using UID: %s\n", argv[arg]);
|
||||||
|
abtUidBcc[4] = 0x00;
|
||||||
|
for (i = 0; i < 4; ++i) {
|
||||||
|
memcpy(abtTmp, argv[arg] + i * 2, 2);
|
||||||
|
abtUidBcc[i] = (uint8_t) strtol((char *) abtTmp, NULL, 16);
|
||||||
|
abtUidBcc[4] ^= abtUidBcc[i];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ERR("%s is not supported option.", argv[arg]);
|
||||||
|
print_usage(argv);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
signal(SIGINT, (void (__cdecl *)(int)) intr_hdlr);
|
||||||
|
#else
|
||||||
|
signal(SIGINT, intr_hdlr);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
nfc_init(&context);
|
||||||
|
if (context == NULL) {
|
||||||
|
ERR("Unable to init libnfc (malloc)");
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Try to open the NFC device
|
||||||
|
pnd = nfc_open(context, NULL);
|
||||||
|
|
||||||
|
if (pnd == NULL) {
|
||||||
|
ERR("Unable to open NFC device");
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("\n");
|
||||||
|
printf("NFC device: %s opened\n", nfc_device_get_name(pnd));
|
||||||
|
printf("[+] Try to break out the auto-emulation, this requires a second NFC device!\n");
|
||||||
|
printf("[+] To do this, please send any command after the anti-collision\n");
|
||||||
|
printf("[+] For example, send a RATS command or use the \"nfc-anticol\" or \"nfc-list\" tool.\n");
|
||||||
|
|
||||||
|
// Note: We have to build a "fake" nfc_target in order to do exactly the same that was done before the new nfc_target_init() was introduced.
|
||||||
|
nfc_target nt = {
|
||||||
|
.nm = {
|
||||||
|
.nmt = NMT_ISO14443A,
|
||||||
|
.nbr = NBR_UNDEFINED,
|
||||||
|
},
|
||||||
|
.nti = {
|
||||||
|
.nai = {
|
||||||
|
.abtAtqa = { 0x04, 0x00 },
|
||||||
|
.abtUid = { 0x08, 0xad, 0xbe, 0xef },
|
||||||
|
.btSak = 0x20,
|
||||||
|
.szUidLen = 4,
|
||||||
|
.szAtsLen = 0,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
if ((szRecvBits = nfc_target_init(pnd, &nt, abtRecv, sizeof(abtRecv), 0)) < 0) {
|
||||||
|
nfc_perror(pnd, "nfc_target_init");
|
||||||
|
ERR("Could not come out of auto-emulation, no command was received");
|
||||||
|
nfc_close(pnd);
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
printf("[+] Received initiator command: ");
|
||||||
|
print_hex_bits(abtRecv, (size_t) szRecvBits);
|
||||||
|
printf("[+] Configuring communication\n");
|
||||||
|
if ((nfc_device_set_property_bool(pnd, NP_HANDLE_CRC, false) < 0) || (nfc_device_set_property_bool(pnd, NP_HANDLE_PARITY, true) < 0)) {
|
||||||
|
nfc_perror(pnd, "nfc_device_set_property_bool");
|
||||||
|
nfc_close(pnd);
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
printf("[+] Done, the emulated tag is initialized with UID: %02X%02X%02X%02X\n\n", abtUidBcc[0], abtUidBcc[1],
|
||||||
|
abtUidBcc[2], abtUidBcc[3]);
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
// Test if we received a frame
|
||||||
|
if ((szRecvBits = nfc_target_receive_bits(pnd, abtRecv, sizeof(abtRecv), 0)) > 0) {
|
||||||
|
// Prepare the command to send back for the anti-collision request
|
||||||
|
switch (szRecvBits) {
|
||||||
|
case 7: // Request or Wakeup
|
||||||
|
pbtTx = abtAtqa;
|
||||||
|
szTxBits = 16;
|
||||||
|
// New anti-collsion session started
|
||||||
|
if (!quiet_output)
|
||||||
|
printf("\n");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 16: // Select All
|
||||||
|
pbtTx = abtUidBcc;
|
||||||
|
szTxBits = 40;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 72: // Select Tag
|
||||||
|
pbtTx = abtSak;
|
||||||
|
szTxBits = 24;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default: // unknown length?
|
||||||
|
szTxBits = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!quiet_output) {
|
||||||
|
printf("R: ");
|
||||||
|
print_hex_bits(abtRecv, (size_t) szRecvBits);
|
||||||
|
}
|
||||||
|
// Test if we know how to respond
|
||||||
|
if (szTxBits) {
|
||||||
|
// Send and print the command to the screen
|
||||||
|
if (nfc_target_send_bits(pnd, pbtTx, szTxBits, NULL) < 0) {
|
||||||
|
nfc_perror(pnd, "nfc_target_send_bits");
|
||||||
|
nfc_close(pnd);
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
if (!quiet_output) {
|
||||||
|
printf("T: ");
|
||||||
|
print_hex_bits(pbtTx, szTxBits);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
40
examples/nfc-mfsetuid.1
Normal file
40
examples/nfc-mfsetuid.1
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
.TH nfc-mfsetuid 1 "Sep 05, 2011" "libnfc" "NFC Utilities"
|
||||||
|
.SH NAME
|
||||||
|
nfc-mfsetuid \- MIFARE 1K special card UID setting and recovery tool
|
||||||
|
.SH SYNOPSIS
|
||||||
|
.B nfc-mfsetuid
|
||||||
|
[
|
||||||
|
.I UID
|
||||||
|
]
|
||||||
|
|
||||||
|
.SH DESCRIPTION
|
||||||
|
.B nfc-mfsetuid
|
||||||
|
is a MIFARE tool that allows setting of UID on special versions (Chinese clones) of Mifare 1K cards. It will also recover
|
||||||
|
damaged cards that have had invalid data written to block 0 (e.g. wrong BCC). Currently only 4 Byte UID is supported.
|
||||||
|
Specify an eight hex character UID or leave blank for the default '01234567'.
|
||||||
|
|
||||||
|
.SH OPTIONS
|
||||||
|
.B -f
|
||||||
|
Format. Wipe all data (set to 0xFF) and reset ACLs to defaults.
|
||||||
|
|
||||||
|
.B -q
|
||||||
|
Quiet. Suppress output of commands and responses.
|
||||||
|
.SH BUGS
|
||||||
|
Please report any bugs on the
|
||||||
|
.B libnfc
|
||||||
|
issue tracker at:
|
||||||
|
.br
|
||||||
|
.BR https://github.com/nfc-tools/libnfc/issues
|
||||||
|
.SH LICENCE
|
||||||
|
.B libnfc
|
||||||
|
is licensed under the GNU Lesser General Public License (LGPL), version 3.
|
||||||
|
.br
|
||||||
|
.B libnfc-utils
|
||||||
|
and
|
||||||
|
.B libnfc-examples
|
||||||
|
are covered by the the BSD 2-Clause license.
|
||||||
|
.SH AUTHORS
|
||||||
|
Adam Laurie <adam@algroup.co.uk>
|
||||||
|
.PP
|
||||||
|
This manual page was written by Adam Laurie <adam@algroup.co.uk>.
|
||||||
|
It is licensed under the terms of the GNU GPL (version 2 or later).
|
||||||
399
examples/nfc-mfsetuid.c
Normal file
399
examples/nfc-mfsetuid.c
Normal file
@ -0,0 +1,399 @@
|
|||||||
|
/*-
|
||||||
|
* Free/Libre Near Field Communication (NFC) library
|
||||||
|
*
|
||||||
|
* Libnfc historical contributors:
|
||||||
|
* Copyright (C) 2009 Roel Verdult
|
||||||
|
* Copyright (C) 2009-2013 Romuald Conty
|
||||||
|
* Copyright (C) 2010-2012 Romain Tartière
|
||||||
|
* Copyright (C) 2010-2013 Philippe Teuwen
|
||||||
|
* Copyright (C) 2012-2013 Ludovic Rousseau
|
||||||
|
* See AUTHORS file for a more comprehensive list of contributors.
|
||||||
|
* Additional contributors of this file:
|
||||||
|
* Copyright (C) 2011 Adam Laurie
|
||||||
|
* Copyright (C) 2014 Dario Carluccio
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* 1) Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* 2 )Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* Note that this license only applies on the examples, NFC library itself is under LGPL
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file nfc-mfsetuid.c
|
||||||
|
* @brief Set UID of special Mifare cards
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* based on nfc-anticol.c
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include "config.h"
|
||||||
|
#endif // HAVE_CONFIG_H
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <nfc/nfc.h>
|
||||||
|
|
||||||
|
#include "utils/nfc-utils.h"
|
||||||
|
|
||||||
|
#define SAK_FLAG_ATS_SUPPORTED 0x20
|
||||||
|
|
||||||
|
#define MAX_FRAME_LEN 264
|
||||||
|
|
||||||
|
static uint8_t abtRx[MAX_FRAME_LEN];
|
||||||
|
static int szRxBits;
|
||||||
|
static uint8_t abtRawUid[12];
|
||||||
|
static uint8_t abtAtqa[2];
|
||||||
|
static uint8_t abtSak;
|
||||||
|
static uint8_t abtAts[MAX_FRAME_LEN];
|
||||||
|
static uint8_t szAts = 0;
|
||||||
|
static size_t szCL = 1;//Always start with Cascade Level 1 (CL1)
|
||||||
|
static nfc_device *pnd;
|
||||||
|
|
||||||
|
bool quiet_output = false;
|
||||||
|
bool iso_ats_supported = false;
|
||||||
|
|
||||||
|
// ISO14443A Anti-Collision Commands
|
||||||
|
uint8_t abtReqa[1] = { 0x26 };
|
||||||
|
uint8_t abtSelectAll[2] = { 0x93, 0x20 };
|
||||||
|
uint8_t abtSelectTag[9] = { 0x93, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
||||||
|
uint8_t abtRats[4] = { 0xe0, 0x50, 0x00, 0x00 };
|
||||||
|
uint8_t abtHalt[4] = { 0x50, 0x00, 0x00, 0x00 };
|
||||||
|
#define CASCADE_BIT 0x04
|
||||||
|
|
||||||
|
// special unlock command
|
||||||
|
uint8_t abtUnlock1[1] = { 0x40 };
|
||||||
|
uint8_t abtUnlock2[1] = { 0x43 };
|
||||||
|
uint8_t abtWipe[1] = { 0x41 };
|
||||||
|
uint8_t abtWrite[4] = { 0xa0, 0x00, 0x5f, 0xb1 };
|
||||||
|
uint8_t abtData[18] = { 0x01, 0x23, 0x45, 0x67, 0x00, 0x08, 0x04, 0x00, 0x46, 0x59, 0x25, 0x58, 0x49, 0x10, 0x23, 0x02, 0x23, 0xeb };
|
||||||
|
uint8_t abtBlank[18] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x07, 0x80, 0x69, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x36, 0xCC };
|
||||||
|
|
||||||
|
|
||||||
|
static bool
|
||||||
|
transmit_bits(const uint8_t *pbtTx, const size_t szTxBits)
|
||||||
|
{
|
||||||
|
// Show transmitted command
|
||||||
|
if (!quiet_output) {
|
||||||
|
printf("Sent bits: ");
|
||||||
|
print_hex_bits(pbtTx, szTxBits);
|
||||||
|
}
|
||||||
|
// Transmit the bit frame command, we don't use the arbitrary parity feature
|
||||||
|
if ((szRxBits = nfc_initiator_transceive_bits(pnd, pbtTx, szTxBits, NULL, abtRx, sizeof(abtRx), NULL)) < 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Show received answer
|
||||||
|
if (!quiet_output) {
|
||||||
|
printf("Received bits: ");
|
||||||
|
print_hex_bits(abtRx, szRxBits);
|
||||||
|
}
|
||||||
|
// Succesful transfer
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static bool
|
||||||
|
transmit_bytes(const uint8_t *pbtTx, const size_t szTx)
|
||||||
|
{
|
||||||
|
// Show transmitted command
|
||||||
|
if (!quiet_output) {
|
||||||
|
printf("Sent bits: ");
|
||||||
|
print_hex(pbtTx, szTx);
|
||||||
|
}
|
||||||
|
int res;
|
||||||
|
// Transmit the command bytes
|
||||||
|
if ((res = nfc_initiator_transceive_bytes(pnd, pbtTx, szTx, abtRx, sizeof(abtRx), 0)) < 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Show received answer
|
||||||
|
if (!quiet_output) {
|
||||||
|
printf("Received bits: ");
|
||||||
|
print_hex(abtRx, res);
|
||||||
|
}
|
||||||
|
// Succesful transfer
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
print_usage(char *argv[])
|
||||||
|
{
|
||||||
|
printf("Usage: %s [OPTIONS] [UID|BLOCK0]\n", argv[0]);
|
||||||
|
printf("Options:\n");
|
||||||
|
printf("\t-h\tHelp. Print this message.\n");
|
||||||
|
printf("\t-f\tFormat. Delete all data (set to 0xFF) and reset ACLs to default.\n");
|
||||||
|
printf("\t-q\tQuiet mode. Suppress output of READER and CARD data (improves timing).\n");
|
||||||
|
printf("\n\tSpecify UID (4 HEX bytes) to set UID, or leave blank for default '01234567'.\n");
|
||||||
|
printf("\n\tSpecify BLOCK0 (16 HEX bytes) to set content of Block0. CRC (Byte 4) is recalculated an overwritten'.\n");
|
||||||
|
printf("\tThis utility can be used to recover cards that have been damaged by writing bad\n");
|
||||||
|
printf("\tdata (e.g. wrong BCC), thus making them non-selectable by most tools/readers.\n");
|
||||||
|
printf("\n\t*** Note: this utility only works with special Mifare 1K cards (Chinese clones).\n\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
int arg, i;
|
||||||
|
bool format = false;
|
||||||
|
unsigned int c;
|
||||||
|
char tmp[3] = { 0x00, 0x00, 0x00 };
|
||||||
|
|
||||||
|
|
||||||
|
// Get commandline options
|
||||||
|
for (arg = 1; arg < argc; arg++) {
|
||||||
|
if (0 == strcmp(argv[arg], "-h")) {
|
||||||
|
print_usage(argv);
|
||||||
|
exit(EXIT_SUCCESS);
|
||||||
|
} else if (0 == strcmp(argv[arg], "-f")) {
|
||||||
|
format = true;
|
||||||
|
} else if (0 == strcmp(argv[arg], "-q")) {
|
||||||
|
quiet_output = true;
|
||||||
|
} else if (strlen(argv[arg]) == 8) {
|
||||||
|
for (i = 0 ; i < 4 ; ++i) {
|
||||||
|
memcpy(tmp, argv[arg] + i * 2, 2);
|
||||||
|
sscanf(tmp, "%02x", &c);
|
||||||
|
abtData[i] = (char) c;
|
||||||
|
}
|
||||||
|
abtData[4] = abtData[0] ^ abtData[1] ^ abtData[2] ^ abtData[3];
|
||||||
|
iso14443a_crc_append(abtData, 16);
|
||||||
|
} else if (strlen(argv[arg]) == 32) {
|
||||||
|
for (i = 0 ; i < 16 ; ++i) {
|
||||||
|
memcpy(tmp, argv[arg] + i * 2, 2);
|
||||||
|
sscanf(tmp, "%02x", &c);
|
||||||
|
abtData[i] = (char) c;
|
||||||
|
}
|
||||||
|
abtData[4] = abtData[0] ^ abtData[1] ^ abtData[2] ^ abtData[3];
|
||||||
|
iso14443a_crc_append(abtData, 16);
|
||||||
|
} else {
|
||||||
|
ERR("%s is not supported option.", argv[arg]);
|
||||||
|
print_usage(argv);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
nfc_context *context;
|
||||||
|
nfc_init(&context);
|
||||||
|
if (context == NULL) {
|
||||||
|
ERR("Unable to init libnfc (malloc)");
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Try to open the NFC reader
|
||||||
|
pnd = nfc_open(context, NULL);
|
||||||
|
|
||||||
|
if (pnd == NULL) {
|
||||||
|
ERR("Error opening NFC reader");
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initialise NFC device as "initiator"
|
||||||
|
if (nfc_initiator_init(pnd) < 0) {
|
||||||
|
nfc_perror(pnd, "nfc_initiator_init");
|
||||||
|
nfc_close(pnd);
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Configure the CRC
|
||||||
|
if (nfc_device_set_property_bool(pnd, NP_HANDLE_CRC, false) < 0) {
|
||||||
|
nfc_perror(pnd, "nfc_device_set_property_bool");
|
||||||
|
nfc_close(pnd);
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
// Use raw send/receive methods
|
||||||
|
if (nfc_device_set_property_bool(pnd, NP_EASY_FRAMING, false) < 0) {
|
||||||
|
nfc_perror(pnd, "nfc_device_set_property_bool");
|
||||||
|
nfc_close(pnd);
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
// Disable 14443-4 autoswitching
|
||||||
|
if (nfc_device_set_property_bool(pnd, NP_AUTO_ISO14443_4, false) < 0) {
|
||||||
|
nfc_perror(pnd, "nfc_device_set_property_bool");
|
||||||
|
nfc_close(pnd);
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("NFC reader: %s opened\n", nfc_device_get_name(pnd));
|
||||||
|
|
||||||
|
// Send the 7 bits request command specified in ISO 14443A (0x26)
|
||||||
|
if (!transmit_bits(abtReqa, 7)) {
|
||||||
|
printf("Error: No tag available\n");
|
||||||
|
nfc_close(pnd);
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
memcpy(abtAtqa, abtRx, 2);
|
||||||
|
|
||||||
|
// Anti-collision
|
||||||
|
transmit_bytes(abtSelectAll, 2);
|
||||||
|
|
||||||
|
// Check answer
|
||||||
|
if ((abtRx[0] ^ abtRx[1] ^ abtRx[2] ^ abtRx[3] ^ abtRx[4]) != 0) {
|
||||||
|
printf("WARNING: BCC check failed!\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save the UID CL1
|
||||||
|
memcpy(abtRawUid, abtRx, 4);
|
||||||
|
|
||||||
|
//Prepare and send CL1 Select-Command
|
||||||
|
memcpy(abtSelectTag + 2, abtRx, 5);
|
||||||
|
iso14443a_crc_append(abtSelectTag, 7);
|
||||||
|
transmit_bytes(abtSelectTag, 9);
|
||||||
|
abtSak = abtRx[0];
|
||||||
|
|
||||||
|
// Test if we are dealing with a CL2
|
||||||
|
if (abtSak & CASCADE_BIT) {
|
||||||
|
szCL = 2;//or more
|
||||||
|
// Check answer
|
||||||
|
if (abtRawUid[0] != 0x88) {
|
||||||
|
printf("WARNING: Cascade bit set but CT != 0x88!\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (szCL == 2) {
|
||||||
|
// We have to do the anti-collision for cascade level 2
|
||||||
|
|
||||||
|
// Prepare CL2 commands
|
||||||
|
abtSelectAll[0] = 0x95;
|
||||||
|
|
||||||
|
// Anti-collision
|
||||||
|
transmit_bytes(abtSelectAll, 2);
|
||||||
|
|
||||||
|
// Check answer
|
||||||
|
if ((abtRx[0] ^ abtRx[1] ^ abtRx[2] ^ abtRx[3] ^ abtRx[4]) != 0) {
|
||||||
|
printf("WARNING: BCC check failed!\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save UID CL2
|
||||||
|
memcpy(abtRawUid + 4, abtRx, 4);
|
||||||
|
|
||||||
|
// Selection
|
||||||
|
abtSelectTag[0] = 0x95;
|
||||||
|
memcpy(abtSelectTag + 2, abtRx, 5);
|
||||||
|
iso14443a_crc_append(abtSelectTag, 7);
|
||||||
|
transmit_bytes(abtSelectTag, 9);
|
||||||
|
abtSak = abtRx[0];
|
||||||
|
|
||||||
|
// Test if we are dealing with a CL3
|
||||||
|
if (abtSak & CASCADE_BIT) {
|
||||||
|
szCL = 3;
|
||||||
|
// Check answer
|
||||||
|
if (abtRawUid[0] != 0x88) {
|
||||||
|
printf("WARNING: Cascade bit set but CT != 0x88!\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (szCL == 3) {
|
||||||
|
// We have to do the anti-collision for cascade level 3
|
||||||
|
|
||||||
|
// Prepare and send CL3 AC-Command
|
||||||
|
abtSelectAll[0] = 0x97;
|
||||||
|
transmit_bytes(abtSelectAll, 2);
|
||||||
|
|
||||||
|
// Check answer
|
||||||
|
if ((abtRx[0] ^ abtRx[1] ^ abtRx[2] ^ abtRx[3] ^ abtRx[4]) != 0) {
|
||||||
|
printf("WARNING: BCC check failed!\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save UID CL3
|
||||||
|
memcpy(abtRawUid + 8, abtRx, 4);
|
||||||
|
|
||||||
|
// Prepare and send final Select-Command
|
||||||
|
abtSelectTag[0] = 0x97;
|
||||||
|
memcpy(abtSelectTag + 2, abtRx, 5);
|
||||||
|
iso14443a_crc_append(abtSelectTag, 7);
|
||||||
|
transmit_bytes(abtSelectTag, 9);
|
||||||
|
abtSak = abtRx[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Request ATS, this only applies to tags that support ISO 14443A-4
|
||||||
|
if (abtRx[0] & SAK_FLAG_ATS_SUPPORTED) {
|
||||||
|
iso_ats_supported = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("\nFound tag with\n UID: ");
|
||||||
|
switch (szCL) {
|
||||||
|
case 1:
|
||||||
|
printf("%02x%02x%02x%02x", abtRawUid[0], abtRawUid[1], abtRawUid[2], abtRawUid[3]);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
printf("%02x%02x%02x", abtRawUid[1], abtRawUid[2], abtRawUid[3]);
|
||||||
|
printf("%02x%02x%02x%02x", abtRawUid[4], abtRawUid[5], abtRawUid[6], abtRawUid[7]);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
printf("%02x%02x%02x", abtRawUid[1], abtRawUid[2], abtRawUid[3]);
|
||||||
|
printf("%02x%02x%02x", abtRawUid[5], abtRawUid[6], abtRawUid[7]);
|
||||||
|
printf("%02x%02x%02x%02x", abtRawUid[8], abtRawUid[9], abtRawUid[10], abtRawUid[11]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
printf("ATQA: %02x%02x\n SAK: %02x\n", abtAtqa[1], abtAtqa[0], abtSak);
|
||||||
|
if (szAts > 1) { // if = 1, it's not actual ATS but error code
|
||||||
|
printf(" ATS: ");
|
||||||
|
print_hex(abtAts, szAts);
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
|
// now reset UID
|
||||||
|
iso14443a_crc_append(abtHalt, 2);
|
||||||
|
transmit_bytes(abtHalt, 4);
|
||||||
|
|
||||||
|
if (!transmit_bits(abtUnlock1, 7)) {
|
||||||
|
printf("Warning: Unlock command [1/2]: failed / not acknowledged.\n");
|
||||||
|
} else {
|
||||||
|
if (format) {
|
||||||
|
transmit_bytes(abtWipe, 1);
|
||||||
|
transmit_bytes(abtHalt, 4);
|
||||||
|
transmit_bits(abtUnlock1, 7);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (transmit_bytes(abtUnlock2, 1)) {
|
||||||
|
printf("Card unlocked\n");
|
||||||
|
} else {
|
||||||
|
printf("Warning: Unlock command [2/2]: failed / not acknowledged.\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
transmit_bytes(abtWrite, 4);
|
||||||
|
transmit_bytes(abtData, 18);
|
||||||
|
if (format) {
|
||||||
|
for (i = 3 ; i < 64 ; i += 4) {
|
||||||
|
abtWrite[1] = (char) i;
|
||||||
|
iso14443a_crc_append(abtWrite, 2);
|
||||||
|
transmit_bytes(abtWrite, 4);
|
||||||
|
transmit_bytes(abtBlank, 18);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
nfc_close(pnd);
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_SUCCESS);
|
||||||
|
}
|
||||||
58
examples/nfc-poll.1
Normal file
58
examples/nfc-poll.1
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
.TH nfc-poll 1 "June 26, 2009" "libnfc" "libnfc's examples"
|
||||||
|
.SH NAME
|
||||||
|
nfc-poll \- poll first available NFC target
|
||||||
|
.SH SYNOPSIS
|
||||||
|
.B nfc-poll
|
||||||
|
.SH DESCRIPTION
|
||||||
|
.B nfc-poll
|
||||||
|
is a utility for polling any available target (tags but also NFCIP targets)
|
||||||
|
using ISO14443-A, FeliCa, Jewel and ISO14443-B modulations.
|
||||||
|
|
||||||
|
This tool uses hardware polling feature if available (ie. PN532) or switch back
|
||||||
|
to software polling, it will display available information retrieved from the
|
||||||
|
tag.
|
||||||
|
|
||||||
|
.SH OPTIONS
|
||||||
|
.TP
|
||||||
|
.B \-v
|
||||||
|
Tells
|
||||||
|
.I
|
||||||
|
nfc-poll
|
||||||
|
to be verbose and display detailed information about the targets shown.
|
||||||
|
This includes SAK decoding and fingerprinting is available.
|
||||||
|
|
||||||
|
.SH IMPORTANT
|
||||||
|
There are some well-know limits with this example:
|
||||||
|
- Even with NDO_AUTO_14443_4A enabled (default),
|
||||||
|
.B nfc-poll
|
||||||
|
can miss ATS. That due to the way the PN532 use to poll for ISO14443 type A, it
|
||||||
|
will attempt to find ISO14443-4-only targets, then ISO14443-3. If your
|
||||||
|
ISO14443-4 target is present when PN532 looks for ISO14443-4-only, ATS will be
|
||||||
|
retrieved. But if your target enter the field during ISO14443-3, RATS will not
|
||||||
|
be sent and ATS not retrieved.
|
||||||
|
-
|
||||||
|
.B nfc-poll
|
||||||
|
can show up only one card while two are in field. That's due, again, to the way
|
||||||
|
the PN532 poll for targets. It will stop polling when one modulation got a
|
||||||
|
result, so if you have, for example, one ISO14443-3 (eg. Mifare Ultralight) and
|
||||||
|
one ISO14443-4 (eg. Mifare DESFire), it will probably return only the
|
||||||
|
ISO14443-4.
|
||||||
|
.SH BUGS
|
||||||
|
Please report any bugs on the
|
||||||
|
.B libnfc
|
||||||
|
issue tracker at:
|
||||||
|
.br
|
||||||
|
.BR https://github.com/nfc-tools/libnfc/issues
|
||||||
|
.SH LICENCE
|
||||||
|
.B libnfc
|
||||||
|
is licensed under the GNU Lesser General Public License (LGPL), version 3.
|
||||||
|
.br
|
||||||
|
.B libnfc-utils
|
||||||
|
and
|
||||||
|
.B libnfc-examples
|
||||||
|
are covered by the the BSD 2-Clause license.
|
||||||
|
.SH AUTHORS
|
||||||
|
Romuald Conty <romuald@libnfc.org>
|
||||||
|
.PP
|
||||||
|
This manual page was written by Romuald Conty <romuald@libnfc.org>.
|
||||||
|
It is licensed under the terms of the GNU GPL (version 2 or later).
|
||||||
162
examples/nfc-poll.c
Normal file
162
examples/nfc-poll.c
Normal file
@ -0,0 +1,162 @@
|
|||||||
|
/*-
|
||||||
|
* Free/Libre Near Field Communication (NFC) library
|
||||||
|
*
|
||||||
|
* Libnfc historical contributors:
|
||||||
|
* Copyright (C) 2009 Roel Verdult
|
||||||
|
* Copyright (C) 2009-2013 Romuald Conty
|
||||||
|
* Copyright (C) 2010-2012 Romain Tartière
|
||||||
|
* Copyright (C) 2010-2013 Philippe Teuwen
|
||||||
|
* Copyright (C) 2012-2013 Ludovic Rousseau
|
||||||
|
* See AUTHORS file for a more comprehensive list of contributors.
|
||||||
|
* Additional contributors of this file:
|
||||||
|
* Copyright (C) 2020 Adam Laurie
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* 1) Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* 2 )Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* Note that this license only applies on the examples, NFC library itself is under LGPL
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file nfc-poll.c
|
||||||
|
* @brief Polling example
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include "config.h"
|
||||||
|
#endif // HAVE_CONFIG_H
|
||||||
|
|
||||||
|
#include <err.h>
|
||||||
|
#include <inttypes.h>
|
||||||
|
#include <signal.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <nfc/nfc.h>
|
||||||
|
#include <nfc/nfc-types.h>
|
||||||
|
|
||||||
|
#include "utils/nfc-utils.h"
|
||||||
|
|
||||||
|
#define MAX_DEVICE_COUNT 16
|
||||||
|
|
||||||
|
static nfc_device *pnd = NULL;
|
||||||
|
static nfc_context *context;
|
||||||
|
|
||||||
|
static void stop_polling(int sig)
|
||||||
|
{
|
||||||
|
(void) sig;
|
||||||
|
if (pnd != NULL)
|
||||||
|
nfc_abort_command(pnd);
|
||||||
|
else {
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
print_usage(const char *progname)
|
||||||
|
{
|
||||||
|
printf("usage: %s [-v]\n", progname);
|
||||||
|
printf(" -v\t verbose display\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
main(int argc, const char *argv[])
|
||||||
|
{
|
||||||
|
bool verbose = false;
|
||||||
|
|
||||||
|
signal(SIGINT, stop_polling);
|
||||||
|
|
||||||
|
// Display libnfc version
|
||||||
|
const char *acLibnfcVersion = nfc_version();
|
||||||
|
|
||||||
|
printf("%s uses libnfc %s\n", argv[0], acLibnfcVersion);
|
||||||
|
if (argc != 1) {
|
||||||
|
if ((argc == 2) && (0 == strcmp("-v", argv[1]))) {
|
||||||
|
verbose = true;
|
||||||
|
} else {
|
||||||
|
print_usage(argv[0]);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const uint8_t uiPollNr = 20;
|
||||||
|
const uint8_t uiPeriod = 2;
|
||||||
|
const nfc_modulation nmModulations[6] = {
|
||||||
|
{ .nmt = NMT_ISO14443A, .nbr = NBR_106 },
|
||||||
|
{ .nmt = NMT_ISO14443B, .nbr = NBR_106 },
|
||||||
|
{ .nmt = NMT_FELICA, .nbr = NBR_212 },
|
||||||
|
{ .nmt = NMT_FELICA, .nbr = NBR_424 },
|
||||||
|
{ .nmt = NMT_JEWEL, .nbr = NBR_106 },
|
||||||
|
{ .nmt = NMT_ISO14443BICLASS, .nbr = NBR_106 },
|
||||||
|
};
|
||||||
|
const size_t szModulations = 6;
|
||||||
|
|
||||||
|
nfc_target nt;
|
||||||
|
int res = 0;
|
||||||
|
|
||||||
|
nfc_init(&context);
|
||||||
|
if (context == NULL) {
|
||||||
|
ERR("Unable to init libnfc (malloc)");
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
pnd = nfc_open(context, NULL);
|
||||||
|
|
||||||
|
if (pnd == NULL) {
|
||||||
|
ERR("%s", "Unable to open NFC device.");
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nfc_initiator_init(pnd) < 0) {
|
||||||
|
nfc_perror(pnd, "nfc_initiator_init");
|
||||||
|
nfc_close(pnd);
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("NFC reader: %s opened\n", nfc_device_get_name(pnd));
|
||||||
|
printf("NFC device will poll during %ld ms (%u pollings of %lu ms for %" PRIdPTR " modulations)\n", (unsigned long) uiPollNr * szModulations * uiPeriod * 150, uiPollNr, (unsigned long) uiPeriod * 150, szModulations);
|
||||||
|
if ((res = nfc_initiator_poll_target(pnd, nmModulations, szModulations, uiPollNr, uiPeriod, &nt)) < 0) {
|
||||||
|
nfc_perror(pnd, "nfc_initiator_poll_target");
|
||||||
|
nfc_close(pnd);
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (res > 0) {
|
||||||
|
print_nfc_target(&nt, verbose);
|
||||||
|
printf("Waiting for card removing...");
|
||||||
|
fflush(stdout);
|
||||||
|
while (0 == nfc_initiator_target_is_present(pnd, NULL)) {}
|
||||||
|
nfc_perror(pnd, "nfc_initiator_target_is_present");
|
||||||
|
printf("done.\n");
|
||||||
|
} else {
|
||||||
|
printf("No target found.\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
nfc_close(pnd);
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_SUCCESS);
|
||||||
|
}
|
||||||
38
examples/nfc-relay.1
Normal file
38
examples/nfc-relay.1
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
.TH nfc-relay 1 "June 26, 2009" "libnfc" "libnfc'examples"
|
||||||
|
.SH NAME
|
||||||
|
nfc-relay \- Relay attack command line tool based on libnfc
|
||||||
|
.SH SYNOPSIS
|
||||||
|
.B nfc-relay
|
||||||
|
.SH DESCRIPTION
|
||||||
|
.B nfc-relay
|
||||||
|
is a utility that demonstrates a relay attack.
|
||||||
|
|
||||||
|
This tool requires two NFC devices. One device (configured as target) will
|
||||||
|
emulate an ISO/IEC 14443 type A tag, while the second device (configured as
|
||||||
|
initiator) will act as a reader. The genuine tag can be placed on the second
|
||||||
|
device (initiator) and the tag emulator (target) can be placed close to the
|
||||||
|
original reader. All communication is now relayed and shown in the screen on
|
||||||
|
real-time.
|
||||||
|
|
||||||
|
This tool has the same issues regarding timing as \fBnfc-emulate-uid\fP has,
|
||||||
|
therefore we advise you to try it against e.g. an OmniKey CardMan 5321 reader.
|
||||||
|
|
||||||
|
.SH BUGS
|
||||||
|
Please report any bugs on the
|
||||||
|
.B libnfc
|
||||||
|
issue tracker at:
|
||||||
|
.br
|
||||||
|
.BR https://github.com/nfc-tools/libnfc/issues
|
||||||
|
.SH LICENCE
|
||||||
|
.B libnfc
|
||||||
|
is licensed under the GNU Lesser General Public License (LGPL), version 3.
|
||||||
|
.br
|
||||||
|
.B libnfc-utils
|
||||||
|
and
|
||||||
|
.B libnfc-examples
|
||||||
|
are covered by the the BSD 2-Clause license.
|
||||||
|
.SH AUTHORS
|
||||||
|
Roel Verdult <roel@libnfc.org>
|
||||||
|
.PP
|
||||||
|
This manual page was written by Romuald Conty <romuald@libnfc.org>.
|
||||||
|
It is licensed under the terms of the GNU GPL (version 2 or later).
|
||||||
263
examples/nfc-relay.c
Normal file
263
examples/nfc-relay.c
Normal file
@ -0,0 +1,263 @@
|
|||||||
|
/*-
|
||||||
|
* Free/Libre Near Field Communication (NFC) library
|
||||||
|
*
|
||||||
|
* Libnfc historical contributors:
|
||||||
|
* Copyright (C) 2009 Roel Verdult
|
||||||
|
* Copyright (C) 2009-2013 Romuald Conty
|
||||||
|
* Copyright (C) 2010-2012 Romain Tartière
|
||||||
|
* Copyright (C) 2010-2013 Philippe Teuwen
|
||||||
|
* Copyright (C) 2012-2013 Ludovic Rousseau
|
||||||
|
* See AUTHORS file for a more comprehensive list of contributors.
|
||||||
|
* Additional contributors of this file:
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* 1) Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* 2 )Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* Note that this license only applies on the examples, NFC library itself is under LGPL
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file nfc-relay.c
|
||||||
|
* @brief Relay example using two devices.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include "config.h"
|
||||||
|
#endif /* HAVE_CONFIG_H */
|
||||||
|
|
||||||
|
#include <inttypes.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <signal.h>
|
||||||
|
|
||||||
|
#include <nfc/nfc.h>
|
||||||
|
|
||||||
|
#include "utils/nfc-utils.h"
|
||||||
|
|
||||||
|
#define MAX_FRAME_LEN 264
|
||||||
|
#define MAX_DEVICE_COUNT 2
|
||||||
|
|
||||||
|
static uint8_t abtReaderRx[MAX_FRAME_LEN];
|
||||||
|
static uint8_t abtReaderRxPar[MAX_FRAME_LEN];
|
||||||
|
static int szReaderRxBits;
|
||||||
|
static uint8_t abtTagRx[MAX_FRAME_LEN];
|
||||||
|
static uint8_t abtTagRxPar[MAX_FRAME_LEN];
|
||||||
|
static int szTagRxBits;
|
||||||
|
static nfc_device *pndReader;
|
||||||
|
static nfc_device *pndTag;
|
||||||
|
static bool quitting = false;
|
||||||
|
|
||||||
|
static void
|
||||||
|
intr_hdlr(int sig)
|
||||||
|
{
|
||||||
|
(void) sig;
|
||||||
|
printf("\nQuitting...\n");
|
||||||
|
quitting = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
print_usage(char *argv[])
|
||||||
|
{
|
||||||
|
printf("Usage: %s [OPTIONS]\n", argv[0]);
|
||||||
|
printf("Options:\n");
|
||||||
|
printf("\t-h\tHelp. Print this message.\n");
|
||||||
|
printf("\t-q\tQuiet mode. Suppress output of READER and EMULATOR data (improves timing).\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
int arg;
|
||||||
|
bool quiet_output = false;
|
||||||
|
const char *acLibnfcVersion = nfc_version();
|
||||||
|
|
||||||
|
// Get commandline options
|
||||||
|
for (arg = 1; arg < argc; arg++) {
|
||||||
|
if (0 == strcmp(argv[arg], "-h")) {
|
||||||
|
print_usage(argv);
|
||||||
|
exit(EXIT_SUCCESS);
|
||||||
|
} else if (0 == strcmp(argv[arg], "-q")) {
|
||||||
|
quiet_output = true;
|
||||||
|
} else {
|
||||||
|
ERR("%s is not supported option.", argv[arg]);
|
||||||
|
print_usage(argv);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Display libnfc version
|
||||||
|
printf("%s uses libnfc %s\n", argv[0], acLibnfcVersion);
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
signal(SIGINT, (void (__cdecl *)(int)) intr_hdlr);
|
||||||
|
#else
|
||||||
|
signal(SIGINT, intr_hdlr);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
nfc_context *context;
|
||||||
|
nfc_init(&context);
|
||||||
|
if (context == NULL) {
|
||||||
|
ERR("Unable to init libnfc (malloc)");
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
nfc_connstring connstrings[MAX_DEVICE_COUNT];
|
||||||
|
// List available devices
|
||||||
|
size_t szFound = nfc_list_devices(context, connstrings, MAX_DEVICE_COUNT);
|
||||||
|
|
||||||
|
if (szFound < 2) {
|
||||||
|
ERR("%" PRIdPTR " device found but two opened devices are needed to relay NFC.", szFound);
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Try to open the NFC emulator device
|
||||||
|
pndTag = nfc_open(context, connstrings[0]);
|
||||||
|
if (pndTag == NULL) {
|
||||||
|
ERR("Error opening NFC emulator device");
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("Hint: tag <---> initiator (relay) <---> target (relay) <---> original reader\n\n");
|
||||||
|
|
||||||
|
printf("NFC emulator device: %s opened\n", nfc_device_get_name(pndTag));
|
||||||
|
printf("[+] Try to break out the auto-emulation, this requires a second reader!\n");
|
||||||
|
printf("[+] To do this, please send any command after the anti-collision\n");
|
||||||
|
printf("[+] For example, send a RATS command or use the \"nfc-anticol\" tool\n");
|
||||||
|
|
||||||
|
nfc_target nt = {
|
||||||
|
.nm = {
|
||||||
|
.nmt = NMT_ISO14443A,
|
||||||
|
.nbr = NBR_UNDEFINED,
|
||||||
|
},
|
||||||
|
.nti = {
|
||||||
|
.nai = {
|
||||||
|
.abtAtqa = { 0x04, 0x00 },
|
||||||
|
.abtUid = { 0x08, 0xad, 0xbe, 0xef },
|
||||||
|
.btSak = 0x20,
|
||||||
|
.szUidLen = 4,
|
||||||
|
.szAtsLen = 0,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
if ((szReaderRxBits = nfc_target_init(pndTag, &nt, abtReaderRx, sizeof(abtReaderRx), 0)) < 0) {
|
||||||
|
ERR("%s", "Initialization of NFC emulator failed");
|
||||||
|
nfc_close(pndTag);
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
printf("%s", "Configuring emulator settings...");
|
||||||
|
if ((nfc_device_set_property_bool(pndTag, NP_HANDLE_CRC, false) < 0) ||
|
||||||
|
(nfc_device_set_property_bool(pndTag, NP_HANDLE_PARITY, false) < 0) || (nfc_device_set_property_bool(pndTag, NP_ACCEPT_INVALID_FRAMES, true)) < 0) {
|
||||||
|
nfc_perror(pndTag, "nfc_device_set_property_bool");
|
||||||
|
nfc_close(pndTag);
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
printf("%s", "Done, emulated tag is initialized");
|
||||||
|
|
||||||
|
// Try to open the NFC reader
|
||||||
|
pndReader = nfc_open(context, connstrings[1]);
|
||||||
|
if (pndReader == NULL) {
|
||||||
|
printf("Error opening NFC reader device\n");
|
||||||
|
nfc_close(pndTag);
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("NFC reader device: %s opened", nfc_device_get_name(pndReader));
|
||||||
|
printf("%s", "Configuring NFC reader settings...");
|
||||||
|
|
||||||
|
if (nfc_initiator_init(pndReader) < 0) {
|
||||||
|
nfc_perror(pndReader, "nfc_initiator_init");
|
||||||
|
nfc_close(pndTag);
|
||||||
|
nfc_close(pndReader);
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
if ((nfc_device_set_property_bool(pndReader, NP_HANDLE_CRC, false) < 0) ||
|
||||||
|
(nfc_device_set_property_bool(pndReader, NP_HANDLE_PARITY, false) < 0) ||
|
||||||
|
(nfc_device_set_property_bool(pndReader, NP_ACCEPT_INVALID_FRAMES, true)) < 0) {
|
||||||
|
nfc_perror(pndReader, "nfc_device_set_property_bool");
|
||||||
|
nfc_close(pndTag);
|
||||||
|
nfc_close(pndReader);
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
printf("%s", "Done, relaying frames now!");
|
||||||
|
|
||||||
|
while (!quitting) {
|
||||||
|
// Test if we received a frame from the reader
|
||||||
|
if ((szReaderRxBits = nfc_target_receive_bits(pndTag, abtReaderRx, sizeof(abtReaderRx), abtReaderRxPar)) > 0) {
|
||||||
|
// Drop down the field before sending a REQA command and start a new session
|
||||||
|
if (szReaderRxBits == 7 && abtReaderRx[0] == 0x26) {
|
||||||
|
// Drop down field for a very short time (original tag will reboot)
|
||||||
|
if (nfc_device_set_property_bool(pndReader, NP_ACTIVATE_FIELD, false) < 0) {
|
||||||
|
nfc_perror(pndReader, "nfc_device_set_property_bool");
|
||||||
|
nfc_close(pndTag);
|
||||||
|
nfc_close(pndReader);
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
if (!quiet_output)
|
||||||
|
printf("\n");
|
||||||
|
if (nfc_device_set_property_bool(pndReader, NP_ACTIVATE_FIELD, true) < 0) {
|
||||||
|
nfc_perror(pndReader, "nfc_device_set_property_bool");
|
||||||
|
nfc_close(pndTag);
|
||||||
|
nfc_close(pndReader);
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Print the reader frame to the screen
|
||||||
|
if (!quiet_output) {
|
||||||
|
printf("R: ");
|
||||||
|
print_hex_par(abtReaderRx, (size_t) szReaderRxBits, abtReaderRxPar);
|
||||||
|
}
|
||||||
|
// Forward the frame to the original tag
|
||||||
|
if ((szTagRxBits = nfc_initiator_transceive_bits
|
||||||
|
(pndReader, abtReaderRx, (size_t) szReaderRxBits, abtReaderRxPar, abtTagRx, sizeof(abtTagRx), abtTagRxPar)) > 0) {
|
||||||
|
// Redirect the answer back to the reader
|
||||||
|
if (nfc_target_send_bits(pndTag, abtTagRx, szTagRxBits, abtTagRxPar) < 0) {
|
||||||
|
nfc_perror(pndTag, "nfc_target_send_bits");
|
||||||
|
nfc_close(pndTag);
|
||||||
|
nfc_close(pndReader);
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
// Print the tag frame to the screen
|
||||||
|
if (!quiet_output) {
|
||||||
|
printf("T: ");
|
||||||
|
print_hex_par(abtTagRx, szTagRxBits, abtTagRxPar);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
nfc_close(pndTag);
|
||||||
|
nfc_close(pndReader);
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_SUCCESS);
|
||||||
|
}
|
||||||
600
examples/nfc-st25tb.c
Normal file
600
examples/nfc-st25tb.c
Normal file
@ -0,0 +1,600 @@
|
|||||||
|
/*-
|
||||||
|
* Free/Libre Near Field Communication (NFC) library
|
||||||
|
*
|
||||||
|
* Libnfc historical contributors:
|
||||||
|
* Copyright (C) 2009 Roel Verdult
|
||||||
|
* Copyright (C) 2009-2013 Romuald Conty
|
||||||
|
* Copyright (C) 2010-2012 Romain Tartière
|
||||||
|
* Copyright (C) 2010-2013 Philippe Teuwen
|
||||||
|
* Copyright (C) 2012-2013 Ludovic Rousseau
|
||||||
|
* See AUTHORS file for a more comprehensive list of contributors.
|
||||||
|
* Additional contributors of this file:
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* 1) Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* 2 )Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* Note that this license only applies on the examples, NFC library itself is under LGPL
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file nfc-st25tb.c
|
||||||
|
* @brief Tool to operate on ISO-14443-B ST25TB* and legacy SR* cards
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Benjamin DELPY `gentilkiwi`
|
||||||
|
* https://blog.gentilkiwi.com
|
||||||
|
* benjamin@gentilkiwi.com
|
||||||
|
* Licence : https://creativecommons.org/licenses/by/4.0/
|
||||||
|
* Rely on : libnfc - https://github.com/nfc-tools/libnfc
|
||||||
|
*
|
||||||
|
* $ gcc -Wall -lnfc -o nfc-st25tb nfc-st25tb.c
|
||||||
|
* $ ./nfc-st25tb -h
|
||||||
|
*
|
||||||
|
* Tested with
|
||||||
|
* - ST25TB512-AC - (BE/Brussels/STIB ; AliExpress ones)
|
||||||
|
* - ST25TB512-AT - (FR/Lille/Ilevia ; FR/Reims/Citura ; FR/Dijon/Divia ; FR/Strasbourg/CTS)
|
||||||
|
* - SRT512 - legacy - (FR/Bordeaux/TBM)
|
||||||
|
* - SRI512 - legacy - (anonymous vending machine)
|
||||||
|
*/
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include "config.h"
|
||||||
|
#endif // HAVE_CONFIG_H
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <nfc/nfc.h>
|
||||||
|
|
||||||
|
#if defined(WIN32) /* mingw compiler */
|
||||||
|
#include <getopt.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define ST25TB_SR_BLOCK_MAX_SIZE ((uint8_t) 4) // for static arrays
|
||||||
|
typedef void(*get_info_specific) (uint8_t * systemArea);
|
||||||
|
|
||||||
|
typedef struct _st_data {
|
||||||
|
uint8_t chipId;
|
||||||
|
bool bIsLegacy;
|
||||||
|
const char *szName;
|
||||||
|
const char *szDatasheetUrl;
|
||||||
|
uint8_t blockSize;
|
||||||
|
uint8_t nbNormalBlock;
|
||||||
|
uint8_t bnSystem;
|
||||||
|
get_info_specific pfnGetInfo;
|
||||||
|
} st_data;
|
||||||
|
|
||||||
|
bool get_block_at(nfc_device *pnd, uint8_t block, uint8_t *data, uint8_t cbData, bool bPrintIt);
|
||||||
|
bool set_block_at(nfc_device *pnd, uint8_t block, uint8_t *data, uint8_t cbData, bool bPrintIt);
|
||||||
|
bool set_block_at_confirmed(nfc_device *pnd, uint8_t block, uint8_t *data, uint8_t cbData, bool bPrintIt);
|
||||||
|
const st_data * get_info(const nfc_target *pnt, bool bPrintIt);
|
||||||
|
void display_system_info(nfc_device *pnd, const st_data * stdata);
|
||||||
|
void print_hex(const uint8_t *pbtData, const size_t szBytes);
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
nfc_context *context = NULL;
|
||||||
|
nfc_device *pnd = NULL;
|
||||||
|
nfc_target nt = {0};
|
||||||
|
nfc_modulation nm = {NMT_ISO14443B2SR, NBR_106};
|
||||||
|
const st_data * stcurrent;
|
||||||
|
int opt, res;
|
||||||
|
bool bIsBlock = false, bIsRead = false, bIsWrite = false, bIsBadCli = false;
|
||||||
|
uint8_t i, blockNumber = 0, data[ST25TB_SR_BLOCK_MAX_SIZE] = {0xff, 0xff, 0xff, 0xff}; // just in case...
|
||||||
|
size_t cbData = 0;
|
||||||
|
|
||||||
|
while(!bIsBadCli && ((opt = getopt(argc, argv, ":hib:rw:")) != -1))
|
||||||
|
{
|
||||||
|
switch(opt)
|
||||||
|
{
|
||||||
|
case 'i':
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'b':
|
||||||
|
if(optarg)
|
||||||
|
{
|
||||||
|
bIsBlock = true;
|
||||||
|
blockNumber = strtoul(optarg, NULL, 0);
|
||||||
|
}
|
||||||
|
else bIsBadCli = true;
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'r':
|
||||||
|
bIsRead = true;
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'w':
|
||||||
|
if(optarg)
|
||||||
|
{
|
||||||
|
cbData = strlen(optarg);
|
||||||
|
if((cbData == (2*2)) || ((cbData == (4*2))))
|
||||||
|
{
|
||||||
|
cbData >>= 1;
|
||||||
|
if(cbData == 2) // sr176
|
||||||
|
{
|
||||||
|
res = sscanf(optarg, "%02hhx%02hhx", data, data + 1);
|
||||||
|
}
|
||||||
|
else // all others
|
||||||
|
{
|
||||||
|
res = sscanf(optarg, "%02hhx%02hhx%02hhx%02hhx", data, data + 1, data + 2, data + 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(res == (int) cbData)
|
||||||
|
{
|
||||||
|
bIsWrite = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!bIsWrite)
|
||||||
|
{
|
||||||
|
bIsBadCli = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
default: // includes -h
|
||||||
|
bIsBadCli = true;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!bIsBadCli)
|
||||||
|
{
|
||||||
|
if(bIsBlock && (bIsRead || bIsWrite))
|
||||||
|
{
|
||||||
|
if(bIsRead && bIsWrite)
|
||||||
|
{
|
||||||
|
printf("|mode : read then write\n");
|
||||||
|
}
|
||||||
|
else if(bIsRead)
|
||||||
|
{
|
||||||
|
printf("|mode : read\n");
|
||||||
|
}
|
||||||
|
else if(bIsWrite)
|
||||||
|
{
|
||||||
|
printf("|mode : write\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("|blk num: 0x%02hhx\n", blockNumber);
|
||||||
|
if(bIsWrite)
|
||||||
|
{
|
||||||
|
printf("|data : ");
|
||||||
|
print_hex(data, cbData);
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(!bIsRead && !bIsWrite && !bIsBlock)
|
||||||
|
{
|
||||||
|
printf("|mode : info\n");
|
||||||
|
}
|
||||||
|
else bIsBadCli = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!bIsBadCli)
|
||||||
|
{
|
||||||
|
nfc_init(&context);
|
||||||
|
if(context)
|
||||||
|
{
|
||||||
|
pnd = nfc_open(context, NULL);
|
||||||
|
if(pnd)
|
||||||
|
{
|
||||||
|
res = nfc_initiator_init(pnd);
|
||||||
|
if(res == NFC_SUCCESS)
|
||||||
|
{
|
||||||
|
printf("Reader : %s - via %s\n ...wait for card...\n", nfc_device_get_name(pnd), nfc_device_get_connstring(pnd));
|
||||||
|
|
||||||
|
if (nfc_initiator_select_passive_target(pnd, nm, NULL, 0, &nt) > 0)
|
||||||
|
{
|
||||||
|
stcurrent = get_info(&nt, true);
|
||||||
|
if(stcurrent)
|
||||||
|
{
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
|
if(bIsBlock && (bIsRead || bIsWrite))
|
||||||
|
{
|
||||||
|
if(bIsRead)
|
||||||
|
{
|
||||||
|
get_block_at(pnd, blockNumber, NULL, 0, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(bIsWrite)
|
||||||
|
{
|
||||||
|
set_block_at_confirmed(pnd, blockNumber, data, cbData, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(!bIsRead && !bIsWrite && !bIsBlock)
|
||||||
|
{
|
||||||
|
for(i = 0; i < stcurrent->nbNormalBlock; i++)
|
||||||
|
{
|
||||||
|
get_block_at(pnd, i, NULL, 0, true);
|
||||||
|
}
|
||||||
|
display_system_info(pnd, stcurrent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else printf("ERROR - nfc_initiator_init: %i\n", res);
|
||||||
|
|
||||||
|
nfc_close(pnd);
|
||||||
|
}
|
||||||
|
else printf("ERROR - nfc_open\n");
|
||||||
|
|
||||||
|
nfc_exit(context);
|
||||||
|
}
|
||||||
|
else printf("ERROR - nfc_init\n");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf(
|
||||||
|
"Usage:\n"
|
||||||
|
" %s [-i]\n"
|
||||||
|
" %s -b N -r\n"
|
||||||
|
" %s -b N [-r] -w ABCD[EF01]\n %s -h\n"
|
||||||
|
"Options:\n"
|
||||||
|
" -i (default) information mode - will try to dump the tag content and display informations\n"
|
||||||
|
" -b N specify block number to operate on (tag dependent), needed for read (-r) and write (-w) modes\n"
|
||||||
|
" -r read mode - will try to read block (specified with -b N parameter)\n"
|
||||||
|
" -w ABCD[EF01] write mode - will try to write specicied data (2 or 4 bytes depending on tag) to block (specified with -b N parameter)\n"
|
||||||
|
" -h this help\n"
|
||||||
|
"Examples:\n"
|
||||||
|
" %s -i\n"
|
||||||
|
" Display all tag informations\n"
|
||||||
|
" %s -b 0x0e -r\n"
|
||||||
|
" Read block 0x0e (14) of the tag\n"
|
||||||
|
" %s -b 0x0d -w 0123abcd\n"
|
||||||
|
" Write block 0x0d (13) of the tag with hexadecimal value '01 23 ab cd'\n"
|
||||||
|
" %s -b 0x0c -r -w 0123abcd\n"
|
||||||
|
" Read, then write block 0x0c (12) of the tag with hexadecimal value '01 23 ab cd'\n"
|
||||||
|
"Warnings:\n"
|
||||||
|
" Be careful with: system area, counters & otp, bytes order.\n"
|
||||||
|
, argv[0], argv[0], argv[0], argv[0], argv[0], argv[0], argv[0], argv[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool get_block_at(nfc_device *pnd, uint8_t block, uint8_t *data, uint8_t cbData, bool bPrintIt)
|
||||||
|
{
|
||||||
|
bool bRet = false;
|
||||||
|
uint8_t tx[2] = {0x08, block}, rx[ST25TB_SR_BLOCK_MAX_SIZE]; // 4 is the maximum, SR176 (only 2) will fit
|
||||||
|
int res;
|
||||||
|
|
||||||
|
res = nfc_initiator_transceive_bytes(pnd, tx, sizeof(tx), rx, sizeof(rx), 0);
|
||||||
|
if((res == 2) || (res == 4))
|
||||||
|
{
|
||||||
|
if(data)
|
||||||
|
{
|
||||||
|
if(cbData == res)
|
||||||
|
{
|
||||||
|
memcpy(data, rx, res);
|
||||||
|
bRet = true;
|
||||||
|
}
|
||||||
|
else printf("ERROR - We got %i bytes for a %hhu buffer size?\n", res, cbData);
|
||||||
|
}
|
||||||
|
else bRet = true;
|
||||||
|
|
||||||
|
if(bPrintIt)
|
||||||
|
{
|
||||||
|
printf("[0x%02hhx] ", block);
|
||||||
|
print_hex(rx, res);
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(res > 0)
|
||||||
|
{
|
||||||
|
printf("ERROR - We got %i bytes?\n", res);
|
||||||
|
}
|
||||||
|
else printf("ERROR - nfc_initiator_transceive_bytes(get): %i\n", res);
|
||||||
|
|
||||||
|
return bRet;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool set_block_at(nfc_device *pnd, uint8_t block, uint8_t *data, uint8_t cbData, bool bPrintIt)
|
||||||
|
{
|
||||||
|
bool bRet = false;
|
||||||
|
uint8_t tx[2 + ST25TB_SR_BLOCK_MAX_SIZE] = {0x09, block}; // 4 is the maximum, SR176 (only 2) will fit
|
||||||
|
int res;
|
||||||
|
|
||||||
|
if(cbData <= ST25TB_SR_BLOCK_MAX_SIZE)
|
||||||
|
{
|
||||||
|
memcpy(tx + 2, data, cbData);
|
||||||
|
|
||||||
|
if(bPrintIt)
|
||||||
|
{
|
||||||
|
printf(">0x%02hhx> ", block);
|
||||||
|
print_hex(data, cbData);
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
res = nfc_initiator_transceive_bytes(pnd, tx, 2 + cbData, NULL, 0, 0);
|
||||||
|
if(res == NFC_ERFTRANS) // ? :')
|
||||||
|
{
|
||||||
|
bRet = true;
|
||||||
|
}
|
||||||
|
else printf("ERROR - nfc_initiator_transceive_bytes(set): %i\n", res);
|
||||||
|
}
|
||||||
|
else printf("ERROR - Wanted to write %hhu bytes, but maximum is %hhu\n", cbData, ST25TB_SR_BLOCK_MAX_SIZE);
|
||||||
|
|
||||||
|
return bRet;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool set_block_at_confirmed(nfc_device *pnd, uint8_t block, uint8_t *data, uint8_t cbData, bool bPrintIt)
|
||||||
|
{
|
||||||
|
bool bRet = false;
|
||||||
|
uint8_t buffer[ST25TB_SR_BLOCK_MAX_SIZE]; // maximum size will be checked in set_block_at
|
||||||
|
|
||||||
|
if(set_block_at(pnd, block, data, cbData, bPrintIt))
|
||||||
|
{
|
||||||
|
if(get_block_at(pnd, block, buffer, cbData, bPrintIt))
|
||||||
|
{
|
||||||
|
if(memcmp(data, buffer, cbData) == 0)
|
||||||
|
{
|
||||||
|
bRet = true;
|
||||||
|
}
|
||||||
|
else if(bPrintIt)
|
||||||
|
{
|
||||||
|
printf("WARNING - not same value readed after write\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return bRet;
|
||||||
|
}
|
||||||
|
|
||||||
|
void get_info_st25tb512(uint8_t * systemArea)
|
||||||
|
{
|
||||||
|
uint8_t b, i;
|
||||||
|
|
||||||
|
b = ((*(uint32_t *) systemArea) >> 15) & 1;
|
||||||
|
|
||||||
|
printf(" | ST reserved : ");
|
||||||
|
for(i = 0; i < 15; i++)
|
||||||
|
{
|
||||||
|
printf("%hhu", (uint8_t) (((*(uint32_t *) systemArea) >> i) & 1));
|
||||||
|
}
|
||||||
|
printf("\n | b15 : %hhu - %sOTP (?)\n | OTP_Lock_Reg : ", b, b ? "not " : "");
|
||||||
|
for(i = 16; i < 32; i++)
|
||||||
|
{
|
||||||
|
printf("%hhu", (uint8_t) (((*(uint32_t *) systemArea) >> i) & 1));
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
for(i = 16; i < 32; i++)
|
||||||
|
{
|
||||||
|
if(!(((*(uint32_t *) systemArea) >> i) & 1))
|
||||||
|
{
|
||||||
|
printf(" block 0x%02hhx is write protected\n", ((uint8_t) (i - 16)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void get_info_st25tb2k_4k(uint8_t * systemArea)
|
||||||
|
{
|
||||||
|
uint8_t b, i;
|
||||||
|
|
||||||
|
b = ((*(uint32_t *) systemArea) >> 15) & 1;
|
||||||
|
|
||||||
|
printf(" | ST reserved : ");
|
||||||
|
for(i = 0; i < 15; i++)
|
||||||
|
{
|
||||||
|
printf("%hhu", (uint8_t) (((*(uint32_t *) systemArea) >> i) & 1));
|
||||||
|
}
|
||||||
|
printf("\n | b15 : %hhu - %sOTP (?)\n | OTP_Lock_RegU: ", b, b ? "not " : "");
|
||||||
|
for(i = 16; i < 24; i++)
|
||||||
|
{
|
||||||
|
printf("%hhu", (uint8_t) (((*(uint32_t *) systemArea) >> i) & 1));
|
||||||
|
}
|
||||||
|
printf("\n | OTP_Lock_Reg : ");
|
||||||
|
for(i = 24; i < 32; i++)
|
||||||
|
{
|
||||||
|
printf("%hhu", (uint8_t) (((*(uint32_t *) systemArea) >> i) & 1));
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
if(!(((*(uint32_t *) systemArea) >> 24) & 1))
|
||||||
|
{
|
||||||
|
printf(" blocks 0x07 and 0x08 are write protected\n");
|
||||||
|
}
|
||||||
|
for(i = 25; i < 32; i++)
|
||||||
|
{
|
||||||
|
if(!(((*(uint32_t *) systemArea) >> i) & 1))
|
||||||
|
{
|
||||||
|
printf(" block 0x%02hhx is write protected\n", ((uint8_t) (i - 16)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void get_info_sr176_legacy(uint8_t * systemArea)
|
||||||
|
{
|
||||||
|
uint8_t i;
|
||||||
|
|
||||||
|
printf(" | Fixed Chip_ID: 0x%1x\n | ST reserved : ", systemArea[0] & 0x0f);
|
||||||
|
for(i = 4; i < 8; i++)
|
||||||
|
{
|
||||||
|
printf("%hhu", (uint8_t) (((*(uint16_t *) systemArea) >> i) & 1));
|
||||||
|
}
|
||||||
|
printf("\n | OTP_Lock_Reg : ");
|
||||||
|
for(i = 8; i < 16; i++)
|
||||||
|
{
|
||||||
|
printf("%hhu", (uint8_t) (((*(uint16_t *) systemArea) >> i) & 1));
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
for(i = 8; i < 16; i++)
|
||||||
|
{
|
||||||
|
if(((*(uint16_t *) systemArea) >> i) & 1)
|
||||||
|
{
|
||||||
|
printf(" blocks 0x%02hhx and 0x%02hhx are write protected\n", (uint8_t) ((i - 8) * 2), (uint8_t) (((i - 8) * 2) + 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void get_info_sri_srt_512_legacy(uint8_t * systemArea)
|
||||||
|
{
|
||||||
|
uint8_t b, i;
|
||||||
|
|
||||||
|
b = ((*(uint32_t *) systemArea) >> 15) & 1;
|
||||||
|
|
||||||
|
printf(" | Fixed Chip_ID: 0x%02hhx\n | ST reserved : ", systemArea[0]);
|
||||||
|
for(i = 8; i < 15; i++)
|
||||||
|
{
|
||||||
|
printf("%hhu", (uint8_t) (((*(uint32_t *) systemArea) >> i) & 1));
|
||||||
|
}
|
||||||
|
printf("\n | b15 : %hhu - %sOTP (?)\n | OTP_Lock_Reg : ", b, b ? "not " : "");
|
||||||
|
for(i = 16; i < 32; i++)
|
||||||
|
{
|
||||||
|
printf("%hhu", (uint8_t) (((*(uint32_t *) systemArea) >> i) & 1));
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
for(i = 16; i < 32; i++)
|
||||||
|
{
|
||||||
|
if(!(((*(uint32_t *) systemArea) >> i) & 1))
|
||||||
|
{
|
||||||
|
printf(" block 0x%02hhx is write protected\n", (uint8_t) (i - 16));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void get_info_sri2k_4k_srix4k_srix512_legacy(uint8_t * systemArea)
|
||||||
|
{
|
||||||
|
uint8_t i;
|
||||||
|
|
||||||
|
printf(" | Fixed Chip_ID: 0x%02hhx\n | ST reserved : ", systemArea[0]);
|
||||||
|
for(i = 8; i < 24; i++)
|
||||||
|
{
|
||||||
|
printf("%hhu", (uint8_t) (((*(uint32_t *) systemArea) >> i) & 1));
|
||||||
|
}
|
||||||
|
printf("\n | OTP_Lock_Reg : ");
|
||||||
|
for(i = 24; i < 32; i++)
|
||||||
|
{
|
||||||
|
printf("%hhu", (uint8_t) (((*(uint32_t *) systemArea) >> i) & 1));
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
if(!(((*(uint32_t *) systemArea) >> 24) & 1))
|
||||||
|
{
|
||||||
|
printf(" blocks 0x07 and 0x08 are write protected\n");
|
||||||
|
}
|
||||||
|
for(i = 25; i < 32; i++)
|
||||||
|
{
|
||||||
|
if(!(((*(uint32_t *) systemArea) >> i) & 1))
|
||||||
|
{
|
||||||
|
printf(" block 0x%02hhx is write protected\n", (uint8_t) (i - 16));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const st_data STRefs[] = {
|
||||||
|
{0x1b, false, "ST25TB512-AC", "https://www.st.com/resource/en/datasheet/st25tb512-ac.pdf", 4, 16, 255, get_info_st25tb512},
|
||||||
|
{0x33, false, "ST25TB512-AT", "https://www.st.com/resource/en/datasheet/st25tb512-at.pdf", 4, 16, 255, get_info_st25tb512},
|
||||||
|
{0x3f, false, "ST25TB02K", "https://www.st.com/resource/en/datasheet/st25tb02k.pdf", 4, 64, 255, get_info_st25tb2k_4k},
|
||||||
|
{0x1f, false, "ST25TB04K", "https://www.st.com/resource/en/datasheet/st25tb04k.pdf", 4, 128, 255, get_info_st25tb2k_4k},
|
||||||
|
};
|
||||||
|
const st_data STRefs_legacy[] = {
|
||||||
|
{ 0, true, "SRI4K(s)", NULL, 4, 128, 255, NULL},
|
||||||
|
{ 2, true, "SR176", "https://www.st.com/resource/en/datasheet/sr176.pdf", 2, 15, 15, get_info_sr176_legacy},
|
||||||
|
{ 3, true, "SRIX4K", NULL, 4, 128, 255, get_info_sri2k_4k_srix4k_srix512_legacy},
|
||||||
|
{ 4, true, "SRIX512", "https://www.st.com/resource/en/datasheet/srix512.pdf", 4, 16, 255, get_info_sri2k_4k_srix4k_srix512_legacy},
|
||||||
|
{ 6, true, "SRI512", "https://www.st.com/resource/en/datasheet/sri512.pdf", 4, 16, 255, get_info_sri_srt_512_legacy},
|
||||||
|
{ 7, true, "SRI4K", "https://www.st.com/resource/en/datasheet/sri4k.pdf", 4, 128, 255, get_info_sri2k_4k_srix4k_srix512_legacy},
|
||||||
|
{12, true, "SRT512", "https://www.st.com/resource/en/datasheet/srt512.pdf", 4, 16, 255, get_info_sri_srt_512_legacy},
|
||||||
|
{15, true, "SRI2K", "https://www.st.com/resource/en/datasheet/sri2k.pdf", 4, 64, 255, get_info_sri2k_4k_srix4k_srix512_legacy},
|
||||||
|
};
|
||||||
|
|
||||||
|
const st_data * get_info(const nfc_target *pnt, bool bPrintIt)
|
||||||
|
{
|
||||||
|
const st_data *currentData = NULL;
|
||||||
|
const uint8_t *p;
|
||||||
|
uint8_t chipId, i;
|
||||||
|
|
||||||
|
if(pnt->nm.nmt == NMT_ISO14443B2SR)
|
||||||
|
{
|
||||||
|
printf("Target : %s (%s)\nUID : ", str_nfc_modulation_type(pnt->nm.nmt), str_nfc_baud_rate(pnt->nm.nbr));
|
||||||
|
print_hex(pnt->nti.nsi.abtUID, sizeof(pnt->nti.nsi.abtUID));
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
|
p = pnt->nti.nsi.abtUID;
|
||||||
|
if(p[7] == 0xd0) // ST25TB* / SR*
|
||||||
|
{
|
||||||
|
chipId = p[5];
|
||||||
|
printf("Manuf : 0x%02hhx - %s\n", p[6], (p[6] == 0x02) ? "STMicroelectronics" : "other");
|
||||||
|
|
||||||
|
for(i = 0; i < (sizeof(STRefs) / sizeof(STRefs[0])); i++)
|
||||||
|
{
|
||||||
|
if(chipId == STRefs[i].chipId)
|
||||||
|
{
|
||||||
|
currentData = &STRefs[i];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!currentData)
|
||||||
|
{
|
||||||
|
chipId >>= 2;
|
||||||
|
for(i = 0; i < (sizeof(STRefs_legacy) / sizeof(STRefs_legacy[0])); i++)
|
||||||
|
{
|
||||||
|
if(chipId == STRefs_legacy[i].chipId)
|
||||||
|
{
|
||||||
|
currentData = &STRefs_legacy[i];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(bPrintIt && currentData)
|
||||||
|
{
|
||||||
|
printf("ChipId : 0x%02hhx - %s%s\nSerial : 0x", currentData->chipId, currentData->szName, currentData->bIsLegacy ? " (legacy)" : "");
|
||||||
|
if(currentData->bIsLegacy)
|
||||||
|
{
|
||||||
|
printf("%1hhx", (uint8_t) (p[5] & 0x03));
|
||||||
|
}
|
||||||
|
printf("%02hhx%02hhx%02hhx%02hhx%02hhx\n|blk sz : %hhu bits\n|nb blks: %hhu\n|sys idx: %hhu\n", p[4], p[3], p[2], p[1], p[0], (uint8_t) (currentData->blockSize * 8), currentData->nbNormalBlock, currentData->bnSystem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else printf("WARNI - Last byte of UID isn\'t 0xd0, but 0x%02hhx (not ST25TB / SR series?)\n", p[7]);
|
||||||
|
}
|
||||||
|
else printf("ERROR - not a NMT_ISO14443B2SR ?\n");
|
||||||
|
|
||||||
|
return currentData;
|
||||||
|
}
|
||||||
|
|
||||||
|
void display_system_info(nfc_device *pnd, const st_data * stdata)
|
||||||
|
{
|
||||||
|
uint8_t systemArea[ST25TB_SR_BLOCK_MAX_SIZE];
|
||||||
|
|
||||||
|
if(get_block_at(pnd, stdata->bnSystem, systemArea, stdata->blockSize, true))
|
||||||
|
{
|
||||||
|
if(stdata->pfnGetInfo)
|
||||||
|
{
|
||||||
|
stdata->pfnGetInfo(systemArea);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void print_hex(const uint8_t *pbtData, const size_t szBytes)
|
||||||
|
{
|
||||||
|
size_t szPos;
|
||||||
|
for (szPos = 0; szPos < szBytes; szPos++)
|
||||||
|
{
|
||||||
|
printf("%02hhx ", pbtData[szPos]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
29
examples/pn53x-diagnose.1
Normal file
29
examples/pn53x-diagnose.1
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
.TH pn53x-diagnose 1 "June 15, 2010" "libnfc" "libnfc's examples"
|
||||||
|
.SH NAME
|
||||||
|
pn53x-diagnose \- PN53x diagnose tool
|
||||||
|
.SH SYNOPSIS
|
||||||
|
.B pn53x-diagnose
|
||||||
|
.SH DESCRIPTION
|
||||||
|
.B pn53x-diagnose
|
||||||
|
is a utility to diagnose PN531, PN532 and PN533 chips.
|
||||||
|
It runs communication, RAM and ROM tests.
|
||||||
|
|
||||||
|
.SH BUGS
|
||||||
|
Please report any bugs on the
|
||||||
|
.B libnfc
|
||||||
|
issue tracker at:
|
||||||
|
.br
|
||||||
|
.BR https://github.com/nfc-tools/libnfc/issues
|
||||||
|
.SH LICENCE
|
||||||
|
.B libnfc
|
||||||
|
is licensed under the GNU Lesser General Public License (LGPL), version 3.
|
||||||
|
.br
|
||||||
|
.B libnfc-utils
|
||||||
|
and
|
||||||
|
.B libnfc-examples
|
||||||
|
are covered by the the BSD 2-Clause license.
|
||||||
|
.SH AUTHORS
|
||||||
|
Romuald Conty <romuald@libnfc.org>
|
||||||
|
.PP
|
||||||
|
This manual page was written by Romuald Conty <romuald@libnfc.org>.
|
||||||
|
It is licensed under the terms of the GNU GPL (version 2 or later).
|
||||||
138
examples/pn53x-diagnose.c
Normal file
138
examples/pn53x-diagnose.c
Normal file
@ -0,0 +1,138 @@
|
|||||||
|
/*-
|
||||||
|
* Free/Libre Near Field Communication (NFC) library
|
||||||
|
*
|
||||||
|
* Libnfc historical contributors:
|
||||||
|
* Copyright (C) 2009 Roel Verdult
|
||||||
|
* Copyright (C) 2009-2013 Romuald Conty
|
||||||
|
* Copyright (C) 2010-2012 Romain Tartière
|
||||||
|
* Copyright (C) 2010-2013 Philippe Teuwen
|
||||||
|
* Copyright (C) 2012-2013 Ludovic Rousseau
|
||||||
|
* See AUTHORS file for a more comprehensive list of contributors.
|
||||||
|
* Additional contributors of this file:
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* 1) Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* 2 )Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* Note that this license only applies on the examples, NFC library itself is under LGPL
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file pn53x-diagnose.c
|
||||||
|
* @brief Small application to diagnose PN53x using dedicated commands
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include "config.h"
|
||||||
|
#endif // HAVE_CONFIG_H
|
||||||
|
|
||||||
|
#include <err.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <nfc/nfc.h>
|
||||||
|
|
||||||
|
#include "utils/nfc-utils.h"
|
||||||
|
#include "libnfc/chips/pn53x.h"
|
||||||
|
|
||||||
|
#define MAX_DEVICE_COUNT 16
|
||||||
|
|
||||||
|
int
|
||||||
|
main(int argc, const char *argv[])
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
nfc_device *pnd = NULL;
|
||||||
|
const char *acLibnfcVersion;
|
||||||
|
bool result;
|
||||||
|
|
||||||
|
uint8_t abtRx[PN53x_EXTENDED_FRAME__DATA_MAX_LEN];
|
||||||
|
size_t szRx = sizeof(abtRx);
|
||||||
|
const uint8_t pncmd_diagnose_communication_line_test[] = { Diagnose, 0x00, 0x06, 'l', 'i', 'b', 'n', 'f', 'c' };
|
||||||
|
const uint8_t pncmd_diagnose_rom_test[] = { Diagnose, 0x01 };
|
||||||
|
const uint8_t pncmd_diagnose_ram_test[] = { Diagnose, 0x02 };
|
||||||
|
|
||||||
|
if (argc > 1) {
|
||||||
|
printf("Usage: %s", argv[0]);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
nfc_context *context;
|
||||||
|
nfc_init(&context);
|
||||||
|
if (context == NULL) {
|
||||||
|
ERR("Unable to init libnfc (malloc)");
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Display libnfc version
|
||||||
|
acLibnfcVersion = nfc_version();
|
||||||
|
printf("%s uses libnfc %s\n", argv[0], acLibnfcVersion);
|
||||||
|
|
||||||
|
nfc_connstring connstrings[MAX_DEVICE_COUNT];
|
||||||
|
size_t szFound = nfc_list_devices(context, connstrings, MAX_DEVICE_COUNT);
|
||||||
|
|
||||||
|
if (szFound == 0) {
|
||||||
|
printf("No NFC device found.\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < szFound; i++) {
|
||||||
|
int res = 0;
|
||||||
|
pnd = nfc_open(context, connstrings[i]);
|
||||||
|
|
||||||
|
if (pnd == NULL) {
|
||||||
|
ERR("%s", "Unable to open NFC device.");
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("NFC device [%s] opened.\n", nfc_device_get_name(pnd));
|
||||||
|
|
||||||
|
res = pn53x_transceive(pnd, pncmd_diagnose_communication_line_test, sizeof(pncmd_diagnose_communication_line_test), abtRx, szRx, 0);
|
||||||
|
if (res > 0) {
|
||||||
|
szRx = (size_t) res;
|
||||||
|
// Result of Diagnose ping for RC-S360 doesn't contain status byte so we've to handle both cases
|
||||||
|
result = (memcmp(pncmd_diagnose_communication_line_test + 1, abtRx, sizeof(pncmd_diagnose_communication_line_test) - 1) == 0) ||
|
||||||
|
(memcmp(pncmd_diagnose_communication_line_test + 2, abtRx, sizeof(pncmd_diagnose_communication_line_test) - 2) == 0);
|
||||||
|
printf(" Communication line test: %s\n", result ? "OK" : "Failed");
|
||||||
|
} else {
|
||||||
|
nfc_perror(pnd, "pn53x_transceive: cannot diagnose communication line");
|
||||||
|
}
|
||||||
|
|
||||||
|
res = pn53x_transceive(pnd, pncmd_diagnose_rom_test, sizeof(pncmd_diagnose_rom_test), abtRx, szRx, 0);
|
||||||
|
if (res > 0) {
|
||||||
|
szRx = (size_t) res;
|
||||||
|
result = ((szRx == 1) && (abtRx[0] == 0x00));
|
||||||
|
printf(" ROM test: %s\n", result ? "OK" : "Failed");
|
||||||
|
} else {
|
||||||
|
nfc_perror(pnd, "pn53x_transceive: cannot diagnose ROM");
|
||||||
|
}
|
||||||
|
|
||||||
|
res = pn53x_transceive(pnd, pncmd_diagnose_ram_test, sizeof(pncmd_diagnose_ram_test), abtRx, szRx, 0);
|
||||||
|
if (res > 0) {
|
||||||
|
szRx = (size_t) res;
|
||||||
|
result = ((szRx == 1) && (abtRx[0] == 0x00));
|
||||||
|
printf(" RAM test: %s\n", result ? "OK" : "Failed");
|
||||||
|
} else {
|
||||||
|
nfc_perror(pnd, "pn53x_transceive: cannot diagnose RAM");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
nfc_close(pnd);
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_SUCCESS);
|
||||||
|
}
|
||||||
35
examples/pn53x-sam.1
Normal file
35
examples/pn53x-sam.1
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
.TH pn53x-sam 1 "June 15, 2010" "libnfc" "libnfc's examples"
|
||||||
|
.SH NAME
|
||||||
|
pn53x-sam \- PN53x SAM communication demonstration tool
|
||||||
|
.SH SYNOPSIS
|
||||||
|
.B pn53x-sam
|
||||||
|
.SH DESCRIPTION
|
||||||
|
.B pn53x-sam
|
||||||
|
is a utility attempt to test a simple connection with a SAM (Secure Access
|
||||||
|
Module) in several modes.
|
||||||
|
|
||||||
|
To run this utility you must have a SAM (like the NXP's P5CN072 chip)
|
||||||
|
successfully connected to your PN53x chip.
|
||||||
|
|
||||||
|
Warning: the SAM inside a Touchatag/ACR122U is \fInot\fP hooked to the PN532
|
||||||
|
but to the intermediate controller so \fBpn53x-sam\fP won't work with a Touchatag/ACR122U.
|
||||||
|
|
||||||
|
.SH BUGS
|
||||||
|
Please report any bugs on the
|
||||||
|
.B libnfc
|
||||||
|
issue tracker at:
|
||||||
|
.br
|
||||||
|
.BR https://github.com/nfc-tools/libnfc/issues
|
||||||
|
.SH LICENCE
|
||||||
|
.B libnfc
|
||||||
|
is licensed under the GNU Lesser General Public License (LGPL), version 3.
|
||||||
|
.br
|
||||||
|
.B libnfc-utils
|
||||||
|
and
|
||||||
|
.B libnfc-examples
|
||||||
|
are covered by the the BSD 2-Clause license.
|
||||||
|
.SH AUTHORS
|
||||||
|
Emanuele Bertoldi <emanuele.bertoldi@gmail.com>
|
||||||
|
.PP
|
||||||
|
This manual page was written by Emanuele Bertoldi <emanuele.bertoldi@gmail.com>.
|
||||||
|
It is licensed under the terms of the GNU GPL (version 2 or later).
|
||||||
244
examples/pn53x-sam.c
Normal file
244
examples/pn53x-sam.c
Normal file
@ -0,0 +1,244 @@
|
|||||||
|
/*-
|
||||||
|
* Free/Libre Near Field Communication (NFC) library
|
||||||
|
*
|
||||||
|
* Libnfc historical contributors:
|
||||||
|
* Copyright (C) 2009 Roel Verdult
|
||||||
|
* Copyright (C) 2009-2013 Romuald Conty
|
||||||
|
* Copyright (C) 2010-2012 Romain Tartière
|
||||||
|
* Copyright (C) 2010-2013 Philippe Teuwen
|
||||||
|
* Copyright (C) 2012-2013 Ludovic Rousseau
|
||||||
|
* See AUTHORS file for a more comprehensive list of contributors.
|
||||||
|
* Additional contributors of this file:
|
||||||
|
* Copyright (C) 2010 Emanuele Bertoldi
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* 1) Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* 2 )Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* Note that this license only applies on the examples, NFC library itself is under LGPL
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file pn53x-sam.c
|
||||||
|
* @brief Configures the NFC device to communicate with a SAM (Secure Access Module).
|
||||||
|
* @note This example requiers a PN532 with SAM connected using S2C interface
|
||||||
|
* @see PN532 User manual
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include "config.h"
|
||||||
|
#endif // HAVE_CONFIG_H
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <time.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include <nfc/nfc.h>
|
||||||
|
|
||||||
|
#include "utils/nfc-utils.h"
|
||||||
|
#include "libnfc/chips/pn53x.h"
|
||||||
|
|
||||||
|
#define MAX_FRAME_LEN 264
|
||||||
|
#define TIMEOUT 60 // secs.
|
||||||
|
|
||||||
|
static void
|
||||||
|
wait_one_minute(void)
|
||||||
|
{
|
||||||
|
int secs = 0;
|
||||||
|
|
||||||
|
printf("|");
|
||||||
|
fflush(stdout);
|
||||||
|
|
||||||
|
while (secs < TIMEOUT) {
|
||||||
|
sleep(1);
|
||||||
|
secs++;
|
||||||
|
printf(".");
|
||||||
|
fflush(stdout);
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("|\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
main(int argc, const char *argv[])
|
||||||
|
{
|
||||||
|
(void) argc;
|
||||||
|
(void) argv;
|
||||||
|
|
||||||
|
nfc_context *context;
|
||||||
|
nfc_init(&context);
|
||||||
|
if (context == NULL) {
|
||||||
|
ERR("Unable to init libnfc (malloc)");
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Display libnfc version
|
||||||
|
const char *acLibnfcVersion = nfc_version();
|
||||||
|
printf("%s uses libnfc %s\n", argv[0], acLibnfcVersion);
|
||||||
|
|
||||||
|
// Open using the first available NFC device
|
||||||
|
nfc_device *pnd;
|
||||||
|
pnd = nfc_open(context, NULL);
|
||||||
|
|
||||||
|
if (pnd == NULL) {
|
||||||
|
ERR("%s", "Unable to open NFC device.");
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("NFC device: %s opened\n", nfc_device_get_name(pnd));
|
||||||
|
|
||||||
|
// Print the example's menu
|
||||||
|
printf("\nSelect the communication mode:\n");
|
||||||
|
printf("[1] Virtual card mode.\n");
|
||||||
|
printf("[2] Wired card mode.\n");
|
||||||
|
printf("[3] Dual card mode.\n");
|
||||||
|
printf(">> ");
|
||||||
|
|
||||||
|
// Take user's choice
|
||||||
|
int input = getchar();
|
||||||
|
printf("\n");
|
||||||
|
if ((input < '1') || (input > '3')) {
|
||||||
|
ERR("%s", "Invalid selection.");
|
||||||
|
nfc_close(pnd);
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* '1' -> "Virtual mode" (0x02)
|
||||||
|
* '2' -> "Wired card" (0x03)
|
||||||
|
* '3' -> "Dual card" (0x04)
|
||||||
|
*/
|
||||||
|
int iMode = input - '0' + 0x01;
|
||||||
|
pn532_sam_mode mode = iMode;
|
||||||
|
|
||||||
|
// Connect with the SAM
|
||||||
|
|
||||||
|
switch (mode) {
|
||||||
|
case PSM_VIRTUAL_CARD: {
|
||||||
|
// FIXME Its a private pn53x function
|
||||||
|
if (pn532_SAMConfiguration(pnd, mode, 0) < 0) {
|
||||||
|
nfc_perror(pnd, "pn53x_SAMConfiguration");
|
||||||
|
nfc_close(pnd);
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
printf("Now the SAM is readable for 1 minute from an external reader.\n");
|
||||||
|
wait_one_minute();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PSM_WIRED_CARD: {
|
||||||
|
// Set opened NFC device to initiator mode
|
||||||
|
if (nfc_initiator_init_secure_element(pnd) < 0) {
|
||||||
|
nfc_perror(pnd, "nfc_initiator_init_secure_element");
|
||||||
|
nfc_close(pnd);
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Let the reader only try once to find a tag
|
||||||
|
if (nfc_device_set_property_bool(pnd, NP_INFINITE_SELECT, false) < 0) {
|
||||||
|
nfc_perror(pnd, "nfc_device_set_property_bool");
|
||||||
|
nfc_close(pnd);
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
// Read the SAM's info
|
||||||
|
const nfc_modulation nmSAM = {
|
||||||
|
.nmt = NMT_ISO14443A,
|
||||||
|
.nbr = NBR_106,
|
||||||
|
};
|
||||||
|
nfc_target nt;
|
||||||
|
|
||||||
|
int res;
|
||||||
|
if ((res = nfc_initiator_select_passive_target(pnd, nmSAM, NULL, 0, &nt)) < 0) {
|
||||||
|
nfc_perror(pnd, "nfc_initiator_select_passive_target");
|
||||||
|
nfc_close(pnd);
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
} else if (res == 0) {
|
||||||
|
ERR("No SAM found.");
|
||||||
|
nfc_close(pnd);
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
} else if (res == 1) {
|
||||||
|
printf("The following ISO14443A tag (SAM) was found:\n");
|
||||||
|
print_nfc_target(&nt, true);
|
||||||
|
} else {
|
||||||
|
ERR("%s", "More than one ISO14442 tag found as SAM.");
|
||||||
|
nfc_close(pnd);
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PSM_DUAL_CARD: {
|
||||||
|
// FIXME Its a private pn53x function
|
||||||
|
if (pn532_SAMConfiguration(pnd, mode, 0) < 0) {
|
||||||
|
nfc_perror(pnd, "pn53x_SAMConfiguration");
|
||||||
|
nfc_close(pnd);
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
uint8_t abtRx[MAX_FRAME_LEN];
|
||||||
|
|
||||||
|
nfc_target nt = {
|
||||||
|
.nm = {
|
||||||
|
.nmt = NMT_ISO14443A,
|
||||||
|
.nbr = NBR_UNDEFINED,
|
||||||
|
},
|
||||||
|
.nti = {
|
||||||
|
.nai = {
|
||||||
|
.abtAtqa = { 0x04, 0x00 },
|
||||||
|
.abtUid = { 0x08, 0xad, 0xbe, 0xef },
|
||||||
|
.btSak = 0x20,
|
||||||
|
.szUidLen = 4,
|
||||||
|
.szAtsLen = 0,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
printf("Now both, NFC device (configured as target) and SAM are readables from an external NFC initiator.\n");
|
||||||
|
printf("Please note that NFC device (configured as target) stay in target mode until it receive RATS, ATR_REQ or proprietary command.\n");
|
||||||
|
if (nfc_target_init(pnd, &nt, abtRx, sizeof(abtRx), 0) < 0) {
|
||||||
|
nfc_perror(pnd, "nfc_target_init");
|
||||||
|
nfc_close(pnd);
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
// wait_one_minute ();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case PSM_NORMAL:
|
||||||
|
// This should not happend... nothing to do.
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Disconnect from the SAM
|
||||||
|
pn532_SAMConfiguration(pnd, PSM_NORMAL, -1);
|
||||||
|
|
||||||
|
// Close NFC device
|
||||||
|
nfc_close(pnd);
|
||||||
|
nfc_exit(context);
|
||||||
|
exit(EXIT_SUCCESS);
|
||||||
|
}
|
||||||
58
examples/pn53x-tamashell-scripts/ASK_LoGO_LEDs.cmd
Normal file
58
examples/pn53x-tamashell-scripts/ASK_LoGO_LEDs.cmd
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
# To be used only on ASK LoGO readers!!!
|
||||||
|
# As we don't know how GPIO can be wired, it may hurt your hardware!!!
|
||||||
|
|
||||||
|
# P32=0 LED1
|
||||||
|
# P34=0 progressive field off
|
||||||
|
# SFR_P3: 0x..101011
|
||||||
|
08 ff b0 2b
|
||||||
|
|
||||||
|
p 100
|
||||||
|
|
||||||
|
# P32=0 LED1
|
||||||
|
# P31=0 LED2
|
||||||
|
# SFR_P3: 0x..101001
|
||||||
|
08 ff b0 29
|
||||||
|
|
||||||
|
p 100
|
||||||
|
|
||||||
|
# P32=0 LED1
|
||||||
|
# P31=0 LED2
|
||||||
|
# P30=0 P33=0 LED3
|
||||||
|
# SFR_P3: 0x..100000
|
||||||
|
08 ff b0 20
|
||||||
|
|
||||||
|
p 100
|
||||||
|
|
||||||
|
# P32=0 LED1
|
||||||
|
# P31=0 LED2
|
||||||
|
# P30=0 P33=0 LED3
|
||||||
|
# P35=0 LED4
|
||||||
|
# SFR_P3: 0x..000000
|
||||||
|
08 ff b0 00
|
||||||
|
|
||||||
|
p 100
|
||||||
|
|
||||||
|
# P32=0 LED1
|
||||||
|
# P31=0 LED2
|
||||||
|
# P30=0 P33=0 LED3
|
||||||
|
# SFR_P3: 0x..100000
|
||||||
|
08 ff b0 20
|
||||||
|
|
||||||
|
p 100
|
||||||
|
|
||||||
|
# P32=0 LED1
|
||||||
|
# P31=0 LED2
|
||||||
|
# SFR_P3: 0x..101001
|
||||||
|
08 ff b0 29
|
||||||
|
|
||||||
|
p 100
|
||||||
|
|
||||||
|
# P32=0 LED1
|
||||||
|
# SFR_P3: 0x..101011
|
||||||
|
08 ff b0 2b
|
||||||
|
|
||||||
|
p 100
|
||||||
|
|
||||||
|
# P32=0 LED1
|
||||||
|
# SFR_P3: 0x..101011
|
||||||
|
08 ff b0 2b
|
||||||
5
examples/pn53x-tamashell-scripts/Makefile.am
Normal file
5
examples/pn53x-tamashell-scripts/Makefile.am
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
EXTRA_DIST = \
|
||||||
|
ReadMobib.sh \
|
||||||
|
ReadNavigo.sh \
|
||||||
|
UltraLightRead.cmd \
|
||||||
|
UltraLightReadWrite.cmd
|
||||||
127
examples/pn53x-tamashell-scripts/ReadMobib.sh
Executable file
127
examples/pn53x-tamashell-scripts/ReadMobib.sh
Executable file
@ -0,0 +1,127 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
#DEBUG='//;'
|
||||||
|
|
||||||
|
cat << EOF | \
|
||||||
|
pn53x-tamashell |\
|
||||||
|
awk $DEBUG'\
|
||||||
|
/^> #.*:/{
|
||||||
|
sub(/^> #/,"")
|
||||||
|
n=$0
|
||||||
|
for (i=0;i<8-length();i++) {
|
||||||
|
n= n " "
|
||||||
|
}
|
||||||
|
getline
|
||||||
|
getline
|
||||||
|
getline
|
||||||
|
sub(/Rx: 00/,"")
|
||||||
|
gsub(/ +/," ")
|
||||||
|
sub(/ 90 00 $/,"")
|
||||||
|
print n toupper($0)}' |\
|
||||||
|
grep -v ": 6A 83"
|
||||||
|
|
||||||
|
# Select one typeB target
|
||||||
|
4A010300
|
||||||
|
|
||||||
|
# SELECT AID "1TIC.ICA"
|
||||||
|
4001 00a4 0400 08 315449432e494341
|
||||||
|
|
||||||
|
# Select ICC file
|
||||||
|
4001 00a4 0000 02 3f00
|
||||||
|
4001 00a4 0000 02 0002
|
||||||
|
#ICC:
|
||||||
|
4001 00b2 0104 1d
|
||||||
|
|
||||||
|
# Select Holder file
|
||||||
|
4001 00a4 0000 02 3f1c
|
||||||
|
#Holder1:
|
||||||
|
4001 00b2 0104 1d
|
||||||
|
#Holder2:
|
||||||
|
4001 00b2 0204 1d
|
||||||
|
|
||||||
|
# Select EnvHol file
|
||||||
|
4001 00a4 0000 00
|
||||||
|
4001 00a4 0000 02 2000
|
||||||
|
4001 00a4 0000 02 2001
|
||||||
|
#EnvHol1:
|
||||||
|
4001 00b2 0104 1d
|
||||||
|
#EnvHol2:
|
||||||
|
4001 00b2 0204 1d
|
||||||
|
|
||||||
|
# Select EvLog file
|
||||||
|
4001 00a4 0000 02 2010
|
||||||
|
#EvLog1:
|
||||||
|
4001 00b2 0104 1d
|
||||||
|
#EvLog2:
|
||||||
|
4001 00b2 0204 1d
|
||||||
|
#EvLog3:
|
||||||
|
4001 00b2 0304 1d
|
||||||
|
|
||||||
|
# Select ConList file
|
||||||
|
4001 00a4 0000 02 2050
|
||||||
|
#ConList:
|
||||||
|
4001 00b2 0104 1d
|
||||||
|
|
||||||
|
# Select Contra file
|
||||||
|
4001 00a4 0000 02 2020
|
||||||
|
#Contra1:
|
||||||
|
4001 00b2 0104 1d
|
||||||
|
#Contra2:
|
||||||
|
4001 00b2 0204 1d
|
||||||
|
#Contra3:
|
||||||
|
4001 00b2 0304 1d
|
||||||
|
#Contra4:
|
||||||
|
4001 00b2 0404 1d
|
||||||
|
#Contra5:
|
||||||
|
4001 00b2 0504 1d
|
||||||
|
#Contra6:
|
||||||
|
4001 00b2 0604 1d
|
||||||
|
#Contra7:
|
||||||
|
4001 00b2 0704 1d
|
||||||
|
#Contra8:
|
||||||
|
4001 00b2 0804 1d
|
||||||
|
#Contra9:
|
||||||
|
4001 00b2 0904 1d
|
||||||
|
#ContraA:
|
||||||
|
4001 00b2 0a04 1d
|
||||||
|
#ContraB:
|
||||||
|
4001 00b2 0b04 1d
|
||||||
|
#ContraC:
|
||||||
|
4001 00b2 0c04 1d
|
||||||
|
|
||||||
|
# Select Counter file
|
||||||
|
4001 00a4 0000 02 2069
|
||||||
|
#Counter:
|
||||||
|
4001 00b2 0104 1d
|
||||||
|
|
||||||
|
# Select LoadLog file
|
||||||
|
4001 00a4 0000 00
|
||||||
|
4001 00a4 0000 02 1000
|
||||||
|
4001 00a4 0000 02 1014
|
||||||
|
#LoadLog:
|
||||||
|
4001 00b2 0104 1d
|
||||||
|
|
||||||
|
# Select Purcha file
|
||||||
|
4001 00a4 0000 02 1015
|
||||||
|
#Purcha1:
|
||||||
|
4001 00b2 0104 1d
|
||||||
|
#Purcha2:
|
||||||
|
4001 00b2 0204 1d
|
||||||
|
#Purcha3:
|
||||||
|
4001 00b2 0304 1d
|
||||||
|
|
||||||
|
# Select SpecEv file
|
||||||
|
4001 00a4 0000 00
|
||||||
|
4001 00a4 0000 02 2000
|
||||||
|
4001 00a4 0000 02 2040
|
||||||
|
#SpecEv1:
|
||||||
|
4001 00b2 0104 1d
|
||||||
|
#SpecEv2:
|
||||||
|
4001 00b2 0204 1d
|
||||||
|
#SpecEv3:
|
||||||
|
4001 00b2 0304 1d
|
||||||
|
#SpecEv4:
|
||||||
|
4001 00b2 0404 1d
|
||||||
|
EOF
|
||||||
|
|
||||||
|
|
||||||
101
examples/pn53x-tamashell-scripts/ReadNavigo.sh
Executable file
101
examples/pn53x-tamashell-scripts/ReadNavigo.sh
Executable file
@ -0,0 +1,101 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
ID=$(cat << EOF | \
|
||||||
|
pn53x-tamashell |\
|
||||||
|
grep -A1 "^Tx: 42 01 0b 3f 80" |\
|
||||||
|
sed -e '1d' -e "s/^Rx: 00 .. .. \(.. .. .. ..\).*/\1/" -e 's/ //g'
|
||||||
|
# Timeouts
|
||||||
|
3205000002
|
||||||
|
# ListTarget ModeB
|
||||||
|
4a010300
|
||||||
|
# TypeB' APGEN
|
||||||
|
42010b3f80
|
||||||
|
EOF
|
||||||
|
)
|
||||||
|
|
||||||
|
if [ -z "$ID" ]; then
|
||||||
|
echo "Error: I was not abble to read Navigo ID" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
cat << EOF | \
|
||||||
|
pn53x-tamashell |\
|
||||||
|
awk '\
|
||||||
|
/^> #.*:/{
|
||||||
|
sub(/^> #/,"")
|
||||||
|
n=$0
|
||||||
|
for (i=0;i<8-length();i++) {
|
||||||
|
n= n " "
|
||||||
|
}
|
||||||
|
getline
|
||||||
|
getline
|
||||||
|
getline
|
||||||
|
sub(/Rx: 00/,"")
|
||||||
|
gsub(/ +/," ")
|
||||||
|
sub(/ 90 00 $/,"")
|
||||||
|
print n toupper($0)}'
|
||||||
|
|
||||||
|
# Timeouts
|
||||||
|
3205000002
|
||||||
|
|
||||||
|
# ListTarget ModeB
|
||||||
|
4a010300
|
||||||
|
|
||||||
|
# TypeB'
|
||||||
|
42010b3f80
|
||||||
|
|
||||||
|
# timings...
|
||||||
|
3202010b0c
|
||||||
|
|
||||||
|
# TypeB' ATTRIB
|
||||||
|
42 01 0f $ID
|
||||||
|
|
||||||
|
# Select ICC file
|
||||||
|
42 01 04 0a 00a4 0800 04 3f00 0002
|
||||||
|
#ICC:
|
||||||
|
42 01 06 06 00b2 0104 1d
|
||||||
|
|
||||||
|
# Select EnvHol file
|
||||||
|
42 01 08 0a 00a4 0800 04 2000 2001
|
||||||
|
#EnvHol1:
|
||||||
|
42 01 0a 06 00b2 0104 1d
|
||||||
|
|
||||||
|
# Select EvLog file
|
||||||
|
42 01 0c 0a 00a4 0800 04 2000 2010
|
||||||
|
#EvLog1:
|
||||||
|
42 01 0e 06 00b2 0104 1d
|
||||||
|
#EvLog2:
|
||||||
|
42 01 00 06 00b2 0204 1d
|
||||||
|
#EvLog3:
|
||||||
|
42 01 02 06 00b2 0304 1d
|
||||||
|
|
||||||
|
# Select ConList file
|
||||||
|
42 01 04 0a 00a4 0800 04 2000 2050
|
||||||
|
#ConList:
|
||||||
|
42 01 06 06 00b2 0104 1d
|
||||||
|
|
||||||
|
# Select Contra file
|
||||||
|
42 01 08 0a 00a4 0800 04 2000 2020
|
||||||
|
#Contra1:
|
||||||
|
42 01 0a 06 00b2 0104 1d
|
||||||
|
#Contra2:
|
||||||
|
42 01 0c 06 00b2 0204 1d
|
||||||
|
#Contra3:
|
||||||
|
42 01 0e 06 00b2 0304 1d
|
||||||
|
#Contra4:
|
||||||
|
42 01 00 06 00b2 0404 1d
|
||||||
|
|
||||||
|
# Select Counter file
|
||||||
|
42 01 02 0a 00a4 0800 04 2000 2069
|
||||||
|
#Counter:
|
||||||
|
42 01 04 06 00b2 0104 1d
|
||||||
|
|
||||||
|
# Select SpecEv file
|
||||||
|
42 01 06 0a 00a4 08 0004 2000 2040
|
||||||
|
#SpecEv1:
|
||||||
|
42 01 08 06 00b2 0104 1d
|
||||||
|
|
||||||
|
# TypeB' Disconnect
|
||||||
|
42 01 03
|
||||||
|
|
||||||
|
EOF
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user