Compare commits
2 Commits
8011d1282f
...
bb1d45335a
| Author | SHA1 | Date | |
|---|---|---|---|
| bb1d45335a | |||
| 6628c638af |
@@ -8,7 +8,7 @@ or
|
||||
- pip3 install git+https://git.ao-it.net/python/CO2Meter
|
||||
"""
|
||||
|
||||
__version__ = '0.3.0'
|
||||
__version__ = '0.3.1'
|
||||
__author__ = 'anima'
|
||||
|
||||
# imports
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user