1+ ''' 
12# LVGL indev driver for evdev mouse device 
23# (for the unix micropython port) 
34
89
910import lcd_bus 
1011import pointer_framework 
11- from  micropython  import  const 
12+ from micropython import const  # NOQA  
1213import lvgl as lv  # NOQA 
1314
14- 
15- _REL_X 			0x00 
16- _REL_Y 			0x01 
17- _REL_Z 			0x02 
18- _REL_RX 			0x03 
19- _REL_RY 			0x04 
20- _REL_RZ 			0x05 
21- _REL_HWHEEL 		0x06 
22- _REL_DIAL 		0x07 
23- _REL_WHEEL 		0x08 
24- _REL_WHEEL_HI_RES 	0x0C 
25- _REL_HWHEEL_HI_RES 	0x0C 
26- 
27- _ABS_X 			0x00 
28- _ABS_Y 			0x01 
29- _ABS_Z 			0x02 
30- _ABS_RX 			0x03 
31- _ABS_RY 			0x04 
32- _ABS_RZ 			0x05 
33- _ABS_THROTTLE 		0x06 
34- _ABS_RUDDER 		0x07 
35- _ABS_WHEEL 		0x08 
36- _ABS_GAS 			0x09 
37- _ABS_BRAKE 		0x0a 
38- _ABS_HAT0X 		0x10 
39- _ABS_HAT0Y 		0x11 
40- _ABS_HAT1X 		0x12 
41- _ABS_HAT1Y 		0x13 
42- _ABS_HAT2X 		0x14 
43- _ABS_HAT2Y 		0x15 
44- _ABS_HAT3X 		0x16 
45- _ABS_HAT3Y 		0x17 
46- _ABS_PRESSURE 		0x18 
47- _ABS_DISTANCE 		0x19 
48- _ABS_TILT_X 		0x1a 
49- _ABS_TILT_Y 		0x1b 
50- _ABS_TOOL_WIDTH 		0x1c 
51- _ABS_VOLUME 		0x20 
52- _ABS_PROFILE 		0x21 
53- 
54- _ABS_MT_POSITION_X 	0x35 	/ *  Center  X  touch  position  * / 
55- _ABS_MT_POSITION_Y 	0x36 	/ *  Center  Y  touch  position  * / 
56- _ABS_MT_TOOL_TYPE 	0x37 	/ *  Type  of  touching  device  * / 
57- _ABS_MT_TOOL_X 		0x3c 	/ *  Center  X  tool  position  * / 
58- _ABS_MT_TOOL_Y 		0x3d 	/ *  Center  Y  tool  position  * / 
59- 
60- 
61- 
62- 
63- 
64- 
15+ # 
16+ # _REL_X			0x00 
17+ # _REL_Y			0x01 
18+ # _REL_Z			0x02 
19+ # _REL_RX			0x03 
20+ # _REL_RY			0x04 
21+ # _REL_RZ			0x05 
22+ # _REL_HWHEEL		0x06 
23+ # _REL_DIAL		0x07 
24+ # _REL_WHEEL		0x08 
25+ # _REL_WHEEL_HI_RES	0x0C 
26+ # _REL_HWHEEL_HI_RES	0x0C 
27+ # 
28+ # _ABS_X			0x00 
29+ # _ABS_Y			0x01 
30+ # _ABS_Z			0x02 
31+ # _ABS_RX			0x03 
32+ # _ABS_RY			0x04 
33+ # _ABS_RZ			0x05 
34+ # _ABS_THROTTLE		0x06 
35+ # _ABS_RUDDER		0x07 
36+ # _ABS_WHEEL		0x08 
37+ # _ABS_GAS			0x09 
38+ # _ABS_BRAKE		0x0a 
39+ # _ABS_HAT0X		0x10 
40+ # _ABS_HAT0Y		0x11 
41+ # _ABS_HAT1X		0x12 
42+ # _ABS_HAT1Y		0x13 
43+ # _ABS_HAT2X		0x14 
44+ # _ABS_HAT2Y		0x15 
45+ # _ABS_HAT3X		0x16 
46+ # _ABS_HAT3Y		0x17 
47+ # _ABS_PRESSURE		0x18 
48+ # _ABS_DISTANCE		0x19 
49+ # _ABS_TILT_X		0x1a 
50+ # _ABS_TILT_Y		0x1b 
51+ # _ABS_TOOL_WIDTH		0x1c 
52+ # _ABS_VOLUME		0x20 
53+ # _ABS_PROFILE		0x21 
54+ # 
55+ # _ABS_MT_POSITION_X	0x35	/* Center X touch position */ 
56+ # _ABS_MT_POSITION_Y	0x36	/* Center Y touch position */ 
57+ # _ABS_MT_TOOL_TYPE	0x37	/* Type of touching device */ 
58+ # _ABS_MT_TOOL_X		0x3c	/* Center X tool position */ 
59+ # _ABS_MT_TOOL_Y		0x3d	/* Center Y tool position */ 
6560
6661
6762class EvdevMouseDriver(pointer_framework.PointerDriver): 
@@ -73,67 +68,73 @@ def __init__(self, device):
7368        super().__init__() 
7469
7570    def _get_key(self, _, data): 
76-         BTN_RIGHT 
77-         BTN_MIDDLE 
78-         BTN_SIDE 
79-         BTN_EXTRA 
80-         BTN_FORWARD 
81-         BTN_BACK 
82-         BTN_TASK 
71+         # BTN_RIGHT 
72+         # BTN_MIDDLE 
73+         # BTN_SIDE 
74+         # BTN_EXTRA 
75+         # BTN_FORWARD 
76+         # BTN_BACK 
77+         # BTN_TASK 
78+         pass 
8379
8480
8581    def _get_wheel(self, _, data): 
86-         REL_HWHEEL 
87-         REL_WHEEL 
88- 
89-         REL_WHEEL_HI_RES 
90-         REL_HWHEEL_HI_RES 
82+         # REL_HWHEEL 
83+         # REL_WHEEL 
84+         # 
85+         # REL_WHEEL_HI_RES 
86+         # REL_HWHEEL_HI_RES 
87+         pass 
9188
9289    def _get_coords(self): 
93-         event  =  self .device .read ()
94- 
95-         if  event  is  None :
96-             return  None 
97- 
98-         if  event .type  ==  _EV_KEY :
99-             key  =  event .code 
100-             state  =  event .code 
101- 
102-         elif  event .type  ==  _EV_REL :
103- 
104-             pos  =  event .value 
105- 
106-         if  not  self ._poll .poll ()[0 ][1 ] &  select .POLLIN :
107-             return  None 
108- 
109-         EV_KEY 
110-         BTN_LEFT 
111-         REL_X 
112-         REL_Y 
113- 
114-         if  (mouse_data [0 ] &  1 ) !=  1 :
115-             return  None 
116- 
117-         # Data is relative, update coordinates 
118-         x  =  self ._last_mouse_x 
119-         y  =  self ._last_mouse_y 
120- 
121-         x  +=  mouse_data [1 ]
122-         y  -=  mouse_data [2 ]
123- 
124-         # Handle coordinate overflow cases 
125-         x  =  max (min (x , self .get_width () -  1 ), 0 )
126-         y  =  max (min (y , self .get_height () -  1 ), 0 )
127- 
128-         # Draw cursor, if needed 
129- 
130-         return  state , x , y 
90+         # event = self.device.read() 
91+         # 
92+         # if event is None: 
93+         #     return None 
94+         # 
95+         # if event.type == _EV_KEY: 
96+         #     key = event.code 
97+         #     state = event.code 
98+         # 
99+         # elif event.type == _EV_REL: 
100+         # 
101+         #     pos = event.value 
102+         # 
103+         # if not self._poll.poll()[0][1] & select.POLLIN: 
104+         #     return None 
105+         # 
106+         # EV_KEY 
107+         # BTN_LEFT 
108+         # REL_X 
109+         # REL_Y 
110+         # 
111+         # if (mouse_data[0] & 1) != 1: 
112+         #     return None 
113+         # 
114+         # # Data is relative, update coordinates 
115+         # x = self._last_mouse_x 
116+         # y = self._last_mouse_y 
117+         # 
118+         # x += mouse_data[1] 
119+         # y -= mouse_data[2] 
120+         # 
121+         # # Handle coordinate overflow cases 
122+         # x = max(min(x, self.get_width() - 1), 0) 
123+         # y = max(min(y, self.get_height() - 1), 0) 
124+         # 
125+         # # Draw cursor, if needed 
126+         # 
127+         # return state, x, y 
128+ 
129+         pass 
131130
132131    def delete(self): 
133-         self ._evdev .close ()
134-         if  self .cursor  and  hasattr (self .cursor , 'delete' ):
135-             self .cursor .delete ()
136-         self ._indev_drv .enable (False )
132+         # self._evdev.close() 
133+         # if self.cursor and hasattr(self.cursor, 'delete'): 
134+         #     self.cursor.delete() 
135+         # self._indev_drv.enable(False) 
136+         pass 
137+ 
137138
138139
139140# evdev driver for mouse 
@@ -178,3 +179,5 @@ def delete(self):
178179        if self.cursor and hasattr(self.cursor, 'delete'): 
179180            self.cursor.delete() 
180181        self._indev_drv.enable(False) 
182+ 
183+ ''' 
0 commit comments