Android Open Source and Hardware Obsolescence

Why only NEXUS devices are sensible choice for Advanced Android Users and Developers? Because NEXUS device vendors provide source code and device drivers.

This makes is possible to re-compile and re-create any customization of the Android by advanced users and developers. The most popular among them is CyanogenMod based on AOSP (Android Open Source Project).

Why is such customization really necessary? Because Vendors does not keep up with the Android development, their releases are flawed, contains unwanted modifications, quite often development is abandoned just after product release.

I know that Drivers Development is time and money consuming task for Vendors. Still, providing source code for device drivers would make it possible to run alternative and/or customized OS, also prolong device life for second-hand users in poor countries. Vendor sells the device anyway and Users can make fixes and customization. Why this Win-Win scheme is so hard to achieve in reality? Is really enforcing sales with mass garbage so important?

Google Android Voice Dial Fail

Another HALL OF SHAME entry goes to Google for missing reliable Voice Dial functionality. It is over 5 years of bleeding edge development of Android, thousands of people in the most powerful IT corporation on this planet, most advanced Text-To-Speech and Speech-To-Text engines available, and still, no reliable Voice Dial function. People that use phone to work simply need a Bluetooth or Wired Headset that is able to correctly dial a designated phone number they want to make a call. These are daily work basics. Learn from Apple iPhone. Until these basic functionalities are provided first I see no reason to introduce thousands of not-yet-working or never-working-will-one-day-fix stuff that only create false image of endless possibilities, potentially, but not at all functional in the real world scenarios..

I have Accessibility, Text-To-Speech, Voice-Input, OK-Google, Google Search, Handsfree, Voice Dialer, Google Voice Typing, Offline Speech Recognition, Bluetooth and Wired Headset Support. Still, it is impossible to dial a phone number via Headset that would not involve touching the phone. Really sad :-(

Update: After several days of struggle (using unsupported flashing tool and ripping the firmware from an official software that declined to work) I have managed to run Android 6.0 (7.0 is already out) on my mobile. Here Google seems to have replaced “Voice Dial” application with “Google Search” and now you can ask Google to dial a number for you. Well, it only works when you are online, and now Google knows exactly what you do all the time. What a breakthrough! ;-)

Sony Xperia Unlocked Mobile Firmware Restore

Sony Xperia phones are my favorite. Very good and durable electronics, amazing photo camera, nice utilities on top of standard Google Android OS. I have also always respected Xperia for allowing users to unlock their phones for Open-Source Firmware Customization on this amazing hardware..


Unfortunately, Sony seems to have this habit to make a bad decisions, so amazing hardware is not always followed with a good software. This is why Open-Source Customization is so important. I have already found several nice devices with a really bad firmware. What is more, this corruption seems to spread, and Sony blocks factory firmware restore for an unlocked devices with their official Xperia Companion utility. This means unlocking a device does not only Voids a Warranty, but also silently makes it Impossible to Go Back to a Stock Firmware! This is really bad idea.


Luckily smart people tends to predict and help each other out. Developer team of Sony Mobile released EMMA utility (nice name by the way) that allows you to re-flash mobile that is unlocked in case something goes wrong or you simply want to get back to a stock firmware.

Open-Source Firmware Customization will become a standard, even for large enterprises, with mutual benefit to their customers, because looking at the big picture we are part of the same eco(no)system..


Most modern Android based devices support USB OTG function [1]. USB is a Host centric bus that means there is only one Host device and many different Devices can be connected to it. Using inexpensive USB-OTG cable it is possible to swich smarphone USB port from Device to Host, and connect external devices, if chipset and OS build allows this. Google provides detailed information on how to code USB Host [2] in your application.


Sony Xperia M5 Bugs

I have just bought next inexpensive Xperia M5 phone with pretty nice hardware. However I already found those things to be missing or deliberately removed:

  • USB OTG does not work (solved).
  • CardBoard VR does not work.

Update regarding USB OTG – “it’s not a bug its a feature” – after you connect a USB device using OTG cable you need to run “Detect USB device” application that will make OTG work. Considering security this may be a good choice to allow external devices by hand.

Google Android Nexus Device Un-Brick


If you happen to brick your Google Nexus device you can always use stock ROM images [1] to revert it to a default and operational state. Package contains not only OS but also bootloader and radio firmware images!

I have bricked my device by installing custom firmware that messed partitions layout inside a Flash Memory. I have seen lots of people having similar problem of endless bootloader-loop. There is no need to send a device to a service when bootloader is operational. All you need is a stock firmware image from Google [1], USB cable, and fastboot utility from Android SDK. If you happen to damage a bootloader, then hardware manipulation at low-level is necessary over JTAG, I can help to recover your device in that case.. no worries :-)


Android: dynamic string processing

There are two easy ways to replace text on-the-fly in Android. This may be required if you want to insert some text/values into displayed text, or construct a data packet of some sort. Both require some code to replace given part of the string.

First is to use HTML/XML tags and then handle them with your own implementation of Html.handleTag(). Unfortunately, String conversion removes the tag in the background, so you need to escape < mark with &lt; in the string resource. This approach is good when you want to put variables inside a string and then process them later in one place using tag handling – that is when you want to have a tag handled at processing time – so you only change tags and one processing routine.

Second is to use Format Strings instead of XML/HTML tags. It seems simpler, faster, and evades hidden conversion problems. getString(resource, ...) works like a well known printf(string, ...). This approach is good when you want to process each string manually at runtime, but strings and variables are hardcoded.



If you want to build your own disk array, let’s say RAID, on your computer to increase disk space and efficiency, you should know about few important things in general:

  • You can consider MBR and x86 obsolete. New way is GPT, UEFI, AMD64.
  • Large RAID arrays (over 2TB) will not work with older hardware and OS (except FreeBSD) due to architecture limitations.
  • To use large RAID volumes you must use GPT partition scheme. MBR will not do the job.
  • Some systems can use GPT only with UEFI BIOS (i.e. Windows works with GPT only via UEFI). You may be forced to buy new motherboard.
  • UEFI and GPT is totally different way of bootstrap so you can forget what you know about BIOS and MBR here.
  • Hard Drives have hidden corruption-fix mechanisms in firmware that will make your RAID array fail to operate. For RAID choose dedicated drives such as WD RED (not Green, not Black, not Blue).

In order to use GPT and UEFI I have replaced my nice ASUS M4A88TD-V EVO/USB3 motherboard with M5A97 R2.0 only because M4 series did not support UEFI. New BIOS is totally different, but I am not really sure if replacing the hardware was mandatory..

Summing up, if you want to use large RAID volumes make sure first that you can use GPT and UEFI BIOS is present on your AMD64 hardware. If not, still you can use the FreeBSD as it knows how to bypass some limitations. Also remember to use dedicated HDD for RAID operations.

Mac OSX USB installer

In order to create OSX installer on USB memory drive you need to:

  • Download the Mac OSX Yosemite installer from AppStore on you Mac.
  • Create installation media from Terminal by executing following command (remember to adjust YOURUSBVOLUME value):

    sudo /Applications/Install\ OS\ X\ --volume /Volumes/YOURUSBVOLUME --applicationpath /Applications/Install\ OS\ X\ --nointeraction
  • Boot target Mac from USB by pressing ALT/OPTION key while powering-on the computer.
  • Remember to format target drive first with Disk Utility if you want to perform clean installation.

Mac OSX Bluetooth Modem resource busy

In case you wonder why your device does not connect as Modem via Bluetooth to the Mac OSX, or you cannot see COM port on Windows, your mobile device may not simply support or provide DUN (Dial Up Network) and/or SPP (Serial Port Profile) profile.

On Mac OSX I got following error, until I tried another device and/or starting by hand DUN service on a mobile/client machine:

cannot open /dev/cu.Bluetooth-Modem: Resource busy


  • Read Bluetooth specification for Serial Port Profile.
  • Read Bluetooth specification for Dial-Up Network Profile.
  • Modern mobile phones / USB 3G dongles, unfortunately, do not provide direct AT/Hayes access to the Radio Modem anymore.
  • You can install DUN application for your smartphone, but it will be only a simple dummy wrapper imitating modem for simple applications, but they do not provide full modem functionality, beware, its a fake.
  • Its only necessary for devices to be paired first in order to get SPP/DUN working. If device does not provide serial port over bluetooth when devices are paired and online, probably its just not there implemented.

FreeBSD sFTP SSHD chroot nologin

There are situations when you have a nice server out there, and you want/need someone to upload important files, but you only want to give them a minimal access to the system. You can use SSHD with sFTP and /sbin/nologin shell for that in chroot environment (dedicated limited userspace). Note that SCP in fact requires a working shell, so you need to use sFTP in this case..

Create a new user account with existing ftp group and /sbin/nologin shell:

# adduser

Alternatively you can modify an existing account to share:

# pw groupmod ftp -m username
# pw usermod username -s /sbin/nologin

You need to set correct permissions to the user home directory and public directory inside for upload:

# chown root:wheel /home/username
# mkdir /home/username/public
# chown username:ftp /home/username/public

Now modify the SSHD server configuration file /etc/ssh/sshd_config and append:

Match Group ftp
        ChrootDirectory         /home/%u
        ForceCommand            internal-sftp
        AllowTcpForwarding      no
        PermitTunnel            no
        X11Forwarding           no

Remember to restart the SSHD in order to apply new configuration:

# service sshd restart

Once the account is not necessary anymore remember to remove it:

# pw userdel username

OSX 10.10 Yosemite install/runtime problem

If you want to perform a fresh installation of OSX 10.10 Yosemite on an older MacBook(Pro) you can obtain the installer with AppStore and then create the USB installation media.

In case you encounter an Installer Verification Error that prevents you from installing the new system try the following. Its not the system date not bad download as internets says.

This may also help you when encountering problems (i.e. USB Mass Storage) after system upgrade to Yosemite.

Try these boot keyboard shortcuts until you hear boot sound two times:

  • Cmd+Alt+R+P when powering on the Mac (NVRAM Reset)
  • Alt+Ctrl+Shift+PowerON alltogether (SMC Reset)

No problem, you are wolcome :-)

FreeBSD + PPP + GSM/3G/LTE Modem

If you want to use GSM/3G/LTE modem on your FreeBSD box you need to use PPP and following configuration:

 set log Phase Chat LCP IPCP CCP tun command
 ident user-ppp VERSION 
 set device /dev/cuaU0
 set phone *99\#
 set redial 5 10
 set speed 115200
           \"\" ATH OK ATZ OK AT OK-AT-OK ATE1Q0 OK \
           AT+CFUN=1 OK-AT-OK \
           AT+CPIN? READY-AT+CPIN=\"1234\"-OK \
           AT+CGDCONT=1,\"ip\",\"internet\" OK \
           \\dATDT\\T TIMEOUT 40 CONNECT"
 set timeout 10
 enable dns
 set ifaddr
 add default HISADDR

Heimdall on FreeBSD

Heimdall is an Open-Source utility to work with Android devices manufactured by Samsung. It allows to flash firmware components into memory via FastBoot/ODIN+USB. I have created a patch to build this nice tool on FreeBSD OS (QT gui works as well, to build it you need qt-{gui,qmake,uic,moc,rcc,…} packages installed). When patch is included into the project sources and release is done, I will prepare a FreeBSD port for this nice utility which is only missing a memory dump and live boot to be totally perfect :-)

Read More

KT-LINK FT2232H based interface on FreeBSD

I have created a simple patch for FreeBSD Operating System to detect and support FT2232H based KT-LINK interface. FTDI chips are already supported using uftdi driver and they can provide various serial and parallel protocols over USB such as RS232, JTAG, SWD, SPI, I2C, 1Wire, etc. My patch allows to use RS232 port on the KT-LINK which in conjunction with Minicom terminal software allows to talk to the Serial Console Port on various embedded systems. KT-LINK is really nice inexpensive (50EUR) and versatile tool for embedded system developers, now it became all-in-one tool on my FreeBSD box :-)

Screenshots in Android 4

If you wonder where did the power menu option to make a screenshot go in Android 4 – you need to long press Power + Volume Down buttons together :-)

Still I don’t know how to disable screen inside ongoing call when my Power button is assigned to end call, or how to end call when screen is locked and Power button is assigned to lock screen ;-) Design Fail or hidden solution somewhere there deep inside..? Apple simply use one button to end/diall call and separate mechanical switch to lock the device – simple functional and elegant.. but hey why Android does not use this solution as well, is “button switch pair” already patented by Apple? ;-)

YouTube and HTML5

I have found very simple solution on how to access YouTube videos that require Flash using HTML5 player. Although front site may not support HTML5 video player, YouTube usually allows to embed videos to other sites, they also should use WebM codec developed by Google. If you have a video that does not work in HTML5 by default try to run it in embed player by URL modification – replace “/watch?v=” with “/embed/” and it should work! :-)

Example: ->

OpenOCD and LibSWD integration complete

Patches that integrate LibSWD with OpenOCD has been already sent, so the platform independent Serial Wire Debug in Open-Source becomes a reality! Mr. Gerrit takes care of the source code review part, while Mr. Jenkins takes care of proper binary build for various platforms and operating systems. This is the right moment to make use of developers mailing list for feedback, asking questions, blaming, testing, adding new features and voting to accept the patches, so the code becomes an integral part of the OpenOCD release! :-)

Orange Labs provided R&D environment for initial stages of the research. Warsaw University of Technology made this possible as part of my MSc and PhD thesis. Krzysztof Kajstura designed and provided his generic KT-LINK (FT2232H based) interface to work with. David Brownell first introduced the Transport layer in OpenOCD in 2010 to split Target from JTAG. Simon Qian was working in parallel on his own SWD implementation for a Versaloon interface (as part of intelligent firmware). Øyvind HarboePeter StugeSpencer Oliver, Rodrigo Rosa helped me on GIT usage and OpenOCD internals,  Freddie Chopin helped me a lot with commited patches to match OpenOCD coding standards, Akos Vandra helped me to test functionality as the program was created… and my other friends should be also noted here for their support :-)

Power of the few outweights power of the many! Thank you for your support! :-)

Open Web and Multimedia

I am happy to notice slow withdrawal of closed-source solutions such as Adobe Flash (and so available only on selected platforms) from the web. When I have working Open-Source and (mostly) BSD-based web browser (Chromium) with some commercial support (Google) at least to display H264 encoded multimedia content (using Open-Source x264 software implementation), and there is HTML5, I start to consider Vimeo a better option than Google’s YouTube, if we speak of quality.

Although Google develops Open and Free multimedia codec called WebM, at the same time they use annoying commercials that makes WebM-ready videos unavailable in most cases on HTML5 YouTube and push users towards Flash anyway, as opposed to Vimeo where all H264 videos works flawlessly in HTML5…


I was even more surprised to see for the first time a very colorful, scalable, interactive and full of multimedia content website of Jennifer Vaughn (created by Phil Giampi) that use NO closed-source Adobe Flash at all!! This website works flawlessly in Chromium browser on my FreeBSD Unix style desktop which use only Open-Source and Free-Software components and embeds Vimeo content. Thank you for supporting high quality open web (although its not totally free)! :-)

What about WebM? Google at one hand creates Free and Open standard such as WebM, but on the other hand Google does not seem to support it at all – neither in its own projects (see advertising with Flash on YouTube that blocks HTML5) nor in external projects (see Mozilla/Firefox struggling alone to promote WebM, see Google Chrome that simply buys restricted H264 license and thus promotes the competitive standard). I think it might be cheaper for Google to make H264/X264 free to use (at least as renderer like Microsoft did) rather than investing into something that is not going to be used anyway… What is the internal organization of Google? Do people need to fight for their projects against each other inside? Why there is no global view for better coordination? This seems to be a great waste of energy, WebM seemed to be very promising Free and Open Standard :-(