diff options
author | Anton Khirnov <anton@khirnov.net> | 2023-01-21 12:59:04 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2023-01-21 12:59:04 +0100 |
commit | 7be242fb7f9909c50840e43afea154b4ada966fc (patch) | |
tree | 3446ed96496b1b85e944d3a2043a84e2b1c80ee1 | |
parent | e0e75d3901231b24a459db7906c23f1821a141e8 (diff) |
dev_add: print device name/phys in the log
-rwxr-xr-x | dev_add | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -12,11 +12,14 @@ import sys import time def dev_match(evpath, pattern, logger): + name = '(null)' + phys = '(null)' + try: with open(evpath + '/device/name', 'r') as f: - name = f.read() + name = f.read().strip() with open(evpath + '/device/phys', 'r') as f: - phys = f.read() + phys = f.read().strip() if not 'uinput' in phys and re.search(pattern, name): logger.debug('%s matched the pattern', evpath) @@ -24,7 +27,7 @@ def dev_match(evpath, pattern, logger): except IOError: pass - logger.debug('%s did not match the pattern', evpath) + logger.debug('%s (%s | %s) did not match the pattern', evpath, name, phys) return False def dev_add(control, syspath, logger): |