18c2ecf20Sopenharmony_ci.. include:: <isonum.txt> 28c2ecf20Sopenharmony_ci 38c2ecf20Sopenharmony_ci========================= 48c2ecf20Sopenharmony_ciN-Trig touchscreen Driver 58c2ecf20Sopenharmony_ci========================= 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci:Copyright: |copy| 2008-2010 Rafi Rubin <rafi@seas.upenn.edu> 88c2ecf20Sopenharmony_ci:Copyright: |copy| 2009-2010 Stephane Chatty 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ciThis driver provides support for N-Trig pen and multi-touch sensors. Single 118c2ecf20Sopenharmony_ciand multi-touch events are translated to the appropriate protocols for 128c2ecf20Sopenharmony_cithe hid and input systems. Pen events are sufficiently hid compliant and 138c2ecf20Sopenharmony_ciare left to the hid core. The driver also provides additional filtering 148c2ecf20Sopenharmony_ciand utility functions accessible with sysfs and module parameters. 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_ciThis driver has been reported to work properly with multiple N-Trig devices 178c2ecf20Sopenharmony_ciattached. 188c2ecf20Sopenharmony_ci 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ciParameters 218c2ecf20Sopenharmony_ci---------- 228c2ecf20Sopenharmony_ci 238c2ecf20Sopenharmony_ciNote: values set at load time are global and will apply to all applicable 248c2ecf20Sopenharmony_cidevices. Adjusting parameters with sysfs will override the load time values, 258c2ecf20Sopenharmony_cibut only for that one device. 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ciThe following parameters are used to configure filters to reduce noise: 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ci+-----------------------+-----------------------------------------------------+ 308c2ecf20Sopenharmony_ci|activate_slack |number of fingers to ignore before processing events | 318c2ecf20Sopenharmony_ci+-----------------------+-----------------------------------------------------+ 328c2ecf20Sopenharmony_ci|activation_height, |size threshold to activate immediately | 338c2ecf20Sopenharmony_ci|activation_width | | 348c2ecf20Sopenharmony_ci+-----------------------+-----------------------------------------------------+ 358c2ecf20Sopenharmony_ci|min_height, |size threshold bellow which fingers are ignored | 368c2ecf20Sopenharmony_ci|min_width |both to decide activation and during activity | 378c2ecf20Sopenharmony_ci+-----------------------+-----------------------------------------------------+ 388c2ecf20Sopenharmony_ci|deactivate_slack |the number of "no contact" frames to ignore before | 398c2ecf20Sopenharmony_ci| |propagating the end of activity events | 408c2ecf20Sopenharmony_ci+-----------------------+-----------------------------------------------------+ 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ciWhen the last finger is removed from the device, it sends a number of empty 438c2ecf20Sopenharmony_ciframes. By holding off on deactivation for a few frames we can tolerate false 448c2ecf20Sopenharmony_cierroneous disconnects, where the sensor may mistakenly not detect a finger that 458c2ecf20Sopenharmony_ciis still present. Thus deactivate_slack addresses problems where a users might 468c2ecf20Sopenharmony_cisee breaks in lines during drawing, or drop an object during a long drag. 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_ci 498c2ecf20Sopenharmony_ciAdditional sysfs items 508c2ecf20Sopenharmony_ci---------------------- 518c2ecf20Sopenharmony_ci 528c2ecf20Sopenharmony_ciThese nodes just provide easy access to the ranges reported by the device. 538c2ecf20Sopenharmony_ci 548c2ecf20Sopenharmony_ci+-----------------------+-----------------------------------------------------+ 558c2ecf20Sopenharmony_ci|sensor_logical_height, | the range for positions reported during activity | 568c2ecf20Sopenharmony_ci|sensor_logical_width | | 578c2ecf20Sopenharmony_ci+-----------------------+-----------------------------------------------------+ 588c2ecf20Sopenharmony_ci|sensor_physical_height,| internal ranges not used for normal events but | 598c2ecf20Sopenharmony_ci|sensor_physical_width | useful for tuning | 608c2ecf20Sopenharmony_ci+-----------------------+-----------------------------------------------------+ 618c2ecf20Sopenharmony_ci 628c2ecf20Sopenharmony_ciAll N-Trig devices with product id of 1 report events in the ranges of 638c2ecf20Sopenharmony_ci 648c2ecf20Sopenharmony_ci* X: 0-9600 658c2ecf20Sopenharmony_ci* Y: 0-7200 668c2ecf20Sopenharmony_ci 678c2ecf20Sopenharmony_ciHowever not all of these devices have the same physical dimensions. Most 688c2ecf20Sopenharmony_ciseem to be 12" sensors (Dell Latitude XT and XT2 and the HP TX2), and 698c2ecf20Sopenharmony_ciat least one model (Dell Studio 17) has a 17" sensor. The ratio of physical 708c2ecf20Sopenharmony_cito logical sizes is used to adjust the size based filter parameters. 718c2ecf20Sopenharmony_ci 728c2ecf20Sopenharmony_ci 738c2ecf20Sopenharmony_ciFiltering 748c2ecf20Sopenharmony_ci--------- 758c2ecf20Sopenharmony_ci 768c2ecf20Sopenharmony_ciWith the release of the early multi-touch firmwares it became increasingly 778c2ecf20Sopenharmony_ciobvious that these sensors were prone to erroneous events. Users reported 788c2ecf20Sopenharmony_ciseeing both inappropriately dropped contact and ghosts, contacts reported 798c2ecf20Sopenharmony_ciwhere no finger was actually touching the screen. 808c2ecf20Sopenharmony_ci 818c2ecf20Sopenharmony_ciDeactivation slack helps prevent dropped contact for single touch use, but does 828c2ecf20Sopenharmony_cinot address the problem of dropping one of more contacts while other contacts 838c2ecf20Sopenharmony_ciare still active. Drops in the multi-touch context require additional 848c2ecf20Sopenharmony_ciprocessing and should be handled in tandem with tacking. 858c2ecf20Sopenharmony_ci 868c2ecf20Sopenharmony_ciAs observed ghost contacts are similar to actual use of the sensor, but they 878c2ecf20Sopenharmony_ciseem to have different profiles. Ghost activity typically shows up as small 888c2ecf20Sopenharmony_cishort lived touches. As such, I assume that the longer the continuous stream 898c2ecf20Sopenharmony_ciof events the more likely those events are from a real contact, and that the 908c2ecf20Sopenharmony_cilarger the size of each contact the more likely it is real. Balancing the 918c2ecf20Sopenharmony_cigoals of preventing ghosts and accepting real events quickly (to minimize 928c2ecf20Sopenharmony_ciuser observable latency), the filter accumulates confidence for incoming 938c2ecf20Sopenharmony_cievents until it hits thresholds and begins propagating. In the interest in 948c2ecf20Sopenharmony_ciminimizing stored state as well as the cost of operations to make a decision, 958c2ecf20Sopenharmony_ciI've kept that decision simple. 968c2ecf20Sopenharmony_ci 978c2ecf20Sopenharmony_ciTime is measured in terms of the number of fingers reported, not frames since 988c2ecf20Sopenharmony_cithe probability of multiple simultaneous ghosts is expected to drop off 998c2ecf20Sopenharmony_cidramatically with increasing numbers. Rather than accumulate weight as a 1008c2ecf20Sopenharmony_cifunction of size, I just use it as a binary threshold. A sufficiently large 1018c2ecf20Sopenharmony_cicontact immediately overrides the waiting period and leads to activation. 1028c2ecf20Sopenharmony_ci 1038c2ecf20Sopenharmony_ciSetting the activation size thresholds to large values will result in deciding 1048c2ecf20Sopenharmony_ciprimarily on activation slack. If you see longer lived ghosts, turning up the 1058c2ecf20Sopenharmony_ciactivation slack while reducing the size thresholds may suffice to eliminate 1068c2ecf20Sopenharmony_cithe ghosts while keeping the screen quite responsive to firm taps. 1078c2ecf20Sopenharmony_ci 1088c2ecf20Sopenharmony_ciContacts continue to be filtered with min_height and min_width even after 1098c2ecf20Sopenharmony_cithe initial activation filter is satisfied. The intent is to provide 1108c2ecf20Sopenharmony_cia mechanism for filtering out ghosts in the form of an extra finger while 1118c2ecf20Sopenharmony_ciyou actually are using the screen. In practice this sort of ghost has 1128c2ecf20Sopenharmony_cibeen far less problematic or relatively rare and I've left the defaults 1138c2ecf20Sopenharmony_ciset to 0 for both parameters, effectively turning off that filter. 1148c2ecf20Sopenharmony_ci 1158c2ecf20Sopenharmony_ciI don't know what the optimal values are for these filters. If the defaults 1168c2ecf20Sopenharmony_cidon't work for you, please play with the parameters. If you do find other 1178c2ecf20Sopenharmony_civalues more comfortable, I would appreciate feedback. 1188c2ecf20Sopenharmony_ci 1198c2ecf20Sopenharmony_ciThe calibration of these devices does drift over time. If ghosts or contact 1208c2ecf20Sopenharmony_cidropping worsen and interfere with the normal usage of your device, try 1218c2ecf20Sopenharmony_cirecalibrating it. 1228c2ecf20Sopenharmony_ci 1238c2ecf20Sopenharmony_ci 1248c2ecf20Sopenharmony_ciCalibration 1258c2ecf20Sopenharmony_ci----------- 1268c2ecf20Sopenharmony_ci 1278c2ecf20Sopenharmony_ciThe N-Trig windows tools provide calibration and testing routines. Also an 1288c2ecf20Sopenharmony_ciunofficial unsupported set of user space tools including a calibrator is 1298c2ecf20Sopenharmony_ciavailable at: 1308c2ecf20Sopenharmony_cihttp://code.launchpad.net/~rafi-seas/+junk/ntrig_calib 1318c2ecf20Sopenharmony_ci 1328c2ecf20Sopenharmony_ci 1338c2ecf20Sopenharmony_ciTracking 1348c2ecf20Sopenharmony_ci-------- 1358c2ecf20Sopenharmony_ci 1368c2ecf20Sopenharmony_ciAs of yet, all tested N-Trig firmwares do not track fingers. When multiple 1378c2ecf20Sopenharmony_cicontacts are active they seem to be sorted primarily by Y position. 138