difonlib 0.3.2__tar.gz → 0.3.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {difonlib-0.3.2 → difonlib-0.3.3}/PKG-INFO +1 -1
- {difonlib-0.3.2 → difonlib-0.3.3}/pyproject.toml +1 -1
- {difonlib-0.3.2 → difonlib-0.3.3}/src/difonlib/input_devs.py +8 -5
- {difonlib-0.3.2 → difonlib-0.3.3}/src/difonlib.egg-info/PKG-INFO +1 -1
- {difonlib-0.3.2 → difonlib-0.3.3}/README.md +0 -0
- {difonlib-0.3.2 → difonlib-0.3.3}/setup.cfg +0 -0
- {difonlib-0.3.2 → difonlib-0.3.3}/src/difonlib/__init__.py +0 -0
- {difonlib-0.3.2 → difonlib-0.3.3}/src/difonlib/bt_scanner.py +0 -0
- {difonlib-0.3.2 → difonlib-0.3.3}/src/difonlib/bt_utils.py +0 -0
- {difonlib-0.3.2 → difonlib-0.3.3}/src/difonlib/conn_kbd_devs.py +0 -0
- {difonlib-0.3.2 → difonlib-0.3.3}/src/difonlib/ng_lib.py +0 -0
- {difonlib-0.3.2 → difonlib-0.3.3}/src/difonlib/py.typed +0 -0
- {difonlib-0.3.2 → difonlib-0.3.3}/src/difonlib/remctrl.py +0 -0
- {difonlib-0.3.2 → difonlib-0.3.3}/src/difonlib/tuya_devs.py +0 -0
- {difonlib-0.3.2 → difonlib-0.3.3}/src/difonlib/utils.py +0 -0
- {difonlib-0.3.2 → difonlib-0.3.3}/src/difonlib.egg-info/SOURCES.txt +0 -0
- {difonlib-0.3.2 → difonlib-0.3.3}/src/difonlib.egg-info/dependency_links.txt +0 -0
- {difonlib-0.3.2 → difonlib-0.3.3}/src/difonlib.egg-info/requires.txt +0 -0
- {difonlib-0.3.2 → difonlib-0.3.3}/src/difonlib.egg-info/top_level.txt +0 -0
- {difonlib-0.3.2 → difonlib-0.3.3}/tests/test_bt_utils.py +0 -0
- {difonlib-0.3.2 → difonlib-0.3.3}/tests/test_utils.py +0 -0
|
@@ -142,7 +142,7 @@ def idev_get_by_field(field: str, field_value: str) -> Optional[List[IDevKbd]]:
|
|
|
142
142
|
return kdevs
|
|
143
143
|
|
|
144
144
|
|
|
145
|
-
def idev_key_monitor(
|
|
145
|
+
def idev_key_monitor(dev_path: str) -> Optional[IDevKbdKey]:
|
|
146
146
|
"""
|
|
147
147
|
Wait for any pressed key on dev_event
|
|
148
148
|
Return: ( key_event.scancode, hold_time, key_event.keycode )"""
|
|
@@ -150,9 +150,9 @@ def idev_key_monitor(dev_event: str) -> Optional[IDevKbdKey]:
|
|
|
150
150
|
press_time: float | None = None # timer key down timestamp
|
|
151
151
|
key: IDevKbdKey | None = None
|
|
152
152
|
|
|
153
|
-
dev = InputDevice(
|
|
153
|
+
dev = InputDevice(dev_path)
|
|
154
154
|
dbg(f"Listening on: {dev.name}")
|
|
155
|
-
|
|
155
|
+
dev.grab() # capture input device
|
|
156
156
|
for event in dev.read_loop():
|
|
157
157
|
# if event.type == ecodes.EV_KEY:
|
|
158
158
|
key_event = categorize(event)
|
|
@@ -173,17 +173,19 @@ def idev_key_monitor(dev_event: str) -> Optional[IDevKbdKey]:
|
|
|
173
173
|
else key_event.keycode[0]
|
|
174
174
|
)
|
|
175
175
|
break
|
|
176
|
+
dev.ungrab()
|
|
176
177
|
dev.close()
|
|
177
178
|
return key
|
|
178
179
|
|
|
179
180
|
|
|
180
|
-
async def idev_get_pressed_key(
|
|
181
|
+
async def idev_get_pressed_key(dev_path: str, timeout: int = 5) -> Optional[IDevKbdKey]:
|
|
181
182
|
"""
|
|
182
183
|
Wait timeout seconds for pressed key on dev_event
|
|
183
184
|
"""
|
|
184
|
-
dev = InputDevice(
|
|
185
|
+
dev = InputDevice(dev_path)
|
|
185
186
|
dbg(f" - Listening on: {dev.name}")
|
|
186
187
|
# key = await _get_first_key_event(dev)
|
|
188
|
+
dev.grab()
|
|
187
189
|
try:
|
|
188
190
|
# asyncio.wait_for ограничивает выполнение асинхронной задачи по времени
|
|
189
191
|
key = await asyncio.wait_for(
|
|
@@ -201,6 +203,7 @@ async def idev_get_pressed_key(dev_event: str, timeout: int = 5) -> Optional[IDe
|
|
|
201
203
|
print(f" =!= Error: {e}")
|
|
202
204
|
|
|
203
205
|
finally:
|
|
206
|
+
dev.ungrab()
|
|
204
207
|
dev.close()
|
|
205
208
|
return None
|
|
206
209
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|