mirror of
https://github.com/RfidResearchGroup/ChameleonUltra.git
synced 2026-05-12 11:22:59 -07:00
Add a new command to open all card slots.
This commit is contained in:
@@ -72,6 +72,7 @@ class ChameleonCLI:
|
||||
'help': "Get/Set tag nick name for slot",
|
||||
},
|
||||
'update': new_uint(chameleon_cli_unit.HWSlotUpdate, "Update config & data to device flash"),
|
||||
'openall': new_uint(chameleon_cli_unit.HWSlotOpenAll, "Open all slot and set to default data"),
|
||||
'help': "Emulation tag slot.",
|
||||
},
|
||||
'help': "hardware controller",
|
||||
|
||||
@@ -900,4 +900,35 @@ class HWSlotUpdate(DeviceRequiredUnit):
|
||||
# hw slot update
|
||||
def on_exec(self, args: argparse.Namespace):
|
||||
self.cmd_positive.update_slot_data_config()
|
||||
print(f' - Update config and data from device memory to flash success.')
|
||||
print(f' - Update config and data from device memory to flash success.')
|
||||
|
||||
|
||||
class HWSlotOpenAll(DeviceRequiredUnit):
|
||||
|
||||
def args_parser(self) -> ArgumentParserNoExit or None:
|
||||
return None
|
||||
|
||||
# hw slot openall
|
||||
def on_exec(self, args: argparse.Namespace):
|
||||
# what type you need set to default?
|
||||
hf_type = chameleon_cmd.TagSpecificType.TAG_TYPE_MIFARE_1024
|
||||
lf_type = chameleon_cmd.TagSpecificType.TAG_TYPE_EM410X
|
||||
|
||||
# set all slot
|
||||
for slot in range(8):
|
||||
# the slot not from 0 offset, so we can inc 1.
|
||||
slot = slot + 1
|
||||
print(f' Slot{slot} setting...')
|
||||
# first to set tag type
|
||||
self.cmd_positive.set_slot_tag_type(slot, hf_type)
|
||||
self.cmd_positive.set_slot_tag_type(slot, lf_type)
|
||||
# to init default data
|
||||
self.cmd_positive.set_slot_data_default(slot, hf_type)
|
||||
self.cmd_positive.set_slot_data_default(slot, lf_type)
|
||||
# finally, we can enable this slot.
|
||||
self.cmd_positive.set_slot_enable(slot, True)
|
||||
print(f' Open slot{slot} finish')
|
||||
|
||||
# update config and save to flash
|
||||
self.cmd_positive.update_slot_data_config()
|
||||
print(f' - Open all slot and set data to default success.')
|
||||
|
||||
Reference in New Issue
Block a user