Merge remote-tracking branch 'ul/dev' into mntm-dev

This commit is contained in:
WillyJL
2026-06-01 19:12:46 +02:00
64 changed files with 4882 additions and 625 deletions
+4 -1
View File
@@ -172,7 +172,10 @@ bool iso14443_4_layer_decode_response(
bit_buffer_copy_right(output_data, block_data, 1);
} else {
if(!bit_buffer_starts_with_byte(block_data, instance->pcb_prev)) break;
bit_buffer_copy_right(output_data, block_data, 1);
// Fix for some EMV cards with strange response
if(bit_buffer_get_size_bytes(block_data) > 1) {
bit_buffer_copy_right(output_data, block_data, 1);
}
ret = true;
}
} while(false);
@@ -15,6 +15,11 @@ extern "C" {
#define ISO15693_3_FDT_LISTEN_FC (4320U)
#define ISO15693_3_POLL_POLL_MIN_US (1500U)
/* NVM write time varies by tag type (ICODE SLIX: 9.6ms, generic: up to 20ms).
* ISO 15693-3 write commands require a longer FWT than reads to account for
* EEPROM programming delays before the tag responds. 20ms covers all known tags. */
#define ISO15693_3_FDT_WRITE_POLL_FC (271200U)
#define ISO15693_3_REQ_FLAG_SUBCARRIER_1 (0U << 0)
#define ISO15693_3_REQ_FLAG_SUBCARRIER_2 (1U << 0)
#define ISO15693_3_REQ_FLAG_DATA_RATE_LO (0U << 1)
@@ -176,6 +176,25 @@ Iso15693_3Error
return ret;
}
Iso15693_3Error iso15693_3_write_block_response_parse(const BitBuffer* buf) {
Iso15693_3Error ret = Iso15693_3ErrorNone;
do {
if(iso15693_3_error_response_parse(&ret, buf)) break;
typedef struct {
uint8_t flags;
} WriteBlockResponseLayout;
if(bit_buffer_get_size_bytes(buf) != sizeof(WriteBlockResponseLayout)) {
ret = Iso15693_3ErrorUnexpectedResponse;
break;
}
} while(false);
return ret;
}
Iso15693_3Error iso15693_3_get_block_security_response_parse(
uint8_t* data,
uint16_t block_count,
@@ -28,6 +28,8 @@ Iso15693_3Error
Iso15693_3Error
iso15693_3_read_block_response_parse(uint8_t* data, uint8_t block_size, const BitBuffer* buf);
Iso15693_3Error iso15693_3_write_block_response_parse(const BitBuffer* buf);
Iso15693_3Error iso15693_3_get_block_security_response_parse(
uint8_t* data,
uint16_t block_count,
@@ -13,6 +13,14 @@ extern "C" {
*/
typedef struct Iso15693_3Poller Iso15693_3Poller;
/**
* @brief Get the Iso15693_3 data accumulated by the poller.
*
* @param[in] instance pointer to the Iso15693_3Poller instance.
* @return pointer to the Iso15693_3Data structure filled during activation.
*/
const Iso15693_3Data* iso15693_3_poller_get_data(Iso15693_3Poller* instance);
/**
* @brief Enumeration of possible Iso15693_3 poller event types.
*/
@@ -144,6 +152,40 @@ Iso15693_3Error iso15693_3_poller_get_blocks_security(
uint8_t* data,
uint16_t block_count);
/**
* @brief Write a single Iso15693_3 block.
*
* Must ONLY be used inside the callback function.
*
* @param[in, out] instance pointer to the instance to be used in the transaction.
* @param[in] data pointer to the buffer containing the data to write.
* @param[in] block_number block number to write.
* @param[in] block_size size of the block in bytes.
* @return Iso15693_3ErrorNone on success, an error code on failure.
*/
Iso15693_3Error iso15693_3_poller_write_block(
Iso15693_3Poller* instance,
const uint8_t* data,
uint8_t block_number,
uint8_t block_size);
/**
* @brief Write multiple consecutive Iso15693_3 blocks.
*
* Must ONLY be used inside the callback function.
*
* @param[in, out] instance pointer to the instance to be used in the transaction.
* @param[in] data pointer to the buffer containing the data to write.
* @param[in] block_count number of blocks to write.
* @param[in] block_size size of each block in bytes.
* @return Iso15693_3ErrorNone on success, an error code on failure.
*/
Iso15693_3Error iso15693_3_poller_write_blocks(
Iso15693_3Poller* instance,
const uint8_t* data,
uint16_t block_count,
uint8_t block_size);
#ifdef __cplusplus
}
#endif
@@ -234,6 +234,57 @@ Iso15693_3Error iso15693_3_poller_read_blocks(
return ret;
}
Iso15693_3Error iso15693_3_poller_write_block(
Iso15693_3Poller* instance,
const uint8_t* data,
uint8_t block_number,
uint8_t block_size) {
furi_assert(instance);
furi_assert(data);
bit_buffer_reset(instance->tx_buffer);
bit_buffer_reset(instance->rx_buffer);
bit_buffer_append_byte(
instance->tx_buffer, ISO15693_3_REQ_FLAG_SUBCARRIER_1 | ISO15693_3_REQ_FLAG_DATA_RATE_HI);
bit_buffer_append_byte(instance->tx_buffer, ISO15693_3_CMD_WRITE_BLOCK);
bit_buffer_append_byte(instance->tx_buffer, block_number);
bit_buffer_append_bytes(instance->tx_buffer, data, block_size);
Iso15693_3Error ret;
do {
ret = iso15693_3_poller_send_frame(
instance, instance->tx_buffer, instance->rx_buffer, ISO15693_3_FDT_WRITE_POLL_FC);
if(ret != Iso15693_3ErrorNone) break;
ret = iso15693_3_write_block_response_parse(instance->rx_buffer);
} while(false);
return ret;
}
Iso15693_3Error iso15693_3_poller_write_blocks(
Iso15693_3Poller* instance,
const uint8_t* data,
uint16_t block_count,
uint8_t block_size) {
furi_assert(instance);
furi_assert(data);
furi_assert(block_count);
furi_assert(block_size);
Iso15693_3Error ret = Iso15693_3ErrorNone;
for(uint32_t i = 0; i < block_count; ++i) {
ret =
iso15693_3_poller_write_block(instance, &data[block_size * i], (uint8_t)i, block_size);
if(ret != Iso15693_3ErrorNone) break;
}
return ret;
}
Iso15693_3Error iso15693_3_poller_get_blocks_security(
Iso15693_3Poller* instance,
uint8_t* data,
@@ -33,8 +33,6 @@ struct Iso15693_3Poller {
void* context;
};
const Iso15693_3Data* iso15693_3_poller_get_data(Iso15693_3Poller* instance);
#ifdef __cplusplus
}
#endif
@@ -65,24 +65,28 @@ void mf_classic_poller_free(MfClassicPoller* instance) {
bit_buffer_free(instance->tx_encrypted_buffer);
bit_buffer_free(instance->rx_encrypted_buffer);
// Clean up resources in MfClassicPollerDictAttackContext
MfClassicPollerDictAttackContext* dict_attack_ctx = &instance->mode_ctx.dict_attack_ctx;
// Clean up dict attack resources when the poller was in dict attack mode.
if(instance->mode == MfClassicPollerModeDictAttackStandard ||
instance->mode == MfClassicPollerModeDictAttackEnhanced ||
instance->mode == MfClassicPollerModeDictAttackCUID) {
MfClassicPollerDictAttackContext* dict_attack_ctx = &instance->mode_ctx.dict_attack_ctx;
// Free the dictionaries
if(dict_attack_ctx->mf_classic_system_dict) {
keys_dict_free(dict_attack_ctx->mf_classic_system_dict);
dict_attack_ctx->mf_classic_system_dict = NULL;
}
if(dict_attack_ctx->mf_classic_user_dict) {
keys_dict_free(dict_attack_ctx->mf_classic_user_dict);
dict_attack_ctx->mf_classic_user_dict = NULL;
}
// Free the dictionaries
if(dict_attack_ctx->mf_classic_system_dict) {
keys_dict_free(dict_attack_ctx->mf_classic_system_dict);
dict_attack_ctx->mf_classic_system_dict = NULL;
}
if(dict_attack_ctx->mf_classic_user_dict) {
keys_dict_free(dict_attack_ctx->mf_classic_user_dict);
dict_attack_ctx->mf_classic_user_dict = NULL;
}
// Free the nested nonce array if it exists
if(dict_attack_ctx->nested_nonce.nonces) {
free(dict_attack_ctx->nested_nonce.nonces);
dict_attack_ctx->nested_nonce.nonces = NULL;
dict_attack_ctx->nested_nonce.count = 0;
// Free the nested nonce array if it exists
if(dict_attack_ctx->nested_nonce.nonces) {
free(dict_attack_ctx->nested_nonce.nonces);
dict_attack_ctx->nested_nonce.nonces = NULL;
dict_attack_ctx->nested_nonce.count = 0;
}
}
free(instance);
@@ -162,6 +166,7 @@ NfcCommand mf_classic_poller_handler_start(MfClassicPoller* instance) {
instance->mfc_event.type = MfClassicPollerEventTypeRequestMode;
command = instance->callback(instance->general_event, instance->context);
instance->mode = instance->mfc_event_data.poller_mode.mode;
if(instance->mfc_event_data.poller_mode.mode == MfClassicPollerModeDictAttackStandard ||
instance->mfc_event_data.poller_mode.mode == MfClassicPollerModeDictAttackCUID) {
@@ -183,6 +183,7 @@ struct MfClassicPoller {
MfClassicType current_type_check;
uint8_t sectors_total;
MfClassicPollerMode mode;
MfClassicPollerModeContext mode_ctx;
Crypto1* crypto;
+1 -3
View File
@@ -290,9 +290,7 @@ bool mf_desfire_file_settings_parse(MfDesfireFileSettings* data, const BitBuffer
printf("\r\n");
break;
}
if(additional_access_rights_len >
MF_DESFIRE_MAX_KEYS * sizeof(MfDesfireFileAccessRights))
break;
if(additional_access_rights_len > MF_DESFIRE_MAX_KEYS - 1) break;
memcpy(
&file_settings_temp.access_rights[1],
@@ -169,6 +169,10 @@ static MfUltralightCommand
MfUltralightPage pages[64] = {};
uint8_t page_cnt = (end_page - start_page) + 1;
if(page_cnt > COUNT_OF(pages)) {
command = MfUltralightCommandNotProcessedNAK;
break;
}
mf_ultralight_listener_perform_read(pages, instance, start_page, page_cnt, do_i2c_check);
bit_buffer_copy_bytes(instance->tx_buffer, (uint8_t*)pages, page_cnt * 4);
+34
View File
@@ -118,6 +118,40 @@ SlixError slix_poller_set_password(
SlixPassword password,
SlixRandomNumber random_number);
/**
* @brief Write a single block to a Slix card.
*
* Must ONLY be used inside the callback function.
*
* @param[in, out] instance pointer to the instance to be used in the transaction.
* @param[in] data pointer to the buffer containing the data to write.
* @param[in] block_number block number to write.
* @param[in] block_size size of the block in bytes.
* @return SlixErrorNone on success, an error code on failure.
*/
SlixError slix_poller_write_block(
SlixPoller* instance,
const uint8_t* data,
uint8_t block_number,
uint8_t block_size);
/**
* @brief Write multiple consecutive blocks to a Slix card.
*
* Must ONLY be used inside the callback function.
*
* @param[in, out] instance pointer to the instance to be used in the transaction.
* @param[in] data pointer to the buffer containing the data to write.
* @param[in] block_count number of blocks to write.
* @param[in] block_size size of each block in bytes.
* @return SlixErrorNone on success, an error code on failure.
*/
SlixError slix_poller_write_blocks(
SlixPoller* instance,
const uint8_t* data,
uint16_t block_count,
uint8_t block_size);
#ifdef __cplusplus
}
#endif
+28
View File
@@ -128,3 +128,31 @@ SlixError slix_poller_set_password(
return error;
}
SlixError slix_poller_write_block(
SlixPoller* instance,
const uint8_t* data,
uint8_t block_number,
uint8_t block_size) {
furi_assert(instance);
furi_assert(data);
const Iso15693_3Error error =
iso15693_3_poller_write_block(instance->iso15693_3_poller, data, block_number, block_size);
return slix_process_iso15693_3_error(error);
}
SlixError slix_poller_write_blocks(
SlixPoller* instance,
const uint8_t* data,
uint16_t block_count,
uint8_t block_size) {
furi_assert(instance);
furi_assert(data);
furi_assert(block_count);
furi_assert(block_size);
const Iso15693_3Error error =
iso15693_3_poller_write_blocks(instance->iso15693_3_poller, data, block_count, block_size);
return slix_process_iso15693_3_error(error);
}
+378
View File
@@ -0,0 +1,378 @@
/**
* allstar_firefly.c -- Allstar Firefly 318ALD31K native SubGHz protocol
*
* Implements the SubGhzProtocol vtable for the Supertex ED-9 based gate remote.
* Uses subghz_block_generic_serialize / deserialize for standard-format .sub
* files, encoding the 9-position trinary DIP code as a uint64 (base-3, MSB
* first: '+' = 2, '0' = 3, '-' = 0).
*
* Saved file format:
* Filetype: Flipper SubGhz Key File
* Version: 1
* Frequency: 318000000
* Preset: FuriHalSubGhzPresetOok650Async
* Protocol: Allstar Firefly
* Key: 00 00 00 00 00 00 34 B9
* Bit: 18
*
* See allstar_firefly.h for full protocol documentation.
*/
#include "allstar_firefly.h"
#include "../blocks/const.h"
#include "../blocks/decoder.h"
#include "../blocks/encoder.h"
#include "../blocks/generic.h"
#include "../blocks/math.h"
#define TAG "AllstarFirefly"
#define DIP_P 0b11 //(+)
#define DIP_O 0b10 //(0)
#define DIP_N 0b00 //(-)
#define DIP_PATTERN "%c%c%c%c%c%c%c%c%c"
#define SHOW_DIP_P(dip, check_dip) \
((((dip >> 0x10) & 0x3) == check_dip) ? '*' : '_'), \
((((dip >> 0xE) & 0x3) == check_dip) ? '*' : '_'), \
((((dip >> 0xC) & 0x3) == check_dip) ? '*' : '_'), \
((((dip >> 0xA) & 0x3) == check_dip) ? '*' : '_'), \
((((dip >> 0x8) & 0x3) == check_dip) ? '*' : '_'), \
((((dip >> 0x6) & 0x3) == check_dip) ? '*' : '_'), \
((((dip >> 0x4) & 0x3) == check_dip) ? '*' : '_'), \
((((dip >> 0x2) & 0x3) == check_dip) ? '*' : '_'), \
((((dip >> 0x0) & 0x3) == check_dip) ? '*' : '_')
static const SubGhzBlockConst subghz_protocol_allstar_firefly_const = {
.te_short = 600,
.te_long = 4000,
.te_delta = 300,
.min_count_bit_for_found = 18,
};
struct SubGhzProtocolDecoderAllstarFirefly {
SubGhzProtocolDecoderBase base;
SubGhzBlockDecoder decoder;
SubGhzBlockGeneric generic;
};
struct SubGhzProtocolEncoderAllstarFirefly {
SubGhzProtocolEncoderBase base;
SubGhzProtocolBlockEncoder encoder;
SubGhzBlockGeneric generic;
};
typedef enum {
AllstarFireflyDecoderStepReset = 0,
AllstarFireflyDecoderStepSaveDuration,
AllstarFireflyDecoderStepCheckDuration,
} AllstarFireflyDecoderStep;
const SubGhzProtocolDecoder subghz_protocol_allstar_firefly_decoder = {
.alloc = subghz_protocol_decoder_allstar_firefly_alloc,
.free = subghz_protocol_decoder_allstar_firefly_free,
.feed = subghz_protocol_decoder_allstar_firefly_feed,
.reset = subghz_protocol_decoder_allstar_firefly_reset,
.get_hash_data = NULL,
.get_hash_data_long = subghz_protocol_decoder_allstar_firefly_get_hash_data,
.serialize = subghz_protocol_decoder_allstar_firefly_serialize,
.deserialize = subghz_protocol_decoder_allstar_firefly_deserialize,
.get_string = subghz_protocol_decoder_allstar_firefly_get_string,
.get_string_brief = NULL,
};
const SubGhzProtocolEncoder subghz_protocol_allstar_firefly_encoder = {
.alloc = subghz_protocol_encoder_allstar_firefly_alloc,
.free = subghz_protocol_encoder_allstar_firefly_free,
.deserialize = subghz_protocol_encoder_allstar_firefly_deserialize,
.stop = subghz_protocol_encoder_allstar_firefly_stop,
.yield = subghz_protocol_encoder_allstar_firefly_yield,
};
const SubGhzProtocol subghz_protocol_allstar_firefly = {
.name = SUBGHZ_PROTOCOL_ALLSTAR_FIREFLY_NAME,
.type = SubGhzProtocolTypeStatic,
.flag = SubGhzProtocolFlag_315 | SubGhzProtocolFlag_AM | SubGhzProtocolFlag_Decodable |
SubGhzProtocolFlag_Load | SubGhzProtocolFlag_Save | SubGhzProtocolFlag_Send,
.decoder = &subghz_protocol_allstar_firefly_decoder,
.encoder = &subghz_protocol_allstar_firefly_encoder,
};
void* subghz_protocol_encoder_allstar_firefly_alloc(SubGhzEnvironment* environment) {
UNUSED(environment);
SubGhzProtocolEncoderAllstarFirefly* instance =
malloc(sizeof(SubGhzProtocolEncoderAllstarFirefly));
instance->base.protocol = &subghz_protocol_allstar_firefly;
instance->generic.protocol_name = instance->base.protocol->name;
instance->encoder.repeat = 5;
instance->encoder.size_upload = 256;
instance->encoder.upload = malloc(instance->encoder.size_upload * sizeof(LevelDuration));
instance->encoder.is_running = false;
return instance;
}
void subghz_protocol_encoder_allstar_firefly_free(void* context) {
furi_assert(context);
SubGhzProtocolEncoderAllstarFirefly* instance = context;
free(instance->encoder.upload);
free(instance);
}
/**
* Generating an upload from data.
* @param instance Pointer to a SubGhzProtocolEncoderAllstarFirefly instance
*/
static void subghz_protocol_encoder_allstar_firefly_get_upload(
SubGhzProtocolEncoderAllstarFirefly* instance) {
furi_assert(instance);
size_t index = 0;
// Send key and GAP
for(uint8_t i = instance->generic.data_count_bit; i > 0; i--) {
if(bit_read(instance->generic.data, i - 1)) {
// Send bit 1
instance->encoder.upload[index++] =
level_duration_make(true, (uint32_t)subghz_protocol_allstar_firefly_const.te_long);
if(i == 1) {
//Send gap if bit was last
instance->encoder.upload[index++] = level_duration_make(
false, (uint32_t)(subghz_protocol_allstar_firefly_const.te_short * 50) + 400);
} else {
instance->encoder.upload[index++] = level_duration_make(
false, (uint32_t)subghz_protocol_allstar_firefly_const.te_short);
}
} else {
// Send bit 0
instance->encoder.upload[index++] = level_duration_make(
true, (uint32_t)subghz_protocol_allstar_firefly_const.te_short);
if(i == 1) {
//Send gap if bit was last
instance->encoder.upload[index++] = level_duration_make(
false, (uint32_t)(subghz_protocol_allstar_firefly_const.te_short * 50) + 400);
} else {
instance->encoder.upload[index++] = level_duration_make(
false, (uint32_t)subghz_protocol_allstar_firefly_const.te_long);
}
}
}
instance->encoder.size_upload = index;
return;
}
SubGhzProtocolStatus subghz_protocol_encoder_allstar_firefly_deserialize(
void* context,
FlipperFormat* flipper_format) {
furi_assert(context);
SubGhzProtocolEncoderAllstarFirefly* instance = context;
SubGhzProtocolStatus ret = SubGhzProtocolStatusError;
do {
ret = subghz_block_generic_deserialize_check_count_bit(
&instance->generic,
flipper_format,
subghz_protocol_allstar_firefly_const.min_count_bit_for_found);
if(ret != SubGhzProtocolStatusOk) {
break;
}
// Optional value
flipper_format_read_uint32(
flipper_format, "Repeat", (uint32_t*)&instance->encoder.repeat, 1);
subghz_protocol_encoder_allstar_firefly_get_upload(instance);
instance->encoder.is_running = true;
} while(false);
return ret;
}
void subghz_protocol_encoder_allstar_firefly_stop(void* context) {
SubGhzProtocolEncoderAllstarFirefly* instance = context;
instance->encoder.is_running = false;
}
LevelDuration subghz_protocol_encoder_allstar_firefly_yield(void* context) {
SubGhzProtocolEncoderAllstarFirefly* instance = context;
if(instance->encoder.repeat == 0 || !instance->encoder.is_running) {
instance->encoder.is_running = false;
return level_duration_reset();
}
LevelDuration ret = instance->encoder.upload[instance->encoder.front];
if(++instance->encoder.front == instance->encoder.size_upload) {
if(!subghz_block_generic_global.endless_tx) instance->encoder.repeat--;
instance->encoder.front = 0;
}
return ret;
}
void* subghz_protocol_decoder_allstar_firefly_alloc(SubGhzEnvironment* environment) {
UNUSED(environment);
SubGhzProtocolDecoderAllstarFirefly* instance =
malloc(sizeof(SubGhzProtocolDecoderAllstarFirefly));
instance->base.protocol = &subghz_protocol_allstar_firefly;
instance->generic.protocol_name = instance->base.protocol->name;
return instance;
}
void subghz_protocol_decoder_allstar_firefly_free(void* context) {
furi_assert(context);
SubGhzProtocolDecoderAllstarFirefly* instance = context;
free(instance);
}
void subghz_protocol_decoder_allstar_firefly_reset(void* context) {
furi_assert(context);
SubGhzProtocolDecoderAllstarFirefly* instance = context;
instance->decoder.parser_step = AllstarFireflyDecoderStepReset;
}
void subghz_protocol_decoder_allstar_firefly_feed(
void* context,
bool level,
volatile uint32_t duration) {
furi_assert(context);
SubGhzProtocolDecoderAllstarFirefly* instance = context;
// Allstar Firefly Decoder
// 2026 - by @jlaughter
// Remake to match other protocols code base - @xMasterX (MMX)
switch(instance->decoder.parser_step) {
case AllstarFireflyDecoderStepReset:
if((!level) &&
(DURATION_DIFF(duration, subghz_protocol_allstar_firefly_const.te_short * 50) <
subghz_protocol_allstar_firefly_const.te_delta * 5)) {
// 30k us
// Found GAP
instance->decoder.decode_data = 0;
instance->decoder.decode_count_bit = 0;
instance->decoder.parser_step = AllstarFireflyDecoderStepSaveDuration;
}
break;
case AllstarFireflyDecoderStepSaveDuration:
if(level) {
instance->decoder.te_last = duration;
instance->decoder.parser_step = AllstarFireflyDecoderStepCheckDuration;
} else {
instance->decoder.parser_step = AllstarFireflyDecoderStepReset;
}
break;
case AllstarFireflyDecoderStepCheckDuration:
if(!level) {
// Bit 1 is long and short timing = 4000us HIGH (te_last) and 600us LOW
if((DURATION_DIFF(
instance->decoder.te_last, subghz_protocol_allstar_firefly_const.te_long) <
subghz_protocol_allstar_firefly_const.te_delta) &&
(DURATION_DIFF(duration, subghz_protocol_allstar_firefly_const.te_short) <
subghz_protocol_allstar_firefly_const.te_delta)) {
subghz_protocol_blocks_add_bit(&instance->decoder, 1);
instance->decoder.parser_step = AllstarFireflyDecoderStepSaveDuration;
// Bit 0 is short and long timing = 600us HIGH (te_last) and 4000us LOW
} else if(
(DURATION_DIFF(
instance->decoder.te_last, subghz_protocol_allstar_firefly_const.te_short) <
subghz_protocol_allstar_firefly_const.te_delta) &&
(DURATION_DIFF(duration, subghz_protocol_allstar_firefly_const.te_long) <
subghz_protocol_allstar_firefly_const.te_delta)) {
subghz_protocol_blocks_add_bit(&instance->decoder, 0);
instance->decoder.parser_step = AllstarFireflyDecoderStepSaveDuration;
} else if(
// End of the key
DURATION_DIFF(duration, subghz_protocol_allstar_firefly_const.te_short * 50) <
subghz_protocol_allstar_firefly_const.te_delta * 5) {
// Found next GAP and add bit 0 or 1
if((DURATION_DIFF(
instance->decoder.te_last, subghz_protocol_allstar_firefly_const.te_long) <
subghz_protocol_allstar_firefly_const.te_delta)) {
subghz_protocol_blocks_add_bit(&instance->decoder, 1);
}
if((DURATION_DIFF(
instance->decoder.te_last,
subghz_protocol_allstar_firefly_const.te_short) <
subghz_protocol_allstar_firefly_const.te_delta)) {
subghz_protocol_blocks_add_bit(&instance->decoder, 0);
}
// If got 18 bits key reading is finished
if(instance->decoder.decode_count_bit ==
subghz_protocol_allstar_firefly_const.min_count_bit_for_found) {
instance->generic.data = instance->decoder.decode_data;
instance->generic.data_count_bit = instance->decoder.decode_count_bit;
if(instance->base.callback)
instance->base.callback(&instance->base, instance->base.context);
}
instance->decoder.decode_data = 0;
instance->decoder.decode_count_bit = 0;
instance->decoder.parser_step = AllstarFireflyDecoderStepReset;
} else {
instance->decoder.parser_step = AllstarFireflyDecoderStepReset;
}
} else {
instance->decoder.parser_step = AllstarFireflyDecoderStepReset;
}
break;
}
}
uint32_t subghz_protocol_decoder_allstar_firefly_get_hash_data(void* context) {
furi_assert(context);
SubGhzProtocolDecoderAllstarFirefly* instance = context;
return subghz_protocol_blocks_get_hash_data_long(
&instance->decoder, (instance->decoder.decode_count_bit / 8) + 1);
}
SubGhzProtocolStatus subghz_protocol_decoder_allstar_firefly_serialize(
void* context,
FlipperFormat* flipper_format,
SubGhzRadioPreset* preset) {
furi_assert(context);
SubGhzProtocolDecoderAllstarFirefly* instance = context;
return subghz_block_generic_serialize(&instance->generic, flipper_format, preset);
}
SubGhzProtocolStatus subghz_protocol_decoder_allstar_firefly_deserialize(
void* context,
FlipperFormat* flipper_format) {
furi_assert(context);
SubGhzProtocolDecoderAllstarFirefly* instance = context;
return subghz_block_generic_deserialize_check_count_bit(
&instance->generic,
flipper_format,
subghz_protocol_allstar_firefly_const.min_count_bit_for_found);
}
void subghz_protocol_decoder_allstar_firefly_get_string(void* context, FuriString* output) {
furi_assert(context);
SubGhzProtocolDecoderAllstarFirefly* instance = context;
uint64_t code_found_reverse = subghz_protocol_blocks_reverse_key(
instance->generic.data, instance->generic.data_count_bit);
furi_string_cat_printf(
output,
"%s %db\r\n"
"Key:0x%05lX Yek:0x%05lX\r\n"
" +: " DIP_PATTERN "\r\n"
" o: " DIP_PATTERN "\r\n"
" -: " DIP_PATTERN "\r\n",
instance->generic.protocol_name,
instance->generic.data_count_bit,
(uint32_t)(instance->generic.data & 0xFFFFF),
(uint32_t)(code_found_reverse & 0xFFFFF),
SHOW_DIP_P(instance->generic.data, DIP_P),
SHOW_DIP_P(instance->generic.data, DIP_O),
SHOW_DIP_P(instance->generic.data, DIP_N));
}
+143
View File
@@ -0,0 +1,143 @@
#pragma once
/**
* allstar_firefly.h - Allstar Firefly 318ALD31K native SubGHz protocol
*
* Registers the Allstar Firefly gate remote as a first-class SubGHz protocol,
* supporting decode from air, save/load of .sub files, and retransmit.
*
* Protocol summary (measured from captured remotes):
* Carrier : 318 MHz OOK (FuriHalSubGhzPresetOok650Async)
* Code type : Static 9-bit trinary (Supertex ED-9 encoder IC)
* Frame : 18 symbols (2 per bit), no separate sync pulse
* Repeats : 20 frames per keypress
* Inter-frame gap: ~30 440 us
*
* Symbol encoding - each bit = two (pulse, gap) pairs:
* '+' ON : H H = [4045us HIGH, 607us LOW] x2
* '-' OFF : L L = [530us HIGH, 4139us LOW] x2
* '0' FLOAT : H L = [4045us HIGH, 607us LOW, 530us HIGH, 4139us LOW]
*
* Save file format:
* Filetype: Flipper SubGhz Key File
* Version: 1
* Frequency: 318000000
* Preset: FuriHalSubGhzPresetOok650Async
* Protocol: Allstar Firefly
* Key: +--000++-
*
* To register with the SubGHz app, in protocol_list.c add:
* #include "allstar_firefly.h"
* &subghz_protocol_allstar_firefly, (in the protocol array)
*/
#include "base.h"
/* Protocol name (must match what is written to .sub files) */
#define SUBGHZ_PROTOCOL_ALLSTAR_FIREFLY_NAME "Allstar Firefly"
typedef struct SubGhzProtocolDecoderAllstarFirefly SubGhzProtocolDecoderAllstarFirefly;
typedef struct SubGhzProtocolEncoderAllstarFirefly SubGhzProtocolEncoderAllstarFirefly;
extern const SubGhzProtocolDecoder subghz_protocol_allstar_firefly_decoder;
extern const SubGhzProtocolEncoder subghz_protocol_allstar_firefly_encoder;
extern const SubGhzProtocol subghz_protocol_allstar_firefly;
/**
* Allocate SubGhzProtocolEncoderAllstarFirefly.
* @param environment Pointer to a SubGhzEnvironment instance
* @return SubGhzProtocolEncoderAllstarFirefly* pointer to a SubGhzProtocolEncoderAllstarFirefly instance
*/
void* subghz_protocol_encoder_allstar_firefly_alloc(SubGhzEnvironment* environment);
/**
* Free SubGhzProtocolEncoderAllstarFirefly.
* @param context Pointer to a SubGhzProtocolEncoderAllstarFirefly instance
*/
void subghz_protocol_encoder_allstar_firefly_free(void* context);
/**
* Deserialize and generating an upload to send.
* @param context Pointer to a SubGhzProtocolEncoderAllstarFirefly instance
* @param flipper_format Pointer to a FlipperFormat instance
* @return status
*/
SubGhzProtocolStatus subghz_protocol_encoder_allstar_firefly_deserialize(
void* context,
FlipperFormat* flipper_format);
/**
* Forced transmission stop.
* @param context Pointer to a SubGhzProtocolEncoderAllstarFirefly instance
*/
void subghz_protocol_encoder_allstar_firefly_stop(void* context);
/**
* Getting the level and duration of the upload to be loaded into DMA.
* @param context Pointer to a SubGhzProtocolEncoderAllstarFirefly instance
* @return LevelDuration
*/
LevelDuration subghz_protocol_encoder_allstar_firefly_yield(void* context);
/**
* Allocate SubGhzProtocolDecoderAllstarFirefly.
* @param environment Pointer to a SubGhzEnvironment instance
* @return SubGhzProtocolDecoderAllstarFirefly* pointer to a SubGhzProtocolDecoderAllstarFirefly instance
*/
void* subghz_protocol_decoder_allstar_firefly_alloc(SubGhzEnvironment* environment);
/**
* Free SubGhzProtocolDecoderAllstarFirefly.
* @param context Pointer to a SubGhzProtocolDecoderAllstarFirefly instance
*/
void subghz_protocol_decoder_allstar_firefly_free(void* context);
/**
* Reset decoder SubGhzProtocolDecoderAllstarFirefly.
* @param context Pointer to a SubGhzProtocolDecoderAllstarFirefly instance
*/
void subghz_protocol_decoder_allstar_firefly_reset(void* context);
/**
* Parse a raw sequence of levels and durations received from the air.
* @param context Pointer to a SubGhzProtocolDecoderAllstarFirefly instance
* @param level Signal level true-high false-low
* @param duration Duration of this level in, us
*/
void subghz_protocol_decoder_allstar_firefly_feed(void* context, bool level, uint32_t duration);
/**
* Getting the hash sum of the last randomly received parcel.
* @param context Pointer to a SubGhzProtocolDecoderAllstarFirefly instance
* @return hash Hash sum
*/
uint32_t subghz_protocol_decoder_allstar_firefly_get_hash_data(void* context);
/**
* Serialize data SubGhzProtocolDecoderAllstarFirefly.
* @param context Pointer to a SubGhzProtocolDecoderAllstarFirefly instance
* @param flipper_format Pointer to a FlipperFormat instance
* @param preset The modulation on which the signal was received, SubGhzRadioPreset
* @return status
*/
SubGhzProtocolStatus subghz_protocol_decoder_allstar_firefly_serialize(
void* context,
FlipperFormat* flipper_format,
SubGhzRadioPreset* preset);
/**
* Deserialize data SubGhzProtocolDecoderAllstarFirefly.
* @param context Pointer to a SubGhzProtocolDecoderAllstarFirefly instance
* @param flipper_format Pointer to a FlipperFormat instance
* @return status
*/
SubGhzProtocolStatus subghz_protocol_decoder_allstar_firefly_deserialize(
void* context,
FlipperFormat* flipper_format);
/**
* Getting a textual representation of the received data.
* @param context Pointer to a SubGhzProtocolDecoderAllstarFirefly instance
* @param output Resulting text
*/
void subghz_protocol_decoder_allstar_firefly_get_string(void* context, FuriString* output);
+54 -2
View File
@@ -260,6 +260,10 @@ static void subghz_protocol_encoder_came_atomo_get_upload(
btn = 0x4;
} else if(btn == 0x4) {
btn = 0x6;
} else if(btn == 0x5) {
btn = 0x0C;
} else if(btn == 0x6) {
btn = 0x0E;
}
// override button if we change it with signal settings button editor
@@ -484,9 +488,11 @@ void subghz_protocol_decoder_came_atomo_feed(void* context, bool level, uint32_t
ManchesterEvent event = ManchesterEventReset;
switch(instance->decoder.parser_step) {
case CameAtomoDecoderStepReset:
// There are two known options for the header: 72K us (TOP42R, TOP44R) or 12k us (found on TOP44RBN)
// There are two known options for the header: 72K us (TOP42R, TOP44R) or 12k us (found on TOP44RBN) / 19k us (TOPD4REN)
if((!level) && ((DURATION_DIFF(duration, subghz_protocol_came_atomo_const.te_long * 10) <
subghz_protocol_came_atomo_const.te_delta * 20) ||
(DURATION_DIFF(duration, subghz_protocol_came_atomo_const.te_long * 16) <
subghz_protocol_came_atomo_const.te_delta * 10) ||
(DURATION_DIFF(duration, subghz_protocol_came_atomo_const.te_long * 60) <
subghz_protocol_came_atomo_const.te_delta * 40))) {
//Found header CAME
@@ -663,6 +669,10 @@ static void subghz_protocol_came_atomo_remote_controller(SubGhzBlockGeneric* ins
instance->btn = 0x3;
} else if(btn_decode == 0x6) {
instance->btn = 0x4;
} else if(btn_decode == 0x0C) {
instance->btn = 0x5;
} else if(btn_decode == 0x0E) {
instance->btn = 0x6;
}
uint32_t hi = pack[0] << 24 | pack[1] << 16 | pack[2] << 8 | pack[3];
@@ -673,7 +683,7 @@ static void subghz_protocol_came_atomo_remote_controller(SubGhzBlockGeneric* ins
if(subghz_custom_btn_get_original() == 0) {
subghz_custom_btn_set_original(instance->btn);
}
subghz_custom_btn_set_max(3);
subghz_custom_btn_set_max(4);
}
void atomo_encrypt(uint8_t* buff) {
@@ -740,6 +750,12 @@ static uint8_t subghz_protocol_came_atomo_get_btn_code(void) {
case 0x4:
btn = 0x1;
break;
case 0x5:
btn = 0x1;
break;
case 0x6:
btn = 0x1;
break;
default:
break;
@@ -758,6 +774,12 @@ static uint8_t subghz_protocol_came_atomo_get_btn_code(void) {
case 0x4:
btn = 0x2;
break;
case 0x5:
btn = 0x2;
break;
case 0x6:
btn = 0x2;
break;
default:
break;
@@ -776,6 +798,36 @@ static uint8_t subghz_protocol_came_atomo_get_btn_code(void) {
case 0x4:
btn = 0x3;
break;
case 0x5:
btn = 0x4;
break;
case 0x6:
btn = 0x4;
break;
default:
break;
}
} else if(custom_btn_id == SUBGHZ_CUSTOM_BTN_RIGHT) {
switch(original_btn_code) {
case 0x1:
btn = 0x5;
break;
case 0x2:
btn = 0x5;
break;
case 0x3:
btn = 0x5;
break;
case 0x4:
btn = 0x5;
break;
case 0x5:
btn = 0x6;
break;
case 0x6:
btn = 0x5;
break;
default:
break;
+8 -4
View File
@@ -111,7 +111,7 @@ void* subghz_protocol_encoder_came_twee_alloc(SubGhzEnvironment* environment) {
instance->base.protocol = &subghz_protocol_came_twee;
instance->generic.protocol_name = instance->base.protocol->name;
instance->encoder.repeat = 3;
instance->encoder.repeat = 1;
instance->encoder.size_upload = 1536; // 1308
instance->encoder.upload = malloc(instance->encoder.size_upload * sizeof(LevelDuration));
instance->encoder.is_running = false;
@@ -324,9 +324,13 @@ void subghz_protocol_decoder_came_twee_feed(void* context, bool level, uint32_t
ManchesterEvent event = ManchesterEventReset;
switch(instance->decoder.parser_step) {
case CameTweeDecoderStepReset:
if((!level) && (DURATION_DIFF(duration, subghz_protocol_came_twee_const.te_long * 51) <
subghz_protocol_came_twee_const.te_delta * 20)) {
//Found header CAME
if((!level) && ((DURATION_DIFF(duration, subghz_protocol_came_twee_const.te_long * 51) <
subghz_protocol_came_twee_const.te_delta * 20) ||
(DURATION_DIFF(duration, subghz_protocol_came_twee_const.te_long * 12) <
subghz_protocol_came_twee_const.te_delta * 10))) {
// Found header CAME
// Original TWEE uses 51k us delay
// TOP44FGN uses 12k us delay
instance->decoder.parser_step = CameTweeDecoderStepDecoderData;
instance->decoder.decode_data = 0;
instance->decoder.decode_count_bit = 0;
+38 -39
View File
@@ -125,6 +125,41 @@ void subghz_protocol_encoder_faac_slh_free(void* context) {
free(instance);
}
static bool subghz_protocol_faac_slh_encrypt(SubGhzProtocolEncoderFaacSLH* instance) {
uint32_t fix = instance->generic.serial << 4 | instance->generic.btn;
uint32_t hop = 0;
uint32_t decrypt = 0;
uint64_t man = 0;
char fixx[8] = {};
int shiftby = 32;
for(int i = 0; i < 8; i++) {
fixx[i] = (fix >> (shiftby -= 4)) & 0xF;
}
if((instance->generic.cnt % 2) == 0) {
decrypt = fixx[6] << 28 | fixx[7] << 24 | fixx[5] << 20 |
(instance->generic.cnt & 0xFFFFF);
} else {
decrypt = fixx[2] << 28 | fixx[3] << 24 | fixx[4] << 20 |
(instance->generic.cnt & 0xFFFFF);
}
for
M_EACH(manufacture_code, *subghz_keystore_get_data(instance->keystore), SubGhzKeyArray_t) {
if(strcmp(furi_string_get_cstr(manufacture_code->name), "FAAC_SLH") == 0) {
//FAAC Learning
man = subghz_protocol_keeloq_common_faac_learning(
instance->generic.seed, manufacture_code->key);
hop = subghz_protocol_keeloq_common_encrypt(decrypt, man);
break;
}
}
if(hop) {
instance->generic.data = (uint64_t)fix << 32 | hop;
}
return true;
}
static bool subghz_protocol_faac_slh_gen_data(SubGhzProtocolEncoderFaacSLH* instance) {
// override button if we change it with signal settings button editor
// else work as standart
@@ -237,16 +272,6 @@ static bool subghz_protocol_faac_slh_gen_data(SubGhzProtocolEncoderFaacSLH* inst
}
}
}
uint32_t fix = instance->generic.serial << 4 | instance->generic.btn;
uint32_t hop = 0;
uint32_t decrypt = 0;
uint64_t man = 0;
int res = 0;
char fixx[8] = {};
int shiftby = 32;
for(int i = 0; i < 8; i++) {
fixx[i] = (fix >> (shiftby -= 4)) & 0xF;
}
if(allow_zero_seed || (instance->generic.seed != 0x0)) {
// check OFEX mode
@@ -277,32 +302,7 @@ static bool subghz_protocol_faac_slh_gen_data(SubGhzProtocolEncoderFaacSLH* inst
}
}
if((instance->generic.cnt % 2) == 0) {
decrypt = fixx[6] << 28 | fixx[7] << 24 | fixx[5] << 20 |
(instance->generic.cnt & 0xFFFFF);
} else {
decrypt = fixx[2] << 28 | fixx[3] << 24 | fixx[4] << 20 |
(instance->generic.cnt & 0xFFFFF);
}
for
M_EACH(manufacture_code, *subghz_keystore_get_data(instance->keystore), SubGhzKeyArray_t) {
res = strcmp(furi_string_get_cstr(manufacture_code->name), instance->manufacture_name);
if(res == 0) {
switch(manufacture_code->type) {
case KEELOQ_LEARNING_FAAC:
//FAAC Learning
man = subghz_protocol_keeloq_common_faac_learning(
instance->generic.seed, manufacture_code->key);
hop = subghz_protocol_keeloq_common_encrypt(decrypt, man);
break;
}
break;
}
}
if(hop) {
instance->generic.data = (uint64_t)fix << 32 | hop;
}
return true;
return subghz_protocol_faac_slh_encrypt(instance);
}
bool subghz_protocol_faac_slh_create_data(
@@ -324,7 +324,7 @@ bool subghz_protocol_faac_slh_create_data(
instance->manufacture_name = manufacture_name;
instance->generic.data_count_bit = 64;
allow_zero_seed = true;
bool res = subghz_protocol_faac_slh_gen_data(instance);
bool res = subghz_protocol_faac_slh_encrypt(instance);
if(res) {
return SubGhzProtocolStatusOk ==
subghz_block_generic_serialize(&instance->generic, flipper_format, preset);
@@ -620,8 +620,7 @@ static void subghz_protocol_faac_slh_check_remote_controller(
for
M_EACH(manufacture_code, *subghz_keystore_get_data(keystore), SubGhzKeyArray_t) {
switch(manufacture_code->type) {
case KEELOQ_LEARNING_FAAC:
if(strcmp(furi_string_get_cstr(manufacture_code->name), "FAAC_SLH") == 0) {
// FAAC Learning
man = subghz_protocol_keeloq_common_faac_learning(
instance->seed, manufacture_code->key);
+93 -7
View File
@@ -369,7 +369,7 @@ static bool subghz_protocol_keeloq_gen_data(
} else if(
(strcmp(instance->manufacture_name, "DTM_Neo") == 0) ||
(strcmp(instance->manufacture_name, "FAAC_RC,XT") == 0) ||
(strcmp(instance->manufacture_name, "Mutanco_Mutancode") == 0) ||
(strcmp(instance->manufacture_name, "Clemsa_Mutancode") == 0) ||
(strcmp(instance->manufacture_name, "Came_Space") == 0) ||
(strcmp(instance->manufacture_name, "Genius_Bravo") == 0) ||
(strcmp(instance->manufacture_name, "GSN") == 0) ||
@@ -378,20 +378,33 @@ static bool subghz_protocol_keeloq_gen_data(
(strcmp(instance->manufacture_name, "Pecinin") == 0) ||
(strcmp(instance->manufacture_name, "Steelmate") == 0) ||
(strcmp(instance->manufacture_name, "Cardin_S449") == 0) ||
(strcmp(instance->manufacture_name, "Stilmatic") == 0)) {
(strcmp(instance->manufacture_name, "Stilmatic") == 0) ||
(strcmp(instance->manufacture_name, "Wisniowski") == 0) ||
(strcmp(instance->manufacture_name, "ATA_PTX4") == 0) ||
(strcmp(instance->manufacture_name, "Fadini") == 0) ||
(strcmp(instance->manufacture_name, "Seav") == 0)) {
// DTM Neo, Came_Space uses 12bit serial -> simple learning
// FAAC_RC,XT , Mutanco_Mutancode, Genius_Bravo, GSN 12bit serial -> normal learning
// FAAC_RC,XT , Clemsa_Mutancode, Genius_Bravo, GSN 12bit serial -> normal learning
// Rosh, Rossi, Pecinin -> 12bit serial - simple learning
// Steelmate -> 12bit serial - normal learning
// Cardin_S449 -> 12bit serial - normal learning
// Stilmatic (r-tech) -> 12bit serial - normal learning
// Wisniowski -> 12bit serial - normal learning
// ATA_PTX4 -> 12bit serial - normal learning
// Fadini -> 12bit serial - simple learning
// Seav -> 12bit serial - normal learning
decrypt = btn << 28 | (instance->generic.serial & 0xFFF) << 16 |
instance->generic.cnt;
} else if(
(strcmp(instance->manufacture_name, "NICE_Smilo") == 0) ||
(strcmp(instance->manufacture_name, "NICE_MHOUSE") == 0) ||
(strcmp(instance->manufacture_name, "JCM_Tech") == 0)) {
// Nice Smilo, MHouse, JCM -> 8bit serial - simple learning
(strcmp(instance->manufacture_name, "JCM_Tech") == 0) ||
(strcmp(instance->manufacture_name, "Pujol_Vario") == 0) ||
(strcmp(instance->manufacture_name, "Pujol") == 0) ||
(strcmp(instance->manufacture_name, "Erreka") == 0)) {
// Nice Smilo, MHouse, JCM, Pujol_Vario -> 8bit serial - simple learning
// Pujol -> 8bit serial - special learning
// Erreka -> 8bit serial - secure learning with seed
decrypt = btn << 28 | (instance->generic.serial & 0xFF) << 16 |
instance->generic.cnt;
} else if(
@@ -455,6 +468,28 @@ static bool subghz_protocol_keeloq_gen_data(
fix, manufacture_code->key);
hop = subghz_protocol_keeloq_common_encrypt(decrypt, man);
break;
case KEELOQ_LEARNING_AERF:
man = subghz_protocol_keeloq_common_learning_aerf(
fix, manufacture_code->key);
hop = subghz_protocol_keeloq_common_encrypt(decrypt, man);
break;
case KEELOQ_LEARNING_ERREKA:
man = subghz_protocol_keeloq_common_learning_erreka(
fix, instance->generic.seed, manufacture_code->key);
hop = subghz_protocol_keeloq_common_encrypt(decrypt, man);
break;
case KEELOQ_LEARNING_PUJOL:
man = subghz_protocol_keeloq_common_learning_pujol(
fix, manufacture_code->key);
hop = subghz_protocol_keeloq_common_encrypt(decrypt, man);
break;
case KEELOQ_LEARNING_SIMPLE_JCM:
//Simple Learning 8 bit serial
decrypt = btn << 28 | (instance->generic.serial & 0xFF) << 16 |
instance->generic.cnt;
hop = subghz_protocol_keeloq_common_encrypt(
decrypt, manufacture_code->key);
break;
case KEELOQ_LEARNING_UNKNOWN:
if(kl_type_en == 1) {
hop = subghz_protocol_keeloq_common_encrypt(
@@ -513,7 +548,7 @@ bool subghz_protocol_keeloq_create_data(
return false;
}
bool subghz_protocol_keeloq_bft_create_data(
bool subghz_protocol_keeloq_seed_create_data(
void* context,
FlipperFormat* flipper_format,
uint32_t serial,
@@ -1103,6 +1138,55 @@ static uint32_t subghz_protocol_keeloq_check_remote_controller_selector(
return decrypt;
}
break;
case KEELOQ_LEARNING_AERF:
man = subghz_protocol_keeloq_common_learning_aerf(fix, manufacture_code->key);
decrypt = subghz_protocol_keeloq_common_decrypt_derived(hop, man, 0x240u);
if(subghz_protocol_keeloq_check_decrypt(instance, decrypt, btn, end_serial)) {
*manufacture_name = furi_string_get_cstr(manufacture_code->name);
keystore->mfname = *manufacture_name;
return decrypt;
}
decrypt = subghz_protocol_keeloq_common_decrypt_derived(hop, man, 0x210u);
if(subghz_protocol_keeloq_check_decrypt(instance, decrypt, btn, end_serial)) {
*manufacture_name = furi_string_get_cstr(manufacture_code->name);
keystore->mfname = *manufacture_name;
return decrypt;
}
decrypt = subghz_protocol_keeloq_common_decrypt(hop, man);
if(subghz_protocol_keeloq_check_decrypt(instance, decrypt, btn, end_serial)) {
*manufacture_name = furi_string_get_cstr(manufacture_code->name);
keystore->mfname = *manufacture_name;
return decrypt;
}
break;
case KEELOQ_LEARNING_ERREKA:
man = subghz_protocol_keeloq_common_learning_erreka(
fix, instance->seed, manufacture_code->key);
decrypt = subghz_protocol_keeloq_common_decrypt(hop, man);
if(subghz_protocol_keeloq_check_decrypt(instance, decrypt, btn, end_serial)) {
*manufacture_name = furi_string_get_cstr(manufacture_code->name);
keystore->mfname = *manufacture_name;
return decrypt;
}
break;
case KEELOQ_LEARNING_PUJOL:
man = subghz_protocol_keeloq_common_learning_pujol(fix, manufacture_code->key);
decrypt = subghz_protocol_keeloq_common_decrypt(hop, man);
if(subghz_protocol_keeloq_check_decrypt(instance, decrypt, btn, end_serial)) {
*manufacture_name = furi_string_get_cstr(manufacture_code->name);
keystore->mfname = *manufacture_name;
return decrypt;
}
break;
case KEELOQ_LEARNING_SIMPLE_JCM:
// Simple Learning 8 bit serial
decrypt = subghz_protocol_keeloq_common_decrypt(hop, manufacture_code->key);
if(subghz_protocol_keeloq_check_decrypt(instance, decrypt, btn, end_serial)) {
*manufacture_name = furi_string_get_cstr(manufacture_code->name);
keystore->mfname = *manufacture_name;
return decrypt;
}
break;
case KEELOQ_LEARNING_UNKNOWN:
// Simple Learning
decrypt = subghz_protocol_keeloq_common_decrypt(hop, manufacture_code->key);
@@ -1627,7 +1711,9 @@ void subghz_protocol_decoder_keeloq_get_string(void* context, FuriString* output
code_found_reverse_lo,
instance->generic.btn,
instance->manufacture_name);
} else if(strcmp(instance->manufacture_name, "BFT") == 0) {
} else if(
(strcmp(instance->manufacture_name, "BFT") == 0) ||
(strcmp(instance->manufacture_name, "Erreka") == 0)) {
// Allow counter edit
subghz_block_generic_global.cnt_is_available = true;
subghz_block_generic_global.cnt_length_bit = 16;
+94
View File
@@ -140,3 +140,97 @@ inline uint64_t
subghz_protocol_keeloq_common_magic_serial_type3_learning(uint32_t data, uint64_t man) {
return (man & 0xFFFFFFFFFF000000) | (data & 0xFFFFFF);
}
// Key utils
static inline uint32_t subghz_protocol_keeloq_common_manufacturer_nl_extend(
uint32_t x,
uint32_t k_lo,
uint32_t k_hi,
uint32_t outer_limit) {
uint32_t r4 = outer_limit;
uint32_t r5 = 0u;
const uint32_t r6 = KEELOQ_NLF;
while(r5 != r4) {
if(r5 < 0x210u) {
uint32_t r1 = (x >> 15) & 1u;
uint32_t r7 = r1 ^ ((x >> 1) | (x << 31));
r1 = (15u - r5) & 0x3Fu;
uint32_t lr = 32u - r1;
uint32_t ip = r1 - 32u;
lr = k_hi << lr;
r1 = k_lo >> r1;
ip = (r1 < 32u) ? (k_hi >> ip) : 0u;
r1 = (r1 | lr | ip) & 1u;
ip = (x >> 30) & 1u;
r1 ^= r7;
r7 = (x >> 25) & 1u;
r7 += ip << 1;
ip = (x >> 19) & 1u;
ip += r7 << 1;
r7 = (x >> 8) & 1u;
r7 += ip << 1;
x &= 1u;
x += r7 << 1;
x = (int32_t)r6 >> (x & 31u);
x &= 1u;
x ^= r1;
}
r5 += 1u;
}
return x;
}
static inline uint32_t subghz_protocol_keeloq_common_word_rotate16(uint32_t v) {
return (v >> 16) | (v << 16);
}
inline uint32_t subghz_protocol_keeloq_common_decrypt_derived(
uint32_t hop_encrypted,
uint64_t derived_manufacturing_key,
uint32_t outer_limit) {
return subghz_protocol_keeloq_common_manufacturer_nl_extend(
hop_encrypted,
(uint32_t)derived_manufacturing_key,
(uint32_t)(derived_manufacturing_key >> 32u),
outer_limit);
}
// Protocol (Manufacturer) specific learning
// TODO: Better documentation for these functions
inline uint64_t subghz_protocol_keeloq_common_learning_aerf(uint32_t data, const uint64_t key) {
uint32_t k_lo = (uint32_t)key;
uint32_t k_hi = (uint32_t)(key >> 32);
uint32_t d = data & 0x0FFFFFFFu;
uint32_t x = d | 0x20000000u;
x = subghz_protocol_keeloq_common_manufacturer_nl_extend(x, k_lo, k_hi, 0x40u);
uint32_t k1 = x;
x = d | 0x60000000u;
x = subghz_protocol_keeloq_common_manufacturer_nl_extend(x, k_lo, k_hi, 0x40u);
return ((uint64_t)x << 32) | k1;
}
inline uint64_t
subghz_protocol_keeloq_common_learning_erreka(uint32_t data, uint32_t mix, const uint64_t key) {
uint32_t d = data & 0x0FFFFFFFu;
uint32_t k1 = subghz_protocol_keeloq_common_decrypt(d | 0x20000000u, key);
uint32_t r4 = mix >> 4;
uint32_t r1 = (mix << 4) & 0xF000F000u;
r4 = (r4 & 0x0F000F00u) | r1;
uint32_t r5 = mix & 0x00FF00FFu;
uint32_t x = r4 | r5;
x |= 0x60000000u;
uint32_t k2 = subghz_protocol_keeloq_common_decrypt(x, key);
return ((uint64_t)k2 << 32) | k1;
}
inline uint64_t subghz_protocol_keeloq_common_learning_pujol(uint32_t data, const uint64_t key) {
uint32_t d = data & 0x0FFFFFFFu;
uint32_t w1 = subghz_protocol_keeloq_common_decrypt(d | 0x20000000u, key);
uint32_t w2 = subghz_protocol_keeloq_common_decrypt(d | 0x60000000u, key);
uint32_t k1 = subghz_protocol_keeloq_common_word_rotate16(w1);
uint32_t k2 = subghz_protocol_keeloq_common_word_rotate16(w2);
return ((uint64_t)k2 << 32) | k1;
}
+20
View File
@@ -28,6 +28,10 @@
// #define BENINCA_ARC_KEY_TYPE 9u -- RESERVED
#define KEELOQ_LEARNING_SIMPLE_KINGGATES 10u
#define KEELOQ_LEARNING_NORMAL_JAROLIFT 11u
#define KEELOQ_LEARNING_ERREKA 12u
#define KEELOQ_LEARNING_PUJOL 13u
#define KEELOQ_LEARNING_AERF 14u
#define KEELOQ_LEARNING_SIMPLE_JCM 15u
/**
* Simple Learning Encrypt
@@ -101,3 +105,19 @@ uint64_t subghz_protocol_keeloq_common_magic_serial_type2_learning(uint32_t data
*/
uint64_t subghz_protocol_keeloq_common_magic_serial_type3_learning(uint32_t data, uint64_t man);
// Protocol (Manufacturer) specific learning
// TODO: Better documentation for these functions
uint64_t subghz_protocol_keeloq_common_learning_aerf(uint32_t data, const uint64_t key);
uint64_t
subghz_protocol_keeloq_common_learning_erreka(uint32_t data, uint32_t mix, const uint64_t key);
uint64_t subghz_protocol_keeloq_common_learning_pujol(uint32_t data, const uint64_t key);
// Utils
uint32_t subghz_protocol_keeloq_common_decrypt_derived(
uint32_t hop_encrypted,
uint64_t derived_manufacturing_key,
uint32_t outer_limit);
+1 -1
View File
@@ -570,8 +570,8 @@ static void subghz_protocol_kinggates_stylo_4k_remote_controller(
if(((decrypt >> 28) == instance->btn) && (((decrypt >> 24) & 0x0F) == 0x0C) &&
(((decrypt >> 16) & 0xFF) == (instance->serial & 0xFF))) {
ret = true;
break;
}
break;
}
}
if(ret) {
+5 -5
View File
@@ -10,7 +10,7 @@
static const SubGhzBlockConst subghz_protocol_nice_flo_const = {
.te_short = 700,
.te_long = 1400,
.te_delta = 200,
.te_delta = 250,
.min_count_bit_for_found = 12,
};
@@ -213,8 +213,8 @@ void subghz_protocol_decoder_nice_flo_feed(void* context, bool level, uint32_t d
switch(instance->decoder.parser_step) {
case NiceFloDecoderStepReset:
if((!level) && (DURATION_DIFF(duration, subghz_protocol_nice_flo_const.te_short * 36) <
subghz_protocol_nice_flo_const.te_delta * 36)) {
//Found header Nice Flo
subghz_protocol_nice_flo_const.te_delta * 29)) {
//Found header Nice Flo (25200us +- 7250us)
instance->decoder.parser_step = NiceFloDecoderStepFoundStartBit;
}
break;
@@ -328,8 +328,8 @@ void subghz_protocol_decoder_nice_flo_get_string(void* context, FuriString* outp
furi_string_cat_printf(
output,
"%s %dbit\r\n"
"Key:0x%08lX\r\n"
"Yek:0x%08lX\r\n",
"Key:0x%06lX\r\n"
"Yek:0x%06lX\r\n",
instance->generic.protocol_name,
instance->generic.data_count_bit,
code_found_lo,
+352
View File
@@ -0,0 +1,352 @@
#include "nord_ice.h"
#include "../blocks/const.h"
#include "../blocks/decoder.h"
#include "../blocks/encoder.h"
#include "../blocks/generic.h"
#include "../blocks/math.h"
#define TAG "SubGhzProtocolNord_Ice"
static const SubGhzBlockConst subghz_protocol_nord_ice_const = {
.te_short = 300,
.te_long = 800,
.te_delta = 150,
.min_count_bit_for_found = 33,
};
struct SubGhzProtocolDecoderNord_Ice {
SubGhzProtocolDecoderBase base;
SubGhzBlockDecoder decoder;
SubGhzBlockGeneric generic;
};
struct SubGhzProtocolEncoderNord_Ice {
SubGhzProtocolEncoderBase base;
SubGhzProtocolBlockEncoder encoder;
SubGhzBlockGeneric generic;
};
typedef enum {
Nord_IceDecoderStepReset = 0,
Nord_IceDecoderStepSaveDuration,
Nord_IceDecoderStepCheckDuration,
} Nord_IceDecoderStep;
const SubGhzProtocolDecoder subghz_protocol_nord_ice_decoder = {
.alloc = subghz_protocol_decoder_nord_ice_alloc,
.free = subghz_protocol_decoder_nord_ice_free,
.feed = subghz_protocol_decoder_nord_ice_feed,
.reset = subghz_protocol_decoder_nord_ice_reset,
.get_hash_data = NULL,
.get_hash_data_long = subghz_protocol_decoder_nord_ice_get_hash_data,
.serialize = subghz_protocol_decoder_nord_ice_serialize,
.deserialize = subghz_protocol_decoder_nord_ice_deserialize,
.get_string = subghz_protocol_decoder_nord_ice_get_string,
.get_string_brief = NULL,
};
const SubGhzProtocolEncoder subghz_protocol_nord_ice_encoder = {
.alloc = subghz_protocol_encoder_nord_ice_alloc,
.free = subghz_protocol_encoder_nord_ice_free,
.deserialize = subghz_protocol_encoder_nord_ice_deserialize,
.stop = subghz_protocol_encoder_nord_ice_stop,
.yield = subghz_protocol_encoder_nord_ice_yield,
};
const SubGhzProtocol subghz_protocol_nord_ice = {
.name = SUBGHZ_PROTOCOL_NORD_ICE_NAME,
.type = SubGhzProtocolTypeStatic,
.flag = SubGhzProtocolFlag_433 | SubGhzProtocolFlag_AM | SubGhzProtocolFlag_Decodable |
SubGhzProtocolFlag_Load | SubGhzProtocolFlag_Save | SubGhzProtocolFlag_Send,
.decoder = &subghz_protocol_nord_ice_decoder,
.encoder = &subghz_protocol_nord_ice_encoder,
};
void* subghz_protocol_encoder_nord_ice_alloc(SubGhzEnvironment* environment) {
UNUSED(environment);
SubGhzProtocolEncoderNord_Ice* instance = malloc(sizeof(SubGhzProtocolEncoderNord_Ice));
instance->base.protocol = &subghz_protocol_nord_ice;
instance->generic.protocol_name = instance->base.protocol->name;
instance->encoder.repeat = 3;
instance->encoder.size_upload = 128;
instance->encoder.upload = malloc(instance->encoder.size_upload * sizeof(LevelDuration));
instance->encoder.is_running = false;
return instance;
}
void subghz_protocol_encoder_nord_ice_free(void* context) {
furi_assert(context);
SubGhzProtocolEncoderNord_Ice* instance = context;
free(instance->encoder.upload);
free(instance);
}
/**
* Generating an upload from data.
* @param instance Pointer to a SubGhzProtocolEncoderNord_Ice instance
*/
static void subghz_protocol_encoder_nord_ice_get_upload(SubGhzProtocolEncoderNord_Ice* instance) {
furi_assert(instance);
size_t index = 0;
// Send key and GAP
for(uint8_t i = instance->generic.data_count_bit; i > 0; i--) {
if(bit_read(instance->generic.data, i - 1)) {
// Send bit 1
instance->encoder.upload[index++] =
level_duration_make(true, (uint32_t)subghz_protocol_nord_ice_const.te_long);
if(i == 1) {
//Send gap if bit was last
instance->encoder.upload[index++] = level_duration_make(
false, (uint32_t)subghz_protocol_nord_ice_const.te_short * 25);
} else {
instance->encoder.upload[index++] =
level_duration_make(false, (uint32_t)subghz_protocol_nord_ice_const.te_short);
}
} else {
// Send bit 0
instance->encoder.upload[index++] =
level_duration_make(true, (uint32_t)subghz_protocol_nord_ice_const.te_short);
if(i == 1) {
//Send gap if bit was last
instance->encoder.upload[index++] = level_duration_make(
false, (uint32_t)subghz_protocol_nord_ice_const.te_short * 25);
} else {
instance->encoder.upload[index++] =
level_duration_make(false, (uint32_t)subghz_protocol_nord_ice_const.te_long);
}
}
}
instance->encoder.size_upload = index;
return;
}
/**
* Analysis of received data
* @param instance Pointer to a SubGhzBlockGeneric* instance
*/
static void subghz_protocol_nord_ice_check_remote_controller(SubGhzBlockGeneric* instance) {
instance->serial = (instance->data >> 15) << 9 |
(instance->data & 0x1FF); // 26 bits for serial
instance->btn = (instance->data >> 9) & 0x3F; // 6 bits for button
}
SubGhzProtocolStatus
subghz_protocol_encoder_nord_ice_deserialize(void* context, FlipperFormat* flipper_format) {
furi_assert(context);
SubGhzProtocolEncoderNord_Ice* instance = context;
SubGhzProtocolStatus ret = SubGhzProtocolStatusError;
do {
ret = subghz_block_generic_deserialize_check_count_bit(
&instance->generic,
flipper_format,
subghz_protocol_nord_ice_const.min_count_bit_for_found);
if(ret != SubGhzProtocolStatusOk) {
break;
}
// Optional value
flipper_format_read_uint32(
flipper_format, "Repeat", (uint32_t*)&instance->encoder.repeat, 1);
subghz_protocol_nord_ice_check_remote_controller(&instance->generic);
subghz_protocol_encoder_nord_ice_get_upload(instance);
instance->encoder.is_running = true;
} while(false);
return ret;
}
void subghz_protocol_encoder_nord_ice_stop(void* context) {
SubGhzProtocolEncoderNord_Ice* instance = context;
instance->encoder.is_running = false;
}
LevelDuration subghz_protocol_encoder_nord_ice_yield(void* context) {
SubGhzProtocolEncoderNord_Ice* instance = context;
if(instance->encoder.repeat == 0 || !instance->encoder.is_running) {
instance->encoder.is_running = false;
return level_duration_reset();
}
LevelDuration ret = instance->encoder.upload[instance->encoder.front];
if(++instance->encoder.front == instance->encoder.size_upload) {
if(!subghz_block_generic_global.endless_tx) instance->encoder.repeat--;
instance->encoder.front = 0;
}
return ret;
}
void* subghz_protocol_decoder_nord_ice_alloc(SubGhzEnvironment* environment) {
UNUSED(environment);
SubGhzProtocolDecoderNord_Ice* instance = malloc(sizeof(SubGhzProtocolDecoderNord_Ice));
instance->base.protocol = &subghz_protocol_nord_ice;
instance->generic.protocol_name = instance->base.protocol->name;
return instance;
}
void subghz_protocol_decoder_nord_ice_free(void* context) {
furi_assert(context);
SubGhzProtocolDecoderNord_Ice* instance = context;
free(instance);
}
void subghz_protocol_decoder_nord_ice_reset(void* context) {
furi_assert(context);
SubGhzProtocolDecoderNord_Ice* instance = context;
instance->decoder.parser_step = Nord_IceDecoderStepReset;
}
void subghz_protocol_decoder_nord_ice_feed(void* context, bool level, volatile uint32_t duration) {
furi_assert(context);
SubGhzProtocolDecoderNord_Ice* instance = context;
// Nord ICE Decoder
// 2026.03 - @xMasterX (MMX)
// Key samples
//
// Serial Btn Serial
// 0x9467688A btn 1 = 10010100011001110 110100 010001010
// 0x9467308A btn 2 = 10010100011001110 011000 010001010
// 0x9467628A btn 3 = 10010100011001110 110001 010001010
// 0x9467648A btn 4 = 10010100011001110 110010 010001010
switch(instance->decoder.parser_step) {
case Nord_IceDecoderStepReset:
if((!level) && (DURATION_DIFF(duration, subghz_protocol_nord_ice_const.te_short * 25) <
subghz_protocol_nord_ice_const.te_delta * 11)) {
//Found GAP
instance->decoder.decode_data = 0;
instance->decoder.decode_count_bit = 0;
instance->decoder.parser_step = Nord_IceDecoderStepSaveDuration;
}
break;
case Nord_IceDecoderStepSaveDuration:
if(level) {
instance->decoder.te_last = duration;
instance->decoder.parser_step = Nord_IceDecoderStepCheckDuration;
} else {
instance->decoder.parser_step = Nord_IceDecoderStepReset;
}
break;
case Nord_IceDecoderStepCheckDuration:
if(!level) {
// Bit 0 is short and long timing = 300us HIGH (te_last) and 800us LOW
if((DURATION_DIFF(instance->decoder.te_last, subghz_protocol_nord_ice_const.te_short) <
subghz_protocol_nord_ice_const.te_delta) &&
(DURATION_DIFF(duration, subghz_protocol_nord_ice_const.te_long) <
subghz_protocol_nord_ice_const.te_delta)) {
subghz_protocol_blocks_add_bit(&instance->decoder, 0);
instance->decoder.parser_step = Nord_IceDecoderStepSaveDuration;
// Bit 1 is long and short timing = 800us HIGH (te_last) and 300us LOW
} else if(
(DURATION_DIFF(instance->decoder.te_last, subghz_protocol_nord_ice_const.te_long) <
subghz_protocol_nord_ice_const.te_delta) &&
(DURATION_DIFF(duration, subghz_protocol_nord_ice_const.te_short) <
subghz_protocol_nord_ice_const.te_delta)) {
subghz_protocol_blocks_add_bit(&instance->decoder, 1);
instance->decoder.parser_step = Nord_IceDecoderStepSaveDuration;
} else if(
// End of the key
DURATION_DIFF(duration, subghz_protocol_nord_ice_const.te_short * 25) <
subghz_protocol_nord_ice_const.te_delta * 11) {
//Found next GAP and add bit 0 or 1 (only bit 0 was found on the remotes)
if((DURATION_DIFF(
instance->decoder.te_last, subghz_protocol_nord_ice_const.te_short) <
subghz_protocol_nord_ice_const.te_delta)) {
subghz_protocol_blocks_add_bit(&instance->decoder, 0);
}
if((DURATION_DIFF(
instance->decoder.te_last, subghz_protocol_nord_ice_const.te_long) <
subghz_protocol_nord_ice_const.te_delta)) {
subghz_protocol_blocks_add_bit(&instance->decoder, 1);
}
// If got 33 bits key reading is finished
if(instance->decoder.decode_count_bit ==
subghz_protocol_nord_ice_const.min_count_bit_for_found) {
instance->generic.data = instance->decoder.decode_data;
instance->generic.data_count_bit = instance->decoder.decode_count_bit;
if(instance->base.callback)
instance->base.callback(&instance->base, instance->base.context);
}
instance->decoder.decode_data = 0;
instance->decoder.decode_count_bit = 0;
instance->decoder.parser_step = Nord_IceDecoderStepReset;
} else {
instance->decoder.parser_step = Nord_IceDecoderStepReset;
}
} else {
instance->decoder.parser_step = Nord_IceDecoderStepReset;
}
break;
}
}
uint32_t subghz_protocol_decoder_nord_ice_get_hash_data(void* context) {
furi_assert(context);
SubGhzProtocolDecoderNord_Ice* instance = context;
return subghz_protocol_blocks_get_hash_data_long(
&instance->decoder, (instance->decoder.decode_count_bit / 8) + 1);
}
SubGhzProtocolStatus subghz_protocol_decoder_nord_ice_serialize(
void* context,
FlipperFormat* flipper_format,
SubGhzRadioPreset* preset) {
furi_assert(context);
SubGhzProtocolDecoderNord_Ice* instance = context;
return subghz_block_generic_serialize(&instance->generic, flipper_format, preset);
}
SubGhzProtocolStatus
subghz_protocol_decoder_nord_ice_deserialize(void* context, FlipperFormat* flipper_format) {
furi_assert(context);
SubGhzProtocolDecoderNord_Ice* instance = context;
return subghz_block_generic_deserialize_check_count_bit(
&instance->generic,
flipper_format,
subghz_protocol_nord_ice_const.min_count_bit_for_found);
}
void subghz_protocol_decoder_nord_ice_get_string(void* context, FuriString* output) {
furi_assert(context);
SubGhzProtocolDecoderNord_Ice* instance = context;
subghz_protocol_nord_ice_check_remote_controller(&instance->generic);
uint64_t code_found_reverse = subghz_protocol_blocks_reverse_key(
instance->generic.data, instance->generic.data_count_bit);
// for future use
// // push protocol data to global variable
// subghz_block_generic_global.btn_is_available = false;
// subghz_block_generic_global.current_btn = instance->generic.btn;
// subghz_block_generic_global.btn_length_bit = 4;
// //
furi_string_cat_printf(
output,
"%s %db\r\n"
"Key: 0x%08llX\r\n"
"Yek: 0x%08llX\r\n"
"Serial: 0x%07lX\r\n"
"Btn: %02X",
instance->generic.protocol_name,
instance->generic.data_count_bit,
(uint64_t)(instance->generic.data & 0xFFFFFFFFF),
(code_found_reverse & 0xFFFFFFFFF),
instance->generic.serial,
instance->generic.btn);
}
+109
View File
@@ -0,0 +1,109 @@
#pragma once
#include "base.h"
#define SUBGHZ_PROTOCOL_NORD_ICE_NAME "Nord ICE"
typedef struct SubGhzProtocolDecoderNord_Ice SubGhzProtocolDecoderNord_Ice;
typedef struct SubGhzProtocolEncoderNord_Ice SubGhzProtocolEncoderNord_Ice;
extern const SubGhzProtocolDecoder subghz_protocol_nord_ice_decoder;
extern const SubGhzProtocolEncoder subghz_protocol_nord_ice_encoder;
extern const SubGhzProtocol subghz_protocol_nord_ice;
/**
* Allocate SubGhzProtocolEncoderNord_Ice.
* @param environment Pointer to a SubGhzEnvironment instance
* @return SubGhzProtocolEncoderNord_Ice* pointer to a SubGhzProtocolEncoderNord_Ice instance
*/
void* subghz_protocol_encoder_nord_ice_alloc(SubGhzEnvironment* environment);
/**
* Free SubGhzProtocolEncoderNord_Ice.
* @param context Pointer to a SubGhzProtocolEncoderNord_Ice instance
*/
void subghz_protocol_encoder_nord_ice_free(void* context);
/**
* Deserialize and generating an upload to send.
* @param context Pointer to a SubGhzProtocolEncoderNord_Ice instance
* @param flipper_format Pointer to a FlipperFormat instance
* @return status
*/
SubGhzProtocolStatus
subghz_protocol_encoder_nord_ice_deserialize(void* context, FlipperFormat* flipper_format);
/**
* Forced transmission stop.
* @param context Pointer to a SubGhzProtocolEncoderNord_Ice instance
*/
void subghz_protocol_encoder_nord_ice_stop(void* context);
/**
* Getting the level and duration of the upload to be loaded into DMA.
* @param context Pointer to a SubGhzProtocolEncoderNord_Ice instance
* @return LevelDuration
*/
LevelDuration subghz_protocol_encoder_nord_ice_yield(void* context);
/**
* Allocate SubGhzProtocolDecoderNord_Ice.
* @param environment Pointer to a SubGhzEnvironment instance
* @return SubGhzProtocolDecoderNord_Ice* pointer to a SubGhzProtocolDecoderNord_Ice instance
*/
void* subghz_protocol_decoder_nord_ice_alloc(SubGhzEnvironment* environment);
/**
* Free SubGhzProtocolDecoderNord_Ice.
* @param context Pointer to a SubGhzProtocolDecoderNord_Ice instance
*/
void subghz_protocol_decoder_nord_ice_free(void* context);
/**
* Reset decoder SubGhzProtocolDecoderNord_Ice.
* @param context Pointer to a SubGhzProtocolDecoderNord_Ice instance
*/
void subghz_protocol_decoder_nord_ice_reset(void* context);
/**
* Parse a raw sequence of levels and durations received from the air.
* @param context Pointer to a SubGhzProtocolDecoderNord_Ice instance
* @param level Signal level true-high false-low
* @param duration Duration of this level in, us
*/
void subghz_protocol_decoder_nord_ice_feed(void* context, bool level, uint32_t duration);
/**
* Getting the hash sum of the last randomly received parcel.
* @param context Pointer to a SubGhzProtocolDecoderNord_Ice instance
* @return hash Hash sum
*/
uint32_t subghz_protocol_decoder_nord_ice_get_hash_data(void* context);
/**
* Serialize data SubGhzProtocolDecoderNord_Ice.
* @param context Pointer to a SubGhzProtocolDecoderNord_Ice instance
* @param flipper_format Pointer to a FlipperFormat instance
* @param preset The modulation on which the signal was received, SubGhzRadioPreset
* @return status
*/
SubGhzProtocolStatus subghz_protocol_decoder_nord_ice_serialize(
void* context,
FlipperFormat* flipper_format,
SubGhzRadioPreset* preset);
/**
* Deserialize data SubGhzProtocolDecoderNord_Ice.
* @param context Pointer to a SubGhzProtocolDecoderNord_Ice instance
* @param flipper_format Pointer to a FlipperFormat instance
* @return status
*/
SubGhzProtocolStatus
subghz_protocol_decoder_nord_ice_deserialize(void* context, FlipperFormat* flipper_format);
/**
* Getting a textual representation of the received data.
* @param context Pointer to a SubGhzProtocolDecoderNord_Ice instance
* @param output Resulting text
*/
void subghz_protocol_decoder_nord_ice_get_string(void* context, FuriString* output);
+2
View File
@@ -86,6 +86,8 @@ const SubGhzProtocol* const subghz_protocol_registry_items[] = {
&subghz_protocol_jarolift,
&subghz_protocol_ditec_gol4,
&subghz_protocol_keyfinder,
&subghz_protocol_nord_ice,
&subghz_protocol_allstar_firefly,
};
const SubGhzProtocolRegistry subghz_protocol_registry = {
+2 -1
View File
@@ -1,7 +1,6 @@
#pragma once
#include "../registry.h"
#include "../subghz_protocol_registry.h"
#include "princeton.h"
#include "keeloq.h"
#include "nice_flo.h"
@@ -87,3 +86,5 @@
#include "jarolift.h"
#include "ditec_gol4.h"
#include "keyfinder.h"
#include "nord_ice.h"
#include "allstar_firefly.h"
+1 -1
View File
@@ -57,7 +57,7 @@ bool subghz_protocol_keeloq_create_data(
* @param preset Modulation, SubGhzRadioPreset
* @return true On success
*/
bool subghz_protocol_keeloq_bft_create_data(
bool subghz_protocol_keeloq_seed_create_data(
void* context,
FlipperFormat* flipper_format,
uint32_t serial,
-4
View File
@@ -101,10 +101,6 @@ bool subghz_protocol_raw_save_to_file_init(
if(!storage_simply_mkdir(instance->storage, SUBGHZ_RAW_FOLDER)) {
break;
}
// Create saved directory if necessary
if(!storage_simply_mkdir(instance->storage, SUBGHZ_RAW_FOLDER)) {
break;
}
furi_string_set(instance->file_name, dev_name);
// First remove subghz device file if it was saved