Merge branch 'DarkFlippers:dev' into dev

This commit is contained in:
Eng1n33r 2023-08-23 20:35:41 +03:00 committed by GitHub
commit 091d32ed7a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 47 additions and 141 deletions

View file

@ -224,7 +224,6 @@ void desktop_lock(Desktop* desktop) {
scene_manager_set_scene_state(
desktop->scene_manager, DesktopSceneLocked, SCENE_LOCKED_FIRST_ENTER);
scene_manager_next_scene(desktop->scene_manager, DesktopSceneLocked);
notification_message(desktop->notification, &sequence_display_backlight_off_delay_1000);
DesktopStatus status = {.locked = true};
furi_pubsub_publish(desktop->status_pubsub, &status);

View file

@ -1,41 +0,0 @@
## From https://github.com/RfidResearchGroup/proxmark3/blob/master/client/dictionaries/iclass_default_keys.dic
# key1/Kc from PicoPass 2k documentation
7665544332211000
# SAGEM
0123456789ABCDEF
# PicoPass Default Exchange Key
5CBCF1DA45D5FB4F
# From HID multiclassSE reader
31ad7ebd2f282168
# From pastebin: https://pastebin.com/uHqpjiuU
6EFD46EFCBB3C875
E033CA419AEE43F9
# default picopass KD / Page 0 / Book 1
FDCB5A52EA8F3090
237FF9079863DF44
5ADC25FB27181D32
83B881F2936B2E49
43644E61EE866BA5
897034143D016080
82D17B44C0122963
4895CA7DE65E2025
DADAD4C57BE271B7
E41E9EDEF5719ABF
293D275EC3AF9C7F
C3C169251B8A70FB
F41DAF58B20C8B91
28877A609EC0DD2B
66584C91EE80D5E5
C1B74D7478053AE2
# default iCLASS RFIDeas
6B65797374726B72
# CTF key
5C100DF7042EAE64
# iCopy-X DRM key (iCE product)
2020666666668888

View file

@ -1,47 +0,0 @@
## From https://github.com/RfidResearchGroup/proxmark3/blob/master/client/dictionaries/iclass_default_keys.dic
# AA1
AEA684A6DAB23278
# key1/Kc from PicoPass 2k documentation
7665544332211000
# SAGEM
0123456789ABCDEF
# from loclass demo file.
5b7c62c491c11b39
# Kd from PicoPass 2k documentation
F0E1D2C3B4A59687
# PicoPass Default Exchange Key
5CBCF1DA45D5FB4F
# From HID multiclassSE reader
31ad7ebd2f282168
# From pastebin: https://pastebin.com/uHqpjiuU
6EFD46EFCBB3C875
E033CA419AEE43F9
# iCopy-x DRM keys
# iCL tags
2020666666668888
# iCS tags reversed from the SOs
6666202066668888
# default picopass KD / Page 0 / Book 1
FDCB5A52EA8F3090
237FF9079863DF44
5ADC25FB27181D32
83B881F2936B2E49
43644E61EE866BA5
897034143D016080
82D17B44C0122963
4895CA7DE65E2025
DADAD4C57BE271B7
E41E9EDEF5719ABF
293D275EC3AF9C7F
C3C169251B8A70FB
F41DAF58B20C8B91
28877A609EC0DD2B
66584C91EE80D5E5
C1B74D7478053AE2
# default iCLASS RFIDeas
6B65797374726B72

View file

@ -128,19 +128,22 @@ void furi_hal_resources_init_early() {
furi_hal_resources_init_input_pins(GpioModeInput);
// Explicit, surviving reset, pulls
LL_PWR_EnablePUPDCfg();
LL_PWR_EnableGPIOPullDown(LL_PWR_GPIO_A, LL_PWR_GPIO_BIT_8); // gpio_vibro
LL_PWR_EnableGPIOPullDown(LL_PWR_GPIO_B, LL_PWR_GPIO_BIT_8); // gpio_speaker
// SD Card stepdown control
furi_hal_gpio_write(&gpio_periph_power, 1);
furi_hal_gpio_init(&gpio_periph_power, GpioModeOutputOpenDrain, GpioPullNo, GpioSpeedLow);
// Display pins
furi_hal_gpio_write(&gpio_display_rst_n, 1);
furi_hal_gpio_write(&gpio_display_rst_n, 0);
furi_hal_gpio_init_simple(&gpio_display_rst_n, GpioModeOutputPushPull);
furi_hal_gpio_init(&gpio_display_di, GpioModeOutputPushPull, GpioPullNo, GpioSpeedLow);
// Pullup display reset pin for shutdown
SET_BIT(PWR->PUCRB, gpio_display_rst_n.pin);
CLEAR_BIT(PWR->PDCRB, gpio_display_rst_n.pin);
SET_BIT(PWR->CR3, PWR_CR3_APC);
LL_PWR_EnableGPIOPullUp(LL_PWR_GPIO_B, LL_PWR_GPIO_BIT_0); // gpio_display_rst_n
furi_hal_gpio_write(&gpio_display_di, 0);
furi_hal_gpio_init_simple(&gpio_display_di, GpioModeOutputPushPull);
LL_PWR_EnableGPIOPullDown(LL_PWR_GPIO_B, LL_PWR_GPIO_BIT_1); // gpio_display_di
// Hard reset USB
furi_hal_gpio_write(&gpio_usb_dm, 1);
@ -182,18 +185,6 @@ void furi_hal_resources_init() {
// Button pins
furi_hal_resources_init_input_pins(GpioModeInterruptRiseFall);
// Explicit pulls pins
LL_PWR_EnablePUPDCfg();
LL_PWR_EnableGPIOPullDown(LL_PWR_GPIO_B, LL_PWR_GPIO_BIT_8); // gpio_speaker
LL_PWR_EnableGPIOPullDown(LL_PWR_GPIO_A, LL_PWR_GPIO_BIT_8); // gpio_vibro
// Display pins
furi_hal_gpio_init(&gpio_display_rst_n, GpioModeOutputPushPull, GpioPullNo, GpioSpeedLow);
furi_hal_gpio_write(&gpio_display_rst_n, 0);
furi_hal_gpio_init(&gpio_display_di, GpioModeOutputPushPull, GpioPullNo, GpioSpeedLow);
furi_hal_gpio_write(&gpio_display_di, 0);
// SD pins
furi_hal_gpio_init(&gpio_sdcard_cd, GpioModeInput, GpioPullNo, GpioSpeedLow);
furi_hal_gpio_write(&gpio_sdcard_cd, 0);

View file

@ -117,19 +117,23 @@ void furi_hal_resources_init_early() {
furi_hal_resources_init_input_pins(GpioModeInput);
// Explicit, surviving reset, pulls
LL_PWR_EnablePUPDCfg();
LL_PWR_EnableGPIOPullDown(LL_PWR_GPIO_A, LL_PWR_GPIO_BIT_8); // gpio_vibro
LL_PWR_EnableGPIOPullDown(LL_PWR_GPIO_B, LL_PWR_GPIO_BIT_8); // gpio_speaker
LL_PWR_EnableGPIOPullDown(LL_PWR_GPIO_B, LL_PWR_GPIO_BIT_9); // gpio_infrared_tx
// SD Card stepdown control
furi_hal_gpio_write(&gpio_periph_power, 1);
furi_hal_gpio_init(&gpio_periph_power, GpioModeOutputOpenDrain, GpioPullNo, GpioSpeedLow);
// Display pins
furi_hal_gpio_write(&gpio_display_rst_n, 1);
furi_hal_gpio_write(&gpio_display_rst_n, 0);
furi_hal_gpio_init_simple(&gpio_display_rst_n, GpioModeOutputPushPull);
LL_PWR_EnableGPIOPullUp(LL_PWR_GPIO_B, LL_PWR_GPIO_BIT_0); // gpio_display_rst_n
furi_hal_gpio_write(&gpio_display_di, 0);
furi_hal_gpio_init_simple(&gpio_display_di, GpioModeOutputPushPull);
// Alternative pull configuration for shutdown
SET_BIT(PWR->PUCRB, DISPLAY_RST_Pin);
CLEAR_BIT(PWR->PDCRB, DISPLAY_RST_Pin);
SET_BIT(PWR->CR3, PWR_CR3_APC);
LL_PWR_EnableGPIOPullDown(LL_PWR_GPIO_B, LL_PWR_GPIO_BIT_1); // gpio_display_di
// Hard reset USB
furi_hal_gpio_write(&gpio_usb_dm, 1);
@ -171,19 +175,6 @@ void furi_hal_resources_init() {
// Button pins
furi_hal_resources_init_input_pins(GpioModeInterruptRiseFall);
// Explicit, surviving reset, pulls
LL_PWR_EnablePUPDCfg();
LL_PWR_EnableGPIOPullDown(LL_PWR_GPIO_B, LL_PWR_GPIO_BIT_9); // gpio_infrared_tx
LL_PWR_EnableGPIOPullDown(LL_PWR_GPIO_B, LL_PWR_GPIO_BIT_8); // gpio_speaker
LL_PWR_EnableGPIOPullDown(LL_PWR_GPIO_A, LL_PWR_GPIO_BIT_8); // gpio_vibro
// Display pins
furi_hal_gpio_init(&gpio_display_rst_n, GpioModeOutputPushPull, GpioPullNo, GpioSpeedLow);
furi_hal_gpio_write(&gpio_display_rst_n, 0);
furi_hal_gpio_init(&gpio_display_di, GpioModeOutputPushPull, GpioPullNo, GpioSpeedLow);
furi_hal_gpio_write(&gpio_display_di, 0);
// SD pins
furi_hal_gpio_init(&gpio_sdcard_cd, GpioModeInput, GpioPullNo, GpioSpeedLow);
furi_hal_gpio_write(&gpio_sdcard_cd, 0);

View file

@ -1,5 +1,8 @@
#!/usr/bin/env python3
import time
from typing import Optional
from flipper.app import App
from flipper.storage import FlipperStorage
from flipper.utils.cdc import resolve_port
@ -27,8 +30,20 @@ class Main(App):
)
self.parser_reboot2dfu.set_defaults(func=self.reboot2dfu)
def _get_flipper(self):
if not (port := resolve_port(self.logger, self.args.port)):
def _get_flipper(self, retry_count: Optional[int] = 1):
port = None
self.logger.info(f"Attempting to find flipper with {retry_count} attempts.")
for i in range(retry_count):
time.sleep(1)
self.logger.info(f"Attempting to find flipper #{i}.")
if port := resolve_port(self.logger, self.args.port):
self.logger.info(f"Found flipper at {port}")
break
if not port:
self.logger.info(f"Failed to find flipper")
return None
flipper = FlipperStorage(port)
@ -36,28 +51,28 @@ class Main(App):
return flipper
def power_off(self):
if not (flipper := self._get_flipper()):
if not (flipper := self._get_flipper(retry_count=10)):
return 1
self.logger.debug("Powering off")
self.logger.info("Powering off")
flipper.send("power off" + "\r")
flipper.stop()
return 0
def reboot(self):
if not (flipper := self._get_flipper()):
if not (flipper := self._get_flipper(retry_count=10)):
return 1
self.logger.debug("Rebooting")
self.logger.info("Rebooting")
flipper.send("power reboot" + "\r")
flipper.stop()
return 0
def reboot2dfu(self):
if not (flipper := self._get_flipper()):
if not (flipper := self._get_flipper(retry_count=10)):
return 1
self.logger.debug("Rebooting to DFU")
self.logger.info("Rebooting to DFU")
flipper.send("power reboot2dfu" + "\r")
flipper.stop()

View file

@ -22,14 +22,14 @@ def flp_serial_by_name(flp_name):
if os.path.exists(flp_serial):
return flp_serial
else:
logging.info(f"Couldn't find {logging.info} on this attempt.")
logging.info(f"Couldn't find {flp_name} on this attempt.")
if os.path.exists(flp_name):
return flp_name
else:
return ""
UPDATE_TIMEOUT = 60 * 4 # 4 minutes
UPDATE_TIMEOUT = 30 * 4 # 4 minutes
def main():
@ -50,7 +50,7 @@ def main():
if flipper == "":
logging.error("Flipper not found!")
sys.exit(1)
exit(1)
logging.info(f"Found Flipper at {flipper}")

View file

@ -20,14 +20,12 @@ def main():
logging.error("Flipper not found!")
sys.exit(1)
with serial.Serial(flp_serial, timeout=10) as flipper:
with serial.Serial(flp_serial, timeout=150) as flipper:
logging.info(f"Found Flipper at {flp_serial}")
flipper.baudrate = 230400
flipper.flushOutput()
flipper.flushInput()
flipper.timeout = 300
flipper.read_until(b">: ").decode("utf-8")
flipper.write(b"unit_tests\r")
data = flipper.read_until(b">: ").decode("utf-8")