diff --git a/checks/check_airq.py b/checks/check_airq.py index e4586e4..e55d037 100755 --- a/checks/check_airq.py +++ b/checks/check_airq.py @@ -103,7 +103,7 @@ class AirQ: matches = list() # log has con is the log entry rolls out command = ["journalctl", "-k", "--no-pager"] # alternative: dmesg # maybe usefull lsusb - pattern = re.compile(r'hidraw\d{2}') + pattern = re.compile(r'hidraw\d{1,2}') ## get kernel logs result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) if result.returncode != 0: @@ -121,9 +121,9 @@ class AirQ: ## search in found log line the usb name and verify path exists if len(matches) > 0: dev_path = f'/dev/{matches[0]}' - if path.exists(f'/dev/{matches[0]}'): - logging.debug(f'usb device is in /dev/{matches[0]}') - self.device = f'/dev/{matches[0]}' + if path.exists(dev_path): + logging.debug(f'usb device is under path {dev_path}') + self.device = dev_path return True logging.error(f'usb device not found!') return False