mirror of
https://github.com/RfidResearchGroup/ChameleonUltra.git
synced 2026-05-12 11:22:59 -07:00
Merge pull request #54 from nemanjan00/git-commit
Add git version command
This commit is contained in:
+2
-1
@@ -6,7 +6,8 @@ ARG NRF_CLT_URL=https://nsscprodmedia.blob.core.windows.net/prod/software-and-ot
|
||||
RUN set -xe; \
|
||||
DEBIAN_FRONTEND=noninteractive; \
|
||||
apt update -q; \
|
||||
apt install -qy --no-install-recommends ca-certificates curl xz-utils make; \
|
||||
apt install -qy --no-install-recommends ca-certificates curl xz-utils make git; \
|
||||
git config --global --add safe.directory /workdir; \
|
||||
curl -sLo /usr/bin/nrfutil https://developer.nordicsemi.com/.pc-tools/nrfutil/x64-linux/nrfutil; \
|
||||
curl -sLo /tmp/nrf-clt.deb $NRF_CLT_URL; \
|
||||
apt install -qfy /tmp/nrf-clt.deb; \
|
||||
|
||||
@@ -22,4 +22,8 @@ LD_DIR := $(SRC_COMMON)
|
||||
CHAMELEON_ULTRA := ultra
|
||||
CHAMELEON_LITE := lite
|
||||
# What device is it?
|
||||
|
||||
CURRENT_DEVICE_TYPE ?= ${CHAMELEON_ULTRA}
|
||||
|
||||
# Versioning information
|
||||
GIT_VERSION := "$(shell git describe --abbrev=7 --dirty --always --tags)"
|
||||
|
||||
@@ -313,6 +313,9 @@ CFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16
|
||||
CFLAGS += -ffunction-sections -fdata-sections -fno-strict-aliasing
|
||||
CFLAGS += -fno-builtin -fshort-enums
|
||||
|
||||
# Versioning flags
|
||||
CFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\"
|
||||
|
||||
# C++ flags common to all targets
|
||||
CXXFLAGS += $(OPT)
|
||||
# Assembler flags common to all targets
|
||||
|
||||
@@ -28,6 +28,12 @@ data_frame_tx_t* cmd_processor_get_version(uint16_t cmd, uint16_t status, uint16
|
||||
return data_frame_make(cmd, status, 2, (uint8_t*)&version);
|
||||
}
|
||||
|
||||
|
||||
data_frame_tx_t* cmd_processor_get_git_version(uint16_t cmd, uint16_t status, uint16_t length, uint8_t *data) {
|
||||
return data_frame_make(cmd, status, strlen(GIT_VERSION), (uint8_t*)GIT_VERSION);
|
||||
}
|
||||
|
||||
|
||||
data_frame_tx_t* cmd_processor_change_device_mode(uint16_t cmd, uint16_t status, uint16_t length, uint8_t *data) {
|
||||
#if defined(PROJECT_CHAMELEON_ULTRA)
|
||||
if (length == 1) {
|
||||
@@ -555,6 +561,7 @@ static cmd_data_map_t m_data_cmd_map[] = {
|
||||
{ DATA_CMD_RESET_SETTINGS, NULL, cmd_processor_reset_settings, NULL },
|
||||
{ DATA_CMD_SET_ANIMATION_MODE, NULL, cmd_processor_set_animation_mode, NULL },
|
||||
{ DATA_CMD_GET_ANIMATION_MODE, NULL, cmd_processor_get_animation_mode, NULL },
|
||||
{ DATA_CMD_GET_GIT_VERSION, NULL, cmd_processor_get_git_version, NULL },
|
||||
|
||||
#if defined(PROJECT_CHAMELEON_ULTRA)
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#define DATA_CMD_RESET_SETTINGS (1014)
|
||||
#define DATA_CMD_SET_ANIMATION_MODE (1015)
|
||||
#define DATA_CMD_GET_ANIMATION_MODE (1016)
|
||||
#define DATA_CMD_GET_GIT_VERSION (1017)
|
||||
//
|
||||
// ******************************************************************
|
||||
|
||||
|
||||
@@ -86,6 +86,7 @@ class ChameleonCLI:
|
||||
'openall': new_uint(chameleon_cli_unit.HWSlotOpenAll, "Open all slot and set to default data"),
|
||||
'help': "Emulation tag slot.",
|
||||
},
|
||||
'version': new_uint(chameleon_cli_unit.HWVersion, "Get current device firmware version"),
|
||||
'dfu': new_uint(chameleon_cli_unit.HWDFU, "Restart application to bootloader mode(Not yet implement dfu)."),
|
||||
'settings': {
|
||||
'animation': {
|
||||
|
||||
@@ -253,6 +253,16 @@ class HWAddressGet(DeviceRequiredUnit):
|
||||
def on_exec(self, args: argparse.Namespace):
|
||||
print(f' - Device address: ' + self.cmd_positive.get_device_address())
|
||||
|
||||
class HWVersion(DeviceRequiredUnit):
|
||||
|
||||
def args_parser(self) -> ArgumentParserNoExit or None:
|
||||
return None
|
||||
|
||||
def on_exec(self, args: argparse.Namespace):
|
||||
fw_version_int = self.cmd_positive.get_firmware_version()
|
||||
fw_version = f'v{fw_version_int // 256}.{fw_version_int % 256}'
|
||||
git_version = self.cmd_positive.get_git_version()
|
||||
print(f' - Version: {fw_version} ({git_version})')
|
||||
|
||||
class HF14AScan(ReaderRequiredUint):
|
||||
def args_parser(self) -> ArgumentParserNoExit or None:
|
||||
|
||||
@@ -19,6 +19,7 @@ DATA_CMD_SLOT_DATA_CONFIG_SAVE = 1009
|
||||
DATA_CMD_ENTER_BOOTLOADER = 1010
|
||||
DATA_CMD_GET_DEVICE_CHIP_ID = 1011
|
||||
DATA_CMD_GET_DEVICE_ADDRESS = 1012
|
||||
DATA_CMD_GET_GIT_VERSION = 1017
|
||||
|
||||
DATA_CMD_SAVE_SETTINGS = 1013
|
||||
DATA_CMD_RESET_SETTINGS = 1014
|
||||
@@ -113,7 +114,10 @@ class BaseChameleonCMD:
|
||||
"""
|
||||
resp = self.device.send_cmd_sync(DATA_CMD_GET_DEVICE_ADDRESS, 0x00, None)
|
||||
return resp.data[::-1].hex()
|
||||
|
||||
|
||||
def get_git_version(self) -> str:
|
||||
resp = self.device.send_cmd_sync(DATA_CMD_GET_GIT_VERSION, 0x00, None)
|
||||
return resp.data.decode('utf-8')
|
||||
|
||||
def is_reader_device_mode(self) -> bool:
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user