mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-12 13:48:35 -07:00
Merge remote-tracking branch 'OFW/dev' into dev
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include <gui/gui.h>
|
||||
#include <input/input.h>
|
||||
#include <lib/toolbox/args.h>
|
||||
#include <lib/toolbox/strint.h>
|
||||
#include <storage/storage.h>
|
||||
#include "ducky_script.h"
|
||||
#include "ducky_script_i.h"
|
||||
@@ -64,7 +65,7 @@ uint16_t ducky_get_keycode(BadUsbScript* bad_usb, const char* param, bool accept
|
||||
|
||||
bool ducky_get_number(const char* param, uint32_t* val) {
|
||||
uint32_t value = 0;
|
||||
if(sscanf(param, "%lu", &value) == 1) {
|
||||
if(strint_to_uint32(param, NULL, &value, 10) == StrintParseNoError) {
|
||||
*val = value;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <furi_hal_infrared.h>
|
||||
#include <flipper_format.h>
|
||||
#include <toolbox/args.h>
|
||||
#include <toolbox/strint.h>
|
||||
#include <m-dict.h>
|
||||
|
||||
#include "infrared_signal.h"
|
||||
@@ -176,25 +177,28 @@ static bool infrared_cli_parse_raw(const char* str, InfraredSignal* signal) {
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32_t* timings = malloc(sizeof(uint32_t) * MAX_TIMINGS_AMOUNT);
|
||||
uint32_t frequency = atoi(frequency_str);
|
||||
float duty_cycle = (float)atoi(duty_cycle_str) / 100;
|
||||
uint32_t frequency;
|
||||
uint32_t duty_cycle_u32;
|
||||
if(strint_to_uint32(frequency_str, NULL, &frequency, 10) != StrintParseNoError ||
|
||||
strint_to_uint32(duty_cycle_str, NULL, &duty_cycle_u32, 10) != StrintParseNoError)
|
||||
return false;
|
||||
float duty_cycle = duty_cycle_u32 / 100.0f;
|
||||
|
||||
str += strlen(frequency_str) + strlen(duty_cycle_str) + INFRARED_CLI_BUF_SIZE;
|
||||
|
||||
uint32_t* timings = malloc(sizeof(uint32_t) * MAX_TIMINGS_AMOUNT);
|
||||
size_t timings_size = 0;
|
||||
while(1) {
|
||||
while(*str == ' ') {
|
||||
++str;
|
||||
}
|
||||
|
||||
char timing_str[INFRARED_CLI_BUF_SIZE];
|
||||
if(sscanf(str, "%9s", timing_str) != 1) {
|
||||
uint32_t timing;
|
||||
char* next_token;
|
||||
if(strint_to_uint32(str, &next_token, &timing, 10) != StrintParseNoError) {
|
||||
break;
|
||||
}
|
||||
|
||||
str += strlen(timing_str);
|
||||
uint32_t timing = atoi(timing_str);
|
||||
str = next_token;
|
||||
|
||||
if((timing <= 0) || (timings_size >= MAX_TIMINGS_AMOUNT)) {
|
||||
break;
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include <flipper_application.h>
|
||||
|
||||
#include <lib/nfc/protocols/mf_desfire/mf_desfire.h>
|
||||
#include <lib/toolbox/strint.h>
|
||||
|
||||
#include <applications/services/locale/locale.h>
|
||||
#include <datetime.h>
|
||||
@@ -72,7 +73,10 @@ static bool itso_parse(const NfcDevice* device, FuriString* parsed_data) {
|
||||
dateBuff[17] = '\0';
|
||||
|
||||
// DateStamp is defined in BS EN 1545 - Days passed since 01/01/1997
|
||||
uint32_t dateStamp = (int)strtol(datep, NULL, 16);
|
||||
uint32_t dateStamp;
|
||||
if(strint_to_uint32(datep, NULL, &dateStamp, 16) != StrintParseNoError) {
|
||||
return false;
|
||||
}
|
||||
uint32_t unixTimestamp = dateStamp * 24 * 60 * 60 + 852076800U;
|
||||
|
||||
furi_string_set(parsed_data, "\e#ITSO Card\n");
|
||||
|
||||
@@ -3,18 +3,20 @@
|
||||
#include <furi.h>
|
||||
#include <furi_hal.h>
|
||||
|
||||
#include <lib/toolbox/args.h>
|
||||
#include <lib/subghz/subghz_keystore.h>
|
||||
#include <applications/drivers/subghz/cc1101_ext/cc1101_ext_interconnect.h>
|
||||
|
||||
#include <lib/subghz/subghz_keystore.h>
|
||||
#include <lib/subghz/receiver.h>
|
||||
#include <lib/subghz/transmitter.h>
|
||||
#include <lib/subghz/subghz_file_encoder_worker.h>
|
||||
#include <lib/subghz/protocols/protocol_items.h>
|
||||
#include <applications/drivers/subghz/cc1101_ext/cc1101_ext_interconnect.h>
|
||||
#include <lib/subghz/devices/cc1101_int/cc1101_int_interconnect.h>
|
||||
#include <lib/subghz/devices/devices.h>
|
||||
#include <lib/subghz/devices/cc1101_configs.h>
|
||||
|
||||
#include <lib/toolbox/args.h>
|
||||
#include <lib/toolbox/strint.h>
|
||||
|
||||
#include "helpers/subghz_chat.h"
|
||||
|
||||
#include <notification/notification_messages.h>
|
||||
@@ -76,9 +78,8 @@ void subghz_cli_command_tx_carrier(Cli* cli, FuriString* args, void* context) {
|
||||
uint32_t frequency = 433920000;
|
||||
|
||||
if(furi_string_size(args)) {
|
||||
int ret = sscanf(furi_string_get_cstr(args), "%lu", &frequency);
|
||||
if(ret != 1) {
|
||||
printf("sscanf returned %d, frequency: %lu\r\n", ret, frequency);
|
||||
if(strint_to_uint32(furi_string_get_cstr(args), NULL, &frequency, 10) !=
|
||||
StrintParseNoError) {
|
||||
cli_print_usage("subghz tx_carrier", "<Frequency: in Hz>", furi_string_get_cstr(args));
|
||||
return;
|
||||
}
|
||||
@@ -120,9 +121,8 @@ void subghz_cli_command_rx_carrier(Cli* cli, FuriString* args, void* context) {
|
||||
uint32_t frequency = 433920000;
|
||||
|
||||
if(furi_string_size(args)) {
|
||||
int ret = sscanf(furi_string_get_cstr(args), "%lu", &frequency);
|
||||
if(ret != 1) {
|
||||
printf("sscanf returned %d, frequency: %lu\r\n", ret, frequency);
|
||||
if(strint_to_uint32(furi_string_get_cstr(args), NULL, &frequency, 10) !=
|
||||
StrintParseNoError) {
|
||||
cli_print_usage("subghz rx_carrier", "<Frequency: in Hz>", furi_string_get_cstr(args));
|
||||
return;
|
||||
}
|
||||
@@ -186,23 +186,14 @@ void subghz_cli_command_tx(Cli* cli, FuriString* args, void* context) {
|
||||
uint32_t device_ind = 0; // 0 - CC1101_INT, 1 - CC1101_EXT
|
||||
|
||||
if(furi_string_size(args)) {
|
||||
int ret = sscanf(
|
||||
furi_string_get_cstr(args),
|
||||
"%lx %lu %lu %lu %lu",
|
||||
&key,
|
||||
&frequency,
|
||||
&te,
|
||||
&repeat,
|
||||
&device_ind);
|
||||
if(ret != 5) {
|
||||
printf(
|
||||
"sscanf returned %d, key: %lx, frequency: %lu, te: %lu, repeat: %lu, device: %lu\r\n ",
|
||||
ret,
|
||||
key,
|
||||
frequency,
|
||||
te,
|
||||
repeat,
|
||||
device_ind);
|
||||
char* args_cstr = (char*)furi_string_get_cstr(args);
|
||||
StrintParseError parse_err = StrintParseNoError;
|
||||
parse_err |= strint_to_uint32(args_cstr, &args_cstr, &key, 16);
|
||||
parse_err |= strint_to_uint32(args_cstr, &args_cstr, &frequency, 10);
|
||||
parse_err |= strint_to_uint32(args_cstr, &args_cstr, &te, 10);
|
||||
parse_err |= strint_to_uint32(args_cstr, &args_cstr, &repeat, 10);
|
||||
parse_err |= strint_to_uint32(args_cstr, &args_cstr, &device_ind, 10);
|
||||
if(parse_err) {
|
||||
cli_print_usage(
|
||||
"subghz tx",
|
||||
"<3 Byte Key: in hex> <Frequency: in Hz> <Te us> <Repeat count> <Device: 0 - CC1101_INT, 1 - CC1101_EXT>",
|
||||
@@ -318,10 +309,11 @@ void subghz_cli_command_rx(Cli* cli, FuriString* args, void* context) {
|
||||
uint32_t device_ind = 0; // 0 - CC1101_INT, 1 - CC1101_EXT
|
||||
|
||||
if(furi_string_size(args)) {
|
||||
int ret = sscanf(furi_string_get_cstr(args), "%lu %lu", &frequency, &device_ind);
|
||||
if(ret != 2) {
|
||||
printf(
|
||||
"sscanf returned %d, frequency: %lu device: %lu\r\n", ret, frequency, device_ind);
|
||||
char* args_cstr = (char*)furi_string_get_cstr(args);
|
||||
StrintParseError parse_err = StrintParseNoError;
|
||||
parse_err |= strint_to_uint32(args_cstr, &args_cstr, &frequency, 10);
|
||||
parse_err |= strint_to_uint32(args_cstr, &args_cstr, &device_ind, 10);
|
||||
if(parse_err) {
|
||||
cli_print_usage(
|
||||
"subghz rx",
|
||||
"<Frequency: in Hz> <Device: 0 - CC1101_INT, 1 - CC1101_EXT>",
|
||||
@@ -405,9 +397,8 @@ void subghz_cli_command_rx_raw(Cli* cli, FuriString* args, void* context) {
|
||||
uint32_t frequency = 433920000;
|
||||
|
||||
if(furi_string_size(args)) {
|
||||
int ret = sscanf(furi_string_get_cstr(args), "%lu", &frequency);
|
||||
if(ret != 1) {
|
||||
printf("sscanf returned %d, frequency: %lu\r\n", ret, frequency);
|
||||
if(strint_to_uint32(furi_string_get_cstr(args), NULL, &frequency, 10) !=
|
||||
StrintParseNoError) {
|
||||
cli_print_usage("subghz rx", "<Frequency: in Hz>", furi_string_get_cstr(args));
|
||||
return;
|
||||
}
|
||||
@@ -624,9 +615,11 @@ void subghz_cli_command_tx_from_file(Cli* cli, FuriString* args, void* context)
|
||||
}
|
||||
|
||||
if(furi_string_size(args)) {
|
||||
int ret = sscanf(furi_string_get_cstr(args), "%lu %lu", &repeat, &device_ind);
|
||||
if(ret != 2) {
|
||||
printf("sscanf returned %d, repeat: %lu device: %lu\r\n", ret, repeat, device_ind);
|
||||
char* args_cstr = (char*)furi_string_get_cstr(args);
|
||||
StrintParseError parse_err = StrintParseNoError;
|
||||
parse_err |= strint_to_uint32(args_cstr, &args_cstr, &frequency, 10);
|
||||
parse_err |= strint_to_uint32(args_cstr, &args_cstr, &device_ind, 10);
|
||||
if(parse_err) {
|
||||
cli_print_usage(
|
||||
"subghz tx_from_file:",
|
||||
"<file_name: path_file> <Repeat count> <Device: 0 - CC1101_INT, 1 - CC1101_EXT>",
|
||||
@@ -939,10 +932,11 @@ static void subghz_cli_command_chat(Cli* cli, FuriString* args) {
|
||||
uint32_t device_ind = 0; // 0 - CC1101_INT, 1 - CC1101_EXT
|
||||
|
||||
if(furi_string_size(args)) {
|
||||
int ret = sscanf(furi_string_get_cstr(args), "%lu %lu", &frequency, &device_ind);
|
||||
if(ret != 2) {
|
||||
printf("sscanf returned %d, Frequency: %lu\r\n", ret, frequency);
|
||||
printf("sscanf returned %d, Device: %lu\r\n", ret, device_ind);
|
||||
char* args_cstr = (char*)furi_string_get_cstr(args);
|
||||
StrintParseError parse_err = StrintParseNoError;
|
||||
parse_err |= strint_to_uint32(args_cstr, &args_cstr, &frequency, 10);
|
||||
parse_err |= strint_to_uint32(args_cstr, &args_cstr, &device_ind, 10);
|
||||
if(parse_err) {
|
||||
cli_print_usage(
|
||||
"subghz chat",
|
||||
"<Frequency: in Hz> <Device: 0 - CC1101_INT, 1 - CC1101_EXT>",
|
||||
|
||||
Reference in New Issue
Block a user