Ali Hatami Tajik
2 years ago
1 changed files with 39 additions and 0 deletions
@ -0,0 +1,39 @@ |
|||
"""eGalax |
|||
|
|||
This module is responsible for detecting the touchpanel. It would detect the |
|||
touchpannel's drm output and its overal status. |
|||
""" |
|||
|
|||
from pathlib import Path |
|||
|
|||
VENDOR_ID = "0EEF" |
|||
DEVICE_ID = "C000" |
|||
|
|||
def get_egalax_path() -> Path: |
|||
"""Get device path |
|||
|
|||
This function will return the path of the HID device related to the pannel. |
|||
NOTE that it is not the path of the EDID but it can be extracted from it. |
|||
|
|||
Returns: |
|||
Path: Path of the eGalax hid device OR None if device is not ceonnected |
|||
""" |
|||
query = '*' + VENDOR_ID + ':' + DEVICE_ID + '*' |
|||
devices = list(Path('/sys/devices').rglob(query)) |
|||
if devices: |
|||
return devices[0] |
|||
else: |
|||
return None |
|||
|
|||
|
|||
def is_egalax_connected() -> bool: |
|||
"""Checks if device is connected |
|||
|
|||
avaiability of the device is checked by existing a path of the device in the |
|||
/sys/devices directory. |
|||
|
|||
Returns: |
|||
bool: True if device is connected |
|||
""" |
|||
devpath = get_egalax_path() |
|||
return bool(devpath) |
Loading…
Reference in new issue