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.
https://github.com/user-attachments/assets/d5382270-cae8-4eb4-90a6-28ccb96e5250
[!CAUTION] If a device is disconnected when attached, it will remain in the connected device table due to the way Windows only registers a
DBT_DEVNODES_CHANGEDevent without any event-specific data and not aDBT_DEVICEREMOVECOMPLETEevent.DBT_DEVNODES_CHANGEDevents usually occur before informativeDBT_DEVICEARRIVALorDBT_DEVICEREMOVECOMPLETEevents, and reacting to these and updating, creates race conditions.
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-attachment (TODO): Detects devices as they are connected & automatically attaches to WSL.
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.
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
| Key | Action |
|---|---|
| a | Attach |
| b | Bind |
| d | Detach |
| u | Unbind |
Select a device in the table and press the corresponding key to perform the action.
Development
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:
just console
Alias for:
uv run textual console -x EVENT -x SYSTEM
Running this command will run PicoLynx in development mode.
just dev
Alias for:
uv run textual run --dev src/picolynx/__main__.py
[!NOTE] Logging level can be modified in
__main__.pyby changing theLOG_LEVELvalue.
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.0.tar.gz.
File metadata
- Download URL: picolynx-0.1.0.tar.gz
- Upload date:
- Size: 4.3 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
416130e844d2eeed209dae325c22a518f028e0d1c79eb85b60ab05405fb93bb2
|
|
| MD5 |
015e290ac6569042daa128df7e312f62
|
|
| BLAKE2b-256 |
e60bdcc543a910d4f75c5ac00ec40d3f161b782fc76d343b56bb2ad0ae0d35ea
|
File details
Details for the file picolynx-0.1.0-py3-none-any.whl.
File metadata
- Download URL: picolynx-0.1.0-py3-none-any.whl
- Upload date:
- Size: 36.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bfaeb84e08fbc222a3414ec9d4f41ab6aa9a63923decdc6b3d2b50b98290c2bd
|
|
| MD5 |
d16f45b6921187912c8c947b862e64b5
|
|
| BLAKE2b-256 |
2300b3056a2c3007f0dc27f342034dbdb0b420c31bceafafbaff83860bf4a4b9
|