Skip to content

Commit 47bec7b

Browse files
committed
fix usages on the ally
1 parent a57aeb7 commit 47bec7b

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

src/hhd/controller/physical/hidraw.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ def __init__(
4141
product: Sequence[str | re.Pattern] = [],
4242
usage_page: Sequence[int] = [],
4343
usage: Sequence[int] = [],
44+
application: Sequence[int] = [],
4445
interface: int | None = None,
4546
btn_map: dict[int | None, dict[Button, BM]] = {},
4647
axis_map: dict[int | None, dict[Axis, AM]] = {},
@@ -59,6 +60,7 @@ def __init__(
5960
self.interface = interface
6061
self.report_size = report_size
6162

63+
self.application = application
6264
self.btn_map = btn_map
6365
self.axis_map = axis_map
6466
self.config_map = config_map
@@ -86,6 +88,10 @@ def open(self) -> Sequence[int]:
8688
continue
8789
if not matches_patterns(d["usage"], self.usage):
8890
continue
91+
if not matches_patterns(
92+
(d["usage_page"] << 16) + d["usage"], self.application
93+
):
94+
continue
8995
if (
9096
self.interface is not None
9197
and d.get("interface_number", None) != self.interface
@@ -117,6 +123,8 @@ def open(self) -> Sequence[int]:
117123
err += f"Usage Page: {hexify(self.usage_page)}\n"
118124
if self.usage:
119125
err += f"Usage: {hexify(self.usage)}\n"
126+
if self.application:
127+
err += f"Application: {hexify(self.application)}\n"
120128
logger.error(err)
121129
if self.required:
122130
raise RuntimeError()

src/hhd/device/rog_ally/base.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,8 +353,11 @@ def controller_loop(
353353
d_allyx = AllyXHidraw(
354354
vid=[ASUS_VID],
355355
pid=[ALLY_X_PID],
356-
usage_page=[0x0F],
357-
usage=[0x21],
356+
application=[
357+
0x000F0002,
358+
0x000F0021,
359+
0x00010005,
360+
],
358361
required=True,
359362
)
360363
else:

0 commit comments

Comments
 (0)