Merge ~andch/plainbox-provider-pc-sanity:check-fingerprint-device into plainbox-provider-pc-sanity:master

Proposed by Andy Chi
Status: Needs review
Proposed branch: ~andch/plainbox-provider-pc-sanity:check-fingerprint-device
Merge into: plainbox-provider-pc-sanity:master
Diff against target: 89 lines (+59/-0)
3 files modified
bin/detect-fingerprint.sh (+46/-0)
units/pc-sanity/pc-sanity-fingerprint.pxu (+11/-0)
units/pc-sanity/pc-sanity.pxu (+2/-0)
Reviewer Review Type Date Requested Status
jeremyszu (community) Needs Fixing
Alex Tu Pending
Kai-Chuan Hsieh Pending
OEM Solutions Group: Engineers Pending
Review via email: mp+416203@code.launchpad.net

Commit message

Add test case to check if USB fingerprint device is supported in upstream and ubuntu release libfprint or not.

Test on Synaptics DUT.

Case 1: Upstream supported but not in ubuntu release package
Category: com.canonical.plainbox::miscellanea
... 8< -------------------------------------------------------------------------
--2022-03-01 22:56:41-- https://raw.githubusercontent.com/freedesktop/libfprint/master/data/autosuspend.hwdb
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 185.199.108.133, 2606:50c0:8003::154, 2606:50c0:8002::154, ...
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|185.199.108.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 5720 (5.6K) [text/plain]
Saving to: ‘/tmp/autosuspend.hwdb’

     0K ..... 100% 37.4M=0s

2022-03-01 22:56:41 (37.4 MB/s) - ‘/tmp/autosuspend.hwdb’ saved [5720/5720]

Device ID 06cbp00f0 is supported in upstream
Please start SRU process to land the ID into current Release version
------------------------------------------------------------------------- >8 ---
Outcome: job failed
Finalizing session that hasn't been submitted anywhere: checkbox-run-2022-03-01T14.56.41
==================================[ Results ]===================================
 ☑ : Collect information about installed software packages
 ☒ : Check USB fingerprint device is supported or not.

Case 2: upstream supported and also ubuntu release package
--2022-03-01 22:58:20-- https://raw.githubusercontent.com/freedesktop/libfprint/master/data/autosuspend.hwdb
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 185.199.110.133, 185.199.108.133, 185.199.109.133, ...
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|185.199.110.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 5720 (5.6K) [text/plain]
Saving to: ‘/tmp/autosuspend.hwdb’

     0K ..... 100% 36.8M=0s

2022-03-01 22:58:21 (36.8 MB/s) - ‘/tmp/autosuspend.hwdb’ saved [5720/5720]

Device ID 27c6p63ac is supported in upstream
ID is supported in current libfprint
------------------------------------------------------------------------- >8 ---
Outcome: job passed
Finalizing session that hasn't been submitted anywhere: checkbox-run-2022-03-01T14.58.20
==================================[ Results ]===================================
 ☑ : Collect information about installed software packages
 ☑ : Check USB fingerprint device is supported or not.

To post a comment you must log in.
Revision history for this message
jeremyszu (os369510) wrote :

Please also ensure the variable is there before use.

review: Needs Fixing
Revision history for this message
OEM Taipei Bot (oem-taipei-bot) wrote :
Revision history for this message
OEM Taipei Bot (oem-taipei-bot) wrote :
Revision history for this message
OEM Taipei Bot (oem-taipei-bot) wrote :

[autopkgtest]
blame: .
badpkg: rules build failed with exit code 2
erroneous package: rules build failed with exit code 2

https://oem-share.canonical.com/partners/lyoncore/share/artifacts/plainbox-provider-pc-sanity/plainbox-provider-pc-sanity-1.0.1ubuntu1-b2d8b91-in-linux-container-jammy

Unmerged commits

b2d8b91... by Andy Chi

Add test case to check if device support fingerprint or not.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/bin/detect-fingerprint.sh b/bin/detect-fingerprint.sh
2new file mode 100755
3index 0000000..0e314e4
4--- /dev/null
5+++ b/bin/detect-fingerprint.sh
6@@ -0,0 +1,46 @@
7+#!/bin/bash
8+
9+UPSTREAM_SUPPORT=0
10+UBUNTU_RELEASE_SUPPORT=0
11+FINGERPRINT_ID=$(lsusb | grep -E "Goodix|Synaptics|Elan" | cut -d " " -f 6 | tr ':' 'p')
12+LIBFPRINT_VERSION=$(dpkg -l | grep libfprint-2-2 | awk '{print $3}')
13+
14+# Clone get device list from libfprint upstream
15+wget --tries=5 --timeout=60 https://raw.githubusercontent.com/freedesktop/libfprint/master/data/autosuspend.hwdb -P /tmp
16+[ ! -f /tmp/autosuspend.hwdb ] && echo "No upstream file" && exit 0
17+
18+if [[ "$LIBFPRINT_VERSION" =~ "1:1.90.2+tod1-0ubuntu1".* ]]; then
19+ LIBFPRINT_SUPPORT_LIST=$(< /lib/udev/rules.d/60-libfprint-2.rules grep "ENV{LIBFPRINT_DRIVER}" | cut -d ',' -f 3 | cut -d '=' -f 3 | sed 's/"//g' | tr '[:upper:]' '[:lower:]')
20+else
21+ LIBFPRINT_SUPPORT_LIST=$(< /lib/udev/hwdb.d/60-autosuspend-libfprint-2.hwdb grep usb | cut -d ":" -f 2 | cut -d "p" -f 2 | sed 's/*$//g' | tr '[:upper:]' '[:lower:]')
22+fi
23+
24+for upstream_support_id in $(< /tmp/autosuspend.hwdb grep usb | cut -d ":" -f 2 | tr '[:upper:]' '[:lower:]')
25+do
26+ if [ "${upstream_support_id:1:9}" = "${FINGERPRINT_ID}" ]; then
27+ UPSTREAM_SUPPORT=1
28+ echo "Device ID ${FINGERPRINT_ID} is supported in upstream"
29+ fi
30+done
31+
32+for local_support_id in ${LIBFPRINT_SUPPORT_LIST}
33+do
34+ if [ "${local_support_id}" = "${FINGERPRINT_ID:5:4}" ]; then
35+ UBUNTU_RELEASE_SUPPORT=1
36+ echo "ID is supported in current libfprint"
37+ fi
38+done
39+
40+rm -rf /tmp/autosuspend.hwdb
41+
42+if [ $UPSTREAM_SUPPORT -eq 1 ] && [ $UBUNTU_RELEASE_SUPPORT -eq 1 ]; then
43+ exit 0
44+
45+elif [ $UPSTREAM_SUPPORT -eq 1 ] && [ $UBUNTU_RELEASE_SUPPORT -eq 0 ]; then
46+ echo "Please start SRU process to land the ID into current Release version"
47+ exit 1
48+
49+elif [ $UPSTREAM_SUPPORT -eq 0 ]; then
50+ echo "Please ask ODM to request fingerprint vendor to support in upstream"
51+ exit 1
52+fi
53diff --git a/units/pc-sanity/pc-sanity-fingerprint.pxu b/units/pc-sanity/pc-sanity-fingerprint.pxu
54new file mode 100644
55index 0000000..f25bc9c
56--- /dev/null
57+++ b/units/pc-sanity/pc-sanity-fingerprint.pxu
58@@ -0,0 +1,11 @@
59+plugin: shell
60+category_id: com.canonical.plainbox::miscellanea
61+id: miscellanea/fingerprint-id-support
62+requires:
63+ package.name == 'libfprint-2-2'
64+ package.name == 'wget'
65+command: detect-fingerprint.sh
66+_summary: Check USB fingerprint device is supported or not.
67+_description:
68+ Check USB fingerprint device is supported or not. Start SRU process or need
69+ ODM to ask vendor to upstream their device.
70diff --git a/units/pc-sanity/pc-sanity.pxu b/units/pc-sanity/pc-sanity.pxu
71index bdf203d..db0546c 100644
72--- a/units/pc-sanity/pc-sanity.pxu
73+++ b/units/pc-sanity/pc-sanity.pxu
74@@ -48,6 +48,7 @@ include:
75 com.canonical.certification::miscellanea/check_.*_start_rt_ucode_failed
76 com.canonical.certification::miscellanea/check_.*_start_wm_firmware_failed
77 com.canonical.certification::miscellanea/check_.*_wifi6e_enabled
78+ com.canonical.certification::miscellanea/fingerprint-id-support
79 exclude:
80 com.canonical.certification::suspend/bluetooth_obex_send_before_suspend
81 com.canonical.certification::suspend/bluetooth_obex_send_after_suspend_auto
82@@ -111,6 +112,7 @@ include:
83 com.canonical.certification::miscellanea/check_.*_start_rt_ucode_failed
84 com.canonical.certification::miscellanea/check_.*_start_wm_firmware_failed
85 com.canonical.certification::miscellanea/check_.*_wifi6e_enabled
86+ com.canonical.certification::miscellanea/fingerprint-id-support
87 exclude:
88 com.canonical.certification::after-suspend-bluetooth4/beacon_.*
89 com.canonical.certification::bluetooth4/beacon_eddystone.*

Subscribers

People subscribed via source and target branches