Skip to main content

Disclaimer: This is a work-in-progress project created during the development of another project. It currently only supports the Steam Deck hardware. It was created with the help of generative AI.

Bitsteam

PyPI version License: MIT

A low-level Python library for reading raw HID input from the Steam Deck, bypassing the default Steam Input system.

Overview

Bitsteam allows you to capture every button press, joystick movement, trigger pull, and IMU (gyroscope) event directly from the hardware. This is ideal for projects that require custom controller logic, robotics, or interfacing with applications outside of Steam without input conflicts.

Core Features

  • Raw HID Access: Reads the device's raw 64-byte data stream.
  • Full Input Support: Captures all buttons, analog sticks, triggers, trackpads, and grip buttons.
  • Normalized Analog Values: All analog inputs are normalized to standard ranges for easy use.
  • Real-time IMU: Provides processed, frame-by-frame delta angles for pitch, yaw, and roll from the gyroscope.
  • Conflict-Free: Designed to work alongside a udev rule to prevent the OS or Steam from intercepting inputs.

Installation

The package is available on PyPI and can be installed with pip:

pip install bitsteam

Quick Start

Important: Supported platforms & Steam input notes

Supported platforms: Linux (Steam Deck). This library is not tested or supported on Windows or macOS (as Linux is the default os for the Steam Deck).

To avoid Steam translating controller input to keyboard/mouse events, disable or adjust Steam Input for desktop mode. In Steam: Settings → Controller → Desktop Configuration → Edit. Set Gyro Behavior to Gyro To Mouse [Beta] if you want the gyro to remain enabled in desktop mode. Follow the udev instructions in the docs folder to allow raw HID access without running as root.

You can run the shipped example script directly:

python examples/simple_usage.py

Analog Input Value Ranges

All analog inputs are normalized by default for consistent behavior:

Input Type Normalized Range Description
Joystick X/Y [-1.0, 1.0] -1.0 = full left/down, 0 = center, 1.0 = full right/up
Trackpad X/Y [-1.0, 1.0] -1.0 = full left/down, 0 = center, 1.0 = full right/up
Triggers [0.0, 1.0] 0.0 = released, 1.0 = fully pressed
Trackpad Pressure [0.0, 1.0] 0.0 = no pressure, 1.0 = maximum pressure

For raw HID values (unsigned/signed 16-bit integers), use get_raw_analog_values().

Example Code

Here is a simple example to get you started.

import time
from bitsteam import SteamDeck

# Initialize and start the background listener
# The constructor will try to auto-discover the Steam Deck HID device.
# Pass device_path explicitly only when automatic discovery is not appropriate.
deck = SteamDeck()
# start() returns only after the HID device has opened successfully and raises
# RuntimeError when it cannot be opened.
deck.start()

try:
    while True:
        a_button = deck.get_button_state('a')
        
        # Get normalized analog values (default)
        analogs = deck.get_analog_values()
        right_trigger = analogs['right_trigger']  # 0.0 to 1.0
        left_stick_x = analogs['left_stick_x']   # -1.0 to 1.0
        
        # Get raw HID values (optional)
        # raw = deck.get_raw_analog_values()
        # raw_trigger = raw['right_trigger']  # 0 to 65535
        
        print(f"\rA Button: {a_button}, Trigger: {right_trigger:.2f}, Stick X: {left_stick_x:.2f}", end="")
        time.sleep(0.1)

except KeyboardInterrupt:
    print("\nStopping...")
finally:
    deck.stop()

If the HID reader fails after startup, deck.is_running becomes False and deck.last_error contains the exception that stopped it.

Contributing

Contributions, issues, and feature requests are welcome! Feel free to check the issues page.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Release Checklist

Before publishing a new release:

python -m venv venv
source venv/bin/activate
pip install build twine

# remove old build before building again
rm -rf dist/

# update version in pyproject.toml
python -m build

# verify package metadata and README rendering
python -m twine check dist/*

# publish to PyPI
python -m twine upload dist/*
# use a PyPI API token from account settings

Metadata

Release files for bitsteam 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bitsteam 0.3.1
File Size Uploaded Provenance Actions
bitsteam-0.3.1.tar.gz 16.3 kB Without provenance Details for bitsteam-0.3.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for bitsteam 0.3.1
File Interpreter ABI Platform Actions
bitsteam-0.3.1-py3-none-any.whl Python 3 none any Details for bitsteam-0.3.1-py3-none-any.whl

Total release size: 25.8 kB

Release files / bitsteam-0.3.1.tar.gz

Download URL bitsteam-0.3.1.tar.gz
Size 16.3 kB
Tags Source
SHA-256 checksum
How to use checksums
f54a1c2bdcc9c19cc44c9338172a069a88ecf0598b98a4994e79919f3d4321c7
BLAKE2b-256 checksum
How to use checksums
34b56b573212d76a73672a3bec759f5374e2b15a7962c69eb9ee82364c0eef8d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"KDE neon","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / bitsteam-0.3.1-py3-none-any.whl

Download URL bitsteam-0.3.1-py3-none-any.whl
Size 9.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
51d6afee361207f212c8b34972a83c65ce366c0b1b853325713943f96b0c7712
BLAKE2b-256 checksum
How to use checksums
d4b6b148122d3f42527bc9d91148d4a84254dcb3ad0d9ee9d8953e6771a88675
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"KDE neon","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for bitsteam 0.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page