[Android Head-Units] sciallo:
MCU communication

Ok, A very preliminary sum of what I found out about the way android communicates with the MCU. I'm just scratching the surface here, I'm sure there is much more to figure out but I'm posting findings as I go in case someone whants to jump in and help :)

I started finding similar things when I had the ouku, just in a different path. There is a few "virtual devices" in /sys/devices/virtual/ depending on permissions we can interact with them, and change things.

For example:

let's look at the /sys/devices/virtual/backlight/tw

as root in terminal (or as I'm doing it in a remote ssh from my computer)

root@android:/ # cd /sys/devices/virtual/backlight/tw
root@android:/sys/devices/virtual/backlight/tw # ll
-r--r--r-- root root 4096 2014-05-13 02:26 actual_brightness
-rw-r--r-- root root 4096 2014-05-13 02:38 bl_power
-rw-rw-rw- system system 4096 2014-05-13 02:40 brightness
-r--r--r-- root root 4096 2014-05-13 01:53 max_brightness
drwxr-xr-x root root 2014-05-13 01:53 power
lrwxrwxrwx root root 2014-05-13 02:26 subsystem -> ../../../../class/backlight
-r--r--r-- root root 4096 2014-05-13 02:26 type
-rw-r--r-- root root 4096 2014-05-13 01:53 uevent
root@android:/sys/devices/virtual/backlight/tw #

We can see an actual_brightness read only file, and a brightness read-write file, I haven't found a case when they're different yet.

cat brightness

Will show it's value,

echo 5 > brightness

will change it's value to 5 and you'll see the screen dim :)

Interestigly if you connect the illumination wire to 12v. that will show a much more drastic difference, a value of 1 is still very visible with the front panel buttons off (headlights off - daytime) barely visible with the headlights on... Also, turning the lights on does slightly dim the backlight, but I haven't found the virtual device it changes (if any) yet. I have my "dvd" button mapped to dim the backlight in the settings, a push of that changes from 10 to 1 to 0 then back to 10. on the command prompt I can now change it from 10 to 0 in increments of 1. (that will come in handy if I ever do get the time to get into the IOIO... Think true screen dimming tied to the dashboard dimmer :)

In this directory not much else does anything. The read only max_brightness tells me my max is 10 bl_power (I'm guessing back light power) is always 0, changing it to 1 or 10 doesn't seem to do anything, I haven't had the guts to try and chmod any of the read only to see if I can change a value (for example max_brightness).

another folder with many files like that is

root@android:/mnt/sdcard # cd /sys/devices/virtual/tw/misc
root@android:/sys/devices/virtual/tw/misc # ll
--w--w--w- root root 4096 2014-05-13 03:28 bt
-rw-rw-rw- root root 4096 2014-05-13 03:28 lheadrest
--w--w--w- root root 4096 2014-05-13 03:28 navi
-rw-rw-rw- root root 4096 2014-05-13 03:28 phone
drwxr-xr-x root root 2014-05-13 03:26 power
--w--w---- root root 4096 2014-05-13 03:28 reset
-rw-rw-rw- root root 4096 2014-05-13 03:28 reverse
-rw-rw-rw- root root 4096 2014-05-13 03:28 rheadrest
-rw-rw-rw- root root 4096 2014-05-13 03:28 source
lrwxrwxrwx root root 2014-05-13 03:28 subsystem -> ../../../../class/tw
-rw-rw-rw- root root 4096 2014-05-13 03:28 test
-rw-r--r-- root root 4096 2014-05-13 03:26 uevent

Here we can see a few write only files. These devices provide no output, I guess they only take input...

A very interesting one here is the "source" device...

With back button on radio, our "source" goes to 0, here is what I found out so far:

0: android (only - back arrow in radio - I can play pandora while for example my input value is 8)

1: Radio

2: cd/dvd

3: Music (native app - not really an android app, mcu based player)

5: TV

7: Aux.

8: BT music

9: Video (native app - not really an android app, mcu based player)

I don't have an Ipod to find out what the input is and I guess I couldn't find out what the other missing value is (if anything)

I can switch audio input with for example:

echo 8 > /sys/devices/virtual/tw/misc/source

The funny thing is that it does not switch the unit to it so I can do that while my radio app is open, listen to my BT music while the HU is still displaying the radio app. I can even tune my radio (without hearing it) but If I use the "tune" knob it will skip to the next song on my phone.

The "test" kind of scared me for a second, I think it gets it in reverse and there is no coming back short of rebooting...

That's all I got so far (and a bunch of unrelated questions I'll come back and ask once I have my list together and I've exhausted my search)

Thoughts, ideas?