{"id":2028,"date":"2014-10-19T20:18:54","date_gmt":"2014-10-19T20:18:54","guid":{"rendered":"http:\/\/www.chalk-elec.com\/?p=2028"},"modified":"2015-05-29T04:50:08","modified_gmt":"2015-05-29T04:50:08","slug":"how-to-get-multi-touch-working-linux-and-android","status":"publish","type":"post","link":"https:\/\/www.chalk-elec.com\/?p=2028","title":{"rendered":"How to get multi-touch working (Linux and Android)"},"content":{"rendered":"<p>All of our panels come with USB HID multi-touch controllers and are supported by standard &#8220;hid-multitouch&#8221; driver available in mainline Linux\/Android kernel.<br \/>\n<br \/>\nIf your system already has this &#8220;hid-multitouch&#8221; 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 &#8220;exit&#8221; statement):<\/p>\n<div class=\"codecolorer-container text railscasts\" style=\"overflow:auto;white-space:nowrap;width:630px;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/>2<br \/><\/div><\/td><td><div class=\"text codecolorer\">modprobe hid-multitouch<br \/>\necho W X Y Z &gt; \/sys\/module\/hid_multitouch\/drivers\/hid\\:hid-multitouch\/new_id<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<p>where<\/p>\n<ul>\n<li><strong>W<\/strong> &#8211; is USB bus number of touchscreen USB, can be figured out by &#8220;lsusb&#8221; command<\/li>\n<li><strong>X and Y<\/strong> &#8211; are VID and PID of touchscreen USB, also can be figured out by &#8220;lsusb&#8221; command<\/li>\n<li><strong>Z<\/strong> &#8211; is <strong>1<\/strong> for 7&#8243; and 10&#8243; panels, and <strong>259<\/strong> for 14&#8243; and 15.6&#8243; panels<\/li>\n<\/ul>\n<div class=\"line\"><\/div>\n<p>If your system has no &#8220;hid-multitouch&#8221; driver compiled, then the following steps are required to get multi-touch working:<\/p>\n<ol>\n<li>Download kernel sources for your board.<\/li>\n<li>Modify hid-multitouch.c file, located  in  kernel\/drivers\/hid\/ folder.<\/li>\n<li>Re-build the kernel with the HID-MULTITOUCH option enabled.<\/li>\n<li>Create an IDC (Input Device Configuration) file (required by Android only).<\/li>\n<\/ol>\n<p>Let&#8217;s consider these steps in more details.<\/p>\n<ol>\n<li><b>Modify hid-multitouch.c file<\/b><br \/>&nbsp;<br \/>\nFirst 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:<\/p>\n<ul>\n<li><b>04D8:F724<\/b> for 7&#8243; and new 10&#8243; touchscreens<\/li>\n<li><b>0EEF:A107<\/b> for 14&#8243; touchscreen<\/li>\n<\/ul>\n<p>&nbsp;<br \/>\nOpen file <b>hid-multitouch.c<\/b>, find <b>mt_devices[]<\/b> struct and insert the following code at the beginning of this structure define:<\/p>\n<div class=\"codecolorer-container text railscasts\" style=\"overflow:auto;white-space:nowrap;width:630px;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/>2<br \/>3<br \/>4<br \/>5<br \/>6<br \/>7<br \/>8<br \/>9<br \/><\/div><\/td><td><div class=\"text codecolorer\">static const struct hid_device_id mt_devices[] = {<br \/>\n&nbsp; &nbsp; <br \/>\n&nbsp; &nbsp; \/* Chalkboard Electronics 7&quot; and 10&quot; *\/<br \/>\n&nbsp; &nbsp; { .driver_data = MT_CLS_DEFAULT, HID_USB_DEVICE(0x04D8,0xF724) },<br \/>\n<br \/>\n&nbsp; &nbsp; \/* Chalkboard Electronics 14&quot; *\/<br \/>\n&nbsp; &nbsp; { .driver_data = MT_CLS_DEFAULT, HID_USB_DEVICE(0x0EEF,0xA107) },<br \/>\n<br \/>\n&nbsp; &nbsp; \/\/ here the rest of definitions comes<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<p>\n\t<\/li>\n<li><b>Re-build the kernel with the HID-MULTITOUCH option<\/b><br \/>&nbsp;<br \/>\nType <b>\u201cmake menuconfig\u201d<\/b> to configure the kernel, then go to <b>Device Drivers -> HID Devices -> Special HID drivers -> HID Multitouch panels<\/b> 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.<br \/>&nbsp;\n\t<\/li>\n<li><b>Create an IDC file<\/b><br \/>&nbsp;<br \/>\nThis 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:<\/p>\n<div class=\"codecolorer-container text railscasts\" style=\"overflow:auto;white-space:nowrap;width:630px;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/>2<br \/>3<br \/>4<br \/>5<br \/>6<br \/>7<br \/>8<br \/>9<br \/><\/div><\/td><td><div class=\"text codecolorer\">touch.deviceType = touchScreen<br \/>\ntouch.orientationAware = 1<br \/>\ndevice.internal = 1<br \/>\nkeyboard.layout = qwerty<br \/>\nkeyboard.characterMap = qwerty2<br \/>\nkeyboard.orientationAware = 1<br \/>\nkeyboard.builtIn = 1<br \/>\ncursor.mode = navigation<br \/>\ncursor.orientationAware = 1<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<p>The file name must be <b>Vendor_xxxx_Product_yyyy.idc<\/b>, where <b>xxxx<\/b> is VID of panel, and <b>yyyy<\/b> is PID of panel. <b>The filename is case sensitive!<\/b>In our case, you should use filename Vendor_04d8_Product_f724.idc (7&#8243; and 10&#8243; panels) or Vendor_0eef_Product_a107.idc (14&#8243; 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):<\/p>\n<div class=\"codecolorer-container text railscasts\" style=\"overflow:auto;white-space:nowrap;width:630px;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/>2<br \/>3<br \/>4<br \/>5<br \/>6<br \/><\/div><\/td><td><div class=\"text codecolorer\">adb shell<br \/>\nsu<br \/>\nmount -o rw,remount \/system<br \/>\n[Ctrl-C]<br \/>\nadb push Vendor_xxxx_Product_yyyy.idc \/system\/usr\/idc\/.<br \/>\nadb reboot<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<\/li>\n<\/ol>\n<p>&nbsp;<br \/>That&#8217;s all. Now you should get multi-touch support working.<br \/>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>All of our panels come with USB HID multi-touch controllers and are supported by standard &#8220;hid-multitouch&#8221; driver available in mainline Linux\/Android kernel. If your system already has this &#8220;hid-multitouch&#8221; 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 &#8220;exit&#8221; statement): 12modprobe [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,26],"tags":[],"class_list":["post-2028","post","type-post","status-publish","format-standard","hentry","category-blog","category-howto"],"_links":{"self":[{"href":"https:\/\/www.chalk-elec.com\/index.php?rest_route=\/wp\/v2\/posts\/2028","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.chalk-elec.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.chalk-elec.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.chalk-elec.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.chalk-elec.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2028"}],"version-history":[{"count":10,"href":"https:\/\/www.chalk-elec.com\/index.php?rest_route=\/wp\/v2\/posts\/2028\/revisions"}],"predecessor-version":[{"id":2211,"href":"https:\/\/www.chalk-elec.com\/index.php?rest_route=\/wp\/v2\/posts\/2028\/revisions\/2211"}],"wp:attachment":[{"href":"https:\/\/www.chalk-elec.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2028"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.chalk-elec.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2028"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.chalk-elec.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2028"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}