diff options
| -rwxr-xr-x | bin/touchpad_confidence_bit.py | 56 | ||||
| -rw-r--r-- | units/touchpad/jobs.pxu | 22 | ||||
| -rw-r--r-- | units/touchpad/test-plan.pxu | 2 |
3 files changed, 60 insertions, 20 deletions
diff --git a/bin/touchpad_confidence_bit.py b/bin/touchpad_confidence_bit.py new file mode 100755 index 0000000..5f94bb9 --- /dev/null +++ b/bin/touchpad_confidence_bit.py @@ -0,0 +1,56 @@ +#!/usr/bin/env python3 + +import sys +from subprocess import check_output, CalledProcessError +from checkbox_support.parsers.udevadm import UdevadmParser + + +class TouchpadDevices: + + def __init__(self): + self.devices = {} + self._collect_devices() + + def _collect_devices(self): + cmd = ['udevadm', 'info', '--export-db'] + try: + output = check_output(cmd).decode(sys.stdout.encoding) + except CalledProcessError as err: + sys.stderr.write(err) + return + udev = UdevadmParser(output) + udev.run(self) + + def addDevice(self, device): + if getattr(device, 'category') == 'TOUCHPAD': + self.devices[getattr(device, 'product_slug') + ] = getattr(device, 'path') + + +def main(): + if len(sys.argv) != 2: + raise SystemExit('ERROR: expected a product slug') + product_slug = sys.argv[1] + + path = TouchpadDevices().devices[product_slug] + abs_path = "/sys" + path + "/capabilities/abs" + + f = open(abs_path, "r") + abs_cap_str = f.readline() + f.close() + support = (int(abs_cap_str[-15], 16) & 8) >> 3 + + if support == 0: + modalias_path = "/sys" + path + "/modalias" + f = open(modalias_path, "r") + modalias_str = f.readline() + f.close() + print("Touchpad modalias: {}".format(modalias_str[0:-2])) + print("Touchpad EV_ABS capabilities: {}".format(abs_cap_str[0:-2])) + sys.exit(1) + + return 0 + + +if __name__ == "__main__": + main() diff --git a/units/touchpad/jobs.pxu b/units/touchpad/jobs.pxu index 794de79..e0d118b 100644 --- a/units/touchpad/jobs.pxu +++ b/units/touchpad/jobs.pxu @@ -220,30 +220,14 @@ _siblings: unit: template template-resource: device -template-filter: device.category == 'TOUCHPAD' +template-filter: + device.category == 'TOUCHPAD' and device.driver == 'hid-multitouch' template-unit: job plugin: shell category_id: com.canonical.plainbox::touchpad id: touchpad/palm-rejection-firmware-labeling_{product_slug} -requires: device.driver == 'hid-multitouch' estimated_duration: 5.0 -command: - dev_path=$(udev_resource.py -f TOUCHPAD | grep "path" | cut -d" " -f2) - abs_path="/sys$dev_path/capabilities/abs" - abs_caps=$(cat <"$abs_path") - abs_caps_hex=$((16#"$abs_caps")) - tool_type_bit=$((abs_caps_hex >> 55)) - support=$((tool_type_bit & 1)) - if [ $support -eq 1 ]; then - exit 0 - else - echo "Touchapd info:" - cat <"/sys$dev_path/name" - cat <"/sys$dev_path/modalias" - echo "Touchpad EV_ABS capabilities:" - echo "$abs_caps" - exit 1 - fi +command: touchpad_confidence_bit.py {product_slug} _summary: Touchpad EV_ABS capability check _description: Libinput firmware/labeling palm detection rely on touchpad ABS_MT_TOOL_TYPE diff --git a/units/touchpad/test-plan.pxu b/units/touchpad/test-plan.pxu index 39769d0..e03ea54 100644 --- a/units/touchpad/test-plan.pxu +++ b/units/touchpad/test-plan.pxu @@ -30,7 +30,7 @@ _description: Touchpad tests (Automated) include: touchpad/detected-as-mouse certification-status=blocker - touchpad/palm-rejection-firmware-labeling_.* certification-status=blocker + touchpad/palm-rejection-firmware-labeling_.* certification-status=non-blocker id: after-suspend-touchpad-cert-full |
