@@ -1120,6 +1120,50 @@ static data_frame_tx_t *cmd_processor_ioprox_set_emu_id(uint16_t cmd, uint16_t s
11201120 return data_frame_make (cmd , STATUS_SUCCESS , 0 , NULL );
11211121}
11221122
1123+ static data_frame_tx_t * cmd_processor_idteck_set_emu_id (uint16_t cmd , uint16_t status , uint16_t length , uint8_t * data ) {
1124+ if (length != LF_IDTECK_TAG_ID_SIZE ) {
1125+ return data_frame_make (cmd , STATUS_PAR_ERR , 0 , NULL );
1126+ }
1127+ tag_data_buffer_t * buffer = get_buffer_by_tag_type (TAG_TYPE_IDTECK );
1128+ memcpy (buffer -> buffer , data , LF_IDTECK_TAG_ID_SIZE );
1129+ tag_emulation_load_by_buffer (TAG_TYPE_IDTECK , false);
1130+ return data_frame_make (cmd , STATUS_SUCCESS , 0 , NULL );
1131+ }
1132+
1133+ static data_frame_tx_t * cmd_processor_idteck_get_emu_id (uint16_t cmd , uint16_t status , uint16_t length , uint8_t * data ) {
1134+ tag_slot_specific_type_t tag_types ;
1135+ tag_emulation_get_specific_types_by_slot (tag_emulation_get_slot (), & tag_types );
1136+ if (tag_types .tag_lf != TAG_TYPE_IDTECK ) {
1137+ return data_frame_make (cmd , STATUS_PAR_ERR , 0 , data );
1138+ }
1139+ tag_data_buffer_t * buffer = get_buffer_by_tag_type (TAG_TYPE_IDTECK );
1140+ return data_frame_make (cmd , STATUS_SUCCESS , LF_IDTECK_TAG_ID_SIZE , buffer -> buffer );
1141+ }
1142+
1143+ #if defined(PROJECT_CHAMELEON_ULTRA )
1144+ // T55xx clone is only available on Chameleon Ultra; the Lite firmware
1145+ // has no LF reader hardware and does not compile the write_*_to_t55xx
1146+ // helpers in lf_reader_main.c.
1147+ static data_frame_tx_t * cmd_processor_idteck_write_to_t55xx (uint16_t cmd , uint16_t status , uint16_t length , uint8_t * data ) {
1148+ typedef struct {
1149+ uint8_t card_data [LF_IDTECK_TAG_ID_SIZE ];
1150+ uint8_t new_key [4 ];
1151+ uint8_t old_keys [4 ];
1152+ } PACKED payload_t ;
1153+
1154+ payload_t * payload = (payload_t * )data ;
1155+
1156+ if (length < sizeof (payload_t ) ||
1157+ (length - offsetof(payload_t , old_keys )) % sizeof (payload -> old_keys ) != 0 ) {
1158+ return data_frame_make (cmd , STATUS_PAR_ERR , 0 , NULL );
1159+ }
1160+
1161+ uint8_t old_cnt = (length - offsetof(payload_t , old_keys )) / sizeof (payload -> old_keys );
1162+ status = write_idteck_to_t55xx (payload -> card_data , payload -> new_key , payload -> old_keys , old_cnt );
1163+ return data_frame_make (cmd , status , 0 , NULL );
1164+ }
1165+ #endif
1166+
11231167static data_frame_tx_t * cmd_processor_ioprox_get_emu_id (uint16_t cmd , uint16_t status , uint16_t length , uint8_t * data ) {
11241168 tag_slot_specific_type_t tag_types ;
11251169 tag_emulation_get_specific_types_by_slot (tag_emulation_get_slot (), & tag_types );
@@ -2956,6 +3000,7 @@ static cmd_data_map_t m_data_cmd_map[] = {
29563000 { DATA_CMD_IOPROX_WRITE_TO_T55XX , before_reader_run , cmd_processor_ioprox_write_to_t55xx , NULL },
29573001 { DATA_CMD_PAC_SCAN , before_reader_run , cmd_processor_pac_scan , NULL },
29583002 { DATA_CMD_PAC_WRITE_TO_T55XX , before_reader_run , cmd_processor_pac_write_to_t55xx , NULL },
3003+ { DATA_CMD_IDTECK_WRITE_TO_T55XX , before_reader_run , cmd_processor_idteck_write_to_t55xx , NULL },
29593004 { DATA_CMD_LF_T55XX_WRITE , before_reader_run , cmd_processor_lf_t55xx_write , NULL },
29603005 { DATA_CMD_ADC_GENERIC_READ , before_reader_run , cmd_processor_generic_read , NULL },
29613006
@@ -3027,6 +3072,8 @@ static cmd_data_map_t m_data_cmd_map[] = {
30273072 { DATA_CMD_VIKING_GET_EMU_ID , NULL , cmd_processor_viking_get_emu_id , NULL },
30283073 { DATA_CMD_PAC_SET_EMU_ID , NULL , cmd_processor_pac_set_emu_id , NULL },
30293074 { DATA_CMD_PAC_GET_EMU_ID , NULL , cmd_processor_pac_get_emu_id , NULL },
3075+ { DATA_CMD_IDTECK_SET_EMU_ID , NULL , cmd_processor_idteck_set_emu_id , NULL },
3076+ { DATA_CMD_IDTECK_GET_EMU_ID , NULL , cmd_processor_idteck_get_emu_id , NULL },
30303077 /* ISO14443-4 T=CL emulation */
30313078#if defined(PROJECT_CHAMELEON_ULTRA )
30323079 /* ISO14443-4 T=CL emulation */
0 commit comments