mirror of
https://github.com/RfidResearchGroup/ChameleonUltra.git
synced 2026-05-12 11:22:59 -07:00
Add EM410x slot reading ability
This commit is contained in:
@@ -116,7 +116,11 @@ class ChameleonCLI:
|
||||
'em': {
|
||||
'read': new_uint(chameleon_cli_unit.LFEMRead, "Scan em410x tag and print id"),
|
||||
'write': new_uint(chameleon_cli_unit.LFEMWriteT55xx, "Write em410x id to t55xx"),
|
||||
'sim': new_uint(chameleon_cli_unit.LFEMSim, "Simulation a em410x id card"),
|
||||
'sim': {
|
||||
'set': new_uint(chameleon_cli_unit.LFEMSimSet, "Set simulated em410x card id"),
|
||||
'get': new_uint(chameleon_cli_unit.LFEMSimGet, "Get simulated em410x card id"),
|
||||
'help': "Manage EM410x emulation data for selected slot"
|
||||
},
|
||||
'help': "EM410x read/write/emulator",
|
||||
},
|
||||
'help': "low frequency tag/reader",
|
||||
|
||||
@@ -891,19 +891,30 @@ class HWSlotEnableSet(SlotIndexRequireUint):
|
||||
print(f' - Set slot {slot_num} {"enable" if enable else "disable"} success.')
|
||||
|
||||
|
||||
class LFEMSim(LFEMCardRequiredUint):
|
||||
class LFEMSimSet(LFEMCardRequiredUint):
|
||||
|
||||
def args_parser(self) -> ArgumentParserNoExit or None:
|
||||
parser = ArgumentParserNoExit()
|
||||
return self.add_card_arg(parser)
|
||||
|
||||
# lf em sim --id 4545454545
|
||||
# lf em sim set --id 4545454545
|
||||
def on_exec(self, args: argparse.Namespace):
|
||||
id_hex = args.id
|
||||
id_bytes = bytearray.fromhex(id_hex)
|
||||
self.cmd_positive.set_em140x_sim_id(id_bytes)
|
||||
self.cmd_positive.set_em410x_sim_id(id_bytes)
|
||||
print(f' - Set em410x tag id success.')
|
||||
|
||||
class LFEMSimGet(DeviceRequiredUnit):
|
||||
|
||||
def args_parser(self) -> ArgumentParserNoExit or None:
|
||||
return None
|
||||
|
||||
# lf em sim get
|
||||
def on_exec(self, args: argparse.Namespace):
|
||||
response = self.cmd_positive.get_em410x_sim_id()
|
||||
print(f' - Get em410x tag id success.')
|
||||
print(f'ID: {response.data.hex()}')
|
||||
|
||||
|
||||
class HWSlotNickSet(SlotIndexRequireUint, SenseTypeRequireUint):
|
||||
def args_parser(self) -> ArgumentParserNoExit or None:
|
||||
|
||||
@@ -327,7 +327,7 @@ class BaseChameleonCMD:
|
||||
data.append(0x01 if enable else 0x00)
|
||||
return self.device.send_cmd_sync(DATA_CMD_SET_SLOT_ENABLE, 0X00, data)
|
||||
|
||||
def set_em140x_sim_id(self, id_bytes: bytearray):
|
||||
def set_em410x_sim_id(self, id_bytes: bytearray):
|
||||
"""
|
||||
设置EM410x模拟的卡号
|
||||
:param id_bytes: 卡号的字节
|
||||
@@ -336,6 +336,12 @@ class BaseChameleonCMD:
|
||||
if len(id_bytes) != 5:
|
||||
raise ValueError("The id bytes length must equal 5")
|
||||
return self.device.send_cmd_sync(DATA_CMD_SET_EM410X_EMU_ID, 0x00, id_bytes)
|
||||
|
||||
def get_em410x_sim_id(self):
|
||||
"""
|
||||
Get the simulated EM410x card id
|
||||
"""
|
||||
return self.device.send_cmd_sync(DATA_CMD_GET_EM410X_EMU_ID, 0x00)
|
||||
|
||||
def set_mf1_detection_enable(self, enable: bool):
|
||||
"""
|
||||
@@ -528,8 +534,8 @@ class PositiveChameleonCMD(BaseChameleonCMD):
|
||||
self.check_status(ret.status, chameleon_status.Device.STATUS_DEVICE_SUCCESS)
|
||||
return ret
|
||||
|
||||
def set_em140x_sim_id(self, id_bytes: bytearray):
|
||||
ret = super(PositiveChameleonCMD, self).set_em140x_sim_id(id_bytes)
|
||||
def set_em410x_sim_id(self, id_bytes: bytearray):
|
||||
ret = super(PositiveChameleonCMD, self).set_em410x_sim_id(id_bytes)
|
||||
self.check_status(ret.status, chameleon_status.Device.STATUS_DEVICE_SUCCESS)
|
||||
return ret
|
||||
|
||||
|
||||
Reference in New Issue
Block a user