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. Do not treat it as stable or secure. 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.
  • 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.

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

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')
        analogs = deck.get_analog_values()
        right_trigger = analogs['right_trigger']
        
        print(f"\rA Button: {a_button}, Right Trigger: {right_trigger}", 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.2.0.tar.gz (10.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.2.0-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: bitsteam-0.2.0.tar.gz
  • Upload date:
  • Size: 10.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.2.0.tar.gz
Algorithm Hash digest
SHA256 3b1dfa1cdc38b54723d233bfd8cba628ca69c6839b690c5ff89f7b50af962788
MD5 abe727f17b9710a715961091f7a590d6
BLAKE2b-256 fe8532cf1b4ce4dc64e3ab4d1cadcb5221e91d84ec52f269c4b094454f3a5a4e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bitsteam-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 7.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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fab6382eaed24dbd004f57388167ed87fec06e97687ef021da3e22945c459156
MD5 b34f996cd9e491546ace1f558424f4aa
BLAKE2b-256 8e55844fa0a13145c3542aba6c923df2635cbaa76cdd138122609f503c3e2cf4

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