@@ -284,7 +284,7 @@ class HIDInputMotionEventProvider(MotionEventProvider):
284
284
options = ('min_position_x' , 'max_position_x' ,
285
285
'min_position_y' , 'max_position_y' ,
286
286
'min_pressure' , 'max_pressure' ,
287
- 'invert_x' , 'invert_y' )
287
+ 'invert_x' , 'invert_y' , 'rotate' )
288
288
289
289
def __init__ (self , device , args ):
290
290
super (HIDInputMotionEventProvider , self ).__init__ (device , args )
@@ -374,6 +374,7 @@ def _thread_run(self, **kwargs):
374
374
range_max_pressure = 255
375
375
invert_x = int (bool (drs ('invert_x' , 0 )))
376
376
invert_y = int (bool (drs ('invert_y' , 0 )))
377
+ rotate = int (drs ('invert_y' , 0 )) % 360
377
378
378
379
def process_as_multitouch (tv_sec , tv_usec , ev_type ,
379
380
ev_code , ev_value ):
@@ -401,14 +402,24 @@ def process_as_multitouch(tv_sec, tv_usec, ev_type,
401
402
range_max_position_x )
402
403
if invert_x :
403
404
val = 1. - val
404
- point ['x' ] = val
405
+ if rotate == 90 :
406
+ point ['y' ] = val
407
+ elif rotate == 270 :
408
+ point ['y' ] = - val
409
+ else :
410
+ point ['x' ] = val
405
411
elif ev_code == ABS_MT_POSITION_Y :
406
412
val = 1. - normalize (ev_value ,
407
413
range_min_position_y ,
408
414
range_max_position_y )
409
415
if invert_y :
410
416
val = 1. - val
411
- point ['y' ] = val
417
+ if rotate == 90 :
418
+ point ['x' ] = - val
419
+ elif rotate == 270 :
420
+ point ['x' ] = val
421
+ else :
422
+ point ['y' ] = val
412
423
elif ev_code == ABS_MT_ORIENTATION :
413
424
point ['orientation' ] = ev_value
414
425
elif ev_code == ABS_MT_BLOB_ID :
0 commit comments