Skip to content

Commit

Permalink
Merge branch 'dev' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
xMasterX committed Oct 10, 2023
2 parents f3f68fd + 130fa43 commit c71d04a
Show file tree
Hide file tree
Showing 207 changed files with 4,067 additions and 3,122 deletions.
7 changes: 7 additions & 0 deletions .ci_files/anims_ofw.txt
Original file line number Diff line number Diff line change
Expand Up @@ -168,3 +168,10 @@ Max butthurt: 13
Min level: 1
Max level: 3
Weight: 4

Name: L2_Coding_in_the_shell_128x64
Min butthurt: 0
Max butthurt: 12
Min level: 2
Max level: 3
Weight: 4
3 changes: 3 additions & 0 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ steps:
- wget https://github.com/xMasterX/all-the-plugins/releases/latest/download/all-the-apps-base.tgz
- tar zxvf all-the-apps-base.tgz
- cp -R base_pack_build/artifacts-base/* assets/resources/apps/
- cp -R base_pack_build/apps_data/* assets/resources/apps_data/
- rm -rf base_pack_build
- rm -rf all-the-apps-base.tgz
- rm -f build/f7-firmware-C/toolbox/version.*
Expand Down Expand Up @@ -113,6 +114,7 @@ steps:
- wget https://github.com/xMasterX/all-the-plugins/releases/latest/download/all-the-apps-base.tgz
- tar zxvf all-the-apps-base.tgz
- cp -R base_pack_build/artifacts-base/* assets/resources/apps/
- cp -R base_pack_build/apps_data/* assets/resources/apps_data/
- rm -rf base_pack_build
- rm -rf all-the-apps-base.tgz
- rm -f build/f7-firmware-C/toolbox/version.*
Expand Down Expand Up @@ -413,6 +415,7 @@ steps:
- wget https://github.com/xMasterX/all-the-plugins/releases/latest/download/all-the-apps-base.tgz
- tar zxvf all-the-apps-base.tgz
- cp -R base_pack_build/artifacts-base/* assets/resources/apps/
- cp -R base_pack_build/apps_data/* assets/resources/apps_data/
- rm -rf base_pack_build
- rm -rf all-the-apps-base.tgz
- rm -f build/f7-firmware-C/toolbox/version.*
Expand Down
71 changes: 25 additions & 46 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,50 +1,29 @@
## New changes
* **Apple BLE Spam app** (by @Willy-JL | Plus research from ECTO-1A, xMasterX and techryptic) -> (app can be found in builds ` `, `e`, `n`, `r`)
* Plugins -> Note for new users: **PicoPass emulation is available** in (Apps -> NFC -> PicoPass) + Latest PicoPass emulation fixes (by nvx) -> (app can be found in builds ` `, `e`, `n`, `r`)
* SubGHz: **FAAC SLH - Programming mode** (by @xMasterX & @Eng1n33r (full research and PoC by @Skorpionm)| PR #585) -> [How to use](https://github.com/DarkFlippers/unleashed-firmware/blob/dev/documentation/SubGHzRemoteProg.md)
* SubGHz: FAAC SLH -> Add manually new options
* SubGHz: **Ignore Princeton** option
* SubGHz: **Save all settings, option to reset config to default** (by @derskythe | PR #590)
* SubGHz: Fix 0xFFFF counter value being skipped
* SubGHz: Fix path reset on save name scene exit
* SubGHz: Various fixes
* SubGHz Remote: New design (by @Svaarich) - Implemented by @gid9798
* SubGHz Remote: Fix Sub-GHz Remote folder name (by @OperKH | PR #583)
* SubGHz Remote: submodule (by @gid9798 | PR #592)
* Infrared: Updated universal assets (by @amec0e | PR #594)
* Infrared: Remake custom universal remotes to use new design (New icons by @Svaarich)
* UI: Keyboard ok to toggle select all in cursor mode (by @Willy-JL)
* CI/CD: CodeQL for internal usage
* CI/CD: Fixed regular builds having `c` in version name in the device info while not being actual `c` build
* Docs: New FAAC SLH instructions
* Docs: Readme & Changelog fixes (by @gid9798 | PR #586 #600)
* OFW: Sub-GHz: fix incorrect key parsing crash
* OFW: fbt: added FW_CFG_name with build configuration
* OFW: SD-Card: proper HAL -> **Breaking API change, API 37.x -> API 38.x** - **Update your apps!**
* OFW: Various Fixes and Improvements -> **Breaking API change, API 36.x -> API 37.x** - **Update your apps!**
* OFW: iButton: Return to the file selection if file is corrupted
* OFW: Account for the "-" in line carry-over
* OFW: github: workflow improvements
* OFW: Storage: force mount
* OFW: Add File Naming setting for more detailed naming -> **Breaking API change, API 35.x -> API 36.x** - **Update your apps!**
* OFW: Disconnect from BLE on protobuf error
* OFW: Add support for Mifare Classic 4k SAK 0x38 ATQA 0x02, 0x04, 0x08
* OFW: Undo some TODO
* OFW: Check the filetype of the update manifest
* OFW: StorageListRequest: size filter
* OFW: SubGhz: heap overflow text error
* OFW: nfc: add rfal wrong state error handling
* OFW: Rfid: fix crash on broken key launch from archive (fix was already done in UL in similar way)
* OFW: AC OFF button
* OFW: New IR universal remote graphics
* OFW: Intelligent probing with warnings for fwflash.py
* OFW: FuriHal: explicitly pull display pins at early init stage, move PUPD config to early stage
* OFW: Fix display last symbol in multiline text
* OFW: Properly reset the NFC device data
* OFW: fbt: various improvements and bug fixes
* OFW: Littlefs updated to v2.7.0
* OFW: loader: restored support for debug apps
* OFW: Removed explicit dependency on scons for external scripting
**Summary: BLE Core2 (Copro) crashes should be fixed with this update, Apple BLE Spam app and other apps updated to the latest versions, NFC file sort crashes has been fixed, other fixes and improvements see below:**
* SubGHz: Nice Flor S - added custom button code 0x3
* NFC: Fixes out of memory crash if we open folder with more than 300 files in it
* LF RFID: Fixed logic in `t5577_write_with_pass` (by @baugp | PR #612)
* Infrared: Updated universal assets (by @amec0e | PR #607 #619)
* **Apple BLE Spam app** updated to latest version (by @Willy-JL) -> (app can be found in builds ` `, `e`, `n`, `r`)
* OFW: Fix spelling across some project files
* OFW: CCID: Support PC To Reader Transfer Block data
* OFW: Firmware: bigger thread name storage. Notification app: better BacklightEnforce edge cases handling.
* OFW: Lib: update stm32wb_copro to 1.17.3 release
* OFW: FuriHal ble: length fix for fw version prop
* OFW: add documentation SubGhz Bin_RAW file format
* OFW: fbt: glob improvements
* OFW: HEX input UI improvements
* OFW: Ble: fix null-ptr dereference in bt_change_profile
* OFW: Add the coding in the shell animation
* OFW: FuriHal,BleGlue: prevent sleep while HCI command executed, proper bt api rpc locking. Fixes random system lockups.
* OFW: fbt: reworked tool path handling
* OFW: Gui: handle view port lockup and notify developer about it
* OFW: Added `fal_embedded` parameter for PLUGIN apps
* OFW: Fix multiline aligned text going out of bounds (again)
* OFW: Add Initial CCID support
* OFW: Add confirmation before exiting USB-UART
* OFW: Add extended I2C HAL functions -> **Breaking API change 38.x -> 39.x**
* OFW: New clock switch schema, **fixes random core2 crashes**

----

Expand Down
3 changes: 3 additions & 0 deletions ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@

<br>

## FAQ (frequently asked questions)
[Follow this link to find answers to most asked questions](https://github.com/DarkFlippers/unleashed-firmware/blob/dev/documentation/FAQ.md)

## Dev builds (unstable)
- https://dev.unleashedflip.com/
- https://t.me/kotnehleb
Expand Down
2 changes: 2 additions & 0 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ if GetOption("fullenv") or any(
"${COPRO_DISCLAIMER}",
"--obdata",
'"${ROOT_DIR.abspath}/${COPRO_OB_DATA}"',
"--stackversion",
"${COPRO_CUBE_VERSION}",
]
dist_resource_arguments = [
"-r",
Expand Down
16 changes: 16 additions & 0 deletions applications/debug/ccid_test/application.fam
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
App(
appid="ccid_test",
name="CCID Debug",
apptype=FlipperAppType.DEBUG,
entry_point="ccid_test_app",
cdefines=["CCID_TEST"],
requires=[
"gui",
],
provides=[
"ccid_test",
],
stack_size=1 * 1024,
order=120,
fap_category="Debug",
)
169 changes: 169 additions & 0 deletions applications/debug/ccid_test/ccid_test_app.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
#include <stdint.h>
#include <furi.h>
#include <furi_hal.h>

#include <gui/view.h>
#include <gui/view_dispatcher.h>
#include <gui/modules/submenu.h>
#include <gui/gui.h>

#include "iso7816_t0_apdu.h"

typedef enum {
EventTypeInput,
} EventType;

typedef struct {
Gui* gui;
ViewPort* view_port;
FuriMessageQueue* event_queue;
FuriHalUsbCcidConfig ccid_cfg;
} CcidTestApp;

typedef struct {
union {
InputEvent input;
};
EventType type;
} CcidTestAppEvent;

typedef enum {
CcidTestSubmenuIndexInsertSmartcard,
CcidTestSubmenuIndexRemoveSmartcard,
CcidTestSubmenuIndexInsertSmartcardReader
} SubmenuIndex;

void icc_power_on_callback(uint8_t* atrBuffer, uint32_t* atrlen, void* context) {
UNUSED(context);

iso7816_answer_to_reset(atrBuffer, atrlen);
}

//dataBlock points to the buffer
//dataBlockLen tells reader how nany bytes should be read
void xfr_datablock_callback(
const uint8_t* dataBlock,
uint32_t dataBlockLen,
uint8_t* responseDataBlock,
uint32_t* responseDataBlockLen,
void* context) {
UNUSED(context);

struct ISO7816_Command_APDU commandAPDU;
iso7816_read_command_apdu(&commandAPDU, dataBlock, dataBlockLen);

struct ISO7816_Response_APDU responseAPDU;
//class not supported
responseAPDU.SW1 = 0x6E;
responseAPDU.SW2 = 0x00;

iso7816_write_response_apdu(&responseAPDU, responseDataBlock, responseDataBlockLen);
}

static const CcidCallbacks ccid_cb = {
icc_power_on_callback,
xfr_datablock_callback,
};

static void ccid_test_app_render_callback(Canvas* canvas, void* ctx) {
UNUSED(ctx);
canvas_clear(canvas);

canvas_set_font(canvas, FontPrimary);
canvas_draw_str(canvas, 0, 10, "CCID Test App");

canvas_set_font(canvas, FontSecondary);
canvas_draw_str(canvas, 0, 63, "Hold [back] to exit");
}

static void ccid_test_app_input_callback(InputEvent* input_event, void* ctx) {
FuriMessageQueue* event_queue = ctx;

CcidTestAppEvent event;
event.type = EventTypeInput;
event.input = *input_event;
furi_message_queue_put(event_queue, &event, FuriWaitForever);
}

uint32_t ccid_test_exit(void* context) {
UNUSED(context);
return VIEW_NONE;
}

CcidTestApp* ccid_test_app_alloc() {
CcidTestApp* app = malloc(sizeof(CcidTestApp));

// Gui
app->gui = furi_record_open(RECORD_GUI);

//viewport
app->view_port = view_port_alloc();
gui_add_view_port(app->gui, app->view_port, GuiLayerFullscreen);
view_port_draw_callback_set(app->view_port, ccid_test_app_render_callback, NULL);

//message queue
app->event_queue = furi_message_queue_alloc(8, sizeof(CcidTestAppEvent));
furi_check(app->event_queue);
view_port_input_callback_set(app->view_port, ccid_test_app_input_callback, app->event_queue);

return app;
}

void ccid_test_app_free(CcidTestApp* app) {
furi_assert(app);

//message queue
furi_message_queue_free(app->event_queue);

//view port
gui_remove_view_port(app->gui, app->view_port);
view_port_free(app->view_port);

// Close gui record
furi_record_close(RECORD_GUI);
app->gui = NULL;

// Free rest
free(app);
}

int32_t ccid_test_app(void* p) {
UNUSED(p);

//setup view
CcidTestApp* app = ccid_test_app_alloc();

//setup CCID USB
// On linux: set VID PID using: /usr/lib/pcsc/drivers/ifd-ccid.bundle/Contents/Info.plist
app->ccid_cfg.vid = 0x1234;
app->ccid_cfg.pid = 0x5678;

FuriHalUsbInterface* usb_mode_prev = furi_hal_usb_get_config();
furi_hal_usb_unlock();
furi_hal_ccid_set_callbacks((CcidCallbacks*)&ccid_cb);
furi_check(furi_hal_usb_set_config(&usb_ccid, &app->ccid_cfg) == true);

//handle button events
CcidTestAppEvent event;
while(1) {
FuriStatus event_status =
furi_message_queue_get(app->event_queue, &event, FuriWaitForever);

if(event_status == FuriStatusOk) {
if(event.type == EventTypeInput) {
if(event.input.type == InputTypeLong && event.input.key == InputKeyBack) {
break;
}
}
}
view_port_update(app->view_port);
}

//tear down USB
furi_hal_usb_set_config(usb_mode_prev, NULL);
furi_hal_ccid_set_callbacks(NULL);

//teardown view
ccid_test_app_free(app);
return 0;
}
37 changes: 37 additions & 0 deletions applications/debug/ccid_test/iso7816_t0_apdu.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/* Implements rudimentary iso7816-3 support for APDU (T=0) */
#include <stdint.h>
#include <string.h>
#include <furi.h>
#include "iso7816_t0_apdu.h"

void iso7816_answer_to_reset(uint8_t* dataBuffer, uint32_t* atrlen) {
//minimum valid ATR: https://smartcard-atr.apdu.fr/parse?ATR=3B+00
uint8_t AtrBuffer[2] = {
0x3B, //TS (direct convention)
0x00 // T0 (Y(1): b0000, K: 0 (historical bytes))
};
*atrlen = 2;

memcpy(dataBuffer, AtrBuffer, sizeof(uint8_t) * (*atrlen));
}

void iso7816_read_command_apdu(
struct ISO7816_Command_APDU* command,
const uint8_t* dataBuffer,
uint32_t dataLen) {
UNUSED(dataLen);
command->CLA = dataBuffer[0];
command->INS = dataBuffer[1];
command->P1 = dataBuffer[2];
command->P2 = dataBuffer[3];
command->Lc = dataBuffer[4];
}

void iso7816_write_response_apdu(
const struct ISO7816_Response_APDU* response,
uint8_t* dataBuffer,
uint32_t* dataLen) {
dataBuffer[0] = response->SW1;
dataBuffer[1] = response->SW2;
*dataLen = 2;
}
32 changes: 32 additions & 0 deletions applications/debug/ccid_test/iso7816_t0_apdu.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#ifndef _ISO7816_T0_APDU_H_
#define _ISO7816_T0_APDU_H_

#include <stdint.h>

struct ISO7816_Command_APDU {
//header
uint8_t CLA;
uint8_t INS;
uint8_t P1;
uint8_t P2;

//body
uint8_t Lc;
uint8_t Le;
} __attribute__((packed));

struct ISO7816_Response_APDU {
uint8_t SW1;
uint8_t SW2;
} __attribute__((packed));

void iso7816_answer_to_reset(uint8_t* atrBuffer, uint32_t* atrlen);
void iso7816_read_command_apdu(
struct ISO7816_Command_APDU* command,
const uint8_t* dataBuffer,
uint32_t dataLen);
void iso7816_write_response_apdu(
const struct ISO7816_Response_APDU* response,
uint8_t* dataBuffer,
uint32_t* dataLen);
#endif //_ISO7816_T0_APDU_H_
Loading

0 comments on commit c71d04a

Please sign in to comment.