Friday 24 November 2017

Hizpo Android car head unit MTCD_XRC sofia3gr

* Update 27/11/17 (See end of page)

I received this as a present from my wife for my birthday, I'd chosen it and ordered it but it was still my birthday present as I wanted a project and loved the idea of getting an android head unit for the car.
I knew it would be a project as it's not as simple as swapping the ISO (Wiring) harness in my make of Chrysler and making it work, making it fit into the dashboard, etc. But that's in a separate post.
This is all about the head unit itself which is from a company called Hizpo and was from ebay. Pricing was good for an Android 6.0.1 head unit, for around £100 with all the extra cables, inputs, etc.
The unit is double DIN and it's specs are below.

Android 6.0.1 Marshmallow
A-MEDIA AUTO (1024x600)
Baseband: SF3GR_M-26.3
Kernel: 3.14.0+ rocky@hctr930 #55
Build number: sofia3gr_car_64-userdebug
Memory: 918MB

I knew it wasn't going to be amazing performance as it's only a 1Gb unit, and things have moved on in Android so 1Gb is total minimum. So after getting the unit and using it? It's not bad, except for a few niggles that I'm working on.
The biggest problem is that there is a task killer somewhere in the stock ROM that seems to kill any app it deems as using too much resources. That means using Google Maps (which is a big memory hog) gets killed randomly, or other apps do whilst maps is running (e.g. music playing can get stopped whilst navigating). This is the biggest annoyance I've found so far.
So I'm now determined to get all the niggles fixed, so onto how to get around it!

  • ADB over wifi
The first bit is to get into ADB and the shell of the unit, this seemed tricky at first. You can't get to developer options by tapping the build multiple times as the ROM developer has removed that option, so in this case you have a few different ways of doing it. Firstly there is a menu "Factory settings" in the main android settings menu. Tapping on it you get a password box. This password box accepts different passwords for different settings.
126 goes into head unit specific settings
adbon enables ADB
3368 i've not yet tested.
I'm unsure if the adbon alone worked, so I also installed a terminal application and at the terminal put in the setting for adb over IP:

setprop persist.adb.tcp.port 5555
I then went to reboot. After reboot, I connected my laptop and the head unit to a wifi access point and then ran adb connect 192.168.x.x (being the IP the head unit picked from DHCP). If you're not sure what IP it is, install "ADB wireless (no root) by Henry", that will show you your IP and also try to enable adb over tcp too, so quite handy. Doing that, I got a shell (adb shell).
  • Rebooting
This isn't as obvious as it first seems! Turning the ignition off runs a 'shutdown' event on the head unit, but in reality it's going into a deep sleep (with processes killed) mode. So it doesn't do a full reboot on power on (This is GOOD as it stops it taking ages when you turn your car on). So pressing and holding the volume knob, that did the same put it into sleep.
I found that if you press the recessed RESET (with a pen or similar point) that causes a reboot of the device.
Some people with different MCU versions (mine came with 2.58_1) report their shutdown and wake-up are buggy and have problems. I can confirm my MCU version here appears to sleep and wake-up really well. Initial boot time is a few minutes (from total battery off), then when you turn the ignition off the unit displays "Shutting down" and goes into a deep sleep. Switching ignition back on and the unit is back running withing 10 seconds and will resume the last music action, normally playing from where you left off.

  • Root/Su/Sudo
After getting a shell, I tried to get root with su, sudo, etc, and as usual it wasn't already installed. Therefore we need to root it. I'm going to use SuperSU as there are a few methods and scripts out there to do the install. One method is using which is a modified version of what I'll be doing.
I can confirm I've got root using the simple method using the file "". Use the script and adb over wifi and this works great, root confirmed.

  • Developer options/tools
This used to be in the play store as "Spare Parts" but it's since changed it's name, and how to get to the developer options in our modified ROM? It doesn't appear to be available from any menus or able to be enabled. However it is there, you just need to be able to load it! So I installed "Developer Options from uDroid". That creates a link and clicking it will load the developer options screen. Checking through this didn't yield anything that would help me, and in fact I made things worse by causing apps to suspend as soon as they lost activity/focus, but there are various settings in there should you need them!

  • Recovery menu (for rom flashing, etc)
To get to a recovery menu for these units:

* Press reset button and hold until you see the button lights blinking (10 secs approx.)
* Release and press again until you see the lollipop logo
* Release and wait to the recovery menu.
Once into recovery, use the reset button for:
* Move along the options (short press)
* Select an option (long press)
  • Custom ROM
This one has currently eluded me, I cannot find a custom/alternative ROM for these Intel Sofia units, which unfortunately may mean I need to 'cook' my own, which isn't something I've done in a lot of years now! (Going back to the google g1/HTC Dream phone)

  • Bluetooth to phone
This was easily setup, go into normal android bluetooth settings menu, pair with phone, allow for calls, phonebook, etc. So I can then click on the "Bluetooth" button on the home-screen/widget and it will show my dialler screen, load contacts, search contacts, etc. Dialling and using it as handsfree worked great, call quality was reasonable. I've since plugged in an external MIC which has improved the audio quality further.
One problem I keep finding though, is that when the unit goes into standby it seems to switch off bluetooth. I've since installed an app "Bluetooth Auto Connect" by "UniqTec" that keeps enabling it and forcing the connection to my phone. This seems to have solved the problem. However no matter how much I select for PAN (Networking) it doesn't seem to enable this. If I go into Settings > Bluetooth and click the cog beside my phone pairing, the "Use internet access" is always unticked and I have to tick it, this then lets the head unit use my phone for it's internet connection. (As an addition on my phone I've installed "Blue Car Tethering" which keeps the tethering enabled on my phone connection ready to accept the connection from the car.
  • Text/SMS alerts
This is one I'm really looking to solve. My phone is paired via bluetooth to the head unit when driving, so I've got handsfree calling, the head unit also uses my phone for internet via bluetooth PAN. However I've not yet found a good way of getting text messages read out to me by the head unit when they arrive. Firstly you need to 'push' the messages to the head unit. I'm currently trying "Tablet SMS 4 Phone" by estang, but the problem is when the head unit goes into shutdown/sleep it kills all background tasks and won't reload them when it powers back on!

I'm continuing to find out more and figure out these bugs, so I'll keep updating this post when I get more!
For now, here are some images of the unit itself:

* Update 27/11/17
So I've continued to investigate, and by watching adb logging whilst carrying different actions, I've come to the conclusion that ART (The newer equivalent of DALVIK) is doing the application killing. In this case I suspect the default has been set as a little too aggressive and is killing application intents at too high a memory level.
The idea is that the kernel has a built-in application killer that will trigger based on several key triggers. These can be seen/set using the /sys/ filesystem:
cat /sys/module/lowmemorykiller/parameters/minfree 
So this shows the different current settings I'm testing.
x1, x2, x3, x4, x5, x6, where each (x) is a memory threshold and 
x1 represents Foreground Applications, x2 Visible Applications, 
x3 Secondary Server, x4 Hidden Applications, 
x5 Content Providers and x6 Empty Applications
This is in memory pages, so to get actual values the formula is [(M*1024)/4=MP].
Where M is the value in Mb and MP is the memory page values.

So far, this has stopped maps from killing and switching between this and music it seems to have solved the issue. Whether this causes a total system failure due to letting memory get too low remains to be seen.

Wednesday 15 November 2017

Car fuse splitters - warning!

I needed to add an extra item to one of my car fuses recently, this was to power my daylight running LEDs (DRLs) and so I found the easiest option was to wire into the ACC fused function in the fusebox. In my car it's in the bonnet to the side so exactly where I need it.

A colleague recommended a nifty fuse splitter that he'd used previously. You take the existing fuse (mini spade fuse on mine) and replaced it with the splitter, which contains two fuses (the original and new one) and a flying lead with crimp connector on. Ideal for this sort of job! (Just be careful not to overload the fuse outlet as the fuse holders were only rated for the original, so an original 20amp if you use 2x20amp and it pulls all 20amp each of them the fuse socket will carry 40amp so may be too much for the wiring, etc!).
So I searched ebay and found what I wanted:

As you can see these are nifty little units, plug them in and add your new fuse. They do go at an angle so it may be tricky to fit in place depending on the size of fuse holder, whats around it, etc, but that should work great.

Unfortunately my cheap-ness then cut in and I started looking for cheaper than £4.49 for 4.
I found some for £3.79 for 4 and with faster delivery, so I duly ordered them. However when they arrived, I think I found why they were cheaper!

The fuse pins themselves have additional plastic around them, almost to the full depth of the pins, so these won't push into a regular mini fuse holder. In addition the fuse sockets on the device itself also have poor connectors and don't hold the fuses properly in place, not securely enough for them not to rattle out during normal driving.
You can see on the photo above the black plastic tab that extends down to the full length of the pins, rendering these useless!
I tried to cut away at this plastic to make them useful, but this ended up with the whole thing exploding and the pins not being secured, so in the end I've given up for now.

Will buy the better ones at some point and do this job again properly!
BTW naming and shaming the dodgy ones the ebay item id is 122558391093.

NOTE: To be fair, now I've looked at the pictures of the ebay sale item they do show this plastic lip, so the photos are accurate!