Skip to content

Instantly share code, notes, and snippets.

@KrisDevelopment
KrisDevelopment / fixcontroller.py
Last active April 11, 2024 22:39 — forked from dnmodder/fixcontroller.py
This script should no longer be necessary thanks to the latest changes made to the master branch of the xpad [https://github.com/paroj/xpad] driver, please give it a try and report any regressions you find.
#!/usr/bin/env python3
import os
import sys
# A shell script wrapper generation for externally managed environemnts (eg. deb12).
if not os.path.exists("run.sh"):
with open("run.sh", "w") as f:
shell_src = """#!/bin/bash
python3 -m venv venv
@pavel-kirienko
pavel-kirienko / 51-xbox-gamepad.rules
Last active June 30, 2024 18:08 — forked from dnmodder/fixcontroller.py
Use Microsoft X-Box 360 Gamepad with GNU/Linux
# By default, X-Box 360-compatible controllers are detectable but dysfunctional because they expect the host
# to send a particular USB control transfer with some sort of initialization command.
# This udev rule will invoke a trivial Python script automatically when the gamepad is connected that emits
# the required initialization command.
#
# Integration:
# 1. Put this rule into /etc/udev/rules.d/51-xbox-gamepad.rules
# 2. Install pyusb for the root's Python: sudo pip install pyusb
# 3. Reload udev rules as root: udevadm control --reload-rules && udevadm trigger
#