liamhays / flipwire

Bluetooth app to control a Flipper Zero from a PC
MIT License
37 stars 1 forks source link
bluetooth flipperzero rust

flipwire - Cross-Platform Bluetooth Flipper Control

demo GIF of Flipwire

Flipwire lets you control your Flipper Zero from any computer over Bluetooth just like the mobile app. Flipwire is currently only a command-line tool.

Usage

Flipwire will attempt to connect to your Flipper before any operation. Pair your Flipper to your computer before using Flipwire so that they can find each other.

Run flipwire with no arguments to see the built-in help. Command line usage is basically:

$ flipwire [-d] -f <Flipper name> <command> <arguments...>

Flags:

Commands:

Flipper paths

The Flipper uses a Unix-style path system to specify paths in internal and external storage. Most likely you want to interact with external storage (the SD card), which the Flipper sees at /ext. /ext is also the directory you browse when you use the Browser tool on the Flipper itself.

Example paths:

In an MSYS shell on Windows, you have to suppress path translation for Flipwire to work, otherwise it will receive Flipper paths as local system paths. In Git Bash, set MSYS_NO_PATHCONV=1. In MSYS2, set MSYS2_ARG_CONV_EXCL="*". See this StackOverflow answer.

FAQ

Why "flipwire"?

It sounds cool. Plus, "flip" is sort of a synonym of "invert", and the opposite of a wire is wireless, and Flipwire lets you do things with your Flipper wirelessly...you get the idea.

Why Rust?

Because I like Rust. Also, because the Flipper ecosystem has a strong "plug and play" mentality, and Rust makes it easy to make an application that does exactly that.

Where's the GUI?

No GUI yet, possibly never. A GUI makes the application a lot larger and more complex, and on top of that, there isn't much Rust GUI support right now. If I do add GUI support, I would probably use imgui-rs.

What about macOS?

From my limited testing, the Flipper doesn't show up in a macOS Bluetooth scan. There's one instance of a person using an alternate Bluetooth tool to connect the Flipper but I don't know if Flipwire works.

I don't have a macOS device to test on or to provide builds for, so until I do, consider Flipwire macOS support completely experimental.

Caveats

Flipwire is not perfect software by any means. In particular:

Troubleshooting

Some common problems include Flipwire not finding the Flipper or returning an error. Make sure the Flipper is already paired to your computer.

On Linux, you might need to use bluetoothctl instead of your desktop environment's Bluetooth tool. For example, the KDE Bluetooth tool refuses to pair to the Flipper.

Troubleshooting steps:

This can fix issues like Error finding Flipper Uwuw2: le-connection-abort-by-local. You might also need to remove and re-pair. If it's still not working, you've probably discovered a bug. Create a new issue with some output with RUST_LOG=debug and a description of the problem.

Flipwire is only intended for use with Flippers running official firmware. If you're using another firmware, you're on your own.

Adapter Incompatibility

Most Bluetooth adapters work perfectly with the Flipper. However, Intel Stone Peak WiFi/Bluetooth have trouble downloading a file from the Flipper. The Flipper's Bluetooth implementation exhibits strange compatibility issues with these: the Flipper will disconnect while it's sending data with disconnect reason 0x08 (connection supervision timeout reached). This means that you can upload files, run small commands, and sometimes download small files without problems, but you can't download files bigger than about 5 kB before the Flipper disconnects. I have no idea why this happens.

If your adapter isn't one of the Stone Peak adapters listed below, and exhibits issues after pair/unpair and disconnect/connect cycles, open an issue to add it to the incompatible list.

Broken adapter list

These are the two models in the Intel Stone Peak series. There are several models of the 7265, but I've only tested the 802.11ac version of the 7265. However, given that both the 7265 and 3165 have the Bluetooth issue, I suspect it's common to the whole series.

I tested the 7265 on Linux and the 3165 on Windows and Linux. Whatever the problem is, it's independent of OS on both the 3165 and 7265. The Intel 8265 works (see below), so I think this is specific to Stone Peak.

Tested working adapters

Given that the Stone Peak adapters have issues independent of operating system, I assume that all adapter functionality is OS-agnostic, so I don't keep track of what OS I test card on.

Contributing

Like Flipwire? Leave me a star!

If you'd like to test Flipwire on macOS, let me know! I'd love to make it fully cross-platform.

If you have feature requests, bugs to report, or code to add, open an issue or pull request.

Building

Make sure you have protoc, the protobuf compiler, installed and in your PATH. On Linux, you also need libdbus (including the headers) and pkg-config. Check your package manager for these.

Clone the Flipwire repo and submodules, and run cargo build:

$ git clone --recursive https://github.com/liamhays/flipwire
$ cd flipwire
$ cargo build

If you're on Linux, especially a weak single-board computer, I recommend using the mold linker via mold -run or some configuration in .cargo/config.toml.