aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2023-01-21 12:59:04 +0100
committerAnton Khirnov <anton@khirnov.net>2023-01-21 12:59:04 +0100
commit7be242fb7f9909c50840e43afea154b4ada966fc (patch)
tree3446ed96496b1b85e944d3a2043a84e2b1c80ee1
parente0e75d3901231b24a459db7906c23f1821a141e8 (diff)
dev_add: print device name/phys in the log
-rwxr-xr-xdev_add9
1 files changed, 6 insertions, 3 deletions
diff --git a/dev_add b/dev_add
index 094345f..5e53451 100755
--- a/dev_add
+++ b/dev_add
@@ -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):