|
10 | 10 | from hhd.controller.lib.hide import unhide_all |
11 | 11 | from hhd.controller.physical.evdev import B as EC |
12 | 12 | from hhd.controller.physical.evdev import GenericGamepadEvdev, enumerate_evs |
| 13 | +from hhd.controller.physical.hidraw import GenericGamepadHidraw |
13 | 14 | from hhd.controller.virtual.uinput import HHD_PID_VENDOR, UInputDevice |
14 | 15 | from hhd.plugins import Config, Context, Emitter, get_outputs |
15 | 16 |
|
16 | 17 | from .const import ( |
17 | 18 | GOS_INTERFACE_AXIS_MAP, |
18 | 19 | GOS_INTERFACE_BTN_ESSENTIALS, |
19 | 20 | GOS_INTERFACE_BTN_MAP, |
20 | | - GOS_TOUCHPAD_BUTTON_MAP, |
21 | | - GOS_TOUCHPAD_AXIS_MAP, |
| 21 | + GOS_TOUCHPAD_AXIS_MAP_HID, |
| 22 | + GOS_TOUCHPAD_BUTTON_MAP_HID, |
22 | 23 | ) |
23 | 24 | from .hid import LegionHidraw, LegionHidrawTs, rgb_callback |
24 | 25 |
|
25 | | - |
26 | 26 | FIND_DELAY = 0.1 |
27 | 27 | ERROR_DELAY = 0.5 |
28 | 28 | LONGER_ERROR_DELAY = 3 |
@@ -268,16 +268,25 @@ def controller_loop_xinput( |
268 | 268 | ) |
269 | 269 |
|
270 | 270 | uses_touch = d_params.get("uses_touch", False) |
271 | | - d_touch = GenericGamepadEvdev( |
| 271 | + d_touch_mute = GenericGamepadEvdev( |
272 | 272 | vid=[GOS_VID], |
273 | 273 | pid=list(GOS_PIDS), |
274 | 274 | capabilities={ |
275 | 275 | EC("EV_KEY"): [EC("BTN_LEFT")], |
276 | 276 | EC("EV_ABS"): [EC("ABS_MT_POSITION_Y")], |
277 | 277 | }, |
278 | | - btn_map=GOS_TOUCHPAD_BUTTON_MAP, |
279 | | - axis_map=GOS_TOUCHPAD_AXIS_MAP, |
280 | | - aspect_ratio=1, |
| 278 | + btn_map={}, |
| 279 | + axis_map={}, |
| 280 | + # aspect_ratio=1, |
| 281 | + required=True, |
| 282 | + ) |
| 283 | + d_touch = GenericGamepadHidraw( |
| 284 | + vid=[GOS_VID], |
| 285 | + pid=list(GOS_PIDS), |
| 286 | + application=[0x000D0022], |
| 287 | + btn_map=GOS_TOUCHPAD_BUTTON_MAP_HID, |
| 288 | + axis_map=GOS_TOUCHPAD_AXIS_MAP_HID, |
| 289 | + # aspect_ratio=1, |
281 | 290 | required=True, |
282 | 291 | ) |
283 | 292 |
|
@@ -342,13 +351,15 @@ def prepare(m): |
342 | 351 | prepare(d_xinput) |
343 | 352 | prepare(d_shortcuts) |
344 | 353 | if uses_touch: |
| 354 | + prepare(d_touch_mute) |
345 | 355 | prepare(d_touch) |
346 | 356 | prepare(d_cfg) |
347 | 357 | prepare(d_raw) |
348 | 358 | for d in d_producers: |
349 | 359 | prepare(d) |
350 | 360 |
|
351 | 361 | logger.info("Emulated controller launched, have fun!") |
| 362 | + |
352 | 363 | while not should_exit.is_set() and not updated.is_set(): |
353 | 364 | start = time.perf_counter() |
354 | 365 | # Add timeout to call consumers a minimum amount of times per second |
|
0 commit comments