genie_recorder 1.3 (no private API)
This commit is contained in:
parent
1cc4506a6b
commit
4202990995
@ -1,5 +1,10 @@
|
||||
# Genie garage door recorder
|
||||
|
||||
Watch this [YouTube video](https://youtu.be/C-TnlVM4Ahs) for a demo of installing and running this application.
|
||||
|
||||
* You MUST need to edit ``lib\subghz\protocols\keeloq.c`` to change the timing values; or else the application will not work!
|
||||
* NOTE: You no longer have to edit ``api_symbols.csv`` file.
|
||||
|
||||
## Description
|
||||
This program was written to allow the Flipper Zero to press buttons on a Genie garage door opened and record the rolling code. The goal is to capture all 65,536 signals (which hopefully repeats when it gets to the end). Our click speed is current 2000ms per click + however long it takes to get the signal. So if we assume it's 1000-1500/hr = about 3 days?
|
||||
|
||||
@ -16,10 +21,8 @@ WARNING -- This could desync your remote from the receiver.
|
||||
WARNING -- Don't run this near your garage. There is no reason to open the physical garage door & you will likely burn out the motor.
|
||||
|
||||
## Running
|
||||
- Step 0. Copy [these files](https://github.com/jamisonderek/flipper-zero-tutorials/tree/main/subghz/apps/genie-recorder) into your firmware ``applications_user\genie-recorder`` folder.
|
||||
- Step 1. Build your firmware. You will get a build error.
|
||||
- Step 2. Edit your ``firmware\targets\f7\api_symbols.csv`` file so that storage_file_sync is public.
|
||||
``Function,+,storage_file_sync,_Bool,File*``
|
||||
- Step 1. Copy [these files](https://github.com/jamisonderek/flipper-zero-tutorials/tree/main/subghz/apps/genie-recorder) into your firmware ``applications_user\genie-recorder`` folder.
|
||||
- Step 2. Build your firmware.
|
||||
- Step 3. Edit ``lib\subghz\protocols\keeloq.c`` so it have te_short=200, te_long=400, te_delta=70. NOTE: This will no longer be able to receive signals from other KeeLoq devices.
|
||||
- Step 4. Build your firmware & deploy onto Flipper.
|
||||
- Step 5. On your Flipper Zero, load ``Sub-GHz`` app.
|
||||
@ -42,8 +45,7 @@ WARNING -- Don't run this near your garage. There is no reason to open the phys
|
||||
- Step 18. Let it run for three days (the goal is to capture at least 65,536+ signals)
|
||||
- Step 19. Press the BACK button twice to exit the application.
|
||||
- Step 20. Copy the file "\apps_data\genie\keys.txt" from the SD card to your computer.
|
||||
|
||||
- Step 21. Edit ``lib\subghz\protocols\keeloq.c`` so it have te_short=400, te_long=800, te_delta=140.
|
||||
- Step 21. Edit ``lib\subghz\protocols\keeloq.c`` so it has original values of te_short=400, te_long=800, te_delta=140.
|
||||
- Step 22. Build your firmware & deploy onto Flipper.
|
||||
|
||||
Now that you have the keys.txt file, you can use the [Genie.py script](https://github.com/jamisonderek/flipper-zero-tutorials/tree/main/subghz/samples/genie-girud-1t/README.md) to generate a genie.sub file that will transmit the key.
|
||||
|
@ -5,7 +5,7 @@ App(
|
||||
entry_point="genie_record_app",
|
||||
requires=["gui", "subghz"],
|
||||
stack_size=2 * 1024,
|
||||
fap_version=(1, 2),
|
||||
fap_version=(1, 3),
|
||||
fap_icon="genie.png",
|
||||
fap_category="Sub-GHz",
|
||||
fap_icon_assets="assets",
|
||||
|
@ -176,7 +176,6 @@ void genie_exit_callback(void* context) {
|
||||
release_button(app);
|
||||
stop_listening(app->genie_subghz);
|
||||
furi_timer_stop(app->timer);
|
||||
genie_file_close();
|
||||
}
|
||||
|
||||
GenieApp* genie_app_alloc() {
|
||||
@ -223,14 +222,20 @@ GenieApp* genie_app_alloc() {
|
||||
0,
|
||||
128,
|
||||
64,
|
||||
"Genie garage door recorder.\nVersion 1.2\n---\n"
|
||||
"Genie garage door recorder.\n"
|
||||
"Version 1.3\n---\n"
|
||||
"Custom keeloq.c firmware\n"
|
||||
"is required for this app.\n"
|
||||
"---\n"
|
||||
"This app clicks your remote\n"
|
||||
"and records the keys, so you\n"
|
||||
"can replay them later.\n"
|
||||
"Connect your remote to pin\n"
|
||||
"A7 and GND. Wiring diagram\n"
|
||||
"at https://tinyurl.com/genierecorder or github.\n"
|
||||
"Once connected run Start!\n---\n"
|
||||
"Once connected and\n"
|
||||
"firmware is updated,\n"
|
||||
"run Start!\n---\n"
|
||||
"author: @codeallnight\n"
|
||||
"https://discord.com/invite/NsjCvqwPAd\n"
|
||||
"https://youtube.com/@MrDerekJamison\n"
|
||||
|
@ -27,104 +27,57 @@ static void ensure_save_folder_exists(Storage* storage) {
|
||||
ensure_dir_exists(storage, GENIE_SAVE_FOLDER);
|
||||
}
|
||||
|
||||
Storage* _storage;
|
||||
File* _file;
|
||||
|
||||
void genie_file_init() {
|
||||
_storage = furi_record_open(RECORD_STORAGE);
|
||||
ensure_save_folder_exists(_storage);
|
||||
_file = storage_file_alloc(_storage);
|
||||
storage_file_open(
|
||||
_file,
|
||||
(GENIE_SAVE_FOLDER "/" GENIE_SAVE_NAME GENIE_SAVE_EXTENSION),
|
||||
FSAM_WRITE,
|
||||
FSOM_OPEN_APPEND);
|
||||
}
|
||||
|
||||
void genie_file_close() {
|
||||
if(_file) {
|
||||
storage_file_close(_file);
|
||||
_file = NULL;
|
||||
}
|
||||
|
||||
if(_storage) {
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
_storage = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void demo() {
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
File* file = storage_file_alloc(storage);
|
||||
if(storage_file_open(
|
||||
file,
|
||||
(GENIE_SAVE_FOLDER "/" GENIE_SAVE_NAME GENIE_SAVE_EXTENSION),
|
||||
FSAM_WRITE,
|
||||
FSOM_OPEN_APPEND)) {
|
||||
if(!storage_file_write(_file, "Hello\r\n", 7)) {
|
||||
FURI_LOG_E(TAG, "Failed to write to file");
|
||||
}
|
||||
} else {
|
||||
FURI_LOG_E(TAG, "Failed to open file");
|
||||
}
|
||||
storage_file_close(file);
|
||||
ensure_save_folder_exists(storage);
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
}
|
||||
|
||||
bool genie_save(uint32_t count, FuriString* key) {
|
||||
bool success = false;
|
||||
// Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
|
||||
char buffer[8 + 1 + 16 + 2 + 1] = {0};
|
||||
snprintf(buffer, 8 + 1 + 16 + 2 + 1, "%08lX,%s\r\n", count, furi_string_get_cstr(key));
|
||||
|
||||
// File* file = NULL;
|
||||
File* file = NULL;
|
||||
do {
|
||||
// if(!storage) {
|
||||
// FURI_LOG_E(TAG, "Failed to access storage");
|
||||
// break;
|
||||
// }
|
||||
|
||||
// file = storage_file_alloc(storage);
|
||||
// if(storage_file_open(
|
||||
// file,
|
||||
// (GENIE_SAVE_FOLDER "/" GENIE_SAVE_NAME GENIE_SAVE_EXTENSION),
|
||||
// FSAM_WRITE,
|
||||
// FSOM_OPEN_APPEND))
|
||||
if(_file == NULL) {
|
||||
genie_file_init();
|
||||
if(!storage) {
|
||||
FURI_LOG_E(TAG, "Failed to access storage");
|
||||
break;
|
||||
}
|
||||
|
||||
if(_file) {
|
||||
if(!storage_file_write(_file, buffer, COUNT_OF(buffer) - 1)) {
|
||||
file = storage_file_alloc(storage);
|
||||
if(file && storage_file_open(
|
||||
file,
|
||||
(GENIE_SAVE_FOLDER "/" GENIE_SAVE_NAME GENIE_SAVE_EXTENSION),
|
||||
FSAM_WRITE,
|
||||
FSOM_OPEN_APPEND)) {
|
||||
if(!storage_file_write(file, buffer, COUNT_OF(buffer) - 1)) {
|
||||
FURI_LOG_E(TAG, "Failed to write to file");
|
||||
break;
|
||||
}
|
||||
|
||||
storage_file_sync(_file);
|
||||
|
||||
success = true;
|
||||
} else {
|
||||
FURI_LOG_E(TAG, "Failed to open file");
|
||||
break;
|
||||
}
|
||||
} while(false);
|
||||
|
||||
// if(file) {
|
||||
// storage_file_close(file);
|
||||
// }
|
||||
if(file) {
|
||||
storage_file_close(file);
|
||||
storage_file_free(file);
|
||||
}
|
||||
|
||||
// furi_record_close(RECORD_STORAGE);
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
return success;
|
||||
}
|
||||
|
||||
uint32_t genie_load() {
|
||||
uint32_t count = 0;
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
FuriString* file_path = furi_string_alloc();
|
||||
|
||||
FuriString* buffer = furi_string_alloc();
|
||||
|
||||
furi_string_printf(
|
||||
file_path, "%s/%s%s", GENIE_SAVE_FOLDER, GENIE_SAVE_NAME, GENIE_SAVE_EXTENSION);
|
||||
|
||||
File* file = NULL;
|
||||
do {
|
||||
if(!storage) {
|
||||
@ -136,8 +89,11 @@ uint32_t genie_load() {
|
||||
|
||||
file = storage_file_alloc(storage);
|
||||
if(storage_file_open(
|
||||
file, furi_string_get_cstr(file_path), FSAM_READ, FSOM_OPEN_EXISTING)) {
|
||||
FURI_LOG_D(TAG, "Reading file: %s", furi_string_get_cstr(file_path));
|
||||
file,
|
||||
(GENIE_SAVE_FOLDER "/" GENIE_SAVE_NAME GENIE_SAVE_EXTENSION),
|
||||
FSAM_READ,
|
||||
FSOM_OPEN_EXISTING)) {
|
||||
FURI_LOG_D(TAG, "Reading file.");
|
||||
|
||||
char data[8 + 1 + 16 + 2 + 1] = {0};
|
||||
|
||||
@ -150,9 +106,9 @@ uint32_t genie_load() {
|
||||
|
||||
if(file) {
|
||||
storage_file_close(file);
|
||||
storage_file_free(file);
|
||||
}
|
||||
|
||||
furi_string_free(file_path);
|
||||
furi_string_free(buffer);
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
return count;
|
||||
|
@ -4,6 +4,4 @@
|
||||
|
||||
bool genie_save(uint32_t count, FuriString* key);
|
||||
uint32_t genie_load();
|
||||
|
||||
void genie_file_init();
|
||||
void genie_file_close();
|
||||
void genie_file_init();
|
Loading…
Reference in New Issue
Block a user