Greetings Everyone,
Thank you so much for keeping this community alive. I really love the idea of ouya and how important it was to the indie gaming history.
[TL;DR] I did a backport of the Nintendo switch pro controller driver to work on ouya. See the bottom of the message to get the link to the resources.
I acquired my ouya in the past because I was interested in indie development, and I bet that it could be a good platform to aim for. Well, you know the story of ouya, and I did not find success in this career anyway. So, after several years I decided to take a look in my ouya again and play some games and also see if I could use it as a streaming device for gaming on my local network.
Well, I have a switch pro controller which I think is one of the best controllers that I have used in my life. I was curious if I could use it wherever it is possible. As you may imagine, connect to ouya does not work so straight forward, if you are able to connect and use the generic input driver, the leds will be blinking like it is still connecting, but the most annoying part is the sticks that will be moving like it is limited to 75% of the range, which of course is unacceptable for most games (or at least the ones I would like to play). Also, the default mapping does not include the home button, so you are unable to exit games or use some options for some games or apps.
Okay, I was wondering if I could do some hacking stuff like port the working driver that works on linux. After some research I found the driver source code, at least a version of it:
https://github.com/DanielOgorchock/linux/blob/ogorchock/drivers/hid/hid-nintendo.c
Things got exciting, because I finally could see a way to make it work. I also learned a lot by reading the amazing article of Christian Weiske: https://cweiske.de/tagebuch/ouya-usb-joysticks.htm. Well, I never had experience writing drivers nor building the kernel of linux, so it was a perfect good start.
Of course, there was a lot of challenges to solve, I had to adapt the driver code to run in a much older kernel, and there were some skills gaps of mine and I had lot of a-ha moments to progress in this task and make it work properly like I wish. Here I highlight some of the most challenging parts that I found and addressed somehow:
-
I could not find a way to use the kernel of the ouya to send messages/commands to the joystick (output report). So, I had to change little bit the bluetooth module based on what I saw in the newer kernels that the original driver was based. This was important to request calibration data and setup the leds.
-
Looks like that the ouya distribution link the name of input to the name of the device when you pair it on the settings app. I had to change to set it to ‘Pro Controller’, while the original code set it to ‘Nintendo Switch Pro Controller’ (best a-ha moment)
And here are some caveats of this implementation and unknown answers:
-
I totally removed the code for battery, I don’t think it will be used anyway
-
I disabled IMU, like the same above
-
I don’t know if the joycons works with this implementation. Well, the original driver supports it, but I didn’t test nor did take care to ensure it works.
-
Similar above, the rumble may work, but I guess that the ouya itself doesn’t have a game that uses it (due to the original joystick does not have rumble), and I didn’t test as well.
-
Extra caveat: Building a custom kernel and installing the ouya make some modules that are not part of the zImage stop working like bcmdhd for wifi. I can share later more details and how to fix it.
The saddest thing, in the end, is that it is still not enough for what I want to do. The joystick works via bluetooth and usb, but on bluetooth the connection is unstable, due to known hardware limitation of the ouya itself. But who do I want to fool? I don’t even have time to play hehehe. I guess that the fun was to just go into this journey and learn a little bit in the process. I was very happy and proud of the results; it is not so often for me to write software that will change somehow my own life. I know that this solution is very specific, but I am sharing it anyway because it might be helpful to someone who might be interested to something similar in the same way the article of Christian inspired me and helped me to conclude my task.
Resources and minimal instructions:
Kernel Fork: https://github.com/wallashss/ouya_1_1-kernel
Key Mapping File: Nintendo Switch Pro Controller mapping for Ouya: Vendor_057e_Product_2009.kl · GitHub
The instruction to build it is very similar to the article that I mentioned few times, you just need to change the repo for the kernel and use the key mapping file that I shared in the gist above (I assume you’ll know what you are doing):