blob: e51663117a4fa2afa0346415160f363a570c5364 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include "mifare_classic.h"
void mfcl_parse_acc_bits(struct acc_bits_parsed *abp, uint8_t *acc_bits)
{
uint8_t c1, c2, c3;
uint8_t block;
memset(abp, 0, sizeof(*abp));
c1 = acc_bits[1] >> 4;
c2 = acc_bits[2] & 0xf;
c3 = acc_bits[2] >> 4;
printf("C1 = %x, C2 = %x, C3 = %x\n", c1, c2, c3);
for (block = 0; block < 4; block++) {
uint8_t testbit = 1 << block;
if (c1 & testbit)
abp->block[block] |= ABP_C1;
if (c2 & testbit)
abp->block[block] |= ABP_C2;
if (c3 & testbit)
abp->block[block] |= ABP_C3;
}
}
|