This commit is contained in:
r3df0xx 2022-04-11 02:35:11 +03:00
parent a5bc243034
commit 1652ab20ee
2 changed files with 8 additions and 11 deletions

View file

@ -17,6 +17,7 @@ struct SubGhzBlockGeneric {
uint8_t data_count_bit;
uint8_t btn;
uint16_t cnt;
uint32_t seed;
};
/**

View file

@ -26,8 +26,6 @@ struct SubGhzProtocolDecoderFaacSLH {
SubGhzKeystore* keystore;
const char* manufacture_name;
uint32_t seed;
};
struct SubGhzProtocolEncoderFaacSLH {
@ -38,8 +36,6 @@ struct SubGhzProtocolEncoderFaacSLH {
SubGhzKeystore* keystore;
const char* manufacture_name;
uint32_t seed;
};
typedef enum {
@ -120,7 +116,7 @@ static bool subghz_protocol_faac_slh_gen_data(SubGhzProtocolEncoderFaacSLH* inst
uint32_t hop = 0;
uint32_t decrypt = 0;
uint64_t man = 0;
instance->seed = 0x77ED7698;
instance->generic.seed = 0x77ED7698;
int res = 0;
char fixx[8] = {};
int shiftby = 32;
@ -143,7 +139,7 @@ static bool subghz_protocol_faac_slh_gen_data(SubGhzProtocolEncoderFaacSLH* inst
case KEELOQ_LEARNING_FAAC:
//FAAC Learning
man =
subghz_protocol_keeloq_common_faac_learning(instance->seed, manufacture_code->key);
subghz_protocol_keeloq_common_faac_learning(instance->generic.seed, manufacture_code->key);
uint32_t hi = manufacture_code->key >> 32;
uint32_t lo = manufacture_code->key & 0xFFFFFFFF;
FURI_LOG_I(TAG, "mfkey: %08lX%08lX mf: %s\n", hi, lo, manufacture_code->name);
@ -218,7 +214,7 @@ bool subghz_protocol_encoder_faac_slh_deserialize(void* context, FlipperFormat*
FURI_LOG_E(TAG, "Deserialize error");
break;
}
if(!flipper_format_read_uint32(flipper_format, "SEED", (uint32_t*)&instance->seed, 1)) {
if(!flipper_format_read_uint32(flipper_format, "SEED", (uint32_t*)&instance->generic.seed, 1)) {
FURI_LOG_E(TAG, "Missing SEED");
break;
}
@ -384,7 +380,7 @@ static void subghz_protocol_faac_slh_check_remote_controller
instance->btn = code_fix & 0xF;
uint32_t decrypt = 0;
uint64_t man;
uint32_t seed = 0x77ED7698;
instance->seed = 0x77ED7698;
for
M_EACH(manufacture_code, *subghz_keystore_get_data(keystore), SubGhzKeyArray_t) {
@ -393,7 +389,7 @@ static void subghz_protocol_faac_slh_check_remote_controller
switch(manufacture_code->type) {
case KEELOQ_LEARNING_FAAC:
// FAAC Learning
man = subghz_protocol_keeloq_common_faac_learning(seed, manufacture_code->key);
man = subghz_protocol_keeloq_common_faac_learning(instance->seed, manufacture_code->key);
FURI_LOG_I(TAG, "mfkey: %08lX%08lX mf: %s\n", hi, lo, manufacture_code->name);
uint32_t mlhi = man >> 32;
uint32_t mllo = man & 0xFFFFFFFF;
@ -421,7 +417,7 @@ bool subghz_protocol_decoder_faac_slh_serialize(
furi_assert(context);
SubGhzProtocolDecoderFaacSLH* instance = context;
bool res = subghz_block_generic_serialize(&instance->generic, flipper_format, frequency, preset);
if(res && !flipper_format_write_uint32(flipper_format, "SEED", &instance->seed, 1)) {
if(res && !flipper_format_write_uint32(flipper_format, "SEED", &instance->generic.seed, 1)) {
FURI_LOG_E(TAG, "Unable to add SEED");
res = false;
}
@ -459,5 +455,5 @@ void subghz_protocol_decoder_faac_slh_get_string(void* context, string_t output)
code_hop,
instance->generic.btn,
instance->generic.serial,
instance->seed);
instance->generic.seed);
}