Skip to main content

A Python library for reading raw HID input from the Steam Deck, bypassing Steam Input.

Project description

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.
# If discovery fails it falls back to `/dev/hidraw2` for compatibility.
deck = SteamDeck()
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()

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

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

bitsteam-0.3.0.tar.gz (13.0 kB view details)

Uploaded Source

Built Distribution

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

bitsteam-0.3.0-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file bitsteam-0.3.0.tar.gz.

File metadata

  • Download URL: bitsteam-0.3.0.tar.gz
  • Upload date:
  • Size: 13.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for bitsteam-0.3.0.tar.gz
Algorithm Hash digest
SHA256 bf6293a3b9ab073c23b1b49eec1c2d8ab0bac36aaf298da5a8416b909d920dfd
MD5 2c848b749da0188dd65698f9e56992ea
BLAKE2b-256 f1128606f6e57c0ebda87d5723bd677b9528963a1ee061b0c975cb7f9bd78a97

See more details on using hashes here.

File details

Details for the file bitsteam-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: bitsteam-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for bitsteam-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3984b6d71fc15490cc4314ca6e9f12f9fed538ed8519976045156c4bababc3e4
MD5 772e097b58c3d0c64f5f8f5c7d96842d
BLAKE2b-256 9494c148d55c1f1bae0be25eff79943a626cc6784c0e1e26bd9a46fae539ff17

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