ich habe hier leider ein sehr spezielles Problem.
Und zwar möchte ich meinen XBox 360 Controller unter Ubuntu / Linux zum Laufen bekommen.
D.h. eigentlich möchte ich das Wireless XBox 360 Chatpad unter Ubuntu / Linux zum Laufen bekommen,
der Controller funktioniert prinzipiell mit Xpad oder xboxdrv.
Dafür müsste ich wohl erstmal den XBox 360 Controller zum Leben erwecken, z.B.
den Befehl für "Rumble" an die richtige Adresse senden.
Mein bisheriger Code sieht so aus:
Code: Alles auswählen
#import uinput
import usb.core
import usb.util
import sys
## XBox 360 wireless controller and XBox 360 wireless chatpad in Python for Ubuntu / Linux
## using python3, python3-uinput, python3-usb
## remove xpad first: rmmod xpad
## find device: lsusb
## Bus 003 Device 002: ID 045e:0719 Microsoft Corp. Xbox 360 Wireless Adapter
dev = usb.core.find(idVendor=0x045e, idProduct=0x0719)
if dev is None:
raise ValueError('Device is not connected')
sys.stdout.write(str(dev) + '\n')
sys.stdout.write("--------------------------------" + '\n')
# set the active configuration. With no arguments, the first
# configuration will be the active one
dev.set_configuration()
# get an endpoint instance
cfg = dev.get_active_configuration()
intf = cfg[(0,0)]
ep = usb.util.find_descriptor(
intf,
# match the first OUT endpoint
custom_match = \
lambda e: \
usb.util.endpoint_direction(e.bEndpointAddress) == \
usb.util.ENDPOINT_OUT)
assert ep is not None
sys.stdout.write(str(ep) + '\n')
sys.stdout.write("--------------------------------" + '\n')
sys.stdout.write(str(intf) + '\n')
## ENDPOINT 0x81: Interrupt IN
## ENDPOINT 0x1: Interrupt OUT
epoint = 0x81
iface = 0
## rumble cmd
## rumble cmd in C++:
## uint8_t rumblecmd[] = { 0x00, 0x01, 0x0f, 0xc0, 0x00, left, right, 0x00, 0x00, 0x00, 0x00, 0x00 };
dev.write(epoint, '\0x00, \0x01, \0x0f, \0xc0, \0x00, \0x00, \0x00, \0x00, \0x00, \0x00, \0x00, \0x00', iface)
http://remotors.de/XBox360Chatpad/PROTOCOL
http://remotors.de/XBox360Chatpad/usb-descriptor.txt
Wäre schön wenn mir da jemand weiter helfen könnte,
auch wenn es wohl eher unwahrscheinlich ist, das jemand gerade dasselbe Problem hat,
oder zufällig noch ein XBox wireless Controller / Chatpad da hat,
Na, ja, wenn nicht, vielleicht hilft es ja irgendwann irgendjemanden
Mfg
djevil