3)
Build your keylayout file.Now I've read different things on this, but I did read somewhere that you cannot create/edit a keylayout file in notepad. It was suggested to use PSPad (Free)
When you use PS pad there is a selection on the bottom that can be toggled between "DOS", "UNIX", and "MAC". Make sure it is selected to UNIX when editing and saving.
A keylayout file is basically a file that looks like this:
# Copyright (C) 2010 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Generic key layout file for full alphabetic US English PC style external keyboards.
#
# This file is intentionally very generic and is intended to support a broad rang of keyboards.
# Do not edit the generic key layout to support a specific keyboard; instead, create
# a new key layout file with the required keyboard configuration.
#
key 1 ESCAPE
key 2 1
key 3 2
key 4 3
key 5 4
key 6 5
key 7 6
key 8 7
key 9 8
key 10 9
key 11 0
key 12 MINUS
key 13 EQUALS
key 14 DEL
key 15 TAB
key 16 Q
key 17 W
key 18 E
key 19 R
key 20 T
key 21 Y
key 22 U
key 23 I
key 24 O
key 25 P
....Etc. all the way to the 400's.
So that is where you take your scancodes from your input device and assign them outputs to your ouya.
For example, at the bottom right corner of my XIN-MO I have scancode 288. If I wanted that to be the L2 button, I would write in the keytest file
key 288 Button_R2
And so on. You only need the scancode inputs that your device has, for example the XIN MO only has inputs from ~280-320 so the ones from 1-280 and from 320 + can be deleted from the keylayout file.
One thing I noticed is that I had some inputs on the XIN-MO that did not have scancodes but had keycodes, (19,20,21,22) These are the default D pad inputs (U,D,L,R)and cannot be reassigned. Don't ask why. I think it has something with them being analog inputs?
Once you have your keylayout file built you need to save it with a device specific name.
The default naming scheme is:
Vendor_XXXX_Product_XXXX.kl
Now to find the vendor and product ID:
Go to "view devices and printers" in My computer. > Right click on your input device > properties > hardware > properties > details > now select : "hardware lds"
You will be given a list that should look like this:
HID\VID_
16C0&PID_
05E1&REV_0100&Col02
HID\VID_16C0&PID_05E1&Col02
HID_DEVICE_SYSTEM_GAME
HID_DEVICE_UP:0001_U:0004
HID_DEVICE
The red is your vendor ID and the green is your product ID. So your keylayout will be saved as :
Vendor_16c0_Product_05e1.klCapitals are important! Adam sent me a file that was labled with a .KL and the capital letters on the extension prevented it from working.
Now drag this file to your keylayout file in your OUYA, restart and it should be good to go.