Jump to content


Photo

[Wip] Hdmi On Non-Moto Based Roms

HDMI

  • Please log in to reply
1 reply to this topic

#1 djuniah

djuniah

    Member

  • Developer
  • 124 posts
  • LocationPhiladelphia, PA

Posted 17 September 2012 - 10:02 AM

Ok, so i've been poking around trying to get HDMI support working in non moto-based ROMs (basically anything that would be using kexec or an AOSP base like CM9). It's not complete but i figure it's better to have more eyes on this than just mine. Apologies ahead of time if this post turns into a big info-dump, but here's what i have so far. Also, this is HDMI only, not webtop. Once this is working for HDMI, I doubt it will be all that hard to get webtop up and running (although i could be way off on that one as well).


Initial research:
My previous phone was a Droid X and there were similar issues relating to HDMI on non-stock roms. So my first inclination was to look into how that was fixed.
Here's the post in question:

Please Login or Register to see this Hidden Content


Basically, there are some required framework files that are needed for detecting an HDMI cable, notifying the system that it exists and enabling the output. There were also some permissions files and an APK that needed to be copied as well. The big issue with this is that the APK needed to be signed with a signature that matched the one that the ROM was built with (and since a lot of devs use the default android test/build keys, this wasn't all that difficult).
Now, keep in mind that the HDMI on the droid X wasn't mirror mode and operated VERY differently. However, it gave me a good place to start looking on the razr.

Some digging:
First, after looking through system/app i found this apk: ExtDispService.apk. As with the DX, this file is definitely going to be needed. This was where i started digging. I contacted dhacker about his CM9 build and he helped me get set up with the keys i needed to re-sign the APK. Once that was done, i added it to the CM9 install zip, and put it on my phone. Now, of course it immediately crashed, but at least i had some logs to help me determine why.

Tools:
As a small note, I was using Virtuous Ten Studio to do a lot of this editing. I can't stress enough how awesome this program is for things like this. I had been doing it all manually at the start and making ONE change to that APK would take me close to 15 minutes. With VTS, i could do it in 5 or less. So from here on out, if you're following along, be sure to have the APK and JAR files mentioned added to a project in VTS and de-compiled so that you can see the smali code.

The roadblocks:
So once i had the logs, i was able to see where the APK was crashing. I knew that I would need to include some items from the framework, but i just wasn't sure what yet.
The first hiccup was in ExtDispService$HandleInitAutoDetectSetting.

Please Login or Register to see this Hidden Content


So, from looking at this, you can see that it's trying to access a Moto utility that allows programs access to information from the settings menu. In this particular instance, it's the on/off switch for HDMI autodetect. This opened up a whole new can of worms. How would we add these items back to the settings menu? How would we fake the overscan setting?

My first inclination was to look for the MotorolaSettings class and include that into the package. However, this could potentially lead us down a very dark path of dependency hell. Worst case scenario: we have to include a lot of moto's framework to get this working (and isn't the whole point of this to get away from moto's code?!). However i had been messaging dhacker a bit about this and he mentioned that he included framework-ext.jar and that problem went away. However, I was not able to replicate that success. Instead i attempted to remove the references to the settings menu in the smali code and replace them with hardcoded values. This was EXTREMELY hackey but it was more of a proof of concept at this point anyway. I was able to get the phone to boot and not have ExtDispService crash on me, however there was also no response when I plugged in the HDMI cable (nothing at all in the logs). Sadly, this was about a month ago, and i don't have the logcat's anymore. I actually had a similar result when i transplanted the settings smali class (com.motorola.android.provider.MotorolaSettings*) from framework-ext.jar into framework.jar (since for some reason, it wouldn't recognize that ext jar when i added it).


List of files needed:
Here are a list of some files that i know are required to get this working:
system/app/ExtDispService.apk
system/framework/framework-ext.jar
system/lib/libextdispjni.so
system/lib/libhdmi.so
system/lib/libhdcp.so

Some final thoughts:
I realize that there isn't too much concrete info here, but I wanted to share what progress I had made so that maybe someone else could either pick up from where i've left off, or make some suggestions on how to proceed. I'm running artic HD at the moment and noticed that there were a couple custom menus in the settings panel (CPU Control). So with some work, it seems like we could probably duplicate the functionality of the moto one, and replace all references in the code to the duped one.
  • Nanniepoo likes this

#2 rnh

rnh

    Member

  • Dedicated Supporter
  • PipPip
  • 294 posts
  • LocationA Ct Yankee living in the land of Mass-oles
  • Current Device(s):Razr,

Posted 17 September 2012 - 02:33 PM

The developers of the new Nitrocm9 rom have said they are developing a rom with webtop and hdmi out capabilities. Perhaps you should contact them.
  • mattlgroff likes this





Also tagged with one or more of these keywords: HDMI

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users