Skip to main content

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.

PicoLynx TUI

PicoLynx TUI

PicoLynx TUI

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_DEVICECHANGE events 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 Textual for 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

picolynx-0.1.2.tar.gz (4.4 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

picolynx-0.1.2-py3-none-any.whl (38.2 kB view details)

Uploaded Python 3

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

Hashes for picolynx-0.1.2.tar.gz
Algorithm Hash digest
SHA256 89807a0e4558a5788bc8ffa83115ff9c063eba80a9d1081da60ff0bf942d7911
MD5 2fb69412c76d5dd6518182fc13508b71
BLAKE2b-256 7339e267dd7fdd9234fab1bed53b48817dee2bcb3f8e62ac0a790e83c3accf8d

See more details on using hashes here.

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

Hashes for picolynx-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 77a0ce20426251b30933cf801fdec689e2856d966447c572c3636869a070e493
MD5 51fb4e839bb109401e3524bd7bbcb62b
BLAKE2b-256 13f0092b64486a20463eca074c37554a8e82e17b18bc4eb77ae3aca9986ad692

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page