October 19, 2014   Posted by: Dr. Ace Jeangle

How to get multi-touch working (Linux and Android)

All of our panels come with USB HID multi-touch controllers and are supported by standard “hid-multitouch” driver available in mainline Linux/Android kernel.

If your system already has this “hid-multitouch” driver available as a kernel module, then you can easy add multi-touch support by adding the following commands to your /etc/rc.local file (before “exit” statement):

1
2
modprobe hid-multitouch
echo W X Y Z > /sys/module/hid_multitouch/drivers/hid\:hid-multitouch/new_id

where

  • W – is USB bus number of touchscreen USB, can be figured out by “lsusb” command
  • X and Y – are VID and PID of touchscreen USB, also can be figured out by “lsusb” command
  • Z – is 1 for 7″ and 10″ panels, and 259 for 14″ and 15.6″ panels

If your system has no “hid-multitouch” driver compiled, then the following steps are required to get multi-touch working:

  1. Download kernel sources for your board.
  2. Modify hid-multitouch.c file, located in kernel/drivers/hid/ folder.
  3. Re-build the kernel with the HID-MULTITOUCH option enabled.
  4. Create an IDC (Input Device Configuration) file (required by Android only).

Let’s consider these steps in more details.

  1. Modify hid-multitouch.c file
     
    First of all, you should download kernel sources and default kernel configuration file for your board. Then, you should go to kernel/drivers/hid older and find there file hid-multitouch.c. This files contain VID:PID values of USB touchscreens that will be processed by hid-multitouch driver. And we should add VID:PID of our touchscreens there. They are:

    • 04D8:F724 for 7″ and new 10″ touchscreens
    • 0EEF:A107 for 14″ touchscreen

     
    Open file hid-multitouch.c, find mt_devices[] struct and insert the following code at the beginning of this structure define:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    static const struct hid_device_id mt_devices[] = {
       
        /* Chalkboard Electronics 7" and 10" */
        { .driver_data = MT_CLS_DEFAULT, HID_USB_DEVICE(0x04D8,0xF724) },

        /* Chalkboard Electronics 14" */
        { .driver_data = MT_CLS_DEFAULT, HID_USB_DEVICE(0x0EEF,0xA107) },

        // here the rest of definitions comes

  2. Re-build the kernel with the HID-MULTITOUCH option
     
    Type “make menuconfig” to configure the kernel, then go to Device Drivers -> HID Devices -> Special HID drivers -> HID Multitouch panels and select it as an embedded driver (*). Save the kernel configuration and compile it to make a zImage kernel file. Transfer the zImage file to your board.
     
  3. Create an IDC file
     
    This final step is required for Android only in order to match the resolution of the touch panel to HDMI. Create a plain text file as below:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    touch.deviceType = touchScreen
    touch.orientationAware = 1
    device.internal = 1
    keyboard.layout = qwerty
    keyboard.characterMap = qwerty2
    keyboard.orientationAware = 1
    keyboard.builtIn = 1
    cursor.mode = navigation
    cursor.orientationAware = 1

    The file name must be Vendor_xxxx_Product_yyyy.idc, where xxxx is VID of panel, and yyyy is PID of panel. The filename is case sensitive!In our case, you should use filename Vendor_04d8_Product_f724.idc (7″ and 10″ panels) or Vendor_0eef_Product_a107.idc (14″ panel). Now copy the IDC file to your Android board (Android must be rooted) with the following commands (substitute Vendor_xxxx_Product_yyyy.idc with real file name):

    1
    2
    3
    4
    5
    6
    adb shell
    su
    mount -o rw,remount /system
    [Ctrl-C]
    adb push Vendor_xxxx_Product_yyyy.idc /system/usr/idc/.
    adb reboot

 
That’s all. Now you should get multi-touch support working.
 

no comments posted in: blog   |   How-To

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Follow us