Merge remote-tracking branch 'origin/dev' into release-candidate
This commit is contained in:
commit
279a33dc8c
@ -16,6 +16,7 @@ PicopassDevice* picopass_device_alloc() {
|
||||
PicopassDevice* picopass_dev = malloc(sizeof(PicopassDevice));
|
||||
picopass_dev->dev_data.pacs.legacy = false;
|
||||
picopass_dev->dev_data.pacs.se_enabled = false;
|
||||
picopass_dev->dev_data.pacs.elite_kdf = false;
|
||||
picopass_dev->dev_data.pacs.pin_length = 0;
|
||||
picopass_dev->storage = furi_record_open(RECORD_STORAGE);
|
||||
picopass_dev->dialogs = furi_record_open(RECORD_DIALOGS);
|
||||
@ -77,6 +78,7 @@ static bool picopass_device_save_file(
|
||||
break;
|
||||
}
|
||||
}
|
||||
// TODO: Add elite
|
||||
if(!flipper_format_write_comment_cstr(file, "Picopass blocks")) break;
|
||||
bool block_saved = true;
|
||||
|
||||
@ -256,6 +258,7 @@ void picopass_device_data_clear(PicopassDeviceData* dev_data) {
|
||||
}
|
||||
dev_data->pacs.legacy = false;
|
||||
dev_data->pacs.se_enabled = false;
|
||||
dev_data->pacs.elite_kdf = false;
|
||||
dev_data->pacs.pin_length = 0;
|
||||
}
|
||||
|
||||
|
||||
@ -62,6 +62,7 @@ typedef struct {
|
||||
bool sio;
|
||||
bool biometrics;
|
||||
uint8_t key[8];
|
||||
bool elite_kdf;
|
||||
uint8_t pin_length;
|
||||
PicopassEncryption encryption;
|
||||
uint8_t credential[8];
|
||||
|
||||
@ -550,6 +550,7 @@ void picopass_worker_elite_dict_attack(PicopassWorker* picopass_worker) {
|
||||
if(err == ERR_NONE) {
|
||||
FURI_LOG_I(TAG, "Found key");
|
||||
memcpy(pacs->key, key, PICOPASS_BLOCK_LEN);
|
||||
pacs->elite_kdf = elite;
|
||||
err = picopass_read_card(AA1);
|
||||
if(err != ERR_NONE) {
|
||||
FURI_LOG_E(TAG, "picopass_read_card error %d", err);
|
||||
@ -720,7 +721,7 @@ void picopass_worker_write_key(PicopassWorker* picopass_worker) {
|
||||
uint8_t* oldKey = AA1[PICOPASS_KD_BLOCK_INDEX].data;
|
||||
|
||||
uint8_t newKey[PICOPASS_BLOCK_LEN] = {0};
|
||||
loclass_iclass_calc_div_key(csn, pacs->key, newKey, false);
|
||||
loclass_iclass_calc_div_key(csn, pacs->key, newKey, pacs->elite_kdf);
|
||||
|
||||
if((fuses & 0x80) == 0x80) {
|
||||
FURI_LOG_D(TAG, "Plain write for personalized mode key change");
|
||||
|
||||
@ -60,24 +60,28 @@ bool picopass_scene_key_menu_on_event(void* context, SceneManagerEvent event) {
|
||||
scene_manager_set_scene_state(
|
||||
picopass->scene_manager, PicopassSceneKeyMenu, SubmenuIndexWriteStandard);
|
||||
memcpy(picopass->dev->dev_data.pacs.key, picopass_iclass_key, PICOPASS_BLOCK_LEN);
|
||||
picopass->dev->dev_data.pacs.elite_kdf = false;
|
||||
scene_manager_next_scene(picopass->scene_manager, PicopassSceneWriteKey);
|
||||
consumed = true;
|
||||
} else if(event.event == SubmenuIndexWriteiCE) {
|
||||
scene_manager_set_scene_state(
|
||||
picopass->scene_manager, PicopassSceneKeyMenu, SubmenuIndexWriteiCE);
|
||||
memcpy(picopass->dev->dev_data.pacs.key, picopass_xice_key, PICOPASS_BLOCK_LEN);
|
||||
picopass->dev->dev_data.pacs.elite_kdf = true;
|
||||
scene_manager_next_scene(picopass->scene_manager, PicopassSceneWriteKey);
|
||||
consumed = true;
|
||||
} else if(event.event == SubmenuIndexWriteiCL) {
|
||||
scene_manager_set_scene_state(
|
||||
picopass->scene_manager, PicopassSceneKeyMenu, SubmenuIndexWriteiCE);
|
||||
picopass->scene_manager, PicopassSceneKeyMenu, SubmenuIndexWriteiCL);
|
||||
memcpy(picopass->dev->dev_data.pacs.key, picopass_xicl_key, PICOPASS_BLOCK_LEN);
|
||||
picopass->dev->dev_data.pacs.elite_kdf = false;
|
||||
scene_manager_next_scene(picopass->scene_manager, PicopassSceneWriteKey);
|
||||
consumed = true;
|
||||
} else if(event.event == SubmenuIndexWriteiCS) {
|
||||
scene_manager_set_scene_state(
|
||||
picopass->scene_manager, PicopassSceneKeyMenu, SubmenuIndexWriteiCE);
|
||||
picopass->scene_manager, PicopassSceneKeyMenu, SubmenuIndexWriteiCS);
|
||||
memcpy(picopass->dev->dev_data.pacs.key, picopass_xics_key, PICOPASS_BLOCK_LEN);
|
||||
picopass->dev->dev_data.pacs.elite_kdf = false;
|
||||
scene_manager_next_scene(picopass->scene_manager, PicopassSceneWriteKey);
|
||||
consumed = true;
|
||||
}
|
||||
|
||||
@ -8,11 +8,17 @@
|
||||
|
||||
static void subghz_txrx_radio_device_power_on(SubGhzTxRx* instance) {
|
||||
UNUSED(instance);
|
||||
uint8_t attempts = 0;
|
||||
while(!furi_hal_power_is_otg_enabled() && attempts++ < 5) {
|
||||
furi_hal_power_enable_otg();
|
||||
//CC1101 power-up time
|
||||
furi_delay_ms(10);
|
||||
uint8_t attempts = 5;
|
||||
while(--attempts > 0) {
|
||||
if(furi_hal_power_enable_otg()) break;
|
||||
}
|
||||
if(attempts == 0) {
|
||||
if(furi_hal_power_get_usb_voltage() < 4.5f) {
|
||||
FURI_LOG_E(
|
||||
TAG,
|
||||
"Error power otg enable. BQ2589 check otg fault = %d",
|
||||
furi_hal_power_check_otg_fault() ? 1 : 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,11 +1,15 @@
|
||||
#include "../desktop_settings_app.h"
|
||||
#include "applications.h"
|
||||
#include "desktop_settings_scene.h"
|
||||
#include <flipper_application/flipper_application.h>
|
||||
#include <storage/storage.h>
|
||||
#include <dialogs/dialogs.h>
|
||||
|
||||
#define EXTERNAL_BROWSER_NAME ("Applications")
|
||||
#define EXTERNAL_BROWSER_INDEX (FLIPPER_APPS_COUNT + 1)
|
||||
|
||||
#define EXTERNAL_APPLICATION_NAME ("[External Application]")
|
||||
#define EXTERNAL_APPLICATION_INDEX (FLIPPER_APPS_COUNT + 1)
|
||||
#define EXTERNAL_APPLICATION_INDEX (FLIPPER_APPS_COUNT + 2)
|
||||
|
||||
static bool favorite_fap_selector_item_callback(
|
||||
FuriString* file_path,
|
||||
@ -13,16 +17,9 @@ static bool favorite_fap_selector_item_callback(
|
||||
uint8_t** icon_ptr,
|
||||
FuriString* item_name) {
|
||||
UNUSED(context);
|
||||
#ifdef APP_FAP_LOADER
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
bool success = fap_loader_load_name_and_icon(file_path, storage, icon_ptr, item_name);
|
||||
bool success = flipper_application_load_name_and_icon(file_path, storage, icon_ptr, item_name);
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
#else
|
||||
UNUSED(file_path);
|
||||
UNUSED(icon_ptr);
|
||||
UNUSED(item_name);
|
||||
bool success = false;
|
||||
#endif
|
||||
return success;
|
||||
}
|
||||
|
||||
@ -64,14 +61,28 @@ void desktop_settings_scene_favorite_on_enter(void* context) {
|
||||
}
|
||||
}
|
||||
|
||||
// Special case: Application browser
|
||||
submenu_add_item(
|
||||
submenu,
|
||||
EXTERNAL_BROWSER_NAME,
|
||||
EXTERNAL_BROWSER_INDEX,
|
||||
desktop_settings_scene_favorite_submenu_callback,
|
||||
app);
|
||||
|
||||
// Special case: Specific application
|
||||
submenu_add_item(
|
||||
submenu,
|
||||
EXTERNAL_APPLICATION_NAME,
|
||||
EXTERNAL_APPLICATION_INDEX,
|
||||
desktop_settings_scene_favorite_submenu_callback,
|
||||
app);
|
||||
|
||||
if(curr_favorite_app->is_external) {
|
||||
pre_select_item = EXTERNAL_APPLICATION_INDEX;
|
||||
if(curr_favorite_app->name_or_path[0] == '\0') {
|
||||
pre_select_item = EXTERNAL_BROWSER_INDEX;
|
||||
} else {
|
||||
pre_select_item = EXTERNAL_APPLICATION_INDEX;
|
||||
}
|
||||
}
|
||||
|
||||
submenu_set_header(
|
||||
@ -92,7 +103,11 @@ bool desktop_settings_scene_favorite_on_event(void* context, SceneManagerEvent e
|
||||
&app->settings.favorite_secondary;
|
||||
|
||||
if(event.type == SceneManagerEventTypeCustom) {
|
||||
if(event.event == EXTERNAL_APPLICATION_INDEX) {
|
||||
if(event.event == EXTERNAL_BROWSER_INDEX) {
|
||||
curr_favorite_app->is_external = true;
|
||||
curr_favorite_app->name_or_path[0] = '\0';
|
||||
consumed = true;
|
||||
} else if(event.event == EXTERNAL_APPLICATION_INDEX) {
|
||||
const DialogsFileBrowserOptions browser_options = {
|
||||
.extension = ".fap",
|
||||
.icon = &I_unknown_10px,
|
||||
|
||||
@ -1 +1 @@
|
||||
Subproject commit f71c4b7f750f2539a1fed08925d8da3abdc80ff9
|
||||
Subproject commit 08a907d95733600becc41c0602ef5ee4c4baf782
|
||||
@ -34,4 +34,8 @@ C1B74D7478053AE2
|
||||
# default iCLASS RFIDeas
|
||||
6B65797374726B72
|
||||
|
||||
# CTF key
|
||||
5C100DF7042EAE64
|
||||
|
||||
# iCopy-X DRM key (iCE product)
|
||||
2020666666668888
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
entry,status,name,type,params
|
||||
Version,+,32.0,,
|
||||
Version,+,33.0,,
|
||||
Header,+,applications/services/bt/bt_service/bt.h,,
|
||||
Header,+,applications/services/cli/cli.h,,
|
||||
Header,+,applications/services/cli/cli_vcp.h,,
|
||||
@ -1030,12 +1030,13 @@ Function,+,furi_hal_mpu_protect_no_access,void,"FuriHalMpuRegion, uint32_t, Furi
|
||||
Function,+,furi_hal_mpu_protect_read_only,void,"FuriHalMpuRegion, uint32_t, FuriHalMPURegionSize"
|
||||
Function,-,furi_hal_os_init,void,
|
||||
Function,+,furi_hal_os_tick,void,
|
||||
Function,+,furi_hal_power_check_otg_fault,_Bool,
|
||||
Function,+,furi_hal_power_check_otg_status,void,
|
||||
Function,+,furi_hal_power_debug_get,void,"PropertyValueCallback, void*"
|
||||
Function,+,furi_hal_power_disable_external_3_3v,void,
|
||||
Function,+,furi_hal_power_disable_otg,void,
|
||||
Function,+,furi_hal_power_enable_external_3_3v,void,
|
||||
Function,+,furi_hal_power_enable_otg,void,
|
||||
Function,+,furi_hal_power_enable_otg,_Bool,
|
||||
Function,+,furi_hal_power_gauge_is_ok,_Bool,
|
||||
Function,+,furi_hal_power_get_bat_health_pct,uint8_t,
|
||||
Function,+,furi_hal_power_get_battery_charge_voltage_limit,float,
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
entry,status,name,type,params
|
||||
Version,+,32.0,,
|
||||
Version,+,33.0,,
|
||||
Header,+,applications/services/bt/bt_service/bt.h,,
|
||||
Header,+,applications/services/cli/cli.h,,
|
||||
Header,+,applications/services/cli/cli_vcp.h,,
|
||||
@ -1235,12 +1235,13 @@ Function,+,furi_hal_nfc_tx_rx,_Bool,"FuriHalNfcTxRxContext*, uint16_t"
|
||||
Function,+,furi_hal_nfc_tx_rx_full,_Bool,FuriHalNfcTxRxContext*
|
||||
Function,-,furi_hal_os_init,void,
|
||||
Function,+,furi_hal_os_tick,void,
|
||||
Function,+,furi_hal_power_check_otg_fault,_Bool,
|
||||
Function,+,furi_hal_power_check_otg_status,void,
|
||||
Function,+,furi_hal_power_debug_get,void,"PropertyValueCallback, void*"
|
||||
Function,+,furi_hal_power_disable_external_3_3v,void,
|
||||
Function,+,furi_hal_power_disable_otg,void,
|
||||
Function,+,furi_hal_power_enable_external_3_3v,void,
|
||||
Function,+,furi_hal_power_enable_otg,void,
|
||||
Function,+,furi_hal_power_enable_otg,_Bool,
|
||||
Function,+,furi_hal_power_gauge_is_ok,_Bool,
|
||||
Function,+,furi_hal_power_get_bat_health_pct,uint8_t,
|
||||
Function,+,furi_hal_power_get_battery_charge_voltage_limit,float,
|
||||
|
||||
|
@ -373,9 +373,6 @@ static void furi_hal_infrared_configure_tim_pwm_tx(uint32_t freq, float duty_cyc
|
||||
LL_TIM_EnableAllOutputs(INFRARED_DMA_TIMER);
|
||||
LL_TIM_DisableIT_UPDATE(INFRARED_DMA_TIMER);
|
||||
LL_TIM_EnableDMAReq_UPDATE(INFRARED_DMA_TIMER);
|
||||
|
||||
NVIC_SetPriority(TIM1_UP_TIM16_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(), 5, 0));
|
||||
NVIC_EnableIRQ(TIM1_UP_TIM16_IRQn);
|
||||
}
|
||||
|
||||
static void furi_hal_infrared_configure_tim_cmgr2_dma_tx(void) {
|
||||
|
||||
@ -62,7 +62,7 @@ const IRQn_Type furi_hal_interrupt_irqn[FuriHalInterruptIdMax] = {
|
||||
|
||||
__attribute__((always_inline)) static inline void
|
||||
furi_hal_interrupt_call(FuriHalInterruptId index) {
|
||||
furi_assert(furi_hal_interrupt_isr[index].isr);
|
||||
furi_check(furi_hal_interrupt_isr[index].isr);
|
||||
furi_hal_interrupt_isr[index].isr(furi_hal_interrupt_isr[index].context);
|
||||
}
|
||||
|
||||
@ -127,16 +127,14 @@ void furi_hal_interrupt_set_isr_ex(
|
||||
uint16_t priority,
|
||||
FuriHalInterruptISR isr,
|
||||
void* context) {
|
||||
furi_assert(index < FuriHalInterruptIdMax);
|
||||
furi_assert(priority < 15);
|
||||
furi_assert(furi_hal_interrupt_irqn[index]);
|
||||
furi_check(index < FuriHalInterruptIdMax);
|
||||
furi_check(priority <= 15);
|
||||
|
||||
if(isr) {
|
||||
// Pre ISR set
|
||||
furi_assert(furi_hal_interrupt_isr[index].isr == NULL);
|
||||
furi_check(furi_hal_interrupt_isr[index].isr == NULL);
|
||||
} else {
|
||||
// Pre ISR clear
|
||||
furi_assert(furi_hal_interrupt_isr[index].isr != NULL);
|
||||
furi_hal_interrupt_disable(index);
|
||||
furi_hal_interrupt_clear_pending(index);
|
||||
}
|
||||
|
||||
@ -284,10 +284,15 @@ void furi_hal_power_reset() {
|
||||
NVIC_SystemReset();
|
||||
}
|
||||
|
||||
void furi_hal_power_enable_otg() {
|
||||
bool furi_hal_power_enable_otg() {
|
||||
furi_hal_i2c_acquire(&furi_hal_i2c_handle_power);
|
||||
bq25896_set_boost_lim(&furi_hal_i2c_handle_power, BoostLim_2150);
|
||||
bq25896_enable_otg(&furi_hal_i2c_handle_power);
|
||||
furi_delay_ms(30);
|
||||
bool ret = bq25896_is_otg_enabled(&furi_hal_i2c_handle_power);
|
||||
bq25896_set_boost_lim(&furi_hal_i2c_handle_power, BoostLim_1400);
|
||||
furi_hal_i2c_release(&furi_hal_i2c_handle_power);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void furi_hal_power_disable_otg() {
|
||||
@ -317,6 +322,13 @@ void furi_hal_power_set_battery_charge_voltage_limit(float voltage) {
|
||||
furi_hal_i2c_release(&furi_hal_i2c_handle_power);
|
||||
}
|
||||
|
||||
bool furi_hal_power_check_otg_fault() {
|
||||
furi_hal_i2c_acquire(&furi_hal_i2c_handle_power);
|
||||
bool ret = bq25896_check_otg_fault(&furi_hal_i2c_handle_power);
|
||||
furi_hal_i2c_release(&furi_hal_i2c_handle_power);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void furi_hal_power_check_otg_status() {
|
||||
furi_hal_i2c_acquire(&furi_hal_i2c_handle_power);
|
||||
if(bq25896_check_otg_fault(&furi_hal_i2c_handle_power))
|
||||
|
||||
@ -99,12 +99,16 @@ void furi_hal_power_reset();
|
||||
|
||||
/** OTG enable
|
||||
*/
|
||||
void furi_hal_power_enable_otg();
|
||||
bool furi_hal_power_enable_otg();
|
||||
|
||||
/** OTG disable
|
||||
*/
|
||||
void furi_hal_power_disable_otg();
|
||||
|
||||
/** Check OTG status fault
|
||||
*/
|
||||
bool furi_hal_power_check_otg_fault();
|
||||
|
||||
/** Check OTG status and disable it if falt happened
|
||||
*/
|
||||
void furi_hal_power_check_otg_status();
|
||||
|
||||
@ -36,7 +36,7 @@ PLACE_IN_SECTION("MB_MEM2") uint32_t __furi_check_registers[13] = {0};
|
||||
*
|
||||
*/
|
||||
#define RESTORE_REGISTERS_AND_HALT_MCU(debug) \
|
||||
register const bool r0 asm("r0") = debug; \
|
||||
register bool r0 asm("r0") = debug; \
|
||||
asm volatile("cbnz r0, with_debugger%= \n" \
|
||||
"ldr r12, =__furi_check_registers\n" \
|
||||
"ldm r12, {r0-r11} \n" \
|
||||
|
||||
@ -61,7 +61,7 @@ void bq25896_init(FuriHalI2cBusHandle* handle) {
|
||||
|
||||
// OTG power configuration
|
||||
bq25896_regs.r0A.BOOSTV = 0x8; // BOOST Voltage: 5.062V
|
||||
bq25896_regs.r0A.BOOST_LIM = BOOST_LIM_1400; // BOOST Current limit: 1.4A
|
||||
bq25896_regs.r0A.BOOST_LIM = BoostLim_1400; // BOOST Current limit: 1.4A
|
||||
furi_hal_i2c_write_reg_8(
|
||||
handle, BQ25896_ADDRESS, 0x0A, *(uint8_t*)&bq25896_regs.r0A, BQ25896_I2C_TIMEOUT);
|
||||
|
||||
@ -74,6 +74,12 @@ void bq25896_init(FuriHalI2cBusHandle* handle) {
|
||||
BQ25896_I2C_TIMEOUT);
|
||||
}
|
||||
|
||||
void bq25896_set_boost_lim(FuriHalI2cBusHandle* handle, BoostLim boost_lim) {
|
||||
bq25896_regs.r0A.BOOST_LIM = boost_lim;
|
||||
furi_hal_i2c_write_reg_8(
|
||||
handle, BQ25896_ADDRESS, 0x0A, *(uint8_t*)&bq25896_regs.r0A, BQ25896_I2C_TIMEOUT);
|
||||
}
|
||||
|
||||
void bq25896_poweroff(FuriHalI2cBusHandle* handle) {
|
||||
bq25896_regs.r09.BATFET_DIS = 1;
|
||||
furi_hal_i2c_write_reg_8(
|
||||
|
||||
@ -9,6 +9,9 @@
|
||||
/** Initialize Driver */
|
||||
void bq25896_init(FuriHalI2cBusHandle* handle);
|
||||
|
||||
/** Set boost lim*/
|
||||
void bq25896_set_boost_lim(FuriHalI2cBusHandle* handle, BoostLim boost_lim);
|
||||
|
||||
/** Send device into shipping mode */
|
||||
void bq25896_poweroff(FuriHalI2cBusHandle* handle);
|
||||
|
||||
|
||||
@ -159,14 +159,16 @@ typedef struct {
|
||||
#define BOOSTV_128 (1 << 1)
|
||||
#define BOOSTV_64 (1 << 0)
|
||||
|
||||
#define BOOST_LIM_500 (0b000)
|
||||
#define BOOST_LIM_750 (0b001)
|
||||
#define BOOST_LIM_1200 (0b010)
|
||||
#define BOOST_LIM_1400 (0b011)
|
||||
#define BOOST_LIM_1650 (0b100)
|
||||
#define BOOST_LIM_1875 (0b101)
|
||||
#define BOOST_LIM_2150 (0b110)
|
||||
#define BOOST_LIM_RSVD (0b111)
|
||||
typedef enum {
|
||||
BoostLim_500 = 0b000,
|
||||
BoostLim_750 = 0b001,
|
||||
BoostLim_1200 = 0b010,
|
||||
BoostLim_1400 = 0b011,
|
||||
BoostLim_1650 = 0b100,
|
||||
BoostLim_1875 = 0b101,
|
||||
BoostLim_2150 = 0b110,
|
||||
BoostLim_Rsvd = 0b111,
|
||||
} BoostLim;
|
||||
|
||||
typedef struct {
|
||||
uint8_t BOOST_LIM : 3; // Boost Mode Current Limit
|
||||
|
||||
@ -724,6 +724,8 @@ void nfc_worker_emulate_mf_ultralight(NfcWorker* nfc_worker) {
|
||||
emulator.auth_received_callback = nfc_worker_mf_ultralight_auth_received_callback;
|
||||
emulator.context = nfc_worker;
|
||||
|
||||
rfal_platform_spi_acquire();
|
||||
|
||||
while(nfc_worker->state == NfcWorkerStateMfUltralightEmulate) {
|
||||
mf_ul_reset_emulation(&emulator, true);
|
||||
furi_hal_nfc_emulate_nfca(
|
||||
@ -743,6 +745,8 @@ void nfc_worker_emulate_mf_ultralight(NfcWorker* nfc_worker) {
|
||||
emulator.data_changed = false;
|
||||
}
|
||||
}
|
||||
|
||||
rfal_platform_spi_release();
|
||||
}
|
||||
|
||||
static bool nfc_worker_mf_get_b_key_from_sector_trailer(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user