@@ -78,6 +78,7 @@ struct ts_priv {
78
78
struct tsdev * ts ;
79
79
int height ;
80
80
int width ;
81
+ int pmax ;
81
82
struct ts_sample last ;
82
83
ValuatorMask * valuators ;
83
84
int8_t abs_x_only ;
@@ -296,10 +297,10 @@ static int xf86TslibControlProc(DeviceIntPtr device, int what)
296
297
InitValuatorAxisStruct (device , 2 ,
297
298
XIGetKnownProperty (AXIS_LABEL_PROP_ABS_PRESSURE ),
298
299
0 , /* min val */
299
- 255 , /* max val */
300
- 256 , /* resolution */
300
+ priv -> pmax , /* max val */
301
+ priv -> pmax + 1 , /* resolution */
301
302
0 , /* min_res */
302
- 256 , /* max_res */
303
+ priv -> pmax + 1 , /* max_res */
303
304
Absolute );
304
305
} else {
305
306
InitValuatorAxisStruct (device , 0 ,
@@ -323,10 +324,10 @@ static int xf86TslibControlProc(DeviceIntPtr device, int what)
323
324
InitValuatorAxisStruct (device , 2 ,
324
325
XIGetKnownProperty (AXIS_LABEL_PROP_ABS_MT_PRESSURE ),
325
326
0 , /* min val */
326
- 255 , /* max val */
327
- 256 , /* resolution */
327
+ priv -> pmax , /* max val */
328
+ priv -> pmax + 1 , /* resolution */
328
329
0 , /* min_res */
329
- 256 , /* max_res */
330
+ priv -> pmax + 1 , /* max_res */
330
331
Absolute );
331
332
}
332
333
@@ -540,6 +541,16 @@ static int xf86TslibInit(__attribute__ ((unused)) InputDriverPtr drv,
540
541
return BadValue ;
541
542
}
542
543
priv -> height = absinfo .maximum ;
544
+
545
+ if (!(absbit [BIT_WORD (ABS_PRESSURE )] & BIT_MASK (ABS_PRESSURE ))) {
546
+ priv -> pmax = 255 ; /* tslib internal */
547
+ } else {
548
+ if (ioctl (pInfo -> fd , EVIOCGABS (ABS_PRESSURE ), & absinfo ) < 0 ) {
549
+ xf86IDrvMsg (pInfo , X_ERROR , "ioctl EVIOGABS failed" );
550
+ return BadValue ;
551
+ }
552
+ priv -> pmax = absinfo .maximum ;
553
+ }
543
554
} else {
544
555
if (ioctl (pInfo -> fd , EVIOCGABS (ABS_MT_POSITION_X ), & absinfo ) < 0 ) {
545
556
xf86IDrvMsg (pInfo , X_ERROR , "ioctl EVIOGABS failed" );
@@ -552,6 +563,16 @@ static int xf86TslibInit(__attribute__ ((unused)) InputDriverPtr drv,
552
563
return BadValue ;
553
564
}
554
565
priv -> height = absinfo .maximum ;
566
+
567
+ if (!(absbit [BIT_WORD (ABS_MT_PRESSURE )] & BIT_MASK (ABS_MT_PRESSURE ))) {
568
+ priv -> pmax = 255 ; /* tslib internal */
569
+ } else {
570
+ if (ioctl (pInfo -> fd , EVIOCGABS (ABS_MT_PRESSURE ), & absinfo ) < 0 ) {
571
+ xf86IDrvMsg (pInfo , X_ERROR , "ioctl EVIOGABS failed" );
572
+ return BadValue ;
573
+ }
574
+ priv -> pmax = absinfo .maximum ;
575
+ }
555
576
}
556
577
557
578
/* Return the configured device */
0 commit comments