Modern async Python driver for Nintendo Switch Joy-Con
Project description
ajoycon
Modern async Python driver for Nintendo Switch Joy-Con controllers
Fork of tokoroten-lab/joycon-python
Install
Using uv (recommended)
uv add ajoycon
Using pip
pip install ajoycon
Linux Setup
1. Install system dependencies
sudo apt install libhidapi-dev libudev-dev
2. Install hidapi with hidraw backend support
The default hidapi package doesn't support Bluetooth HID devices properly. Install from source:
Using uv:
uv remove hidapi
uv add hidapi --no-binary hidapi
Using pip:
pip uninstall hidapi
pip install hidapi --no-binary hidapi
3. Setup udev rules
Use the provided installation script:
./install_udev.sh
Or manually:
sudo cp 50-nintendo-switch.rules /etc/udev/rules.d/
sudo udevadm control --reload-rules && sudo udevadm trigger
4. Blacklist the kernel hid_nintendo driver
The kernel driver conflicts with hidapi access:
echo "blacklist hid_nintendo" | sudo tee /etc/modprobe.d/blacklist-nintendo.conf
sudo rmmod hid_nintendo # Unload the module (or reboot)
5. Connect your Joy-Cons
Pair and connect your Joy-Cons via Bluetooth, then reconnect them after completing the setup above.
Usage
import asyncio
from ajoycon import discover_joycons
async def main():
joycons = discover_joycons()
if not joycons:
return
async with joycons[0].connect() as joycon:
status = joycon.status
print(f"Battery: {status.battery.level.name}")
print(f"Buttons: {status.buttons}")
print(f"Sticks: {status.stick_l}, {status.stick_r}")
print(f"IMU: {status.imu}")
asyncio.run(main())
Requirements
- Python 3.13+
- hidapi (built with hidraw backend for Linux Bluetooth support)
- pyglm
System Dependencies (Linux)
- libhidapi-dev
- libudev-dev
License
MIT
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 ajoycon-1.0.1.tar.gz.
File metadata
- Download URL: ajoycon-1.0.1.tar.gz
- Upload date:
- Size: 20.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a546751a48204e8974d2722262d5eabaf712b303e3dcf7cd4dfec9286cb5be5e
|
|
| MD5 |
66fac5b6d0a9662af535c7809e072f8c
|
|
| BLAKE2b-256 |
22503f05ed2e0b48a7bc10d283c710d95f9f97377ba3f581dffe998449956deb
|
File details
Details for the file ajoycon-1.0.1-py3-none-any.whl.
File metadata
- Download URL: ajoycon-1.0.1-py3-none-any.whl
- Upload date:
- Size: 12.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8ecca16e907eb190c05249cca6fed9bc5f976ec0344f27dca9bd9dae83caf197
|
|
| MD5 |
9c6aee69bce7b0353ebfadec9aedf5aa
|
|
| BLAKE2b-256 |
b3d961eaf23d39e95b9272821c3e6198a5ae150cb8835168b594e49009cea685
|