@@ -111,8 +111,8 @@ def get_device_info(name, cmd_list_devices, device_list):
111111 # If the device name starts with a '/' then it is instead
112112 # considered as the explicit device path although since
113113 # device paths can change through reboots this is best to be
114- # a symlink. E.g. use the corresponding full path link under
115- # /dev/input/by-path/ or /dev/input/by-id/.
114+ # a symlink. E.g. users should use the corresponding full
115+ # path link under /dev/input/by-path/ or /dev/input/by-id/.
116116 if kdev :
117117 if d .get ('kernel' ) == kdev :
118118 return d
@@ -125,13 +125,11 @@ def get_device_info(name, cmd_list_devices, device_list):
125125 if 'size' in d and 'pointer' in d .get ('capabilities' ):
126126 return d
127127 # Otherwise look for 1st device with touchpad in it's name
128- for d in devices :
129- if re .search (r'touch ?pad' , d .get ('device' , '' ), re .I ):
130- return d
131- # Otherwise look for 1st device with trackpad in it's name
132- for d in devices :
133- if re .search (r'track ?pad' , d .get ('device' , '' ), re .I ):
134- return d
128+ # or, failing that, 1st device with trackpad in it's name
129+ for txt in ('touch ?pad' , 'track ?pad' ):
130+ for d in devices :
131+ if re .search (txt , d .get ('device' , '' ), re .I ):
132+ return d
135133
136134 # Give up
137135 return None
0 commit comments