diff --git a/yoke/assets/joypad/main.html b/yoke/assets/joypad/main.html
index 5139428..273ca00 100644
--- a/yoke/assets/joypad/main.html
+++ b/yoke/assets/joypad/main.html
@@ -13,7 +13,7 @@
Racing
Retro (D-pad)
Gamepad
- Testing
+ Xbox 360
diff --git a/yoke/assets/joypad/xbox.css b/yoke/assets/joypad/xbox.css
new file mode 100644
index 0000000..dc34e9e
--- /dev/null
+++ b/yoke/assets/joypad/xbox.css
@@ -0,0 +1,41 @@
+/* Gamepad settings the user might want to change. */
+
+/* This is for xbox 360 */
+#joypad {
+ grid-template-columns: repeat(10, 1fr);
+ grid-template-rows: repeat(5, 1fr);
+ grid-template-areas:
+ /* The map below must match the number of rows and columns specified above.
+ * Controls may cover any rectangular area.
+ * Do not try drawing non-rectangular shapes. */
+ "a9 a9 . . j2 j2 . . a8 a8 "
+ ". . b6 . j2 j2 . b5 . . "
+ "j1 j1 j1 . . . . . b3 . "
+ "j1 j1 j1 . bg bg . b4 . b2 "
+ "j1 j1 j1 . bs bs . . b1 . "
+ ;
+ /* Possible values:
+ * j1, j2, j3... for joystick (returns to center when released);
+ * s1, s2, s3... for sticky joystick (stays in place when released);
+ * t1, t2, t3... for thumb joystick (returns to center, and can be
+ pressed down with force or two fingers to simulate L3/R3 button,
+ like in console controllers).
+ * m_ for motion detector, where _ is one of these letters:
+ * x for acceleration in the X-axis (left to right),
+ * y for acceleration in the Y-axis (bottom to top),
+ * z for acceleration in the Z-axis (back to front),
+ * a for α (alpha) angle -- rotation around the Z-axis,
+ * b for β (beta) angle -- rotation around the X-axis,
+ * g for γ (gamma) angle -- rotation around the Y-axis;
+ * pa, pb, pt for pedals (accelerator, brake, throttle);
+ * k1, k2... for knobs;
+ * b_ for buttons, where _ is:
+ * s for START button,
+ * g for SELECT button,
+ * m for the branded button (HOME or equivalent),
+ * 1, 2, 3, 4, 5, 6, 7, 8, 9, 10... for the rest.
+ * a_ for analog button/trigger, where _ is a number;
+ * dp for D-pad;
+ * dbg for debug messages;
+ * a period for empty space. */
+}
diff --git a/yoke/events.py b/yoke/events.py
index 05d7680..55abe8b 100644
--- a/yoke/events.py
+++ b/yoke/events.py
@@ -604,13 +604,13 @@
't1': 'ABS_X,ABS_Y,BTN_THUMB',
't2': 'ABS_RX,ABS_RY,BTN_THUMB2',
'mx': 'ABS_MISC',
-'my': 'ABS_RZ',
-'mz': 'ABS_Z',
'ma': 'ABS_TILT_X',
'mb': 'ABS_WHEEL',
'mg': 'ABS_TILT_Y',
'pa': 'ABS_GAS',
'pb': 'ABS_BRAKE',
+'py': 'ABS_RZ',
+'pz': 'ABS_Z',
'pt': 'ABS_THROTTLE',
'k1': 'ABS_VOLUME',
'k2': 'ABS_RUDDER',
@@ -624,6 +624,8 @@
'a6': 'ABS_HAT2Y',
'a7': 'ABS_HAT3X',
'a8': 'ABS_HAT3Y',
+'a8': 'ABS_RZ',
+'a9': 'ABS_Z',
'bs': 'BTN_START',
'bg': 'BTN_SELECT',
'bm': 'BTN_MODE',
diff --git a/yoke/service.py b/yoke/service.py
index 7feb8e9..3fd4f53 100644
--- a/yoke/service.py
+++ b/yoke/service.py
@@ -35,9 +35,15 @@ def __init__(self, id=1, name='Yoke', events=(), bytestring=b''):
self.inStruct = struct.Struct('>x' + ''.join(['H' if e in ABS_EVENTS else '?' for e in events]))
events = [e + (0, 0x7fff, 0, 0) if e in ABS_EVENTS else e for e in events]
- BUS_VIRTUAL = 0x06
+ # see usbids here: http://www.linux-usb.org/usb.ids
+ # For xbox
+ BUS_VIRTUAL = 0x03
+ VENDOR_VIRTUAL = 0x45e
+ PRODUCT_VIRTUAL = 0x28e
+ VERSION_VIRTUAL = 0x110
+
try:
- self.device = uinput.Device(events, name, BUS_VIRTUAL)
+ self.device = uinput.Device(events, name, BUS_VIRTUAL, VENDOR_VIRTUAL, PRODUCT_VIRTUAL, VERSION_VIRTUAL)
except Exception as e:
raise UInputDisabledError(*e.args)