Hello everyone, I've finished the support for using USB Gamepads to control on-screen Orbiters on TVs within LinuxMCE. I have pasted the wiki content of the following article because I am too lazy to type it out again,
Enjoy
-Thom
LinuxMCE as of 10.04 can allow any media director to control its on-screen [[Orbiter]] using a standard [http://www.amazon.com/s/ref=nb_sb_noss?url=search-alias%3Daps&field-keywords=usb+game+pad&x=0&y=0 USB Game Pad].
== How to install ==
Simply plug in the USB Game Pad, at any time, and the system will automatically detect up to 4 USB Game pads, and allow them to control Orbiter.
== How to use ==
=== Navigating items ===
==== Direction Pad ====
Items can be navigated either by a gamepad's direction cross, or by using the analogue wheels. Pressing down and releasing will cause the cursor to move in the direction pressed on the game pad. Currently button presses are not repeated.
For MythTV, pressing up and down, will cause the channel browser to change to the previous and next channel.
==== Buttons ====
By default, the USB Game Pad Remote device installed is mapped for a SIXAXIS(tm) compatible gamepad with 12 buttons total.
* The four diamond buttons.
** Button 1 - '''OK/Select/Enter'''
** Button 2 - '''Back'''
** Button 3 - '''Pause'''
** Button 4 - '''Stop'''
* The Front buttons
** Button 5 (''aka L1 - aka the small one on the left'') - '''Volume Down'''
** Button 6 (''aka R1 - aka the small one on the right'') - '''Volume Up'''
** Button 7 (''aka L2 - aka the big one on the left'') - '''Page Down/Skip Back'''
** Button 8 (''aka R2 - aka the big one on the right'') - '''Page Up/Skip Forward'''
** Button 9 (''aka what most people think as Select'') - '''Back''' (''same as Button 2'')
** Button 10 (''aka what most people think as Start'') - '''Home'''
=== Plugging and Unplugging ===
Game Pads can be plugged and unplugged at any time. The router will not need to be reloaded.
=== Use Within Games ===
Because there is no Home Button on most USB game pads, When a game is started by the [[Game Player]], the system will automatically pass through the USB game pads directly to the Game Player engine; any subsequent usage of the gamepad will be ignored by Orbiter unless Orbiter displays another visible screen. This means that you will not be able to get to the home menu currently while playing a game (because the start button would be mapped to the game system.)
== Changing the controller mapping ==
(preliminary instructions follow)
The controller mapping can currently be changed by accessing the web admin, selecting [[Advanced Pages Devices|Advanced > Configuration > Devices]], selecting the USB Game Pad remote device closest to your media director, and scrolling down to see the Configuration device data entry.
By default, the controller mapping is:
up USB-GAMEPAD-UP USB-GAMEPAD-UP
down USB-GAMEPAD-DOWN USB-GAMEPAD-DOWN
left USB-GAMEPAD-LEFT USB-GAMEPAD-LEFT
right USB-GAMEPAD-RIGHT USB-GAMEPAD-RIGHT
ok USB-GAMEPAD-B1 USB-GAMEPAD-B1
back USB-GAMEPAD-B9 USB-GAMEPAD-B9
back USB-GAMEPAD-B2 USB-GAMEPAD-B2
skipback USB-GAMEPAD-B5 USB-GAMEPAD-B5
skipback USB-GAMEPAD-B7 USB-GAMEPAD-B7
skipfwd USB-GAMEPAD-B6 USB-GAMEPAD-B6
skipfwd USB-GAMEPAD-B8 USB-GAMEPAD-B8
menu USB-GAMEPAD-B3 USB-GAMEPAD-B3
menu USB-GAMEPAD-B10 USB-GAMEPAD-B10
The syntax is very simple:
remotemapping USB-GAMEPAD-XX USB-GAMEPAD-XX
The remotemapping entry corresponds to an entry in the [[Infrared Remote Buttons Understood by LinuxMCE|RemoteMapping]] table,
The second and third components right now correspond to the same thing (the third field is unused, but must be specified), that is, what USB button to press, either consisting of:
* A direction: UP, DOWN, LEFT, and RIGHT are currently understood. (do we need more?)
* A Button #, B1, B2, B3, ... B11, B12, for example.
Using this nomenclature, and the link to the [[Infrared Remote Buttons Understood by LinuxMCE|RemoteMapping]] table, it is possible to map any button on the gamepad to something useful in LinuxMCE. The Remote control template used will be the one closest to that media director (so yes, it is possible, although ill advised, for each media director to have a different button mapping.)
== Usage in AV Wizard ==
It is possible, to use the gamepad with the AV Wizard. Simply attach a game pad before powering up the unit. Holding down the 1 button while the system is booting will cause the [[AVWizard]] to launch.
Once the [[AVWizard]] has been started, it is possible to use the gamepad to navigate and select items within the wizard, and also to select explicit video modes, just as if number keys had been pressed on a real keyboard:
The following buttons are mapped for the AV Wizard:
* Button 2 - DVI
* Button 3 - DVI-2
* Button 4 - HDMI
* Button 5 - VGA
* Button 6 - VGA-2
* Button 7 - Component
* Button 8 - Composite
* Button 9 - S-Video
== Source Code ==
Source code for this module may be found here:
* [http://svn.linuxmce.org/svn/branches/LinuxMCE-1004/src/USB_Game_Pad/
http://svn.linuxmce.org/svn/branches/LinuxMCE-1004/src/USB_Game_Pad/]
== Trademarks ==
SIXAXIS(tm) is a trademark of Sony Corporation.
(and before anyone asks, yes, SixAxis controllers that are connected via a USB cable work. Bluetooth support will not work yet until we do some serious re-engineering of our BlueTooth stack!)