Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _ensure_open(self) -> bool:
try:
if self._dev is None:
self._dev = hidapi.Device(self._devinfo, blocking=False)
except Exception as err:
self.logger.exception("Failed to open connection", exc_info=err)
return False
return True
def read_eeprom(devinfo):
dev = hidapi.Device(devinfo)
cfg = json.loads(loadconfig(dev).decode('ascii'))
pprint(cfg)
# TODO: Use calibration data. Sample code in lgdisplaytest.py
return (dev, cfg)