17
17
GOS_INTERFACE_AXIS_MAP ,
18
18
GOS_INTERFACE_BTN_ESSENTIALS ,
19
19
GOS_INTERFACE_BTN_MAP ,
20
+ GOS_TOUCHPAD_BUTTON_MAP ,
21
+ GOS_TOUCHPAD_AXIS_MAP ,
20
22
)
21
23
from .hid import LegionHidraw , LegionHidrawTs , rgb_callback
22
24
25
+
23
26
FIND_DELAY = 0.1
24
27
ERROR_DELAY = 0.5
25
28
LONGER_ERROR_DELAY = 3
@@ -224,12 +227,13 @@ def controller_loop_xinput(
224
227
debug = DEBUG_MODE
225
228
226
229
# Output
227
-
230
+ touchpad_enable = conf . get ( "touchpad" , "disabled" )
228
231
d_producers , d_outs , d_params = get_outputs (
229
232
conf ["xinput" ],
230
233
None ,
231
234
conf ["imu" ].to (bool ),
232
235
emit = emit ,
236
+ touchpad_enable = touchpad_enable , # type: ignore
233
237
rgb_modes = {
234
238
"disabled" : [],
235
239
"solid" : ["color" ],
@@ -263,6 +267,20 @@ def controller_loop_xinput(
263
267
)
264
268
)
265
269
270
+ uses_touch = d_params .get ("uses_touch" , False )
271
+ d_touch = GenericGamepadEvdev (
272
+ vid = [GOS_VID ],
273
+ pid = list (GOS_PIDS ),
274
+ capabilities = {
275
+ EC ("EV_KEY" ): [EC ("BTN_LEFT" )],
276
+ EC ("EV_ABS" ): [EC ("ABS_MT_POSITION_Y" )],
277
+ },
278
+ btn_map = GOS_TOUCHPAD_BUTTON_MAP ,
279
+ axis_map = GOS_TOUCHPAD_AXIS_MAP ,
280
+ aspect_ratio = 1 ,
281
+ required = True ,
282
+ )
283
+
266
284
freq = conf .get ("freq" , None )
267
285
os = conf .get ("mapping.mode" , None )
268
286
d_cfg = LegionHidraw (
@@ -279,6 +297,7 @@ def controller_loop_xinput(
279
297
os = os ,
280
298
turbo = conf .get ("mapping.windows.turbo" , None ) if os == "windows" else None ,
281
299
freq = freq ,
300
+ touchpad = "absolute" if uses_touch else "relative" ,
282
301
)
283
302
284
303
# Mute keyboard shortcuts, mute
@@ -322,6 +341,8 @@ def prepare(m):
322
341
try :
323
342
prepare (d_xinput )
324
343
prepare (d_shortcuts )
344
+ if uses_touch :
345
+ prepare (d_touch )
325
346
prepare (d_cfg )
326
347
prepare (d_raw )
327
348
for d in d_producers :
0 commit comments