@@ -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 ()
0 commit comments