Synaptics TouchPad on Panasonic CF-MX4

This wulf7 [1] is a really nice guy that helped me run full featured Synaptics TouchPad with FreeBSD on Panasonic Toughbook CF-MX4 [2][3]. Now it works for moused and libinput with all multitouch gestures like two or three finger scroll, scale, etc! The problem was in detection mechanism as device is connected over multiplexer with both PS/2 and SMBus but multitouch works only over SMBus. Although fix requires change and rebuild of FreeBSD Kernel I hope it gets quickly to the upstream [4]. I had a chance to exercise building whole FreeBSD distribution into the USB memstick image, so I could test driver fix on a target computer without even touching its hard drive contents :-)

/* psm has a special support for GenMouse + SynTouchpad combination */
if (active_ports_count >= 2) {
    for (port = 0; port < KBDC_AUX_MUX_NUM_PORTS; port++) {

That 2 above had to be changed into 1 in /usr/src/sys/dev/atkbdc/psm.c. Nice? That’s what I call a one-bit-fix :-)

In addition, when you work with Synaptics Touchpad in Xorg and you want to use its all features like tap-to-click, natural (swapped) two finger scroll, two and three finger gestures, don’t use moused,xmodmap, or xinput as this will produce inconsistent behavior in applications based on different toolkits (i.e. GTK will scroll up while Qt will scroll down etc), instead use the new way of input based on libinput and modify MatchIsTouchpad section of /usr/local/share/X11/xorg.conf.d/40-libinput.conf like:

Section "InputClass"
        Identifier "libinput touchpad catchall"
        MatchIsTouchpad "on"
        MatchDevicePath "/dev/input/event5"
        Option "NaturalScrolling" "on"
        Option "Tapping" "on"
        Option "ClickMethod" "clickfinger"
        Driver "libinput"
EndSection

[1] https://github.com/wulf7/iichid
[2] https://github.com/wulf7/iichid/issues/51
[3] https://github.com/wulf7/iichid/issues/53
[4] https://reviews.freebsd.org/D28502

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?

Android USB OTG HOST

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.

[1] http://www.usb.org/developers/onthego/
[2] https://developer.android.com/guide/topics/connectivity/usb/host.html

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.

[1] http://stackoverflow.com/questions/7899563/android-converting-between-strings-spannedstrings-and-spannablestrings/34556513#34556513