From 71e45a3194b2d26fcd9d96845cbfc491f8c6a590 Mon Sep 17 00:00:00 2001 From: Gabriel Cardoso Date: Mon, 26 Jan 2026 18:34:06 +0000 Subject: [PATCH 1/3] - fix typo in hidprox econfig set/get function --- software/script/chameleon_cli_unit.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/software/script/chameleon_cli_unit.py b/software/script/chameleon_cli_unit.py index 2f6bcc8d..8e9b9f21 100644 --- a/software/script/chameleon_cli_unit.py +++ b/software/script/chameleon_cli_unit.py @@ -199,7 +199,7 @@ def before_exec(self, args: argparse.Namespace): if ret: return True else: - print("Please connect to chameleon device first(use 'hw connect').") + print("Please connect to chameleon device first (use 'hw connect').") return False @@ -3678,19 +3678,19 @@ def on_exec(self, args: argparse.Namespace): format = HIDFormat[args.format] id = struct.pack(">BIBIBH", format.value, args.fc, (args.cn >> 32), args.cn & 0xffffffff, args.il, args.oem) self.cmd.hidprox_set_emu_id(id) - print(' - Set hidprox tag id success.') + print(' - SET hidprox tag id success.') else: (format, fc, cn1, cn2, il, oem) = self.cmd.hidprox_get_emu_id() cn = (cn1 << 32) + cn2 - print(' - Get hidprox tag id success.') + print(' - GET hidprox tag id success.') print(f" - HIDProx/{HIDFormat(format)}") - if fc > 0: - print(f" FC: {color_string((CG, fc))}") - if il > 0: - print(f" IL: {color_string((CG, il))}") - if oem > 0: - print(f" OEM: {color_string((CG, oem))}") - print(f" CN: {color_string((CG, cn))}") + if fc > 0: + print(f" FC: {color_string((CG, fc))}") + if il > 0: + print(f" IL: {color_string((CG, il))}") + if oem > 0: + print(f" OEM: {color_string((CG, oem))}") + print(f" CN: {color_string((CG, cn))}") @lf_viking.command('read') class LFVikingRead(ReaderRequiredUnit): From 8ed2677ba206b3267073c9df7c7338a6fe7d3a0c Mon Sep 17 00:00:00 2001 From: Gabriel Cardoso Date: Mon, 26 Jan 2026 19:06:34 +0000 Subject: [PATCH 2/3] - added ACT Prox HID format --- .../src/rfid/nfctag/lf/protocols/wiegand.c | 33 +++++++++++++++++++ .../src/rfid/nfctag/lf/protocols/wiegand.h | 1 + software/script/chameleon_cli_unit.py | 1 + software/script/chameleon_enum.py | 2 ++ 4 files changed, 37 insertions(+) diff --git a/firmware/application/src/rfid/nfctag/lf/protocols/wiegand.c b/firmware/application/src/rfid/nfctag/lf/protocols/wiegand.c index cb8579c6..5c1fb6d3 100644 --- a/firmware/application/src/rfid/nfctag/lf/protocols/wiegand.c +++ b/firmware/application/src/rfid/nfctag/lf/protocols/wiegand.c @@ -18,6 +18,7 @@ #define PREAMBLE_34BIT (0x009) #define PREAMBLE_35BIT (0x005) #define PREAMBLE_36BIT (0x003) +#define PREAMBLE_ACTP (0x095) /**@brief Set a bit in the uint64 word. * @@ -548,6 +549,37 @@ static wiegand_card_t *unpack_c15001(uint64_t hi, uint64_t lo) { return d; } +static uint64_t pack_actprox(wiegand_card_t *card) { + if (card->oem == 0) { + card->oem = 900; + } + uint64_t bits = PREAMBLE_36BIT; + bits <<= 1; + bits = (bits << 10) | (card->oem & 0x3ff); + bits = (bits << 8) | (card->facility_code & 0xff); + bits = (bits << 16) | (card->card_number & 0xffff); + bits <<= 1; + if (evenparity32((bits >> 18) & 0x1ffff)) { + SET_BIT64(bits, 35); + } + if (oddparity32((bits >> 1) & 0x1ffff)) { + SET_BIT64(bits, 0); + } + return bits; +} + +static wiegand_card_t *unpack_actprox(uint64_t hi, uint64_t lo) { + if (!(IS_SET(lo, 35) == evenparity32((lo >> 18) & 0x1ffff) && + IS_SET(lo, 0) == oddparity32((lo >> 1) & 0x1ffff))) { + return NULL; + } + wiegand_card_t *d = wiegand_card_alloc(); + d->oem = (lo >> 25) & 0x3ff; + d->facility_code = (lo >> 17) & 0xff; + d->card_number = (lo >> 1) & 0xffff; + return d; +} + static uint64_t pack_s12906(wiegand_card_t *card) { uint64_t bits = PREAMBLE_36BIT; bits <<= 1; @@ -819,6 +851,7 @@ static const card_format_table_t formats[] = { {P10004, pack_p10004, unpack_p10004, 37, {0, 0x1FFF, 0x3FFFF, 0, 0}}, // HID P10004 37-bit PCSC {HGEN37, pack_hgeneric37, unpack_hgeneric37, 37, {1, 0, 0xFFFFFFFF, 0, 0}}, // HID Generic 37-bit {MDI37, pack_mdi37, unpack_mdi37, 37, {1, 0xF, 0x1FFFFFFF, 0, 0}}, // PointGuard MDI 37-bit + {ACTPHID, pack_actprox, unpack_actprox, 36, {1, 0xFF, 0xFFFF, 0x3FF, 0}}, // HID ACTProx 36-bit }; uint64_t pack(wiegand_card_t *card) { diff --git a/firmware/application/src/rfid/nfctag/lf/protocols/wiegand.h b/firmware/application/src/rfid/nfctag/lf/protocols/wiegand.h index 8f898cf1..43f848e0 100644 --- a/firmware/application/src/rfid/nfctag/lf/protocols/wiegand.h +++ b/firmware/application/src/rfid/nfctag/lf/protocols/wiegand.h @@ -72,6 +72,7 @@ typedef enum { C1K48S, AVIG56, IR56, + ACTPHID, } card_format_t; // Structure for defined Wiegand card formats available for packing/unpacking diff --git a/software/script/chameleon_cli_unit.py b/software/script/chameleon_cli_unit.py index 8e9b9f21..ee66f1b6 100644 --- a/software/script/chameleon_cli_unit.py +++ b/software/script/chameleon_cli_unit.py @@ -453,6 +453,7 @@ def check_limits(format: int, fc: Union[int, None], cn: Union[int, None], il: Un HIDFormat.C1K35S: [0xFFF, 0xFFFFF, 0, 0], HIDFormat.C15001: [0xFF, 0xFFFF, 0, 0x3FF], HIDFormat.S12906: [0xFF, 0xFFFFFF, 0x3, 0], + HIDFormat.ACTPHID: [0xFF, 0xFFFFFF, 0, 0x3FF], HIDFormat.SIE36: [0x3FFFF, 0xFFFF, 0, 0], HIDFormat.H10320: [0, 99999999, 0, 0], HIDFormat.H10302: [0, 0x7FFFFFFFF, 0, 0], diff --git a/software/script/chameleon_enum.py b/software/script/chameleon_enum.py index a66ebcae..268cff94 100644 --- a/software/script/chameleon_enum.py +++ b/software/script/chameleon_enum.py @@ -581,6 +581,7 @@ class HIDFormat(enum.IntEnum): C1K35S = 21 C15001 = 22 S12906 = 23 + ACTPHID = 42 SIE36 = 24 H10320 = 25 H10302 = 26 @@ -614,6 +615,7 @@ def __str__(self): HIDFormat.C1K35S: "HID Corporate 1000 35-bit Std", HIDFormat.C15001: "HID KeyScan 36-bit", HIDFormat.S12906: "HID Simplex 36-bit", + HIDFormat.ACTPHID: "HID ACTProx 36-bit", HIDFormat.SIE36: "HID 36-bit Siemens", HIDFormat.H10320: "HID H10320 37-bit BCD", HIDFormat.H10302: "HID H10302 37-bit huge ID", From 2f867569482c9135f48e59b169aff61c27c8ef9e Mon Sep 17 00:00:00 2001 From: Gabriel Cardoso Date: Mon, 26 Jan 2026 19:10:39 +0000 Subject: [PATCH 3/3] fix tipo in previous commint --- firmware/application/src/rfid/nfctag/lf/protocols/wiegand.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/firmware/application/src/rfid/nfctag/lf/protocols/wiegand.c b/firmware/application/src/rfid/nfctag/lf/protocols/wiegand.c index 5c1fb6d3..e33bad78 100644 --- a/firmware/application/src/rfid/nfctag/lf/protocols/wiegand.c +++ b/firmware/application/src/rfid/nfctag/lf/protocols/wiegand.c @@ -553,7 +553,7 @@ static uint64_t pack_actprox(wiegand_card_t *card) { if (card->oem == 0) { card->oem = 900; } - uint64_t bits = PREAMBLE_36BIT; + uint64_t bits = PREAMBLE_ACTP; bits <<= 1; bits = (bits << 10) | (card->oem & 0x3ff); bits = (bits << 8) | (card->facility_code & 0xff);