Jump to content
Flirc Forums

[GUIDE] getting Flirc to work with OUYA


stacyk819

Recommended Posts

 

Hi I just got flirc and ouya today and spent the last few hours getting it working with my ouya. Obviously android recognises it as a usb keyboard so some functions work right away but you need to get a little tricky if you want everything to work seemlessly including android home, menu, back buttons.

 

Step 1: install superuser

follow this guide:

http://forum.xda-developers.com/showthread.php?t=2270589

 

if you do not understand how to do this i cannot help you.

 

Step 2: install a file manger, I use es file explorer

 

step 3 navigate to system/usr/keylayout and find the file "Generic.kl"

 

this file is the default key map and maps android functions/ characters to coresponding keys on the keyboard

 

Step 4: edit file

 

NOte: on es file manager you need to enable r/w access by going to tools> root explorer

 

using this file you can set android use certion functions for different keys. I didn't change this too much but made one really important edit. Key 102 which corresponds to the "home" key on most usb keyboards is by default set to "MOVE_HOME" which means go to the top of the page you need to change this to "HOME ALT" which is a special function that ouya made to be the home button.

 

Note: for most android devices "HOME" is the home key but this brings up the menu on ouya, the reason they did this is so they can have single tap bring menu and double bring home.

 

 

 

Done

 

This seems really simple and isnt too bad the tricky part was figuring out about the "HOME ALT" function which as far as I know I am the only one to figure out.

 

PS: this is off-topic I hate the ouya launcher but installed nova launcher and open launcher for google tv both of which work really well, I have it set to open nova at start (sort of a desktop) and open open launcher with the home button (which goes over the media or apps and is great for multitasking etc. I have attached the apk which is very hard to find because you need a google tv to get it from the playstore

 

https://dl.dropboxusercontent.com/u/17958951/Open-Launcher-for-GTV.apk

  • Like 2
Link to comment
Share on other sites

EDIT: so mapping the keys (menu and back) using the app worked in android but not in xbmc, in order to get around this, you need to set the keys you want in the "Generic.kl" file to

 

HOME           VIRTUAL

and

BACK           VIRTUAL

for some reason when they are not virtual, it crashes xbmc

Link to comment
Share on other sites

This is awesome - glad someone found the time to post a great guide.

I'll be directing people here for android related things :)

 

this is off-topic I hate the ouya launcher but installed nova launcher and open launcher for google tv both of which work really well

I saw a video of the Ouya launcher... seemed an acquired taste.

Link to comment
Share on other sites

EDIT: Easier method/ way not to mess up your default keyboard layout.

 

So on android you can create different key layouts for individual keyboards as long as the file names indicate the device (see attached)

 

I created a key layout for flirc and restored my stock generic one so that other keyboards arent affected.

 

Instructions

 

Step 1: root/ install superuser

 

Step 2: move attached file (unzipped of course) to /system/usr/keylayout/

 

Step 3: on Flirc software program the following buttons for android commands ie: program the buttons on your remote to the keys which correspond to the following android commands

 

esc: back

home: home

F2: MENU

F3: play/pause

F4: play/pause

F5: Stop

F6: rewind

F7: previous track

F8: next track

F9: fast forward

 

Done

 

all other keys are default, of course you can edit the key list to whatever you want...

 

 

 

Vendor_20a0_Product_0001.zip

  • Like 1
Link to comment
Share on other sites

Well, I have been dealing with setting up Flirc with an Ouya and a Harmony One today.  Part of the reason I bought the Ouya was promises it will work with XBMC.  It seems like it will work pretty well, especially when there is an Ouya optimized version.

 

Anyway, I've got everything pretty much working in XBMC by remapping some keys in Keyboard.xml (such as mapping "b" to back and "c" for context menus) and then setting Flirc to emulate those keys.  Other mappings are quite easy, like mapping the Harmony's "ok" key to "return" on the keyboard.  This works nicely in XBMC.

 

I'd like to get it to work fine with the OUYA interface as well.  I've tried some ways to do this, but the problem that OUYA UI hasn't quite standardized itself yet.  For instance in the "Make" menu, you can hit the return key and it selects, but in the other a keyboard return does nothing.  Android itself usually has trouble with the ESC key, but oddly in OUYA it works in some circumstances and doesn't work in others.

 

So the next idea is to use an Android program like Exernal Keyboard Helper to do some internal Android remapping so that those Harmony keys emulate keys on the OUYA controller.  However I haven't been successful in that yet either.  Here is part of the generic.kl file.

 

key 304   BUTTON_A
key 305   BUTTON_B
key 306   BUTTON_C
key 307   BUTTON_X
key 308   BUTTON_Y
key 309   BUTTON_Z
 

Do constants like BUTTON_O work in this file? Does anyone know?  They aren't present in External Keyboard Helper... has anyone tried to edit the generic.kl directly to emulate the controller buttons.

  • Like 1
Link to comment
Share on other sites

EDIT: Easier method/ way not to mess up your default keyboard layout.

 

So on android you can create different key layouts for individual keyboards as long as the file names indicate the device (see attached)

 

I created a key layout for flirc and restored my stock generic one so that other keyboards arent affected.

 

Instructions

 

Step 1: root/ install superuser

 

Step 2: move attached file (unzipped of course) to /system/usr/keylayout/

 

Step 3: on Flirc software program the following buttons for android commands ie: program the buttons on your remote to the keys which correspond to the following android commands

 

esc: back

home: home

F2: MENU

F3: play/pause

F4: play/pause

F5: Stop

F6: rewind

F7: previous track

F8: next track

F9: fast forward

 

Done

 

all other keys are default, of course you can edit the key list to whatever you want...

Interesting stuff. I'll have to check if we can distribute keymaps through the play store as i'm sure a lot of users won't want to root (and many will have no problem).

 

Really should get myself an android media box or something of android that I can plug a flirc into

Link to comment
Share on other sites

Well, I have been dealing with setting up Flirc with an Ouya and a Harmony One today.  Part of the reason I bought the Ouya was promises it will work with XBMC.  It seems like it will work pretty well, especially when there is an Ouya optimized version.

 

Anyway, I've got everything pretty much working in XBMC by remapping some keys in Keyboard.xml (such as mapping "b" to back and "c" for context menus) and then setting Flirc to emulate those keys.  Other mappings are quite easy, like mapping the Harmony's "ok" key to "return" on the keyboard.  This works nicely in XBMC.

 

I'd like to get it to work fine with the OUYA interface as well.  I've tried some ways to do this, but the problem that OUYA UI hasn't quite standardized itself yet.  For instance in the "Make" menu, you can hit the return key and it selects, but in the other a keyboard return does nothing.  Android itself usually has trouble with the ESC key, but oddly in OUYA it works in some circumstances and doesn't work in others.

 

So the next idea is to use an Android program like Exernal Keyboard Helper to do some internal Android remapping so that those Harmony keys emulate keys on the OUYA controller.  However I haven't been successful in that yet either.  Here is part of the generic.kl file.

 

key 304   BUTTON_A

key 305   BUTTON_B

key 306   BUTTON_C

key 307   BUTTON_X

key 308   BUTTON_Y

key 309   BUTTON_Z

 

Do constants like BUTTON_O work in this file? Does anyone know?  They aren't present in External Keyboard Helper... has anyone tried to edit the generic.kl directly to emulate the controller buttons.

THe OUYA controller keymap is called "Vendor_2836_Product_0001.kl" located in the same folder check that out if you want to map the remote to OUYA functions

 

You can use this app: https://github.com/downloads/chrisboyle/keytest/KeyTest.apk to find out which keys correspond to which OUYA buttons

Link to comment
Share on other sites

I attached a copy in case you dont want to go grab it from your ouya.. you can probably just change the key numbers to whatever you have set on your remote/flirc and rename it to "Vendor_20a0_Product_0001.kl" idk though i havent tried like i said I dont use the ouya launcher but i can navigate fine just useing to normal buttons using my keymap though i havent messed with it too much though as enter and back only function as the O and A keys

Vendor_2836_Product_0001.zip

  • Like 1
Link to comment
Share on other sites

Well, I have been dealing with setting up Flirc with an Ouya and a Harmony One today.  Part of the reason I bought the Ouya was promises it will work with XBMC.  It seems like it will work pretty well, especially when there is an Ouya optimized version.

 

Anyway, I've got everything pretty much working in XBMC by remapping some keys in Keyboard.xml (such as mapping "b" to back and "c" for context menus) and then setting Flirc to emulate those keys.  Other mappings are quite easy, like mapping the Harmony's "ok" key to "return" on the keyboard.  This works nicely in XBMC.

 

I'd like to get it to work fine with the OUYA interface as well.  I've tried some ways to do this, but the problem that OUYA UI hasn't quite standardized itself yet.  For instance in the "Make" menu, you can hit the return key and it selects, but in the other a keyboard return does nothing.  Android itself usually has trouble with the ESC key, but oddly in OUYA it works in some circumstances and doesn't work in others.

 

So the next idea is to use an Android program like Exernal Keyboard Helper to do some internal Android remapping so that those Harmony keys emulate keys on the OUYA controller.  However I haven't been successful in that yet either.  Here is part of the generic.kl file.

 

key 304   BUTTON_A

key 305   BUTTON_B

key 306   BUTTON_C

key 307   BUTTON_X

key 308   BUTTON_Y

key 309   BUTTON_Z

 

Do constants like BUTTON_O work in this file? Does anyone know?  They aren't present in External Keyboard Helper... has anyone tried to edit the generic.kl directly to emulate the controller buttons.

Hi I just read your post more carefully... Clearly you did not read my guide at all because otherwise you would have flirc working perfectly with your ouya menu and xbmc. external keyboard helper does not work very well  with ouya because it is not actually able to map the keys correctly (ouya changes a few things around from stock android) for example you can map the menu and home button with external keyboard helper but they will not work for all programs, you need to create a new keymap. I am gong to delete my earlier comment about that program because it will likely confuse more people. in order to get it working you need to create a custom key layout and name it "Vendor_20a0_Product_0001.kl" you can use either the generic keylayout or the ouya one as a template.

 

you also do not need to map the keys c, i etc because xbmc for android recognises the context menu as the menu button and back as the back button.

 

you should delete the Keyboard.xml file and just edit the android keymaps located in /system/usr/keylayout/ or just copy the file i attached and follow my instructions and everything will work perfectly...

 

also this version of xbmc works really well with ouya http://forum.xbmc.org/showthread.php?tid=152005

Link to comment
Share on other sites

I was actually writing my post at the exact same time you were writing your updated post, so I haven't tried the better procedure, no.  I am having some problems with su (the procedure for completly rooting ouya has some problems and caused my original su to go to zero bytes, so I have no su on my ouya currently) so I haven't tried the new keymap.  When I get the su problem figured out then I will put the new keymap in there as it's going to be the obvious solution to the problem.  Thanks for your help.

Link to comment
Share on other sites

Okay that makes sense...

 

Do you mean you cannot use su with adb? If thats true, you may need to reflash the image with recovery. you can download it here : http://forum.xda-developers.com/showthread.php?t=2266629

 

this will tell you how to get into recovery: http://forums.ouya.tv/discussion/1380/recovery-mode

 

if you can still use adb with su privlages however you don't need to do that.

 

in order to root, you should follow the instructions in post #8 in the xda i put in the first post here (http://forum.xda-developers.com/showthread.php?t=2270589) starting with pushing su to your sdcard ie: adb push su /sdcard/su

 

all of the files from the superuser zip need to be located in the sdk/platform-tools directory on your computer

Link to comment
Share on other sites

Thanks stacy... yeah, I can not su when I use adb.  I might have to do a reflash, though I have a suggestion from another forum to try out first.  That helps because I hadn't see reflash though, so this helps a lot.

Link to comment
Share on other sites

Stacy, et. al.:

 

Glad to say that after a console reflash I have everything working.  I used the kl file here but with some modifications.

 

To answer my own earlier question, the OUYA buttons are mapped using the usual interal keycodes:

 

BUTTON_A = the O button

BUTTON_B = the A button

BUTTON_X = the U button

BUTTON_Y = the Y button

 

Yeah, that's a bit confusing but that the usual button layout of a playstation controller, of course.

 

So I changed the keymap around so that "return" key on the Harmony maps to the Ouya O button and and "back" maps to the Ouya A button.  This gets around the fact that the keyboard behavor is different on differenl Ouya launch screens.  If you plug in a USB keyboard, Enter and ESC do not work on all the screens.  Hopefully as the OUYA launcher matures this will be fixed.  At that point programming the Flirc (at least for my situation as I have no home key to use) will just be a matter of mapping the correct keyboard keys.

 

Thanks for the info... hope this helps someone as well.

 

--dcl

Link to comment
Share on other sites

  • 1 month later...

Hi, I tried following the second guide with my harmony 650 and for some reason whenever I press a button the signal is received 2-4 times by my flirc. I tried using the Panasonic TC-P65VT30 and SAMSUNG LN46C650L1F as recommended in the forums and I still haven't had any success. Any ideas that I could try?

Link to comment
Share on other sites

Stacy, et. al.:

 

Glad to say that after a console reflash I have everything working.  I used the kl file here but with some modifications.

 

To answer my own earlier question, the OUYA buttons are mapped using the usual interal keycodes:

 

BUTTON_A = the O button

BUTTON_B = the A button

BUTTON_X = the U button

BUTTON_Y = the Y button

 

Yeah, that's a bit confusing but that the usual button layout of a playstation controller, of course.

 

So I changed the keymap around so that "return" key on the Harmony maps to the Ouya O button and and "back" maps to the Ouya A button.  This gets around the fact that the keyboard behavor is different on differenl Ouya launch screens.  If you plug in a USB keyboard, Enter and ESC do not work on all the screens.  Hopefully as the OUYA launcher matures this will be fixed.  At that point programming the Flirc (at least for my situation as I have no home key to use) will just be a matter of mapping the correct keyboard keys.

 

Thanks for the info... hope this helps someone as well.

 

--dcl

Hi, 

 

I'm just working through the keymaps for my Flirc/Ouya/Harmony and came across your post. 

 

Care to share your .kl file? I'm not sure I understand what you have changed in the files above to get the fix for enter and escape working on the remote. 

 

Are you mapping the Ouya controller O and A buttons to act exclusively as enter and escape respectively on the Ouya itself? Does this affect the usability at all? I've noticed that I HAVE to use the O and A buttons on the controller some times so wouldn't removing the map for those also remove their ability to behave as intended and render the controller useless? 

 

I have my Harmony setup well for navigating plex as plex interprets enter and escape correctly. It's just when I get back into the main menu's that I have to use the controller to navigate around/back into plex. 

 

Thanks in advance. 

Link to comment
Share on other sites

Hi, 

 

I'm just working through the keymaps for my Flirc/Ouya/Harmony and came across your post. 

 

Care to share your .kl file? I'm not sure I understand what you have changed in the files above to get the fix for enter and escape working on the remote. 

 

Are you mapping the Ouya controller O and A buttons to act exclusively as enter and escape respectively on the Ouya itself? Does this affect the usability at all? I've noticed that I HAVE to use the O and A buttons on the controller some times so wouldn't removing the map for those also remove their ability to behave as intended and render the controller useless? 

 

I have my Harmony setup well for navigating plex as plex interprets enter and escape correctly. It's just when I get back into the main menu's that I have to use the controller to navigate around/back into plex. 

 

Thanks in advance. 

 

Sorry that I don't check this thread too much.  I am going to attach my current .kl file for you to take a look at. I am not sure it's finished.  It isn't well commented, but I can tell you that my changes are "key 1" and "key 28".     Key 1 and Key 28 are what Android would see as "ESC" and as "Return" respectively.  Ouya doesn't map those correctly to their usual uses, or at least it

 

It actually doesn't affect any Ouya usability at all because you are ONLY redefining keys in resepect to FLIRC itself.  It shouldn't affect anything else.

 

I have to admit that I didn't understand the problem with the "HOME" key until just a few minutes ago, so I don't think the home key is mapped on my .kl file.  Maybe I can experiment with that this weekend and that working as well.

 

One last thing: don't put the .kl file where it says above.  It will be erased every time there is a system update.  I was about to post on that when I saw your question to me.

 

--dcl

Vendor_20a0_Product_0001.kl.zip

  • Like 1
Link to comment
Share on other sites

I have an update to this.  You might have noticed that the .kl file gets wiped every time there is a system update if it is put in /system/usr/keylayout/.  Since Ouya has had an update a week this is a problem.  Here's the solution for that...

 

In the android dev site I found this information about the .kl files:

 

Key layout files are located by USB vendor, product (and optionally version) id or by input device name.

The following paths are consulted in order.

  • /system/usr/keylayout/Vendor_XXXX_Product_XXXX_Version_XXXX.kl
  • /system/usr/keylayout/Vendor_XXXX_Product_XXXX.kl
  • /system/usr/keylayout/DEVICE_NAME.kl
  • /data/system/devices/keylayout/Vendor_XXXX_Product_XXXX_Version_XXXX.kl
  • /data/system/devices/keylayout/Vendor_XXXX_Product_XXXX.kl
  • /data/system/devices/keylayout/DEVICE_NAME.kl
  • /system/usr/keylayout/Generic.kl
  • /data/system/devices/keylayout/Generic.kl

When constructing a file path that contains the device name, all characters in the device name other than '0'-'9', 'a'-'z', 'A'-'Z', '-' or '' are replaced by ''.

 

The major difference between /system and /data (not noted here) is that /system is what is wiped and replaced when the Android image is updated, so it is a bad spot to put user fixes.   /data is where all your user settings and packages go and they are left untouched on an Ouya system upgrade.

 

So, to put it in a nutshell, but the Vendor_20a0_Product_0001.kl file in /data/system/devices/keylayout.  You will probably need to create these directores on your Ouya.  I did on mine and it works as this is a basic Android behavior for Android keylayout files.

 

I held off on posting this to make sure that I was correct.  After the Ouya system upgrade from this week it still continues to work.

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

Hey, is there an easy way to add the file to data folder in ouya? I don't have permission to go to data folder. Do you always need supersu? How do you install that?

My harmony remote works ok, but only the buttons back, home and info doesn't work. Maybe remapping keys in xbmc for ouya is an option?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...