Auto-attach microcontrollers to WSL.
Project description
PicoLynx - Attach Microcontrollers to WSL
PicoLynx is a Windows-only TUI (Text-based User Interface) application for attaching and detaching microcontroller devices to WSL (Windows Subsystem for Linux) distributions. It monitors Windows WM_DEVICECHANGE messages with pywin32 and leverages usbipd-win to manage device connections.
The TUI will react to USB Serial and USB Storage device connections and can run usbipd-win commands on any device in its interface.
https://github.com/user-attachments/assets/d5382270-cae8-4eb4-90a6-28ccb96e5250
[!NOTE] If a device is disconnected when attached to WSL or a USB mass storage device is safely removed, it will remain in the connected device table.
WM_DEVICECHANGEevents under these circumstances are not granular enough, but a manual detach ('d' press) or refresh ('r' press) will trigger an update.
Features
- Manual control: Easily attach, bind, detach, or unbind devices using keyboard shortcuts.
- Live device table: View connected and persisted devices in real time.
- Windows message monitoring: Reacts instantly to hardware changes.
- Thread-safe: Ensures safe device operations even with concurrent events.
- Beautiful TUI: Built with
Textualfor a modern terminal experience & many theme options. - Auto-detect: Detects devices as they are connected & disconnected.
- Auto-attach (TODO): Auto-attachment of persisted devices on connection.
Requirements
Windows 10/11 is the only supported platform, given the nature of this package. PicoLynx requires administrator privileges to interact with USB/Serial devices. If not run as administrator, it will prompt for elevation.
Install usbipd-win
This tool enables sharing locally connected USB devices to other machines, including Hyper-V guests and WSL 2. Full instructions are available at usbipd-win Github. Window package manager can be used to install the tool:
winget install usbipd
Install WSL
Microsoft WSL documentation is available @ learn.microsoft.com. The following Windows features are required, which can be enabled by searching for 'Turn Windows features on or off' in the Start Menu:
- Virtual Machine Platform
- Windows Hypervisor Platform
- Windows Subsystem for Linux
Its worth updating WSL if newly enabled:
wsl --update
To install a Linux distribution, refer to the guide listed above, or see my Void Linux & Alpine Linux WSL repo guides for an example of a manual distro installation.
PicoLynx Installation
Astral uv package manager is recommended for a fast, isolated, and reliable install. To install uv, use the following command:
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
You can install PicoLynx globally with the following uv command:
uv tool install picolynx
Or:
uv tool install "git+https://github.com/andyrids/picolynx.git"
You can run PicoLynx without installing, by running the following command:
uvx picolynx
Or:
uvx "git+https://github.com/andyrids/picolynx.git"
Keyboard Shortcuts
The TUI command palette can be opened with ctrl + p, which has options for theme changes and the full command help panel. Tabs can be navigated and switched to with the tab key and tables can be traversed with the arrow keys.
| Key | Action |
|---|---|
| a | Attach |
| b | Bind |
| d | Detach |
| u | Unbind |
| r | Refresh |
Select a device in the table and press the corresponding key to perform the action.
Development
Clone the repository and enter the picolynx directory.
git clone git@github.com:andyrids/picolynx.git
cd picolynx
The just command runner (GitHub page) is a handy way to save and run project-specific commands, which are written in a file called justfile.
If you use just, you can add use the commands below to run PicoLynx in development mode, with the textual console integration.
This command uses uv to sync the package dependencies and create a .venv:
just sync
Alias for:
uv sync
Running the command below in one terminal, will activate the textual console, which listens to a running textual app in --dev mode:
just console
Alias for:
uv run textual console -x EVENT -x SYSTEM
Running this command will run PicoLynx in development mode, with a logging level set to 'DEBUG'.
just dev
Alias for:
uv run textual run --dev src/picolynx/__main__.py --log-level DEBUG
The logging level can be modified in with a --log-level option, which takes the following choices; 'DEBUG', 'INFO', 'WARNING' (default), 'ERROR' & 'CRITICAL'.
uv run textual run --dev src/picolynx/__main__.py --log-level INFO
Acknowledgements
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file picolynx-0.1.2.tar.gz.
File metadata
- Download URL: picolynx-0.1.2.tar.gz
- Upload date:
- Size: 4.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
89807a0e4558a5788bc8ffa83115ff9c063eba80a9d1081da60ff0bf942d7911
|
|
| MD5 |
2fb69412c76d5dd6518182fc13508b71
|
|
| BLAKE2b-256 |
7339e267dd7fdd9234fab1bed53b48817dee2bcb3f8e62ac0a790e83c3accf8d
|
File details
Details for the file picolynx-0.1.2-py3-none-any.whl.
File metadata
- Download URL: picolynx-0.1.2-py3-none-any.whl
- Upload date:
- Size: 38.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
77a0ce20426251b30933cf801fdec689e2856d966447c572c3636869a070e493
|
|
| MD5 |
51fb4e839bb109401e3524bd7bbcb62b
|
|
| BLAKE2b-256 |
13f0092b64486a20463eca074c37554a8e82e17b18bc4eb77ae3aca9986ad692
|