From b7ef842c39d0c45a7dcc0bfb724d75df209c69a5 Mon Sep 17 00:00:00 2001 From: Alex4386 Date: Fri, 7 Jun 2024 06:47:35 +0900 Subject: [PATCH] docs: update docs --- HOW_TO_BUILD.md | 32 ++++++++++++++++++++++++ README.md | 59 +++++++++++--------------------------------- src/scenes/mtp/mtp.c | 8 ++++-- 3 files changed, 53 insertions(+), 46 deletions(-) create mode 100644 HOW_TO_BUILD.md diff --git a/HOW_TO_BUILD.md b/HOW_TO_BUILD.md new file mode 100644 index 0000000..073bde0 --- /dev/null +++ b/HOW_TO_BUILD.md @@ -0,0 +1,32 @@ +## Setup Build environment + +### Build Instruction + +1. Install `ufbt`: + ```bash + pip3 install ufbt + ``` +2. Clone this repository and enter the repository root. +3. Run `ufbt update` to update the SDK for your flipper + - If you are using custom firmware, You should switch SDK. Here is the example for `unleashed` firmware: + ```bash + ufbt update --index-url=https://up.unleashedflip.com/directory.json + ``` + - If you want to use different release channel, You can run update to that channel too. Here is the example for `dev` channel (`dev`, `rc`, `release` are supported): + ```bash + ufbt update --channel=dev + ``` +4. Run `ufbt` in the repository root: + ```bash + ufbt + ``` +5. Compiled binary is now available at `./dist/` directory. + +### Setup Visual Studio Code + +> [!WARNING] +> This command will overwrite your `.vscode` directory and `.gitignore` on your root directory. +> **Make sure to backup your changes before running this command.** + +1. Suppose your build environment is ready. +2. Run `ufbt vscode_dist` to generate Visual Studio Code config. diff --git a/README.md b/README.md index 5f38e3f..845007d 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,7 @@ -

Flipper Zero: Application Template

- -## How to use this template - -1. Setup the repository by clicking the `Use this template` button on the top of the repository. Fill in the data if needed. -2. Update `README.md`'s upstream url with your repository's url. -3. Add `LICENSE` file with your own license. -4. Continue on [Setup Build environment](#setup-build-environment). -5. Change `AppID` +

Flipper Zero: MTP

## Build Status - - - **Latest Release**: [Download](https://github.com/Alex4386/f0-mtp/releases/latest) - **Latest Nightly**: [Download](https://github.com/Alex4386/f0-mtp/actions/workflows/nightly.yml) _(GitHub Login Required)_ @@ -19,39 +9,20 @@ | :-----------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------: | | ![Nightly Build](https://github.com/Alex4386/f0-mtp/actions/workflows/nightly.yml/badge.svg) | ![Release Build](https://github.com/Alex4386/f0-mtp/actions/workflows/release.yml/badge.svg) | -## Setup Build environment - -### Build Instruction - -1. Install `ufbt`: - ```bash - pip3 install ufbt - ``` -2. Clone this repository and enter the repository root. -3. Run `ufbt update` to update the SDK for your flipper - - If you are using custom firmware, You should switch SDK. Here is the example for `unleashed` firmware: - ```bash - ufbt update --index-url=https://up.unleashedflip.com/directory.json - ``` - - If you want to use different release channel, You can run update to that channel too. Here is the example for `dev` channel (`dev`, `rc`, `release` are supported): - ```bash - ufbt update --channel=dev - ``` -4. Run `ufbt` in the repository root: - ```bash - ufbt - ``` -5. Compiled binary is now available at `./dist/` directory. - -### Setup Visual Studio Code - -> [!WARNING] -> This command will overwrite your `.vscode` directory and `.gitignore` on your root directory. -> **Make sure to backup your changes before running this command.** +## What is this? +`f0-mtp` is a application that implements [`MTP (Media Transfer Protocol)` defined by `USB-IF`](https://www.usb.org/document-library/media-transfer-protocol-v11-spec-and-mtp-v11-adopters-agreement) on Flipper Zero. +This allows you to access the Flipper Zero's internal and SD card storages from your computer without the need of any additional drivers like [`HID-File-Transfer`](https://github.com/Kavakuo/HID-File-Transfer). + +If your computer can handle Android devices, it should be able to handle Flipper Zero as well with this application. + -1. Suppose your build environment is ready. -2. Run `ufbt vscode_dist` to generate Visual Studio Code config. +### Features +* Access Internal and SD card storages +* List files and directories + - Navigate directories (Currently has a bug that file/directory name is not shown correctly) -### What Next? +## How to build +See [HOW_TO_BUILD.md](HOW_TO_BUILD.md) for more information. -See [KICKSTART.md](KICKSTART.md) to see how to start building and setting up the repo for the first time! (This includes changing `AppID` and required steps to make your app **WORK**) +## License +This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. diff --git a/src/scenes/mtp/mtp.c b/src/scenes/mtp/mtp.c index 971e2e1..a431bdb 100644 --- a/src/scenes/mtp/mtp.c +++ b/src/scenes/mtp/mtp.c @@ -277,9 +277,13 @@ int list_and_issue_handles( FURI_LOG_I("MTP", "Found file: %s", file_name); } + // implement this way since strcat is unavailable + char* ptr = full_path; strcpy(full_path, base_path); - strcat(full_path, "/"); - strcat(full_path, file_name); + ptr += strlen(base_path); + strcpy(ptr, "/"); + ptr++; + strcpy(ptr, file_name); FURI_LOG_I("MTP", "Full path: %s", full_path);