mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-07-27 01:58:09 -07:00
Merge branch 'dev' of https://github.com/DarkFlippers/unleashed-firmware into xfw-dev
This commit is contained in:
@@ -243,10 +243,12 @@ static void digital_signal_stop_timer() {
|
||||
LL_TIM_DisableCounter(TIM2);
|
||||
LL_TIM_DisableUpdateEvent(TIM2);
|
||||
LL_TIM_DisableDMAReq_UPDATE(TIM2);
|
||||
|
||||
furi_hal_bus_disable(FuriHalBusTIM2);
|
||||
}
|
||||
|
||||
static void digital_signal_setup_timer() {
|
||||
digital_signal_stop_timer();
|
||||
furi_hal_bus_enable(FuriHalBusTIM2);
|
||||
|
||||
LL_TIM_SetCounterMode(TIM2, LL_TIM_COUNTERMODE_UP);
|
||||
LL_TIM_SetClockDivision(TIM2, LL_TIM_CLOCKDIVISION_DIV1);
|
||||
|
||||
@@ -151,9 +151,7 @@ static int32_t lfrfid_raw_read_worker_thread(void* thread_context) {
|
||||
|
||||
if(file_valid) {
|
||||
// setup carrier
|
||||
furi_hal_rfid_pins_read();
|
||||
furi_hal_rfid_tim_read(worker->frequency, worker->duty_cycle);
|
||||
furi_hal_rfid_tim_read_start();
|
||||
furi_hal_rfid_tim_read_start(worker->frequency, worker->duty_cycle);
|
||||
|
||||
// stabilize detector
|
||||
furi_delay_ms(1500);
|
||||
|
||||
@@ -100,24 +100,21 @@ static LFRFIDWorkerReadState lfrfid_worker_read_internal(
|
||||
uint32_t timeout,
|
||||
ProtocolId* result_protocol) {
|
||||
LFRFIDWorkerReadState state = LFRFIDWorkerReadTimeout;
|
||||
furi_hal_rfid_pins_read();
|
||||
|
||||
if(feature & LFRFIDFeatureASK) {
|
||||
furi_hal_rfid_tim_read(125000, 0.5);
|
||||
furi_hal_rfid_tim_read_start(125000, 0.5);
|
||||
FURI_LOG_D(TAG, "Start ASK");
|
||||
if(worker->read_cb) {
|
||||
worker->read_cb(LFRFIDWorkerReadStartASK, PROTOCOL_NO, worker->cb_ctx);
|
||||
}
|
||||
} else {
|
||||
furi_hal_rfid_tim_read(62500, 0.25);
|
||||
furi_hal_rfid_tim_read_start(62500, 0.25);
|
||||
FURI_LOG_D(TAG, "Start PSK");
|
||||
if(worker->read_cb) {
|
||||
worker->read_cb(LFRFIDWorkerReadStartPSK, PROTOCOL_NO, worker->cb_ctx);
|
||||
}
|
||||
}
|
||||
|
||||
furi_hal_rfid_tim_read_start();
|
||||
|
||||
// stabilize detector
|
||||
lfrfid_worker_delay(worker, LFRFID_WORKER_READ_STABILIZE_TIME_MS);
|
||||
|
||||
@@ -205,7 +202,7 @@ static LFRFIDWorkerReadState lfrfid_worker_read_internal(
|
||||
average_index = 0;
|
||||
|
||||
if(worker->read_cb) {
|
||||
if(average > 0.2 && average < 0.8) {
|
||||
if(average > 0.2f && average < 0.8f) {
|
||||
if(!card_detected) {
|
||||
card_detected = true;
|
||||
worker->read_cb(
|
||||
|
||||
@@ -14,9 +14,7 @@
|
||||
#define T5577_OPCODE_RESET 0b00
|
||||
|
||||
static void t5577_start() {
|
||||
furi_hal_rfid_tim_read(125000, 0.5);
|
||||
furi_hal_rfid_pins_read();
|
||||
furi_hal_rfid_tim_read_start();
|
||||
furi_hal_rfid_tim_read_start(125000, 0.5);
|
||||
|
||||
// do not ground the antenna
|
||||
furi_hal_rfid_pin_pull_release();
|
||||
@@ -24,14 +22,13 @@ static void t5577_start() {
|
||||
|
||||
static void t5577_stop() {
|
||||
furi_hal_rfid_tim_read_stop();
|
||||
furi_hal_rfid_tim_reset();
|
||||
furi_hal_rfid_pins_reset();
|
||||
}
|
||||
|
||||
static void t5577_write_gap(uint32_t gap_time) {
|
||||
furi_hal_rfid_tim_read_stop();
|
||||
furi_hal_rfid_tim_read_pause();
|
||||
furi_delay_us(gap_time * 8);
|
||||
furi_hal_rfid_tim_read_start();
|
||||
furi_hal_rfid_tim_read_continue();
|
||||
}
|
||||
|
||||
static void t5577_write_bit(bool value) {
|
||||
@@ -54,7 +51,12 @@ static void t5577_write_reset() {
|
||||
t5577_write_bit(0);
|
||||
}
|
||||
|
||||
static void t5577_write_block(uint8_t block, bool lock_bit, uint32_t data) {
|
||||
static void t5577_write_block_pass(
|
||||
uint8_t block,
|
||||
bool lock_bit,
|
||||
uint32_t data,
|
||||
bool with_pass,
|
||||
uint32_t password) {
|
||||
furi_delay_us(T5577_TIMING_WAIT_TIME * 8);
|
||||
|
||||
// start gap
|
||||
@@ -63,6 +65,13 @@ static void t5577_write_block(uint8_t block, bool lock_bit, uint32_t data) {
|
||||
// opcode for page 0
|
||||
t5577_write_opcode(T5577_OPCODE_PAGE_0);
|
||||
|
||||
// password
|
||||
if(with_pass) {
|
||||
for(uint8_t i = 0; i < 32; i++) {
|
||||
t5577_write_bit((password >> (31 - i)) & 1);
|
||||
}
|
||||
}
|
||||
|
||||
// lock bit
|
||||
t5577_write_bit(lock_bit);
|
||||
|
||||
@@ -82,11 +91,26 @@ static void t5577_write_block(uint8_t block, bool lock_bit, uint32_t data) {
|
||||
t5577_write_reset();
|
||||
}
|
||||
|
||||
static void t5577_write_block_simple(uint8_t block, bool lock_bit, uint32_t data) {
|
||||
t5577_write_block_pass(block, lock_bit, data, false, 0);
|
||||
}
|
||||
|
||||
void t5577_write(LFRFIDT5577* data) {
|
||||
t5577_start();
|
||||
FURI_CRITICAL_ENTER();
|
||||
for(size_t i = 0; i < data->blocks_to_write; i++) {
|
||||
t5577_write_block(i, false, data->block[i]);
|
||||
t5577_write_block_simple(i, false, data->block[i]);
|
||||
}
|
||||
t5577_write_reset();
|
||||
FURI_CRITICAL_EXIT();
|
||||
t5577_stop();
|
||||
}
|
||||
|
||||
void t5577_write_with_pass(LFRFIDT5577* data, uint32_t password) {
|
||||
t5577_start();
|
||||
FURI_CRITICAL_ENTER();
|
||||
for(size_t i = 0; i < data->blocks_to_write; i++) {
|
||||
t5577_write_block_pass(0, false, data->block[i], true, password);
|
||||
}
|
||||
t5577_write_reset();
|
||||
FURI_CRITICAL_EXIT();
|
||||
|
||||
@@ -51,6 +51,8 @@ typedef struct {
|
||||
*/
|
||||
void t5577_write(LFRFIDT5577* data);
|
||||
|
||||
void t5577_write_with_pass(LFRFIDT5577* data, uint32_t password);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -143,7 +143,7 @@ bool opal_parser_parse(NfcDeviceData* dev_data) {
|
||||
// sign separately, because then we can handle balances of -99..-1
|
||||
// cents, as the "dollars" division below would result in a positive
|
||||
// zero value.
|
||||
o->balance = abs(o->balance);
|
||||
o->balance = abs(o->balance); //-V1081
|
||||
sign = "-";
|
||||
}
|
||||
uint8_t cents = o->balance % 100;
|
||||
@@ -164,7 +164,7 @@ bool opal_parser_parse(NfcDeviceData* dev_data) {
|
||||
o->mode = 4;
|
||||
}
|
||||
|
||||
const char* mode_str = (o->mode <= 4 ? opal_modes[o->mode] : opal_modes[3]);
|
||||
const char* mode_str = (o->mode <= 4 ? opal_modes[o->mode] : opal_modes[3]); //-V547
|
||||
const char* usage_str = (o->usage <= 12 ? opal_usages[o->usage] : opal_usages[13]);
|
||||
|
||||
furi_string_printf(
|
||||
|
||||
@@ -135,6 +135,7 @@ void pulse_reader_stop(PulseReader* signal) {
|
||||
LL_DMA_DisableChannel(DMA1, signal->dma_channel + 1);
|
||||
LL_DMAMUX_DisableRequestGen(NULL, LL_DMAMUX_REQ_GEN_0);
|
||||
LL_TIM_DisableCounter(TIM2);
|
||||
furi_hal_bus_disable(FuriHalBusTIM2);
|
||||
furi_hal_gpio_init_simple(signal->gpio, GpioModeAnalog);
|
||||
}
|
||||
|
||||
@@ -146,6 +147,8 @@ void pulse_reader_start(PulseReader* signal) {
|
||||
signal->dma_config_gpio.MemoryOrM2MDstAddress = (uint32_t)signal->gpio_buffer;
|
||||
signal->dma_config_gpio.NbData = signal->size;
|
||||
|
||||
furi_hal_bus_enable(FuriHalBusTIM2);
|
||||
|
||||
/* start counter */
|
||||
LL_TIM_SetCounterMode(TIM2, LL_TIM_COUNTERMODE_UP);
|
||||
LL_TIM_SetClockDivision(TIM2, LL_TIM_CLOCKDIVISION_DIV1);
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
#include "custom_btn.h"
|
||||
#include "custom_btn_i.h"
|
||||
|
||||
static uint8_t custom_btn_id = SUBGHZ_CUSTOM_BTN_OK;
|
||||
static uint8_t custom_btn_original = 0;
|
||||
static uint8_t custom_btn_max_btns = 0;
|
||||
static uint8_t controller_programming_mode = PROG_MODE_OFF;
|
||||
|
||||
bool subghz_custom_btn_set(uint8_t btn_id) {
|
||||
if(btn_id > custom_btn_max_btns) {
|
||||
@@ -33,8 +34,18 @@ void subghz_custom_btn_set_max(uint8_t b) {
|
||||
void subghz_custom_btns_reset() {
|
||||
custom_btn_original = 0;
|
||||
custom_btn_max_btns = 0;
|
||||
controller_programming_mode = PROG_MODE_OFF;
|
||||
custom_btn_id = SUBGHZ_CUSTOM_BTN_OK;
|
||||
}
|
||||
|
||||
bool subghz_custom_btn_is_allowed() {
|
||||
return custom_btn_max_btns != 0;
|
||||
}
|
||||
|
||||
void subghz_custom_btn_set_prog_mode(ProgMode prog_mode) {
|
||||
controller_programming_mode = prog_mode;
|
||||
}
|
||||
|
||||
ProgMode subghz_custom_btn_get_prog_mode() {
|
||||
return controller_programming_mode;
|
||||
}
|
||||
@@ -19,12 +19,8 @@ bool subghz_custom_btn_set(uint8_t btn_id);
|
||||
|
||||
uint8_t subghz_custom_btn_get();
|
||||
|
||||
void subghz_custom_btn_set_original(uint8_t btn_code);
|
||||
|
||||
uint8_t subghz_custom_btn_get_original();
|
||||
|
||||
void subghz_custom_btn_set_max(uint8_t b);
|
||||
|
||||
void subghz_custom_btns_reset();
|
||||
|
||||
bool subghz_custom_btn_is_allowed();
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
#include "custom_btn.h"
|
||||
|
||||
#define PROG_MODE_OFF (0U)
|
||||
#define PROG_MODE_KEELOQ_BFT (1U)
|
||||
#define PROG_MODE_KEELOQ_APRIMATIC (2U)
|
||||
|
||||
typedef uint8_t ProgMode;
|
||||
|
||||
void subghz_custom_btn_set_original(uint8_t btn_code);
|
||||
|
||||
void subghz_custom_btn_set_max(uint8_t b);
|
||||
|
||||
void subghz_custom_btn_set_prog_mode(ProgMode prog_mode);
|
||||
|
||||
ProgMode subghz_custom_btn_get_prog_mode();
|
||||
@@ -7,6 +7,8 @@ struct SubGhzEnvironment {
|
||||
const char* came_atomo_rainbow_table_file_name;
|
||||
const char* nice_flor_s_rainbow_table_file_name;
|
||||
const char* alutech_at_4n_rainbow_table_file_name;
|
||||
const char* mfname;
|
||||
uint8_t kl_type;
|
||||
};
|
||||
|
||||
SubGhzEnvironment* subghz_environment_alloc() {
|
||||
@@ -17,6 +19,8 @@ SubGhzEnvironment* subghz_environment_alloc() {
|
||||
instance->came_atomo_rainbow_table_file_name = NULL;
|
||||
instance->nice_flor_s_rainbow_table_file_name = NULL;
|
||||
instance->alutech_at_4n_rainbow_table_file_name = NULL;
|
||||
instance->mfname = "";
|
||||
instance->kl_type = 0;
|
||||
|
||||
return instance;
|
||||
}
|
||||
@@ -115,4 +119,10 @@ const char*
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void subghz_environment_reset_keeloq(SubGhzEnvironment* instance) {
|
||||
furi_assert(instance);
|
||||
|
||||
subghz_keystore_reset_kl(instance->keystore);
|
||||
}
|
||||
|
||||
@@ -110,6 +110,12 @@ void* subghz_environment_get_protocol_registry(SubGhzEnvironment* instance);
|
||||
*/
|
||||
const char* subghz_environment_get_protocol_name_registry(SubGhzEnvironment* instance, size_t idx);
|
||||
|
||||
/**
|
||||
* Resetting the parameters used in the keeloq protocol.
|
||||
* @param instance Pointer to a SubGhzEnvironment instance
|
||||
*/
|
||||
void subghz_environment_reset_keeloq(SubGhzEnvironment* instance);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include "../blocks/generic.h"
|
||||
#include "../blocks/math.h"
|
||||
|
||||
#include "../blocks/custom_btn.h"
|
||||
#include "../blocks/custom_btn_i.h"
|
||||
|
||||
#define TAG "SubGhzProtocoAlutech_at_4n"
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "../blocks/generic.h"
|
||||
#include "../blocks/math.h"
|
||||
|
||||
#include "../blocks/custom_btn.h"
|
||||
#include "../blocks/custom_btn_i.h"
|
||||
|
||||
#define TAG "SubGhzProtocoCameAtomo"
|
||||
|
||||
|
||||
@@ -10,14 +10,11 @@
|
||||
#include "../blocks/generic.h"
|
||||
#include "../blocks/math.h"
|
||||
|
||||
#include "../blocks/custom_btn.h"
|
||||
#include "../blocks/custom_btn_i.h"
|
||||
#include "../subghz_keystore_i.h"
|
||||
|
||||
#define TAG "SubGhzProtocolKeeloq"
|
||||
|
||||
#define KEELOQ_PROG_MODE_OFF (0U)
|
||||
#define KEELOQ_PROG_MODE_BFT (1U)
|
||||
#define KEELOQ_PROG_MODE_APRIMATIC (2U)
|
||||
|
||||
static const SubGhzBlockConst subghz_protocol_keeloq_const = {
|
||||
.te_short = 400,
|
||||
.te_long = 800,
|
||||
@@ -90,25 +87,6 @@ const SubGhzProtocol subghz_protocol_keeloq = {
|
||||
.encoder = &subghz_protocol_keeloq_encoder,
|
||||
};
|
||||
|
||||
static const char* mfname;
|
||||
static uint8_t kl_type;
|
||||
static uint8_t klq_prog_mode;
|
||||
static uint16_t temp_counter;
|
||||
|
||||
void keeloq_reset_original_btn() {
|
||||
subghz_custom_btns_reset();
|
||||
temp_counter = 0;
|
||||
klq_prog_mode = KEELOQ_PROG_MODE_OFF;
|
||||
}
|
||||
|
||||
void keeloq_reset_mfname() {
|
||||
mfname = "";
|
||||
}
|
||||
|
||||
void keeloq_reset_kl_type() {
|
||||
kl_type = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Analysis of received data
|
||||
* @param instance Pointer to a SubGhzBlockGeneric* instance
|
||||
@@ -165,29 +143,32 @@ static bool subghz_protocol_keeloq_gen_data(
|
||||
}
|
||||
|
||||
// programming mode on / off conditions
|
||||
ProgMode prog_mode = subghz_custom_btn_get_prog_mode();
|
||||
if(strcmp(instance->manufacture_name, "BFT") == 0) {
|
||||
// BFT programming mode on / off conditions
|
||||
if(btn == 0xF) {
|
||||
klq_prog_mode = KEELOQ_PROG_MODE_BFT;
|
||||
} else if(klq_prog_mode == KEELOQ_PROG_MODE_BFT) {
|
||||
klq_prog_mode = KEELOQ_PROG_MODE_OFF;
|
||||
prog_mode = PROG_MODE_KEELOQ_BFT;
|
||||
} else if(prog_mode == PROG_MODE_KEELOQ_BFT) {
|
||||
prog_mode = PROG_MODE_OFF;
|
||||
}
|
||||
} else if(strcmp(instance->manufacture_name, "Aprimatic") == 0) {
|
||||
// Aprimatic programming mode on / off conditions
|
||||
if(btn == 0xF) {
|
||||
klq_prog_mode = KEELOQ_PROG_MODE_APRIMATIC;
|
||||
} else if(klq_prog_mode == KEELOQ_PROG_MODE_APRIMATIC) {
|
||||
klq_prog_mode = KEELOQ_PROG_MODE_OFF;
|
||||
prog_mode = PROG_MODE_KEELOQ_APRIMATIC;
|
||||
} else if(prog_mode == PROG_MODE_KEELOQ_APRIMATIC) {
|
||||
prog_mode = PROG_MODE_OFF;
|
||||
}
|
||||
}
|
||||
subghz_custom_btn_set_prog_mode(prog_mode);
|
||||
|
||||
// If we using BFT programming mode we will trasmit its seed in hop part like original remote
|
||||
if(klq_prog_mode == KEELOQ_PROG_MODE_BFT) {
|
||||
if(prog_mode == PROG_MODE_KEELOQ_BFT) {
|
||||
hop = instance->generic.seed;
|
||||
} else if(klq_prog_mode == KEELOQ_PROG_MODE_APRIMATIC) {
|
||||
} else if(prog_mode == PROG_MODE_KEELOQ_APRIMATIC) {
|
||||
// If we using Aprimatic programming mode we will trasmit some strange looking hop value, why? cuz manufacturer did it this way :)
|
||||
hop = 0x1A2B3C4D;
|
||||
}
|
||||
if(counter_up && klq_prog_mode == KEELOQ_PROG_MODE_OFF) {
|
||||
if(counter_up && prog_mode == PROG_MODE_OFF) {
|
||||
if(instance->generic.cnt < 0xFFFF) {
|
||||
if((instance->generic.cnt + furi_hal_subghz_get_rolling_counter_mult()) >= 0xFFFF) {
|
||||
instance->generic.cnt = 0;
|
||||
@@ -198,7 +179,7 @@ static bool subghz_protocol_keeloq_gen_data(
|
||||
instance->generic.cnt = 0;
|
||||
}
|
||||
}
|
||||
if(klq_prog_mode == KEELOQ_PROG_MODE_OFF) {
|
||||
if(prog_mode == PROG_MODE_OFF) {
|
||||
// Protocols that do not use encryption
|
||||
if(strcmp(instance->manufacture_name, "Unknown") == 0) {
|
||||
code_found_reverse = subghz_protocol_blocks_reverse_key(
|
||||
@@ -252,7 +233,7 @@ static bool subghz_protocol_keeloq_gen_data(
|
||||
decrypt = btn << 28 | (0x000) << 16 | instance->generic.cnt;
|
||||
// Beninca / Allmatic -> no serial - simple XOR
|
||||
}
|
||||
|
||||
uint8_t kl_type_en = instance->keystore->kl_type;
|
||||
for
|
||||
M_EACH(
|
||||
manufacture_code,
|
||||
@@ -292,21 +273,21 @@ static bool subghz_protocol_keeloq_gen_data(
|
||||
hop = subghz_protocol_keeloq_common_encrypt(decrypt, man);
|
||||
break;
|
||||
case KEELOQ_LEARNING_UNKNOWN:
|
||||
if(kl_type == 1) {
|
||||
if(kl_type_en == 1) {
|
||||
hop = subghz_protocol_keeloq_common_encrypt(
|
||||
decrypt, manufacture_code->key);
|
||||
}
|
||||
if(kl_type == 2) {
|
||||
if(kl_type_en == 2) {
|
||||
man = subghz_protocol_keeloq_common_normal_learning(
|
||||
fix, manufacture_code->key);
|
||||
hop = subghz_protocol_keeloq_common_encrypt(decrypt, man);
|
||||
}
|
||||
if(kl_type == 3) {
|
||||
if(kl_type_en == 3) {
|
||||
man = subghz_protocol_keeloq_common_secure_learning(
|
||||
fix, instance->generic.seed, manufacture_code->key);
|
||||
hop = subghz_protocol_keeloq_common_encrypt(decrypt, man);
|
||||
}
|
||||
if(kl_type == 4) {
|
||||
if(kl_type_en == 4) {
|
||||
man = subghz_protocol_keeloq_common_magic_xor_type1_learning(
|
||||
instance->generic.serial, manufacture_code->key);
|
||||
hop = subghz_protocol_keeloq_common_encrypt(decrypt, man);
|
||||
@@ -399,9 +380,10 @@ static bool
|
||||
if(instance->manufacture_name == 0x0) {
|
||||
instance->manufacture_name = "";
|
||||
}
|
||||
if(klq_prog_mode == KEELOQ_PROG_MODE_BFT) {
|
||||
ProgMode prog_mode = subghz_custom_btn_get_prog_mode();
|
||||
if(prog_mode == PROG_MODE_KEELOQ_BFT) {
|
||||
instance->manufacture_name = "BFT";
|
||||
} else if(klq_prog_mode == KEELOQ_PROG_MODE_APRIMATIC) {
|
||||
} else if(prog_mode == PROG_MODE_KEELOQ_APRIMATIC) {
|
||||
instance->manufacture_name = "Aprimatic";
|
||||
}
|
||||
uint8_t klq_last_custom_btn = 0xA;
|
||||
@@ -507,7 +489,7 @@ SubGhzProtocolStatus
|
||||
if(flipper_format_read_string(
|
||||
flipper_format, "Manufacture", instance->manufacture_from_file)) {
|
||||
instance->manufacture_name = furi_string_get_cstr(instance->manufacture_from_file);
|
||||
mfname = furi_string_get_cstr(instance->manufacture_from_file);
|
||||
instance->keystore->mfname = instance->manufacture_name;
|
||||
} else {
|
||||
FURI_LOG_D(TAG, "ENCODER: Missing Manufacture");
|
||||
}
|
||||
@@ -579,7 +561,7 @@ void* subghz_protocol_decoder_keeloq_alloc(SubGhzEnvironment* environment) {
|
||||
instance->keystore = subghz_environment_get_keystore(environment);
|
||||
instance->manufacture_from_file = furi_string_alloc();
|
||||
|
||||
klq_prog_mode = KEELOQ_PROG_MODE_OFF;
|
||||
subghz_custom_btn_set_prog_mode(PROG_MODE_OFF);
|
||||
|
||||
return instance;
|
||||
}
|
||||
@@ -596,8 +578,9 @@ void subghz_protocol_decoder_keeloq_reset(void* context) {
|
||||
furi_assert(context);
|
||||
SubGhzProtocolDecoderKeeloq* instance = context;
|
||||
instance->decoder.parser_step = KeeloqDecoderStepReset;
|
||||
mfname = "";
|
||||
kl_type = 0;
|
||||
// TODO
|
||||
instance->keystore->mfname = "";
|
||||
instance->keystore->kl_type = 0;
|
||||
}
|
||||
|
||||
void subghz_protocol_decoder_keeloq_feed(void* context, bool level, uint32_t duration) {
|
||||
@@ -740,9 +723,12 @@ static uint8_t subghz_protocol_keeloq_check_remote_controller_selector(
|
||||
uint32_t decrypt = 0;
|
||||
uint64_t man;
|
||||
bool mf_not_set = false;
|
||||
if(mfname == 0x0) {
|
||||
mfname = "";
|
||||
}
|
||||
// TODO:
|
||||
// if(mfname == 0x0) {
|
||||
// mfname = "";
|
||||
// }
|
||||
|
||||
const char* mfname = keystore->mfname;
|
||||
|
||||
if(strcmp(mfname, "Unknown") == 0) {
|
||||
return 1;
|
||||
@@ -758,7 +744,7 @@ static uint8_t subghz_protocol_keeloq_check_remote_controller_selector(
|
||||
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);
|
||||
mfname = *manufacture_name;
|
||||
keystore->mfname = *manufacture_name;
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
@@ -770,7 +756,7 @@ static uint8_t subghz_protocol_keeloq_check_remote_controller_selector(
|
||||
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);
|
||||
mfname = *manufacture_name;
|
||||
keystore->mfname = *manufacture_name;
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
@@ -780,7 +766,7 @@ static uint8_t subghz_protocol_keeloq_check_remote_controller_selector(
|
||||
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);
|
||||
mfname = *manufacture_name;
|
||||
keystore->mfname = *manufacture_name;
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
@@ -790,7 +776,7 @@ static uint8_t subghz_protocol_keeloq_check_remote_controller_selector(
|
||||
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);
|
||||
mfname = *manufacture_name;
|
||||
keystore->mfname = *manufacture_name;
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
@@ -800,7 +786,7 @@ static uint8_t subghz_protocol_keeloq_check_remote_controller_selector(
|
||||
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);
|
||||
mfname = *manufacture_name;
|
||||
keystore->mfname = *manufacture_name;
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
@@ -810,7 +796,7 @@ static uint8_t subghz_protocol_keeloq_check_remote_controller_selector(
|
||||
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);
|
||||
mfname = *manufacture_name;
|
||||
keystore->mfname = *manufacture_name;
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
@@ -820,7 +806,7 @@ static uint8_t subghz_protocol_keeloq_check_remote_controller_selector(
|
||||
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);
|
||||
mfname = *manufacture_name;
|
||||
keystore->mfname = *manufacture_name;
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
@@ -829,8 +815,8 @@ static uint8_t subghz_protocol_keeloq_check_remote_controller_selector(
|
||||
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);
|
||||
mfname = *manufacture_name;
|
||||
kl_type = 1;
|
||||
keystore->mfname = *manufacture_name;
|
||||
keystore->kl_type = 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -845,8 +831,8 @@ static uint8_t subghz_protocol_keeloq_check_remote_controller_selector(
|
||||
decrypt = subghz_protocol_keeloq_common_decrypt(hop, man_rev);
|
||||
if(subghz_protocol_keeloq_check_decrypt(instance, decrypt, btn, end_serial)) {
|
||||
*manufacture_name = furi_string_get_cstr(manufacture_code->name);
|
||||
mfname = *manufacture_name;
|
||||
kl_type = 1;
|
||||
keystore->mfname = *manufacture_name;
|
||||
keystore->kl_type = 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -858,8 +844,8 @@ static uint8_t subghz_protocol_keeloq_check_remote_controller_selector(
|
||||
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);
|
||||
mfname = *manufacture_name;
|
||||
kl_type = 2;
|
||||
keystore->mfname = *manufacture_name;
|
||||
keystore->kl_type = 2;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -868,8 +854,8 @@ static uint8_t subghz_protocol_keeloq_check_remote_controller_selector(
|
||||
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);
|
||||
mfname = *manufacture_name;
|
||||
kl_type = 2;
|
||||
keystore->mfname = *manufacture_name;
|
||||
keystore->kl_type = 2;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -879,8 +865,8 @@ static uint8_t subghz_protocol_keeloq_check_remote_controller_selector(
|
||||
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);
|
||||
mfname = *manufacture_name;
|
||||
kl_type = 3;
|
||||
keystore->mfname = *manufacture_name;
|
||||
keystore->kl_type = 3;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -890,8 +876,8 @@ static uint8_t subghz_protocol_keeloq_check_remote_controller_selector(
|
||||
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);
|
||||
mfname = *manufacture_name;
|
||||
kl_type = 3;
|
||||
keystore->mfname = *manufacture_name;
|
||||
keystore->kl_type = 3;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -901,8 +887,8 @@ static uint8_t subghz_protocol_keeloq_check_remote_controller_selector(
|
||||
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);
|
||||
mfname = *manufacture_name;
|
||||
kl_type = 4;
|
||||
keystore->mfname = *manufacture_name;
|
||||
keystore->kl_type = 4;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -911,8 +897,8 @@ static uint8_t subghz_protocol_keeloq_check_remote_controller_selector(
|
||||
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);
|
||||
mfname = *manufacture_name;
|
||||
kl_type = 4;
|
||||
keystore->mfname = *manufacture_name;
|
||||
keystore->kl_type = 4;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -922,7 +908,7 @@ static uint8_t subghz_protocol_keeloq_check_remote_controller_selector(
|
||||
}
|
||||
|
||||
*manufacture_name = "Unknown";
|
||||
mfname = "Unknown";
|
||||
keystore->mfname = "Unknown";
|
||||
instance->cnt = 0;
|
||||
|
||||
return 0;
|
||||
@@ -935,18 +921,20 @@ static void subghz_protocol_keeloq_check_remote_controller(
|
||||
uint64_t key = subghz_protocol_blocks_reverse_key(instance->data, instance->data_count_bit);
|
||||
uint32_t key_fix = key >> 32;
|
||||
uint32_t key_hop = key & 0x00000000ffffffff;
|
||||
static uint16_t temp_counter = 0; // Be careful with prog_mode
|
||||
|
||||
// If we are in BFT / Aprimatic programming mode we will set previous remembered counter and skip mf keys check
|
||||
if(klq_prog_mode == KEELOQ_PROG_MODE_OFF) {
|
||||
ProgMode prog_mode = subghz_custom_btn_get_prog_mode();
|
||||
if(prog_mode == PROG_MODE_OFF) {
|
||||
// Check key AN-Motors
|
||||
if((key_hop >> 24) == ((key_hop >> 16) & 0x00ff) &&
|
||||
(key_fix >> 28) == ((key_hop >> 12) & 0x0f) && (key_hop & 0xFFF) == 0x404) {
|
||||
*manufacture_name = "AN-Motors";
|
||||
mfname = *manufacture_name;
|
||||
keystore->mfname = *manufacture_name;
|
||||
instance->cnt = key_hop >> 16;
|
||||
} else if((key_hop & 0xFFF) == (0x000) && (key_fix >> 28) == ((key_hop >> 12) & 0x0f)) {
|
||||
*manufacture_name = "HCS101";
|
||||
mfname = *manufacture_name;
|
||||
keystore->mfname = *manufacture_name;
|
||||
instance->cnt = key_hop >> 16;
|
||||
} else {
|
||||
subghz_protocol_keeloq_check_remote_controller_selector(
|
||||
@@ -954,14 +942,17 @@ static void subghz_protocol_keeloq_check_remote_controller(
|
||||
}
|
||||
temp_counter = instance->cnt;
|
||||
|
||||
} else if(klq_prog_mode == KEELOQ_PROG_MODE_BFT) {
|
||||
} else if(prog_mode == PROG_MODE_KEELOQ_BFT) {
|
||||
*manufacture_name = "BFT";
|
||||
mfname = *manufacture_name;
|
||||
keystore->mfname = *manufacture_name;
|
||||
instance->cnt = temp_counter;
|
||||
} else if(klq_prog_mode == KEELOQ_PROG_MODE_APRIMATIC) {
|
||||
} else if(prog_mode == PROG_MODE_KEELOQ_APRIMATIC) {
|
||||
*manufacture_name = "Aprimatic";
|
||||
mfname = *manufacture_name;
|
||||
keystore->mfname = *manufacture_name;
|
||||
instance->cnt = temp_counter;
|
||||
} else {
|
||||
// Counter protection
|
||||
furi_crash("Unsuported Prog Mode");
|
||||
}
|
||||
|
||||
instance->serial = key_fix & 0x0FFFFFFF;
|
||||
@@ -1052,7 +1043,7 @@ SubGhzProtocolStatus
|
||||
if(flipper_format_read_string(
|
||||
flipper_format, "Manufacture", instance->manufacture_from_file)) {
|
||||
instance->manufacture_name = furi_string_get_cstr(instance->manufacture_from_file);
|
||||
mfname = furi_string_get_cstr(instance->manufacture_from_file);
|
||||
instance->keystore->mfname = instance->manufacture_name;
|
||||
} else {
|
||||
FURI_LOG_D(TAG, "DECODER: Missing Manufacture");
|
||||
}
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
|
||||
#include "base.h"
|
||||
|
||||
#include "../blocks/custom_btn.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -17,12 +15,6 @@ extern const SubGhzProtocolDecoder subghz_protocol_keeloq_decoder;
|
||||
extern const SubGhzProtocolEncoder subghz_protocol_keeloq_encoder;
|
||||
extern const SubGhzProtocol subghz_protocol_keeloq;
|
||||
|
||||
void keeloq_reset_mfname();
|
||||
|
||||
void keeloq_reset_kl_type();
|
||||
|
||||
void keeloq_reset_original_btn();
|
||||
|
||||
/**
|
||||
* Allocate SubGhzProtocolEncoderKeeloq.
|
||||
* @param environment Pointer to a SubGhzEnvironment instance
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "../blocks/generic.h"
|
||||
#include "../blocks/math.h"
|
||||
|
||||
#include "../blocks/custom_btn.h"
|
||||
#include "../blocks/custom_btn_i.h"
|
||||
|
||||
/*
|
||||
* https://phreakerclub.com/1615
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "../blocks/generic.h"
|
||||
#include "../blocks/math.h"
|
||||
|
||||
#include "../blocks/custom_btn.h"
|
||||
#include "../blocks/custom_btn_i.h"
|
||||
|
||||
/*
|
||||
* Help
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "../blocks/generic.h"
|
||||
#include "../blocks/math.h"
|
||||
|
||||
#include "../blocks/custom_btn.h"
|
||||
#include "../blocks/custom_btn_i.h"
|
||||
|
||||
#define TAG "SubGhzProtocolSomfyTelis"
|
||||
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
#include "../blocks/generic.h"
|
||||
#include "../blocks/math.h"
|
||||
|
||||
#include "../subghz_keystore_i.h"
|
||||
|
||||
#define TAG "SubGhzProtocolStarLine"
|
||||
|
||||
static const SubGhzBlockConst subghz_protocol_star_line_const = {
|
||||
@@ -83,18 +85,6 @@ const SubGhzProtocol subghz_protocol_star_line = {
|
||||
.encoder = &subghz_protocol_star_line_encoder,
|
||||
};
|
||||
|
||||
static const char* mfname;
|
||||
|
||||
static int kl_type;
|
||||
|
||||
void star_line_reset_mfname() {
|
||||
mfname = "";
|
||||
}
|
||||
|
||||
void star_line_reset_kl_type() {
|
||||
kl_type = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Analysis of received data
|
||||
* @param instance Pointer to a SubGhzBlockGeneric* instance
|
||||
@@ -163,6 +153,7 @@ static bool
|
||||
instance->generic.data, instance->generic.data_count_bit);
|
||||
hop = code_found_reverse & 0x00000000ffffffff;
|
||||
} else {
|
||||
uint8_t kl_type_en = instance->keystore->kl_type;
|
||||
for
|
||||
M_EACH(
|
||||
manufacture_code,
|
||||
@@ -184,11 +175,11 @@ static bool
|
||||
hop = subghz_protocol_keeloq_common_encrypt(decrypt, man);
|
||||
break;
|
||||
case KEELOQ_LEARNING_UNKNOWN:
|
||||
if(kl_type == 1) {
|
||||
if(kl_type_en == 1) {
|
||||
hop = subghz_protocol_keeloq_common_encrypt(
|
||||
decrypt, manufacture_code->key);
|
||||
}
|
||||
if(kl_type == 2) {
|
||||
if(kl_type_en == 2) {
|
||||
man = subghz_protocol_keeloq_common_normal_learning(
|
||||
fix, manufacture_code->key);
|
||||
hop = subghz_protocol_keeloq_common_encrypt(decrypt, man);
|
||||
@@ -300,7 +291,7 @@ SubGhzProtocolStatus
|
||||
if(flipper_format_read_string(
|
||||
flipper_format, "Manufacture", instance->manufacture_from_file)) {
|
||||
instance->manufacture_name = furi_string_get_cstr(instance->manufacture_from_file);
|
||||
mfname = furi_string_get_cstr(instance->manufacture_from_file);
|
||||
instance->keystore->mfname = instance->manufacture_name;
|
||||
} else {
|
||||
FURI_LOG_D(TAG, "ENCODER: Missing Manufacture");
|
||||
}
|
||||
@@ -382,8 +373,9 @@ void subghz_protocol_decoder_star_line_reset(void* context) {
|
||||
furi_assert(context);
|
||||
SubGhzProtocolDecoderStarLine* instance = context;
|
||||
instance->decoder.parser_step = StarLineDecoderStepReset;
|
||||
mfname = "";
|
||||
kl_type = 0;
|
||||
// TODO
|
||||
instance->keystore->mfname = "";
|
||||
instance->keystore->kl_type = 0;
|
||||
}
|
||||
|
||||
void subghz_protocol_decoder_star_line_feed(void* context, bool level, uint32_t duration) {
|
||||
@@ -523,9 +515,12 @@ static uint8_t subghz_protocol_star_line_check_remote_controller_selector(
|
||||
uint32_t decrypt = 0;
|
||||
uint64_t man_normal_learning;
|
||||
bool mf_not_set = false;
|
||||
if(mfname == 0x0) {
|
||||
mfname = "";
|
||||
}
|
||||
// TODO:
|
||||
// if(mfname == 0x0) {
|
||||
// mfname = "";
|
||||
// }
|
||||
|
||||
const char* mfname = keystore->mfname;
|
||||
|
||||
if(strcmp(mfname, "Unknown") == 0) {
|
||||
return 1;
|
||||
@@ -542,7 +537,7 @@ static uint8_t subghz_protocol_star_line_check_remote_controller_selector(
|
||||
if(subghz_protocol_star_line_check_decrypt(
|
||||
instance, decrypt, btn, end_serial)) {
|
||||
*manufacture_name = furi_string_get_cstr(manufacture_code->name);
|
||||
mfname = *manufacture_name;
|
||||
keystore->mfname = *manufacture_name;
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
@@ -555,7 +550,7 @@ static uint8_t subghz_protocol_star_line_check_remote_controller_selector(
|
||||
if(subghz_protocol_star_line_check_decrypt(
|
||||
instance, decrypt, btn, end_serial)) {
|
||||
*manufacture_name = furi_string_get_cstr(manufacture_code->name);
|
||||
mfname = *manufacture_name;
|
||||
keystore->mfname = *manufacture_name;
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
@@ -565,8 +560,8 @@ static uint8_t subghz_protocol_star_line_check_remote_controller_selector(
|
||||
if(subghz_protocol_star_line_check_decrypt(
|
||||
instance, decrypt, btn, end_serial)) {
|
||||
*manufacture_name = furi_string_get_cstr(manufacture_code->name);
|
||||
mfname = *manufacture_name;
|
||||
kl_type = 1;
|
||||
keystore->mfname = *manufacture_name;
|
||||
keystore->kl_type = 1;
|
||||
return 1;
|
||||
}
|
||||
// Check for mirrored man
|
||||
@@ -580,8 +575,8 @@ static uint8_t subghz_protocol_star_line_check_remote_controller_selector(
|
||||
if(subghz_protocol_star_line_check_decrypt(
|
||||
instance, decrypt, btn, end_serial)) {
|
||||
*manufacture_name = furi_string_get_cstr(manufacture_code->name);
|
||||
mfname = *manufacture_name;
|
||||
kl_type = 1;
|
||||
keystore->mfname = *manufacture_name;
|
||||
keystore->kl_type = 1;
|
||||
return 1;
|
||||
}
|
||||
//###########################
|
||||
@@ -593,8 +588,8 @@ static uint8_t subghz_protocol_star_line_check_remote_controller_selector(
|
||||
if(subghz_protocol_star_line_check_decrypt(
|
||||
instance, decrypt, btn, end_serial)) {
|
||||
*manufacture_name = furi_string_get_cstr(manufacture_code->name);
|
||||
mfname = *manufacture_name;
|
||||
kl_type = 2;
|
||||
keystore->mfname = *manufacture_name;
|
||||
keystore->kl_type = 2;
|
||||
return 1;
|
||||
}
|
||||
// Check for mirrored man
|
||||
@@ -604,8 +599,8 @@ static uint8_t subghz_protocol_star_line_check_remote_controller_selector(
|
||||
if(subghz_protocol_star_line_check_decrypt(
|
||||
instance, decrypt, btn, end_serial)) {
|
||||
*manufacture_name = furi_string_get_cstr(manufacture_code->name);
|
||||
mfname = *manufacture_name;
|
||||
kl_type = 2;
|
||||
keystore->mfname = *manufacture_name;
|
||||
keystore->kl_type = 2;
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
@@ -614,7 +609,7 @@ static uint8_t subghz_protocol_star_line_check_remote_controller_selector(
|
||||
}
|
||||
|
||||
*manufacture_name = "Unknown";
|
||||
mfname = "Unknown";
|
||||
keystore->mfname = "Unknown";
|
||||
instance->cnt = 0;
|
||||
|
||||
return 0;
|
||||
@@ -690,7 +685,7 @@ SubGhzProtocolStatus
|
||||
if(flipper_format_read_string(
|
||||
flipper_format, "Manufacture", instance->manufacture_from_file)) {
|
||||
instance->manufacture_name = furi_string_get_cstr(instance->manufacture_from_file);
|
||||
mfname = furi_string_get_cstr(instance->manufacture_from_file);
|
||||
instance->keystore->mfname = instance->manufacture_name;
|
||||
} else {
|
||||
FURI_LOG_D(TAG, "DECODER: Missing Manufacture");
|
||||
}
|
||||
|
||||
@@ -15,10 +15,6 @@ extern const SubGhzProtocolDecoder subghz_protocol_star_line_decoder;
|
||||
extern const SubGhzProtocolEncoder subghz_protocol_star_line_encoder;
|
||||
extern const SubGhzProtocol subghz_protocol_star_line;
|
||||
|
||||
void star_line_reset_mfname();
|
||||
|
||||
void star_line_reset_kl_type();
|
||||
|
||||
/**
|
||||
* Allocate SubGhzProtocolEncoderStarLine.
|
||||
* @param environment Pointer to a SubGhzEnvironment instance
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "subghz_keystore.h"
|
||||
#include "subghz_keystore_i.h"
|
||||
|
||||
#include <furi.h>
|
||||
#include <furi_hal.h>
|
||||
@@ -26,18 +27,23 @@ typedef enum {
|
||||
SubGhzKeystoreEncryptionAES256,
|
||||
} SubGhzKeystoreEncryption;
|
||||
|
||||
struct SubGhzKeystore {
|
||||
SubGhzKeyArray_t data;
|
||||
};
|
||||
|
||||
SubGhzKeystore* subghz_keystore_alloc() {
|
||||
SubGhzKeystore* instance = malloc(sizeof(SubGhzKeystore));
|
||||
|
||||
SubGhzKeyArray_init(instance->data);
|
||||
|
||||
subghz_keystore_reset_kl(instance);
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
void subghz_keystore_reset_kl(SubGhzKeystore* instance) {
|
||||
furi_assert(instance);
|
||||
|
||||
instance->mfname = "";
|
||||
instance->kl_type = 0;
|
||||
}
|
||||
|
||||
void subghz_keystore_free(SubGhzKeystore* instance) {
|
||||
furi_assert(instance);
|
||||
|
||||
|
||||
@@ -75,6 +75,8 @@ bool subghz_keystore_raw_encrypted_save(
|
||||
*/
|
||||
bool subghz_keystore_raw_get_data(const char* file_name, size_t offset, uint8_t* data, size_t len);
|
||||
|
||||
void subghz_keystore_reset_kl(SubGhzKeystore* instance);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <m-array.h>
|
||||
|
||||
struct SubGhzKeystore {
|
||||
SubGhzKeyArray_t data;
|
||||
const char* mfname;
|
||||
uint8_t kl_type;
|
||||
};
|
||||
+14
-1
@@ -5,7 +5,7 @@
|
||||
|
||||
#define VERSION_MAGIC (0xBE40u)
|
||||
#define VERSION_MAJOR (0x1u)
|
||||
#define VERSION_MINOR (0x0u)
|
||||
#define VERSION_MINOR (0x1u)
|
||||
|
||||
struct Version {
|
||||
// Header
|
||||
@@ -20,6 +20,9 @@ struct Version {
|
||||
// Payload bits and pieces
|
||||
const uint8_t target;
|
||||
const bool build_is_dirty;
|
||||
// v 1.1
|
||||
const char* firmware_origin;
|
||||
const char* git_origin;
|
||||
const char* custom_flipper_name;
|
||||
};
|
||||
|
||||
@@ -38,6 +41,8 @@ static Version version = {
|
||||
,
|
||||
.target = TARGET,
|
||||
.build_is_dirty = BUILD_DIRTY,
|
||||
.firmware_origin = FIRMWARE_ORIGIN,
|
||||
.git_origin = GIT_ORIGIN,
|
||||
.custom_flipper_name = NULL,
|
||||
};
|
||||
|
||||
@@ -83,3 +88,11 @@ uint8_t version_get_target(const Version* v) {
|
||||
bool version_get_dirty_flag(const Version* v) {
|
||||
return v ? v->build_is_dirty : version.build_is_dirty;
|
||||
}
|
||||
|
||||
const char* version_get_firmware_origin(const Version* v) {
|
||||
return v ? v->firmware_origin : version.firmware_origin;
|
||||
}
|
||||
|
||||
const char* version_get_git_origin(const Version* v) {
|
||||
return v ? v->git_origin : version.git_origin;
|
||||
}
|
||||
|
||||
@@ -100,6 +100,17 @@ uint8_t version_get_target(const Version* v);
|
||||
*/
|
||||
bool version_get_dirty_flag(const Version* v);
|
||||
|
||||
/**
|
||||
* Get firmware origin. "Official" for mainline firmware, fork name for forks.
|
||||
* Set by FIRMWARE_ORIGIN fbt argument.
|
||||
*/
|
||||
const char* version_get_firmware_origin(const Version* v);
|
||||
|
||||
/**
|
||||
* Get git repo origin
|
||||
*/
|
||||
const char* version_get_git_origin(const Version* v);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user