|
@ -5,6 +5,8 @@ touchpannel's drm output and its overal status. |
|
|
""" |
|
|
""" |
|
|
|
|
|
|
|
|
from pathlib import Path |
|
|
from pathlib import Path |
|
|
|
|
|
from x import get_edid_dev_path |
|
|
|
|
|
from common import max_match |
|
|
|
|
|
|
|
|
VENDOR_ID = "0EEF" |
|
|
VENDOR_ID = "0EEF" |
|
|
DEVICE_ID = "C000" |
|
|
DEVICE_ID = "C000" |
|
@ -38,3 +40,28 @@ def is_egalax_connected() -> bool: |
|
|
""" |
|
|
""" |
|
|
devpath = get_egalax_path() |
|
|
devpath = get_egalax_path() |
|
|
return bool(devpath) |
|
|
return bool(devpath) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_egalax_edid_path() -> Path: |
|
|
|
|
|
"""return EDID path of touchpannel rdm |
|
|
|
|
|
|
|
|
|
|
|
This function will find intersection of the edid pathes and eGalax hid |
|
|
|
|
|
device and if this intersection and returns the maximum match. |
|
|
|
|
|
|
|
|
|
|
|
Runtime: 160ms on average -> Not efficient |
|
|
|
|
|
|
|
|
|
|
|
Returns: |
|
|
|
|
|
Path: edid path of eGalax OR None if not found or device is'nt connected |
|
|
|
|
|
""" |
|
|
|
|
|
egalax_dev = get_egalax_path() |
|
|
|
|
|
if not egalax_dev: |
|
|
|
|
|
return None |
|
|
|
|
|
max_dir = "/sys/devices" |
|
|
|
|
|
max_path = None |
|
|
|
|
|
for path in get_edid_dev_path(): |
|
|
|
|
|
base_dir = max_match(str(path), str(egalax_dev)) |
|
|
|
|
|
if len(max_dir) < len(base_dir): |
|
|
|
|
|
max_dir = base_dir |
|
|
|
|
|
max_path = path |
|
|
|
|
|
# TODO add sanity check (both edid and VENDOR:DEVICE are in that base) |
|
|
|
|
|
return max_path |
|
|