From ff41d262dc1dab11763dd8ba436e2abbb83aed54 Mon Sep 17 00:00:00 2001
From: MX <10697207+xMasterX@users.noreply.github.com>
Date: Wed, 29 Nov 2023 16:18:20 +0300
Subject: [PATCH 1/7] add 303.9 frequency
---
.../main/subghz/views/subghz_frequency_analyzer.c | 14 +++++++-------
documentation/SubGHzSettings.md | 1 +
lib/subghz/subghz_setting.c | 1 +
3 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/applications/main/subghz/views/subghz_frequency_analyzer.c b/applications/main/subghz/views/subghz_frequency_analyzer.c
index 9f39bb0d6..bc472f233 100644
--- a/applications/main/subghz/views/subghz_frequency_analyzer.c
+++ b/applications/main/subghz/views/subghz_frequency_analyzer.c
@@ -21,13 +21,13 @@
#define MAX_HISTORY 4
static const uint32_t subghz_frequency_list[] = {
- 300000000, 302757000, 303875000, 304250000, 307000000, 307500000, 307800000, 309000000,
- 310000000, 312000000, 312100000, 313000000, 313850000, 314000000, 314350000, 314980000,
- 315000000, 318000000, 330000000, 345000000, 348000000, 350000000, 387000000, 390000000,
- 418000000, 430000000, 431000000, 431500000, 433075000, 433220000, 433420000, 433657070,
- 433889000, 433920000, 434075000, 434176948, 434390000, 434420000, 434775000, 438900000,
- 440175000, 464000000, 779000000, 868350000, 868400000, 868800000, 868950000, 906400000,
- 915000000, 925000000, 928000000};
+ 300000000, 302757000, 303875000, 303900000, 304250000, 307000000, 307500000, 307800000,
+ 309000000, 310000000, 312000000, 312100000, 313000000, 313850000, 314000000, 314350000,
+ 314980000, 315000000, 318000000, 330000000, 345000000, 348000000, 350000000, 387000000,
+ 390000000, 418000000, 430000000, 431000000, 431500000, 433075000, 433220000, 433420000,
+ 433657070, 433889000, 433920000, 434075000, 434176948, 434390000, 434420000, 434775000,
+ 438900000, 440175000, 464000000, 779000000, 868350000, 868400000, 868800000, 868950000,
+ 906400000, 915000000, 925000000, 928000000};
typedef enum {
SubGhzFrequencyAnalyzerStatusIDLE,
diff --git a/documentation/SubGHzSettings.md b/documentation/SubGHzSettings.md
index a15f72b98..1988dcbd8 100644
--- a/documentation/SubGHzSettings.md
+++ b/documentation/SubGHzSettings.md
@@ -13,6 +13,7 @@ if you need your custom one, make sure it doesn't listed here
300000000,
302757000,
303875000,
+ 303900000,
304250000,
307000000,
307500000,
diff --git a/lib/subghz/subghz_setting.c b/lib/subghz/subghz_setting.c
index 0277e4aed..a9f6b7c6b 100644
--- a/lib/subghz/subghz_setting.c
+++ b/lib/subghz/subghz_setting.c
@@ -20,6 +20,7 @@ static const uint32_t subghz_frequency_list[] = {
300000000,
302757000,
303875000,
+ 303900000,
304250000,
307000000,
307500000,
From e027d5c3e818dcf921a6c9423fd930044899bc17 Mon Sep 17 00:00:00 2001
From: MX <10697207+xMasterX@users.noreply.github.com>
Date: Fri, 1 Dec 2023 04:47:17 +0300
Subject: [PATCH 2/7] Add new API function for varitemlist
by Willy-JL
https://github.com/Flipper-XFW/Xtreme-Firmware/commit/466e1f989f5c320675facbfde099d0cc5e53071a
---
.../services/gui/modules/variable_item_list.c | 17 +++++++++++++++++
.../services/gui/modules/variable_item_list.h | 9 +++++++++
targets/f7/api_symbols.csv | 1 +
3 files changed, 27 insertions(+)
diff --git a/applications/services/gui/modules/variable_item_list.c b/applications/services/gui/modules/variable_item_list.c
index 724f70bcd..9aefcfd0e 100644
--- a/applications/services/gui/modules/variable_item_list.c
+++ b/applications/services/gui/modules/variable_item_list.c
@@ -499,6 +499,23 @@ VariableItem* variable_item_list_add(
return item;
}
+VariableItem* variable_item_list_get(VariableItemList* variable_item_list, uint8_t position) {
+ VariableItem* item = NULL;
+ furi_assert(variable_item_list);
+
+ with_view_model(
+ variable_item_list->view,
+ VariableItemListModel * model,
+ {
+ if(position < VariableItemArray_size(model->items)) {
+ item = VariableItemArray_get(model->items, position);
+ }
+ },
+ true);
+
+ return item;
+}
+
void variable_item_list_set_enter_callback(
VariableItemList* variable_item_list,
VariableItemListEnterCallback callback,
diff --git a/applications/services/gui/modules/variable_item_list.h b/applications/services/gui/modules/variable_item_list.h
index db8b1788f..59a3b0830 100644
--- a/applications/services/gui/modules/variable_item_list.h
+++ b/applications/services/gui/modules/variable_item_list.h
@@ -59,6 +59,15 @@ VariableItem* variable_item_list_add(
VariableItemChangeCallback change_callback,
void* context);
+/** Get item in VariableItemList
+ *
+ * @param variable_item_list VariableItemList instance
+ * @param position index of the item to get
+ *
+ * @return VariableItem* item instance
+ */
+VariableItem* variable_item_list_get(VariableItemList* variable_item_list, uint8_t position);
+
/** Set enter callback
*
* @param variable_item_list VariableItemList instance
diff --git a/targets/f7/api_symbols.csv b/targets/f7/api_symbols.csv
index 34353d1cf..0129354a0 100644
--- a/targets/f7/api_symbols.csv
+++ b/targets/f7/api_symbols.csv
@@ -3166,6 +3166,7 @@ Function,+,variable_item_get_current_value_index,uint8_t,VariableItem*
Function,+,variable_item_list_add,VariableItem*,"VariableItemList*, const char*, uint8_t, VariableItemChangeCallback, void*"
Function,+,variable_item_list_alloc,VariableItemList*,
Function,+,variable_item_list_free,void,VariableItemList*
+Function,+,variable_item_list_get,VariableItem*,"VariableItemList*, uint8_t"
Function,+,variable_item_list_get_selected_item_index,uint8_t,VariableItemList*
Function,+,variable_item_list_get_view,View*,VariableItemList*
Function,+,variable_item_list_reset,void,VariableItemList*
From d675563271d4398b3e6bce3d93e37d388c03c907 Mon Sep 17 00:00:00 2001
From: MX <10697207+xMasterX@users.noreply.github.com>
Date: Fri, 1 Dec 2023 04:47:54 +0300
Subject: [PATCH 3/7] sync anims
---
.ci_files/anims_ofw.txt | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/.ci_files/anims_ofw.txt b/.ci_files/anims_ofw.txt
index 5bc576779..a061c48ce 100644
--- a/.ci_files/anims_ofw.txt
+++ b/.ci_files/anims_ofw.txt
@@ -175,3 +175,10 @@ Max butthurt: 12
Min level: 2
Max level: 3
Weight: 4
+
+Name: L2_Secret_door_128x64
+Min butthurt: 0
+Max butthurt: 12
+Min level: 2
+Max level: 3
+Weight: 4
From 961dd297dd1987de72deacba04b30564da5e6730 Mon Sep 17 00:00:00 2001
From: MX <10697207+xMasterX@users.noreply.github.com>
Date: Fri, 1 Dec 2023 04:53:11 +0300
Subject: [PATCH 4/7] upd changelog
---
CHANGELOG.md | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index dc6d5813b..79c17d2cb 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,21 +5,27 @@
- Mifare Mini clones reading is broken (OFW)
- Mifare Classic dict attack fast skip causes glitches/incorrect reading (OFW)
- EMV simple data parser was removed with protocol with refactoring (OFW)
+- NFC V(Slix), Mifare Classic Emulation issues (unconfirmed) (OFW)
+- Option to unlock Slix-L (NFC V) with preset or custom password was removed with refactoring (OFW)
### Some apps that was made for old nfc stack is now not compatible with the new API and require complete remake:
**If you want to help with making this apps work again please send PR to the repo at link below**
- Current list of affected apps: https://github.com/xMasterX/all-the-plugins/tree/dev/apps_broken_by_last_refactors
-- Also in app **Enhanced Sub-GHz Chat** - NFC part was temporarily removed to make app usable, NFC part of the app requires remaking it with new nfc stack
-**API was updated to v46.x**
+- Also in app **Enhanced Sub-GHz Chat** - NFC part was temporarily removed to make app usable, NFC part of the app requires remaking it with new nfc stack
+**API was updated to v47.x**
## New changes
* NFC: Added new parsers for transport cards - Umarsh, Kazan, Moscow, Metromoney(Tbilisi), and fixes for OFW parsers (by @assasinfil and @Leptopt1los) (special thanks for users who provided various dumps of those cards for research)
* NFC: Added simple key name display to UI to fix regression
* iButton: Fix UI text - protocol name getting out of screen bounds when key name is too large, and other related issues (by @krolchonok | PR #649)
* SubGHz: Fixed feature naming in menu
* SubGHz: Added honeywell protocol [(by @htotoo)](https://github.com/Flipper-XFW/Xtreme-Firmware/commit/ceee551befa0cb8fd8514a4f8a1250fd9e0997ee)
+* SubGHz: Add 303.9 Mhz to default frequency list
+* API: Add new get function for varitemlist (by @Willy-JL)
* Misc code cleanup
* Apps: **Bluetooth Remote / USB Keyboard & Mouse** - `Movie` and `PTT` modes by @hryamzik
* Apps: **BLE Spam app** updated to latest version (New devices support, + Menu by holding Start) (by @Willy-JL) -> (app can be found in builds ` `, `e`, `n`, `r`)
* Apps: **Check out Apps updates by following** [this link](https://github.com/xMasterX/all-the-plugins/commits/dev)
+* OFW: Add the secret door animation
+* OFW: Allows you to use UCS-2 in canvas_glyph_width
* OFW: Mifare Classic fixes
* OFW: NFC: Felica UID emulation
* OFW: 64k does not enough
From 99d657fcfbd4155a82f7eec3bd1b54851d131e4d Mon Sep 17 00:00:00 2001
From: MX <10697207+xMasterX@users.noreply.github.com>
Date: Fri, 1 Dec 2023 20:33:14 +0300
Subject: [PATCH 5/7] merge fixes
---
applications/main/nfc/plugins/supported_cards/kazan.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/applications/main/nfc/plugins/supported_cards/kazan.c b/applications/main/nfc/plugins/supported_cards/kazan.c
index 68ef6c16f..035d20d9f 100644
--- a/applications/main/nfc/plugins/supported_cards/kazan.c
+++ b/applications/main/nfc/plugins/supported_cards/kazan.c
@@ -28,7 +28,6 @@
#include
#include
#include
-#include "md5.h"
#define TAG "Kazan"
From f7c63c675b4862542878f6ab28a1f634d97812d5 Mon Sep 17 00:00:00 2001
From: MX <10697207+xMasterX@users.noreply.github.com>
Date: Fri, 1 Dec 2023 20:38:01 +0300
Subject: [PATCH 6/7] upd changelog
---
CHANGELOG.md | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 79c17d2cb..d16d3a7cf 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,7 +11,7 @@
**If you want to help with making this apps work again please send PR to the repo at link below**
- Current list of affected apps: https://github.com/xMasterX/all-the-plugins/tree/dev/apps_broken_by_last_refactors
- Also in app **Enhanced Sub-GHz Chat** - NFC part was temporarily removed to make app usable, NFC part of the app requires remaking it with new nfc stack
-**API was updated to v47.x**
+**API was updated to v49.x**
## New changes
* NFC: Added new parsers for transport cards - Umarsh, Kazan, Moscow, Metromoney(Tbilisi), and fixes for OFW parsers (by @assasinfil and @Leptopt1los) (special thanks for users who provided various dumps of those cards for research)
* NFC: Added simple key name display to UI to fix regression
@@ -24,6 +24,9 @@
* Apps: **Bluetooth Remote / USB Keyboard & Mouse** - `Movie` and `PTT` modes by @hryamzik
* Apps: **BLE Spam app** updated to latest version (New devices support, + Menu by holding Start) (by @Willy-JL) -> (app can be found in builds ` `, `e`, `n`, `r`)
* Apps: **Check out Apps updates by following** [this link](https://github.com/xMasterX/all-the-plugins/commits/dev)
+* OFW: Mifare Classic nested auth support
+* OFW: ST25TB poller refining + write support
+* OFW: Libraries cleanup; u2f crypto rework to use mbedtls
* OFW: Add the secret door animation
* OFW: Allows you to use UCS-2 in canvas_glyph_width
* OFW: Mifare Classic fixes
From 159aef022bed497b65e1a955ef9c9dbe036f4612 Mon Sep 17 00:00:00 2001
From: MX <10697207+xMasterX@users.noreply.github.com>
Date: Fri, 1 Dec 2023 22:51:21 +0300
Subject: [PATCH 7/7] Fix keeloq decoding order
---
lib/subghz/protocols/keeloq.c | 70 ++++++++++++++++++++++++++++-------
1 file changed, 57 insertions(+), 13 deletions(-)
diff --git a/lib/subghz/protocols/keeloq.c b/lib/subghz/protocols/keeloq.c
index 0bda954ba..464f27ac5 100644
--- a/lib/subghz/protocols/keeloq.c
+++ b/lib/subghz/protocols/keeloq.c
@@ -138,6 +138,7 @@ static bool subghz_protocol_keeloq_gen_data(
uint64_t man = 0;
uint64_t code_found_reverse;
int res = 0;
+ // No mf name set? -> set to ""
if(instance->manufacture_name == 0x0) {
instance->manufacture_name = "";
}
@@ -169,7 +170,11 @@ static bool subghz_protocol_keeloq_gen_data(
hop = 0x1A2B3C4D;
}
if(counter_up && prog_mode == PROG_MODE_OFF) {
+ // Counter increment conditions
+
+ // If counter is 0xFFFF we will reset it to 0
if(instance->generic.cnt < 0xFFFF) {
+ // Increase counter with value set in global settings (mult)
if((instance->generic.cnt + furi_hal_subghz_get_rolling_counter_mult()) > 0xFFFF) {
instance->generic.cnt = 0;
} else {
@@ -182,13 +187,16 @@ static bool subghz_protocol_keeloq_gen_data(
if(prog_mode == PROG_MODE_OFF) {
// Protocols that do not use encryption
if(strcmp(instance->manufacture_name, "Unknown") == 0) {
+ // Simple Replay of received code
code_found_reverse = subghz_protocol_blocks_reverse_key(
instance->generic.data, instance->generic.data_count_bit);
hop = code_found_reverse & 0x00000000ffffffff;
} else if(strcmp(instance->manufacture_name, "AN-Motors") == 0) {
+ // An-Motors encode
hop = (instance->generic.cnt & 0xFF) << 24 | (instance->generic.cnt & 0xFF) << 16 |
(btn & 0xF) << 12 | 0x404;
} else if(strcmp(instance->manufacture_name, "HCS101") == 0) {
+ // HCS101 Encode
hop = instance->generic.cnt << 16 | (btn & 0xF) << 12 | 0x000;
} else {
// Protocols that use encryption
@@ -235,6 +243,7 @@ static bool subghz_protocol_keeloq_gen_data(
decrypt = btn << 28 | (0x1CE) << 16 | instance->generic.cnt;
// Centurion -> no serial in hop, uses fixed value 0x1CE - normal learning
}
+ // Old type selector fixage for compatibilitiy with old signal files
uint8_t kl_type_en = instance->keystore->kl_type;
for
M_EACH(
@@ -302,6 +311,7 @@ static bool subghz_protocol_keeloq_gen_data(
}
}
if(hop) {
+ // If we have hop - we will save it to generic data var that will be used later in transmission
uint64_t yek = (uint64_t)fix << 32 | hop;
instance->generic.data =
subghz_protocol_blocks_reverse_key(yek, instance->generic.data_count_bit);
@@ -379,15 +389,18 @@ static bool
subghz_custom_btn_set_original(btn);
}
+ // No mf name set? -> set to ""
if(instance->manufacture_name == 0x0) {
instance->manufacture_name = "";
}
+ // Prog mode checks and extra fixage of MF Names
ProgMode prog_mode = subghz_custom_btn_get_prog_mode();
if(prog_mode == PROG_MODE_KEELOQ_BFT) {
instance->manufacture_name = "BFT";
} else if(prog_mode == PROG_MODE_KEELOQ_APRIMATIC) {
instance->manufacture_name = "Aprimatic";
}
+ // Custom button (programming mode button) for BFT and Aprimatic
uint8_t klq_last_custom_btn = 0xA;
if((strcmp(instance->manufacture_name, "BFT") == 0) ||
(strcmp(instance->manufacture_name, "Aprimatic") == 0)) {
@@ -945,6 +958,7 @@ static uint8_t subghz_protocol_keeloq_check_remote_controller_selector(
}
}
+ // MF not found
*manufacture_name = "Unknown";
keystore->mfname = "Unknown";
instance->cnt = 0;
@@ -956,6 +970,7 @@ static void subghz_protocol_keeloq_check_remote_controller(
SubGhzBlockGeneric* instance,
SubGhzKeystore* keystore,
const char** manufacture_name) {
+ // Reverse key, split FIX and HOP parts
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;
@@ -964,27 +979,54 @@ static void subghz_protocol_keeloq_check_remote_controller(
// If we are in BFT / Aprimatic programming mode we will set previous remembered counter and skip mf keys check
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";
- 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";
- keystore->mfname = *manufacture_name;
- instance->cnt = key_hop >> 16;
+ // Case when we have no mf name means that we are checking for the first time and we have to check all conditions
+ if((strlen(keystore->mfname) < 1) && strlen(*manufacture_name) < 1) {
+ // 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";
+ 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";
+ keystore->mfname = *manufacture_name;
+ instance->cnt = key_hop >> 16;
+ } else {
+ subghz_protocol_keeloq_check_remote_controller_selector(
+ instance, key_fix, key_hop, keystore, manufacture_name);
+ }
} else {
- subghz_protocol_keeloq_check_remote_controller_selector(
- instance, key_fix, key_hop, keystore, manufacture_name);
+ // If we have mfname and its one of AN-Motors or HCS101 we should preform only check for this system
+ if((strcmp(keystore->mfname, "AN-Motors") == 0) ||
+ (strcmp(keystore->mfname, "HCS101") == 0)) {
+ // 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";
+ 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";
+ keystore->mfname = *manufacture_name;
+ instance->cnt = key_hop >> 16;
+ }
+ } else {
+ // Else we have mfname that is not AN-Motors or HCS101 we should check it via default selector
+ subghz_protocol_keeloq_check_remote_controller_selector(
+ instance, key_fix, key_hop, keystore, manufacture_name);
+ }
}
+ // Save original counter as temp counter in case of later usage of prog mode
temp_counter = instance->cnt;
} else if(prog_mode == PROG_MODE_KEELOQ_BFT) {
+ // When we are in prog mode we should fix mfname and apply temp counter
*manufacture_name = "BFT";
keystore->mfname = *manufacture_name;
instance->cnt = temp_counter;
} else if(prog_mode == PROG_MODE_KEELOQ_APRIMATIC) {
+ // When we are in prog mode we should fix mfname and apply temp counter
*manufacture_name = "Aprimatic";
keystore->mfname = *manufacture_name;
instance->cnt = temp_counter;
@@ -993,6 +1035,7 @@ static void subghz_protocol_keeloq_check_remote_controller(
furi_crash("Unsupported Prog Mode");
}
+ // Get serial and button code from FIX part of the key
instance->serial = key_fix & 0x0FFFFFFF;
instance->btn = key_fix >> 28;
@@ -1000,6 +1043,7 @@ static void subghz_protocol_keeloq_check_remote_controller(
if(subghz_custom_btn_get_original() == 0) {
subghz_custom_btn_set_original(instance->btn);
}
+ // Set max custom buttons
subghz_custom_btn_set_max(4);
}
@@ -1265,7 +1309,7 @@ void subghz_protocol_decoder_keeloq_get_string(void* context, FuriString* output
code_found_reverse_hi,
code_found_reverse_lo,
instance->generic.btn,
- instance->manufacture_name);
+ instance->manufacture_name);
} else {
furi_string_cat_printf(
output,