1*4882a593Smuzhiyun.. include:: <isonum.txt> 2*4882a593Smuzhiyun 3*4882a593Smuzhiyun========================= 4*4882a593SmuzhiyunN-Trig touchscreen Driver 5*4882a593Smuzhiyun========================= 6*4882a593Smuzhiyun 7*4882a593Smuzhiyun:Copyright: |copy| 2008-2010 Rafi Rubin <rafi@seas.upenn.edu> 8*4882a593Smuzhiyun:Copyright: |copy| 2009-2010 Stephane Chatty 9*4882a593Smuzhiyun 10*4882a593SmuzhiyunThis driver provides support for N-Trig pen and multi-touch sensors. Single 11*4882a593Smuzhiyunand multi-touch events are translated to the appropriate protocols for 12*4882a593Smuzhiyunthe hid and input systems. Pen events are sufficiently hid compliant and 13*4882a593Smuzhiyunare left to the hid core. The driver also provides additional filtering 14*4882a593Smuzhiyunand utility functions accessible with sysfs and module parameters. 15*4882a593Smuzhiyun 16*4882a593SmuzhiyunThis driver has been reported to work properly with multiple N-Trig devices 17*4882a593Smuzhiyunattached. 18*4882a593Smuzhiyun 19*4882a593Smuzhiyun 20*4882a593SmuzhiyunParameters 21*4882a593Smuzhiyun---------- 22*4882a593Smuzhiyun 23*4882a593SmuzhiyunNote: values set at load time are global and will apply to all applicable 24*4882a593Smuzhiyundevices. Adjusting parameters with sysfs will override the load time values, 25*4882a593Smuzhiyunbut only for that one device. 26*4882a593Smuzhiyun 27*4882a593SmuzhiyunThe following parameters are used to configure filters to reduce noise: 28*4882a593Smuzhiyun 29*4882a593Smuzhiyun+-----------------------+-----------------------------------------------------+ 30*4882a593Smuzhiyun|activate_slack |number of fingers to ignore before processing events | 31*4882a593Smuzhiyun+-----------------------+-----------------------------------------------------+ 32*4882a593Smuzhiyun|activation_height, |size threshold to activate immediately | 33*4882a593Smuzhiyun|activation_width | | 34*4882a593Smuzhiyun+-----------------------+-----------------------------------------------------+ 35*4882a593Smuzhiyun|min_height, |size threshold bellow which fingers are ignored | 36*4882a593Smuzhiyun|min_width |both to decide activation and during activity | 37*4882a593Smuzhiyun+-----------------------+-----------------------------------------------------+ 38*4882a593Smuzhiyun|deactivate_slack |the number of "no contact" frames to ignore before | 39*4882a593Smuzhiyun| |propagating the end of activity events | 40*4882a593Smuzhiyun+-----------------------+-----------------------------------------------------+ 41*4882a593Smuzhiyun 42*4882a593SmuzhiyunWhen the last finger is removed from the device, it sends a number of empty 43*4882a593Smuzhiyunframes. By holding off on deactivation for a few frames we can tolerate false 44*4882a593Smuzhiyunerroneous disconnects, where the sensor may mistakenly not detect a finger that 45*4882a593Smuzhiyunis still present. Thus deactivate_slack addresses problems where a users might 46*4882a593Smuzhiyunsee breaks in lines during drawing, or drop an object during a long drag. 47*4882a593Smuzhiyun 48*4882a593Smuzhiyun 49*4882a593SmuzhiyunAdditional sysfs items 50*4882a593Smuzhiyun---------------------- 51*4882a593Smuzhiyun 52*4882a593SmuzhiyunThese nodes just provide easy access to the ranges reported by the device. 53*4882a593Smuzhiyun 54*4882a593Smuzhiyun+-----------------------+-----------------------------------------------------+ 55*4882a593Smuzhiyun|sensor_logical_height, | the range for positions reported during activity | 56*4882a593Smuzhiyun|sensor_logical_width | | 57*4882a593Smuzhiyun+-----------------------+-----------------------------------------------------+ 58*4882a593Smuzhiyun|sensor_physical_height,| internal ranges not used for normal events but | 59*4882a593Smuzhiyun|sensor_physical_width | useful for tuning | 60*4882a593Smuzhiyun+-----------------------+-----------------------------------------------------+ 61*4882a593Smuzhiyun 62*4882a593SmuzhiyunAll N-Trig devices with product id of 1 report events in the ranges of 63*4882a593Smuzhiyun 64*4882a593Smuzhiyun* X: 0-9600 65*4882a593Smuzhiyun* Y: 0-7200 66*4882a593Smuzhiyun 67*4882a593SmuzhiyunHowever not all of these devices have the same physical dimensions. Most 68*4882a593Smuzhiyunseem to be 12" sensors (Dell Latitude XT and XT2 and the HP TX2), and 69*4882a593Smuzhiyunat least one model (Dell Studio 17) has a 17" sensor. The ratio of physical 70*4882a593Smuzhiyunto logical sizes is used to adjust the size based filter parameters. 71*4882a593Smuzhiyun 72*4882a593Smuzhiyun 73*4882a593SmuzhiyunFiltering 74*4882a593Smuzhiyun--------- 75*4882a593Smuzhiyun 76*4882a593SmuzhiyunWith the release of the early multi-touch firmwares it became increasingly 77*4882a593Smuzhiyunobvious that these sensors were prone to erroneous events. Users reported 78*4882a593Smuzhiyunseeing both inappropriately dropped contact and ghosts, contacts reported 79*4882a593Smuzhiyunwhere no finger was actually touching the screen. 80*4882a593Smuzhiyun 81*4882a593SmuzhiyunDeactivation slack helps prevent dropped contact for single touch use, but does 82*4882a593Smuzhiyunnot address the problem of dropping one of more contacts while other contacts 83*4882a593Smuzhiyunare still active. Drops in the multi-touch context require additional 84*4882a593Smuzhiyunprocessing and should be handled in tandem with tacking. 85*4882a593Smuzhiyun 86*4882a593SmuzhiyunAs observed ghost contacts are similar to actual use of the sensor, but they 87*4882a593Smuzhiyunseem to have different profiles. Ghost activity typically shows up as small 88*4882a593Smuzhiyunshort lived touches. As such, I assume that the longer the continuous stream 89*4882a593Smuzhiyunof events the more likely those events are from a real contact, and that the 90*4882a593Smuzhiyunlarger the size of each contact the more likely it is real. Balancing the 91*4882a593Smuzhiyungoals of preventing ghosts and accepting real events quickly (to minimize 92*4882a593Smuzhiyunuser observable latency), the filter accumulates confidence for incoming 93*4882a593Smuzhiyunevents until it hits thresholds and begins propagating. In the interest in 94*4882a593Smuzhiyunminimizing stored state as well as the cost of operations to make a decision, 95*4882a593SmuzhiyunI've kept that decision simple. 96*4882a593Smuzhiyun 97*4882a593SmuzhiyunTime is measured in terms of the number of fingers reported, not frames since 98*4882a593Smuzhiyunthe probability of multiple simultaneous ghosts is expected to drop off 99*4882a593Smuzhiyundramatically with increasing numbers. Rather than accumulate weight as a 100*4882a593Smuzhiyunfunction of size, I just use it as a binary threshold. A sufficiently large 101*4882a593Smuzhiyuncontact immediately overrides the waiting period and leads to activation. 102*4882a593Smuzhiyun 103*4882a593SmuzhiyunSetting the activation size thresholds to large values will result in deciding 104*4882a593Smuzhiyunprimarily on activation slack. If you see longer lived ghosts, turning up the 105*4882a593Smuzhiyunactivation slack while reducing the size thresholds may suffice to eliminate 106*4882a593Smuzhiyunthe ghosts while keeping the screen quite responsive to firm taps. 107*4882a593Smuzhiyun 108*4882a593SmuzhiyunContacts continue to be filtered with min_height and min_width even after 109*4882a593Smuzhiyunthe initial activation filter is satisfied. The intent is to provide 110*4882a593Smuzhiyuna mechanism for filtering out ghosts in the form of an extra finger while 111*4882a593Smuzhiyunyou actually are using the screen. In practice this sort of ghost has 112*4882a593Smuzhiyunbeen far less problematic or relatively rare and I've left the defaults 113*4882a593Smuzhiyunset to 0 for both parameters, effectively turning off that filter. 114*4882a593Smuzhiyun 115*4882a593SmuzhiyunI don't know what the optimal values are for these filters. If the defaults 116*4882a593Smuzhiyundon't work for you, please play with the parameters. If you do find other 117*4882a593Smuzhiyunvalues more comfortable, I would appreciate feedback. 118*4882a593Smuzhiyun 119*4882a593SmuzhiyunThe calibration of these devices does drift over time. If ghosts or contact 120*4882a593Smuzhiyundropping worsen and interfere with the normal usage of your device, try 121*4882a593Smuzhiyunrecalibrating it. 122*4882a593Smuzhiyun 123*4882a593Smuzhiyun 124*4882a593SmuzhiyunCalibration 125*4882a593Smuzhiyun----------- 126*4882a593Smuzhiyun 127*4882a593SmuzhiyunThe N-Trig windows tools provide calibration and testing routines. Also an 128*4882a593Smuzhiyununofficial unsupported set of user space tools including a calibrator is 129*4882a593Smuzhiyunavailable at: 130*4882a593Smuzhiyunhttp://code.launchpad.net/~rafi-seas/+junk/ntrig_calib 131*4882a593Smuzhiyun 132*4882a593Smuzhiyun 133*4882a593SmuzhiyunTracking 134*4882a593Smuzhiyun-------- 135*4882a593Smuzhiyun 136*4882a593SmuzhiyunAs of yet, all tested N-Trig firmwares do not track fingers. When multiple 137*4882a593Smuzhiyuncontacts are active they seem to be sorted primarily by Y position. 138