Merge ~binli/checkbox-support/+git/checkbox-support:dmic-support into checkbox-support:master

Proposed by Bin Li
Status: Merged
Approved by: Sylvain Pineau
Approved revision: 94737b089c08c82540794cf2961da599cad145e1
Merged at revision: 1c78925ab80ff725f62fa1b7ca49f6c8362bda20
Proposed branch: ~binli/checkbox-support/+git/checkbox-support:dmic-support
Merge into: checkbox-support:master
Diff against target: 929 lines (+827/-5)
7 files modified
checkbox_support/parsers/pactl.py (+2/-2)
checkbox_support/parsers/tests/pactl_data/cards-desktop-bionic-x13.txt (+41/-0)
checkbox_support/parsers/tests/pactl_data/desktop-bionic-x13.txt (+685/-0)
checkbox_support/parsers/tests/pactl_data/sinks-desktop-bionic-x13.txt (+50/-0)
checkbox_support/parsers/tests/test_pactl.py (+32/-1)
checkbox_support/scripts/audio_settings.py (+2/-2)
checkbox_support/scripts/tests/test_audio_settings.py (+15/-0)
Reviewer Review Type Date Requested Status
Sylvain Pineau (community) Approve
Jonathan Cave Pending
Checkbox Developers Pending
Review via email: mp+383049@code.launchpad.net

Commit message

* Let port-name support the blank space. (LP: #1875526)
* The name of port-label changed, so the way to detect HDMI/DP should be changed. (LP: #1875526)

To post a comment you must log in.
Revision history for this message
Sylvain Pineau (sylvain-pineau) wrote :

Thanks a lot for the fix, this pactl parser is a pain to maintain across releases.

Could you attach to the test collection the `pactl list` output here:

https://git.launchpad.net/checkbox-support/tree/checkbox_support/parsers/tests/pactl_data

and write a unit test for this dmic:

https://git.launchpad.net/checkbox-support/tree/checkbox_support/parsers/tests/test_pactl.py

setup.py test should also tell you if the proposed fix does not add a regression to the older behaviors.

review: Needs Fixing
Revision history for this message
Bin Li (binli) wrote :
Download full text (3.4 KiB)

@Sylvain,

 Thanks for your feedback. And I try to run 'setup.py test' in the master branch, it also failed in several testcases. I just pasted part of result.

======================================================================
FAIL: test_SPDIF_in_port_label (checkbox_support.parsers.tests.test_pactl.AttributeTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/work/source/gits/checkbox-dev/checkbox-support/checkbox_support/parsers/tests/test_pactl.py", line 522, in test_SPDIF_in_port_label
    self.assertEqual(attr.value[0].latency_offset, 0)
AssertionError: ([0], {}) != 0

====================================================================== FAIL: test_many_ports (checkbox_support.parsers.tests.test_pactl.AttributeTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/work/source/gits/checkbox-dev/checkbox-support/checkbox_support/parsers/tests/test_pactl.py", line 443, in test_many_ports
    self.assertEqual(attr.value[0].availability, '')
AssertionError: ([''], {}) != ''

======================================================================
FAIL: test_one_port (checkbox_support.parsers.tests.test_pactl.AttributeTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/work/source/gits/checkbox-dev/checkbox-support/checkbox_support/parsers/tests/test_pactl.py", line 421, in test_one_port
    self.assertEq...

Read more...

Revision history for this message
Bin Li (binli) wrote :

Ran 178 tests in 19.883s

FAILED (failures=10)
Test failed: <unittest.runner.TextTestResult run=178 errors=0 failures=10>
error: Test failed: <unittest.runner.TextTestResult run=178 errors=0 failures=10>

> @Sylvain,
>
> Thanks for your feedback. And I try to run 'setup.py test' in the master
> branch, it also failed in several testcases. I just pasted part of result.
>
> ======================================================================
> FAIL: test_SPDIF_in_port_label
> (checkbox_support.parsers.tests.test_pactl.AttributeTests)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
> File "/work/source/gits/checkbox-dev/checkbox-
> support/checkbox_support/parsers/tests/test_pactl.py", line 522, in
> test_SPDIF_in_port_label
> self.assertEqual(attr.value[0].latency_offset, 0)
> AssertionError: ([0], {}) != 0
>
> ======================================================================
> FAIL: test_many_ports
> (checkbox_support.parsers.tests.test_pactl.AttributeTests)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
> File "/work/source/gits/checkbox-dev/checkbox-
> support/checkbox_support/parsers/tests/test_pactl.py", line 443, in
> test_many_ports
> self.assertEqual(attr.value[0].availability, '')
> AssertionError: ([''], {}) != ''
>
> ======================================================================
> FAIL: test_one_port (checkbox_support.parsers.tests.test_pactl.AttributeTests)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
> File "/work/source/gits/checkbox-dev/checkbox-
> support/checkbox_support/parsers/tests/test_pactl.py", line 421, in
> test_one_port
> self.assertEqual(attr.value[0].availability, 'available')
> AssertionError: (['available'], {}) != 'available'

Revision history for this message
Sylvain Pineau (sylvain-pineau) wrote :

Please use the 2.x version of pyparsing to run the tests, as pip will download the 3.x alpha:

sudo apt install python3-pyparsing

Revision history for this message
Bin Li (binli) wrote :

Thanks, it works fine now.

----------------------------------------------------------------------
Ran 178 tests in 18.711s

OK

Revision history for this message
Bin Li (binli) wrote :

@Sylvain,

 Please help review again, thanks!

Revision history for this message
Sylvain Pineau (sylvain-pineau) wrote :

It was not an easy fix, this pactl parser is one of the worst module to maintain across releases.
Thanks a lot.

review: Approve
Revision history for this message
Bin Li (binli) wrote :

Thanks a lot!

And I also learned a very excellent example to parse files from this project. :)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/checkbox_support/parsers/pactl.py b/checkbox_support/parsers/pactl.py
index 8bc67c2..741f59b 100644
--- a/checkbox_support/parsers/pactl.py
+++ b/checkbox_support/parsers/pactl.py
@@ -226,7 +226,7 @@ class Port(Node):
226 __syntax__ = (226 __syntax__ = (
227 p.Optional('[Out] ').suppress()227 p.Optional('[Out] ').suppress()
228 + p.Optional('[In] ').suppress()228 + p.Optional('[In] ').suppress()
229 + p.Word(p.alphanums + "-;").setResultsName('port-name')229 + p.Word(p.alphanums + " -;").setResultsName('port-name')
230 + p.Suppress(':')230 + p.Suppress(':')
231 # This part was very tricky to write. The label is basically231 # This part was very tricky to write. The label is basically
232 # arbitrary localized Unicode text. We want to grab all of it in232 # arbitrary localized Unicode text. We want to grab all of it in
@@ -291,7 +291,7 @@ class PortWithProfile(Node):
291 __syntax__ = (291 __syntax__ = (
292 p.Optional('[Out] ').suppress()292 p.Optional('[Out] ').suppress()
293 + p.Optional('[In] ').suppress()293 + p.Optional('[In] ').suppress()
294 + p.Word(p.alphanums + "-;").setResultsName('port-name')294 + p.Word(p.alphanums + " -;").setResultsName('port-name')
295 + p.Suppress(':')295 + p.Suppress(':')
296 # This part was very tricky to write. The label is basically arbitrary296 # This part was very tricky to write. The label is basically arbitrary
297 # localized Unicode text. We want to grab all of it in one go but297 # localized Unicode text. We want to grab all of it in one go but
diff --git a/checkbox_support/parsers/tests/pactl_data/cards-desktop-bionic-x13.txt b/checkbox_support/parsers/tests/pactl_data/cards-desktop-bionic-x13.txt
298new file mode 100644298new file mode 100644
index 0000000..0236145
--- /dev/null
+++ b/checkbox_support/parsers/tests/pactl_data/cards-desktop-bionic-x13.txt
@@ -0,0 +1,41 @@
1Card #0
2 Name: alsa_card.pci-0000_00_1f.3-platform-skl_hda_dsp_generic
3 Driver: module-alsa-card.c
4 Owner Module: 7
5 Properties:
6 alsa.card = "0"
7 alsa.card_name = "sof-skl_hda_card"
8 alsa.long_card_name = "LENOVO-20T2SIT004-ThinkPadX13Gen1-20T2SIT004"
9 alsa.driver_name = "snd_soc_skl_hda_dsp"
10 device.bus_path = "pci-0000:00:1f.3-platform-skl_hda_dsp_generic"
11 sysfs.path = "/devices/pci0000:00/0000:00:1f.3/skl_hda_dsp_generic/sound/card0"
12 device.bus = "pci"
13 device.vendor.id = "8086"
14 device.vendor.name = "Intel Corporation"
15 device.product.id = "02c8"
16 device.string = "0"
17 device.description = "sof-skl_hda_card"
18 module-udev-detect.discovered = "1"
19 device.icon_name = "audio-card-pci"
20 Profiles:
21 Hdmi3: Play to Hdmi3 (sinks: 1, sources: 2, priority: 1000, available: yes)
22 Hdmi2: Play to Hdmi2 (sinks: 1, sources: 2, priority: 1000, available: yes)
23 Hdmi1: Play to Hdmi1 (sinks: 1, sources: 2, priority: 1000, available: yes)
24 HiFi: Play HiFi Music (sinks: 1, sources: 2, priority: 8000, available: yes)
25 off: Off (sinks: 0, sources: 0, priority: 0, available: yes)
26 Active Profile: Hdmi2
27 Ports:
28 [Out] HDMI3: HDMI3/DP3 Output (priority: 500, latency offset: 0 usec, not available)
29 Part of profile(s): Hdmi3
30 [In] Dmic: Digital Microphone (priority: 100, latency offset: 0 usec)
31 Part of profile(s): Hdmi3, Hdmi2, Hdmi1, HiFi
32 [In] Headset Microphone: Headset Microphone (priority: 100, latency offset: 0 usec, not available)
33 Part of profile(s): Hdmi3, Hdmi2, Hdmi1, HiFi
34 [Out] HDMI2: HDMI2/DP2 Output (priority: 400, latency offset: 0 usec, available)
35 Part of profile(s): Hdmi2
36 [Out] HDMI1: HDMI1/DP1 Output (priority: 300, latency offset: 0 usec, not available)
37 Part of profile(s): Hdmi1
38 [Out] Headphone: Headphone (priority: 200, latency offset: 0 usec, not available)
39 Part of profile(s): HiFi
40 [Out] Speaker: Speaker (priority: 100, latency offset: 0 usec)
41 Part of profile(s): HiFi
diff --git a/checkbox_support/parsers/tests/pactl_data/desktop-bionic-x13.txt b/checkbox_support/parsers/tests/pactl_data/desktop-bionic-x13.txt
0new file mode 10064442new file mode 100644
index 0000000..78e8b95
--- /dev/null
+++ b/checkbox_support/parsers/tests/pactl_data/desktop-bionic-x13.txt
@@ -0,0 +1,685 @@
1Module #0
2 Name: module-device-restore
3 Argument:
4 Usage counter: n/a
5 Properties:
6 module.author = "Lennart Poettering"
7 module.description = "Automatically restore the volume/mute state of devices"
8 module.version = "11.1"
9
10Module #1
11 Name: module-stream-restore
12 Argument:
13 Usage counter: n/a
14 Properties:
15 module.author = "Lennart Poettering"
16 module.description = "Automatically restore the volume/mute/device state of streams"
17 module.version = "11.1"
18
19Module #2
20 Name: module-card-restore
21 Argument:
22 Usage counter: n/a
23 Properties:
24 module.author = "Lennart Poettering"
25 module.description = "Automatically restore profile of cards"
26 module.version = "11.1"
27
28Module #3
29 Name: module-augment-properties
30 Argument:
31 Usage counter: n/a
32 Properties:
33 module.author = "Lennart Poettering"
34 module.description = "Augment the property sets of streams with additional static information"
35 module.version = "11.1"
36
37Module #4
38 Name: module-switch-on-port-available
39 Argument:
40 Usage counter: n/a
41 Properties:
42
43
44Module #5
45 Name: module-switch-on-connect
46 Argument:
47 Usage counter: n/a
48 Properties:
49 module.author = "Michael Terry"
50 module.description = "When a sink/source is added, switch to it or conditionally switch to it"
51 module.version = "11.1"
52
53Module #6
54 Name: module-udev-detect
55 Argument:
56 Usage counter: n/a
57 Properties:
58 module.author = "Lennart Poettering"
59 module.description = "Detect available audio hardware and load matching drivers"
60 module.version = "11.1"
61
62Module #7
63 Name: module-alsa-card
64 Argument: device_id="0" name="pci-0000_00_1f.3-platform-skl_hda_dsp_generic" card_name="alsa_card.pci-0000_00_1f.3-platform-skl_hda_dsp_generic" namereg_fail=false tsched=yes fixed_latency_range=no ignore_dB=no deferred_volume=yes use_ucm=yes card_properties="module-udev-detect.discovered=1"
65 Usage counter: 0
66 Properties:
67 module.author = "Lennart Poettering"
68 module.description = "ALSA Card"
69 module.version = "11.1"
70
71Module #8
72 Name: module-bluetooth-policy
73 Argument:
74 Usage counter: n/a
75 Properties:
76 module.author = "Frédéric Dalleau, Pali Rohár"
77 module.description = "Policy module to make using bluetooth devices out-of-the-box easier"
78 module.version = "11.1"
79
80Module #9
81 Name: module-bluetooth-discover
82 Argument:
83 Usage counter: n/a
84 Properties:
85 module.author = "João Paulo Rechi Vita"
86 module.description = "Detect available Bluetooth daemon and load the corresponding discovery module"
87 module.version = "11.1"
88
89Module #10
90 Name: module-bluez5-discover
91 Argument:
92 Usage counter: n/a
93 Properties:
94 module.author = "João Paulo Rechi Vita"
95 module.description = "Detect available BlueZ 5 Bluetooth audio devices and load BlueZ 5 Bluetooth audio drivers"
96 module.version = "11.1"
97
98Module #11
99 Name: module-native-protocol-unix
100 Argument:
101 Usage counter: n/a
102 Properties:
103 module.author = "Lennart Poettering"
104 module.description = "Native protocol (UNIX sockets)"
105 module.version = "11.1"
106
107Module #12
108 Name: module-default-device-restore
109 Argument:
110 Usage counter: n/a
111 Properties:
112 module.author = "Lennart Poettering"
113 module.description = "Automatically restore the default sink and source"
114 module.version = "11.1"
115
116Module #13
117 Name: module-rescue-streams
118 Argument:
119 Usage counter: n/a
120 Properties:
121 module.author = "Lennart Poettering"
122 module.description = "When a sink/source is removed, try to move its streams to the default sink/source"
123 module.version = "11.1"
124
125Module #14
126 Name: module-always-sink
127 Argument:
128 Usage counter: n/a
129 Properties:
130 module.author = "Colin Guthrie"
131 module.description = "Always keeps at least one sink loaded even if it's a null one"
132 module.version = "11.1"
133
134Module #15
135 Name: module-intended-roles
136 Argument:
137 Usage counter: n/a
138 Properties:
139 module.author = "Lennart Poettering"
140 module.description = "Automatically set device of streams based on intended roles of devices"
141 module.version = "11.1"
142
143Module #16
144 Name: module-suspend-on-idle
145 Argument:
146 Usage counter: n/a
147 Properties:
148 module.author = "Lennart Poettering"
149 module.description = "When a sink/source is idle for too long, suspend it"
150 module.version = "11.1"
151
152Module #17
153 Name: module-console-kit
154 Argument:
155 Usage counter: n/a
156 Properties:
157 module.author = "Lennart Poettering"
158 module.description = "Create a client for each ConsoleKit session of this user"
159 module.version = "11.1"
160
161Module #18
162 Name: module-systemd-login
163 Argument:
164 Usage counter: n/a
165 Properties:
166 module.author = "Lennart Poettering"
167 module.description = "Create a client for each login session of this user"
168 module.version = "11.1"
169
170Module #19
171 Name: module-position-event-sounds
172 Argument:
173 Usage counter: n/a
174 Properties:
175 module.author = "Lennart Poettering"
176 module.description = "Position event sounds between L and R depending on the position on screen of the widget triggering them."
177 module.version = "11.1"
178
179Module #20
180 Name: module-role-cork
181 Argument:
182 Usage counter: n/a
183 Properties:
184 module.author = "Lennart Poettering"
185 module.description = "Mute & cork streams with certain roles while others exist"
186 module.version = "11.1"
187
188Module #21
189 Name: module-snap-policy
190 Argument:
191 Usage counter: n/a
192 Properties:
193 module.author = "Canonical Ltd"
194 module.description = "Ubuntu Snap policy management"
195 module.version = "11.1"
196
197Module #22
198 Name: module-filter-heuristics
199 Argument:
200 Usage counter: n/a
201 Properties:
202 module.author = "Colin Guthrie"
203 module.description = "Detect when various filters are desirable"
204 module.version = "11.1"
205
206Module #23
207 Name: module-filter-apply
208 Argument:
209 Usage counter: n/a
210 Properties:
211 module.author = "Colin Guthrie"
212 module.description = "Load filter sinks automatically when needed"
213 module.version = "11.1"
214
215Module #24
216 Name: module-x11-publish
217 Argument: display=:0
218 Usage counter: n/a
219 Properties:
220 module.author = "Lennart Poettering"
221 module.description = "X11 credential publisher"
222 module.version = "11.1"
223
224Module #25
225 Name: module-x11-bell
226 Argument: display=:0 sample=bell.ogg
227 Usage counter: n/a
228 Properties:
229 module.author = "Lennart Poettering"
230 module.description = "X11 bell interceptor"
231 module.version = "11.1"
232
233Module #26
234 Name: module-x11-cork-request
235 Argument: display=:0
236 Usage counter: n/a
237 Properties:
238 module.author = "Lennart Poettering"
239 module.description = "Synthesize X11 media key events when cork/uncork is requested"
240 module.version = "11.1"
241
242Module #27
243 Name: module-x11-xsmp
244 Argument: display=:0 session_manager=local/u-ThinkPad-X13-Gen-1:@/tmp/.ICE-unix/2045,unix/u-ThinkPad-X13-Gen-1:/tmp/.ICE-unix/2045
245 Usage counter: n/a
246 Properties:
247 module.author = "Lennart Poettering"
248 module.description = "X11 session management"
249 module.version = "11.1"
250
251Sink #42
252 State: SUSPENDED
253 Name: alsa_output.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.Hdmi2__hw_sofsklhdacard_4__sink
254 Description: sof-skl_hda_card HDMI2/DP2 Output
255 Driver: module-alsa-card.c
256 Sample Specification: s16le 2ch 48000Hz
257 Channel Map: front-left,front-right
258 Owner Module: 7
259 Mute: no
260 Volume: front-left: 65536 / 100% / 0.00 dB, front-right: 65536 / 100% / 0.00 dB
261 balance 0.00
262 Base Volume: 65536 / 100% / 0.00 dB
263 Monitor Source: alsa_output.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.Hdmi2__hw_sofsklhdacard_4__sink.monitor
264 Latency: 0 usec, configured 0 usec
265 Flags: HARDWARE DECIBEL_VOLUME LATENCY
266 Properties:
267 alsa.resolution_bits = "16"
268 device.api = "alsa"
269 device.class = "sound"
270 alsa.class = "generic"
271 alsa.subclass = "generic-mix"
272 alsa.name = ""
273 alsa.id = "HDMI2 (*)"
274 alsa.subdevice = "0"
275 alsa.subdevice_name = "subdevice #0"
276 alsa.device = "4"
277 alsa.card = "0"
278 alsa.card_name = "sof-skl_hda_card"
279 alsa.long_card_name = "LENOVO-20T2SIT004-ThinkPadX13Gen1-20T2SIT004"
280 alsa.driver_name = "snd_soc_skl_hda_dsp"
281 device.bus_path = "pci-0000:00:1f.3-platform-skl_hda_dsp_generic"
282 sysfs.path = "/devices/pci0000:00/0000:00:1f.3/skl_hda_dsp_generic/sound/card0"
283 device.bus = "pci"
284 device.vendor.id = "8086"
285 device.vendor.name = "Intel Corporation"
286 device.product.id = "02c8"
287 device.string = "hw:sofsklhdacard,4"
288 device.buffering.buffer_size = "65472"
289 device.buffering.fragment_size = "16320"
290 device.access_mode = "mmap+timer"
291 device.profile.name = "Hdmi2: hw:sofsklhdacard,4: sink"
292 device.profile.description = "HDMI2/DP2 Output"
293 device.description = "sof-skl_hda_card HDMI2/DP2 Output"
294 module-udev-detect.discovered = "1"
295 device.icon_name = "audio-card-pci"
296 Ports:
297 [Out] HDMI2: HDMI2/DP2 Output (priority: 400, available)
298 Active Port: [Out] HDMI2
299 Formats:
300 pcm
301
302Source #84
303 State: SUSPENDED
304 Name: alsa_output.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.Hdmi2__hw_sofsklhdacard_4__sink.monitor
305 Description: Monitor of sof-skl_hda_card HDMI2/DP2 Output
306 Driver: module-alsa-card.c
307 Sample Specification: s16le 2ch 48000Hz
308 Channel Map: front-left,front-right
309 Owner Module: 7
310 Mute: no
311 Volume: front-left: 65536 / 100% / 0.00 dB, front-right: 65536 / 100% / 0.00 dB
312 balance 0.00
313 Base Volume: 65536 / 100% / 0.00 dB
314 Monitor of Sink: alsa_output.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.Hdmi2__hw_sofsklhdacard_4__sink
315 Latency: 0 usec, configured 0 usec
316 Flags: DECIBEL_VOLUME LATENCY
317 Properties:
318 device.description = "Monitor of sof-skl_hda_card HDMI2/DP2 Output"
319 device.class = "monitor"
320 alsa.card = "0"
321 alsa.card_name = "sof-skl_hda_card"
322 alsa.long_card_name = "LENOVO-20T2SIT004-ThinkPadX13Gen1-20T2SIT004"
323 alsa.driver_name = "snd_soc_skl_hda_dsp"
324 device.bus_path = "pci-0000:00:1f.3-platform-skl_hda_dsp_generic"
325 sysfs.path = "/devices/pci0000:00/0000:00:1f.3/skl_hda_dsp_generic/sound/card0"
326 device.bus = "pci"
327 device.vendor.id = "8086"
328 device.vendor.name = "Intel Corporation"
329 device.product.id = "02c8"
330 device.string = "0"
331 module-udev-detect.discovered = "1"
332 device.icon_name = "audio-card-pci"
333 Formats:
334 pcm
335
336Source #85
337 State: SUSPENDED
338 Name: alsa_input.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.Hdmi2__hw_sofsklhdacard_6__source
339 Description: sof-skl_hda_card Digital Microphone
340 Driver: module-alsa-card.c
341 Sample Specification: s16le 2ch 48000Hz
342 Channel Map: front-left,front-right
343 Owner Module: 7
344 Mute: no
345 Volume: front-left: 65536 / 100% / 0.00 dB, front-right: 65536 / 100% / 0.00 dB
346 balance 0.00
347 Base Volume: 65536 / 100% / 0.00 dB
348 Monitor of Sink: n/a
349 Latency: 0 usec, configured 0 usec
350 Flags: HARDWARE DECIBEL_VOLUME LATENCY
351 Properties:
352 alsa.resolution_bits = "16"
353 device.api = "alsa"
354 device.class = "sound"
355 alsa.class = "generic"
356 alsa.subclass = "generic-mix"
357 alsa.name = ""
358 alsa.id = "DMIC32 (*)"
359 alsa.subdevice = "0"
360 alsa.subdevice_name = "subdevice #0"
361 alsa.device = "6"
362 alsa.card = "0"
363 alsa.card_name = "sof-skl_hda_card"
364 alsa.long_card_name = "LENOVO-20T2SIT004-ThinkPadX13Gen1-20T2SIT004"
365 alsa.driver_name = "snd_soc_skl_hda_dsp"
366 device.bus_path = "pci-0000:00:1f.3-platform-skl_hda_dsp_generic"
367 sysfs.path = "/devices/pci0000:00/0000:00:1f.3/skl_hda_dsp_generic/sound/card0"
368 device.bus = "pci"
369 device.vendor.id = "8086"
370 device.vendor.name = "Intel Corporation"
371 device.product.id = "02c8"
372 device.string = "hw:sofsklhdacard,6"
373 device.buffering.buffer_size = "65472"
374 device.buffering.fragment_size = "16320"
375 device.access_mode = "mmap+timer"
376 device.profile.name = "Hdmi2: hw:sofsklhdacard,6: source"
377 device.profile.description = "Digital Microphone"
378 device.description = "sof-skl_hda_card Digital Microphone"
379 module-udev-detect.discovered = "1"
380 device.icon_name = "audio-card-pci"
381 Ports:
382 [In] Dmic: Digital Microphone (priority: 100)
383 Active Port: [In] Dmic
384 Formats:
385 pcm
386
387Source #86
388 State: SUSPENDED
389 Name: alsa_input.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.Hdmi2__hw_sofsklhdacard_0__source
390 Description: sof-skl_hda_card Headset Microphone
391 Driver: module-alsa-card.c
392 Sample Specification: s16le 2ch 48000Hz
393 Channel Map: front-left,front-right
394 Owner Module: 7
395 Mute: no
396 Volume: front-left: 65536 / 100% / 0.00 dB, front-right: 65536 / 100% / 0.00 dB
397 balance 0.00
398 Base Volume: 65536 / 100% / 0.00 dB
399 Monitor of Sink: n/a
400 Latency: 0 usec, configured 0 usec
401 Flags: HARDWARE DECIBEL_VOLUME LATENCY
402 Properties:
403 alsa.resolution_bits = "16"
404 device.api = "alsa"
405 device.class = "sound"
406 alsa.class = "generic"
407 alsa.subclass = "generic-mix"
408 alsa.name = ""
409 alsa.id = "HDA Analog (*)"
410 alsa.subdevice = "0"
411 alsa.subdevice_name = "subdevice #0"
412 alsa.device = "0"
413 alsa.card = "0"
414 alsa.card_name = "sof-skl_hda_card"
415 alsa.long_card_name = "LENOVO-20T2SIT004-ThinkPadX13Gen1-20T2SIT004"
416 alsa.driver_name = "snd_soc_skl_hda_dsp"
417 device.bus_path = "pci-0000:00:1f.3-platform-skl_hda_dsp_generic"
418 sysfs.path = "/devices/pci0000:00/0000:00:1f.3/skl_hda_dsp_generic/sound/card0"
419 device.bus = "pci"
420 device.vendor.id = "8086"
421 device.vendor.name = "Intel Corporation"
422 device.product.id = "02c8"
423 device.string = "hw:sofsklhdacard,0"
424 device.buffering.buffer_size = "65472"
425 device.buffering.fragment_size = "16320"
426 device.access_mode = "mmap+timer"
427 device.profile.name = "Hdmi2: hw:sofsklhdacard,0: source"
428 device.profile.description = "Headset Microphone"
429 device.description = "sof-skl_hda_card Headset Microphone"
430 module-udev-detect.discovered = "1"
431 device.icon_name = "audio-card-pci"
432 Ports:
433 [In] Headset Microphone: Headset Microphone (priority: 100, not available)
434 Active Port: [In] Headset Microphone
435 Formats:
436 pcm
437
438Client #0
439 Driver: module-systemd-login.c
440 Owner Module: 18
441 Properties:
442 application.name = "Login Session 2"
443 systemd-login.session = "2"
444
445Client #1
446 Driver: protocol-native.c
447 Owner Module: 11
448 Properties:
449 application.name = "GNOME Shell"
450 native-protocol.peer = "UNIX socket client"
451 native-protocol.version = "32"
452 application.id = "org.gnome.Shell"
453 application.icon_name = "start-here"
454 application.language = "en_US.UTF-8"
455 window.x11.screen = "0"
456 window.x11.display = ":0"
457 application.process.id = "2184"
458 application.process.user = "u"
459 application.process.host = "u-ThinkPad-X13-Gen-1"
460 application.process.binary = "gnome-shell"
461 application.process.machine_id = "d565935cdbf64125b679eb560a79c787"
462 application.process.session_id = "2"
463
464Client #2
465 Driver: protocol-native.c
466 Owner Module: 11
467 Properties:
468 application.name = "GNOME Shell Volume Control"
469 native-protocol.peer = "UNIX socket client"
470 native-protocol.version = "32"
471 application.id = "org.gnome.VolumeControl"
472 application.icon_name = "multimedia-volume-control"
473 application.version = "3.28.4"
474 application.process.id = "2184"
475 application.process.user = "u"
476 application.process.host = "u-ThinkPad-X13-Gen-1"
477 application.process.binary = "gnome-shell"
478 application.language = "en_US.UTF-8"
479 window.x11.display = ":0"
480 application.process.machine_id = "d565935cdbf64125b679eb560a79c787"
481 application.process.session_id = "2"
482
483Client #8
484 Driver: module-x11-xsmp.c
485 Owner Module: 27
486 Properties:
487 application.name = "XSMP Session on gnome-session as 102c5c5ae2e20bde3b158804149680521100000020450059"
488 xsmp.vendor = "gnome-session"
489 xsmp.client.id = "102c5c5ae2e20bde3b158804149680521100000020450059"
490
491Client #9
492 Driver: protocol-native.c
493 Owner Module: 11
494 Properties:
495 application.name = "GNOME Volume Control Media Keys"
496 native-protocol.peer = "UNIX socket client"
497 native-protocol.version = "32"
498 application.id = "org.gnome.VolumeControl"
499 application.icon_name = "multimedia-volume-control"
500 application.version = ""
501 application.process.id = "2544"
502 application.process.user = "u"
503 application.process.host = "u-ThinkPad-X13-Gen-1"
504 application.process.binary = "gsd-media-keys"
505 application.language = "en_US.UTF-8"
506 window.x11.display = ":0"
507 application.process.machine_id = "d565935cdbf64125b679eb560a79c787"
508 application.process.session_id = "2"
509
510Client #71
511 Driver: protocol-native.c
512 Owner Module: 11
513 Properties:
514 application.name = "gsd-power"
515 native-protocol.peer = "UNIX socket client"
516 native-protocol.version = "32"
517 window.x11.display = ":0"
518 window.x11.screen = "0"
519 application.process.id = "2488"
520 application.process.user = "u"
521 application.process.host = "u-ThinkPad-X13-Gen-1"
522 application.process.binary = "gsd-power"
523 application.language = "en_US.UTF-8"
524 application.process.machine_id = "d565935cdbf64125b679eb560a79c787"
525 application.process.session_id = "2"
526
527Client #352
528 Driver: protocol-native.c
529 Owner Module: 11
530 Properties:
531 application.name = "gsd-media-keys"
532 native-protocol.peer = "UNIX socket client"
533 native-protocol.version = "32"
534 window.x11.display = ":0"
535 window.x11.screen = "0"
536 application.process.id = "2544"
537 application.process.user = "u"
538 application.process.host = "u-ThinkPad-X13-Gen-1"
539 application.process.binary = "gsd-media-keys"
540 application.language = "en_US.UTF-8"
541 application.process.machine_id = "d565935cdbf64125b679eb560a79c787"
542 application.process.session_id = "2"
543
544Client #578
545 Driver: protocol-native.c
546 Owner Module: 11
547 Properties:
548 application.name = "pactl"
549 native-protocol.peer = "UNIX socket client"
550 native-protocol.version = "32"
551 application.process.id = "8383"
552 application.process.user = "u"
553 application.process.host = "u-ThinkPad-X13-Gen-1"
554 application.process.binary = "pactl"
555 application.language = "en_US.UTF-8"
556 window.x11.display = ":0"
557 application.process.machine_id = "d565935cdbf64125b679eb560a79c787"
558 application.process.session_id = "2"
559
560Sample #0
561 Name: bell.ogg
562 Sample Specification: float32le 1ch 44100Hz
563 Channel Map: mono
564 Volume: (invalid)
565 balance 0.00
566 Duration: 0.2s
567 Size: 34.5 KiB
568 Lazy: no
569 Filename: n/a
570 Properties:
571 media.role = "event"
572 media.name = "bell.ogg"
573 application.name = "pactl"
574 native-protocol.peer = "UNIX socket client"
575 native-protocol.version = "32"
576 application.process.id = "2528"
577 application.process.user = "u"
578 application.process.host = "u-ThinkPad-X13-Gen-1"
579 application.process.binary = "pactl"
580 application.language = "en_US.UTF-8"
581 window.x11.display = ":0"
582 application.process.machine_id = "d565935cdbf64125b679eb560a79c787"
583 application.process.session_id = "2"
584
585Sample #1
586 Name: bell-window-system
587 Sample Specification: s16le 1ch 44100Hz
588 Channel Map: mono
589 Volume: (invalid)
590 balance 0.00
591 Duration: 0.2s
592 Size: 17.2 KiB
593 Lazy: no
594 Filename: n/a
595 Properties:
596 media.role = "event"
597 application.process.id = "2709"
598 application.name = "gnome-terminal-server"
599 event.description = "Bell event"
600 event.id = "bell-window-system"
601 media.name = "bell-window-system"
602 media.filename = "/usr/share//sounds/ubuntu/stereo/bell.ogg"
603 native-protocol.peer = "UNIX socket client"
604 native-protocol.version = "32"
605 application.id = "org.gnome.Shell"
606 application.icon_name = "start-here"
607 application.language = "en_US.UTF-8"
608 window.x11.screen = "0"
609 window.x11.display = ":0"
610 application.process.user = "u"
611 application.process.host = "u-ThinkPad-X13-Gen-1"
612 application.process.binary = "gnome-shell"
613 application.process.machine_id = "d565935cdbf64125b679eb560a79c787"
614 application.process.session_id = "2"
615
616Sample #2
617 Name: screen-capture
618 Sample Specification: s16le 2ch 96000Hz
619 Channel Map: front-left,front-right
620 Volume: (invalid)
621 balance 0.00
622 Duration: 0.9s
623 Size: 327.1 KiB
624 Lazy: no
625 Filename: n/a
626 Properties:
627 media.role = "event"
628 event.description = "Screenshot taken"
629 event.id = "screen-capture"
630 media.name = "screen-capture"
631 media.filename = "/usr/share//sounds/freedesktop/stereo/screen-capture.oga"
632 application.name = "gsd-media-keys"
633 native-protocol.peer = "UNIX socket client"
634 native-protocol.version = "32"
635 window.x11.display = ":0"
636 window.x11.screen = "0"
637 application.process.id = "2544"
638 application.process.user = "u"
639 application.process.host = "u-ThinkPad-X13-Gen-1"
640 application.process.binary = "gsd-media-keys"
641 application.language = "en_US.UTF-8"
642 application.process.machine_id = "d565935cdbf64125b679eb560a79c787"
643 application.process.session_id = "2"
644
645Card #0
646 Name: alsa_card.pci-0000_00_1f.3-platform-skl_hda_dsp_generic
647 Driver: module-alsa-card.c
648 Owner Module: 7
649 Properties:
650 alsa.card = "0"
651 alsa.card_name = "sof-skl_hda_card"
652 alsa.long_card_name = "LENOVO-20T2SIT004-ThinkPadX13Gen1-20T2SIT004"
653 alsa.driver_name = "snd_soc_skl_hda_dsp"
654 device.bus_path = "pci-0000:00:1f.3-platform-skl_hda_dsp_generic"
655 sysfs.path = "/devices/pci0000:00/0000:00:1f.3/skl_hda_dsp_generic/sound/card0"
656 device.bus = "pci"
657 device.vendor.id = "8086"
658 device.vendor.name = "Intel Corporation"
659 device.product.id = "02c8"
660 device.string = "0"
661 device.description = "sof-skl_hda_card"
662 module-udev-detect.discovered = "1"
663 device.icon_name = "audio-card-pci"
664 Profiles:
665 Hdmi3: Play to Hdmi3 (sinks: 1, sources: 2, priority: 1000, available: yes)
666 Hdmi2: Play to Hdmi2 (sinks: 1, sources: 2, priority: 1000, available: yes)
667 Hdmi1: Play to Hdmi1 (sinks: 1, sources: 2, priority: 1000, available: yes)
668 HiFi: Play HiFi Music (sinks: 1, sources: 2, priority: 8000, available: yes)
669 off: Off (sinks: 0, sources: 0, priority: 0, available: yes)
670 Active Profile: Hdmi2
671 Ports:
672 [Out] HDMI3: HDMI3/DP3 Output (priority: 500, latency offset: 0 usec, not available)
673 Part of profile(s): Hdmi3
674 [In] Dmic: Digital Microphone (priority: 100, latency offset: 0 usec)
675 Part of profile(s): Hdmi3, Hdmi2, Hdmi1, HiFi
676 [In] Headset Microphone: Headset Microphone (priority: 100, latency offset: 0 usec, not available)
677 Part of profile(s): Hdmi3, Hdmi2, Hdmi1, HiFi
678 [Out] HDMI2: HDMI2/DP2 Output (priority: 400, latency offset: 0 usec, available)
679 Part of profile(s): Hdmi2
680 [Out] HDMI1: HDMI1/DP1 Output (priority: 300, latency offset: 0 usec, not available)
681 Part of profile(s): Hdmi1
682 [Out] Headphone: Headphone (priority: 200, latency offset: 0 usec, not available)
683 Part of profile(s): HiFi
684 [Out] Speaker: Speaker (priority: 100, latency offset: 0 usec)
685 Part of profile(s): HiFi
diff --git a/checkbox_support/parsers/tests/pactl_data/sinks-desktop-bionic-x13.txt b/checkbox_support/parsers/tests/pactl_data/sinks-desktop-bionic-x13.txt
0new file mode 100644686new file mode 100644
index 0000000..5c90e9e
--- /dev/null
+++ b/checkbox_support/parsers/tests/pactl_data/sinks-desktop-bionic-x13.txt
@@ -0,0 +1,50 @@
1Sink #42
2 State: SUSPENDED
3 Name: alsa_output.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.Hdmi2__hw_sofsklhdacard_4__sink
4 Description: sof-skl_hda_card HDMI2/DP2 Output
5 Driver: module-alsa-card.c
6 Sample Specification: s16le 2ch 48000Hz
7 Channel Map: front-left,front-right
8 Owner Module: 7
9 Mute: no
10 Volume: front-left: 65536 / 100% / 0.00 dB, front-right: 65536 / 100% / 0.00 dB
11 balance 0.00
12 Base Volume: 65536 / 100% / 0.00 dB
13 Monitor Source: alsa_output.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.Hdmi2__hw_sofsklhdacard_4__sink.monitor
14 Latency: 0 usec, configured 0 usec
15 Flags: HARDWARE DECIBEL_VOLUME LATENCY
16 Properties:
17 alsa.resolution_bits = "16"
18 device.api = "alsa"
19 device.class = "sound"
20 alsa.class = "generic"
21 alsa.subclass = "generic-mix"
22 alsa.name = ""
23 alsa.id = "HDMI2 (*)"
24 alsa.subdevice = "0"
25 alsa.subdevice_name = "subdevice #0"
26 alsa.device = "4"
27 alsa.card = "0"
28 alsa.card_name = "sof-skl_hda_card"
29 alsa.long_card_name = "LENOVO-20T2SIT004-ThinkPadX13Gen1-20T2SIT004"
30 alsa.driver_name = "snd_soc_skl_hda_dsp"
31 device.bus_path = "pci-0000:00:1f.3-platform-skl_hda_dsp_generic"
32 sysfs.path = "/devices/pci0000:00/0000:00:1f.3/skl_hda_dsp_generic/sound/card0"
33 device.bus = "pci"
34 device.vendor.id = "8086"
35 device.vendor.name = "Intel Corporation"
36 device.product.id = "02c8"
37 device.string = "hw:sofsklhdacard,4"
38 device.buffering.buffer_size = "65472"
39 device.buffering.fragment_size = "16320"
40 device.access_mode = "mmap+timer"
41 device.profile.name = "Hdmi2: hw:sofsklhdacard,4: sink"
42 device.profile.description = "HDMI2/DP2 Output"
43 device.description = "sof-skl_hda_card HDMI2/DP2 Output"
44 module-udev-detect.discovered = "1"
45 device.icon_name = "audio-card-pci"
46 Ports:
47 [Out] HDMI2: HDMI2/DP2 Output (priority: 400, available)
48 Active Port: [Out] HDMI2
49 Formats:
50 pcm
diff --git a/checkbox_support/parsers/tests/test_pactl.py b/checkbox_support/parsers/tests/test_pactl.py
index 31f9071..876d3d9 100644
--- a/checkbox_support/parsers/tests/test_pactl.py
+++ b/checkbox_support/parsers/tests/test_pactl.py
@@ -157,7 +157,6 @@ class PropertyTests(ParsingTestCase):
157 self.assertEqual(prop.name, 'module-udev-detect.discovered')157 self.assertEqual(prop.name, 'module-udev-detect.discovered')
158 self.assertEqual(prop.value, '1')158 self.assertEqual(prop.value, '1')
159159
160
161class PortTests(ParsingTestCase):160class PortTests(ParsingTestCase):
162161
163 def test_port(self):162 def test_port(self):
@@ -192,6 +191,17 @@ class PortTests(ParsingTestCase):
192 self.assertEqual(port.priority, 9900)191 self.assertEqual(port.priority, 9900)
193 self.assertEqual(port.availability, '')192 self.assertEqual(port.availability, '')
194193
194 def test_DMIC_port_with_blank_space(self):
195 port = self.assertParses(
196 pactl.Port.Syntax, (
197 '[In] Headset Microphone: Headset Microphone '
198 '(priority: 100, not available)')
199 )['port']
200 self.assertEqual(port.name, 'Headset Microphone')
201 self.assertEqual(port.label, 'Headset Microphone')
202 self.assertEqual(port.priority, 100)
203 self.assertEqual(port.availability, 'not available')
204
195 def test_chinese_label(self):205 def test_chinese_label(self):
196 port = self.assertParses(206 port = self.assertParses(
197 pactl.Port.Syntax, (207 pactl.Port.Syntax, (
@@ -580,6 +590,21 @@ class RecordTests(ParsingTestCase, PactlDataMixIn):
580 self.assertEqual(590 self.assertEqual(
581 record.attribute_map['Formats'].value, ['pcm'])591 record.attribute_map['Formats'].value, ['pcm'])
582592
593 def test_DMIC_sinks(self):
594 record = self.assertParses(
595 pactl.Record.Syntax, self.get_text("sinks-desktop-bionic-x13")
596 )['record']
597 self.assertEqual(record.name, "Sink #42")
598 self.assertEqual(record.attribute_list[0].name, "State")
599 self.assertIs(record.attribute_map['State'], record.attribute_list[0])
600 # Probe some random things
601 self.assertEqual(
602 record.attribute_map['Ports'].value[0].name, "HDMI2")
603 self.assertEqual(
604 record.attribute_map['Properties'].value[2].value, "sound")
605 self.assertEqual(
606 record.attribute_map['Formats'].value, ['pcm'])
607
583 def test_modules(self):608 def test_modules(self):
584 record = self.assertParses(609 record = self.assertParses(
585 pactl.Record.Syntax, self.get_text("modules-desktop-precise-0")610 pactl.Record.Syntax, self.get_text("modules-desktop-precise-0")
@@ -633,6 +658,12 @@ class DocumentTests(ParsingTestCase, PactlDataMixIn):
633 )[0]658 )[0]
634 self.assertEqual(len(document.record_list), 34)659 self.assertEqual(len(document.record_list), 34)
635660
661 def test_DMIC_pactl_list_cards_x13(self):
662 document = self.assertParses(
663 pactl.Document.Syntax, self.get_text("cards-desktop-bionic-x13")
664 )[0]
665 self.assertEqual(len(document.record_list), 1)
666
636 def test_pactl_list_clients_bionic(self):667 def test_pactl_list_clients_bionic(self):
637 document = self.assertParses(668 document = self.assertParses(
638 pactl.Document.Syntax, self.get_text("desktop-bionic-t480s")669 pactl.Document.Syntax, self.get_text("desktop-bionic-t480s")
diff --git a/checkbox_support/scripts/audio_settings.py b/checkbox_support/scripts/audio_settings.py
index f1ea9b7..f850e5a 100644
--- a/checkbox_support/scripts/audio_settings.py
+++ b/checkbox_support/scripts/audio_settings.py
@@ -74,7 +74,7 @@ def _guess_hdmi_profile(pactl_list):
74 card = re.sub('.*#', '', record.name) # save the card id74 card = re.sub('.*#', '', record.name) # save the card id
75 ports = [75 ports = [
76 p for p in record.attribute_map['Ports'].value76 p for p in record.attribute_map['Ports'].value
77 if 'HDMI / DisplayPort' in p.label]77 if ('HDMI' in p.label) and (('DisplayPort' in p.label) or ('DP' in p.label))]
78 if not ports:78 if not ports:
79 continue79 continue
80 if [p for p in ports if p.availability]:80 if [p for p in ports if p.availability]:
@@ -115,7 +115,7 @@ def _guess_hdmi_profile(pactl_list):
115 card, port = available_port.popitem()115 card, port = available_port.popitem()
116 # Keep the shortest string in the profile_list including 'stereo'116 # Keep the shortest string in the profile_list including 'stereo'
117 # it will avoid testing 'surround' profiles117 # it will avoid testing 'surround' profiles
118 profile = min([p for p in port.profile_list if 'stereo' in p], key=len)118 profile = min([p for p in port.profile_list if ('stereo' in p) or ('Hdmi' in p)], key=len)
119 logging.info("[ Selected profile ]".center(80, '='))119 logging.info("[ Selected profile ]".center(80, '='))
120 logging.info("Card #{} Profile: {}".format(card, profile))120 logging.info("Card #{} Profile: {}".format(card, profile))
121 return (card, profile)121 return (card, profile)
diff --git a/checkbox_support/scripts/tests/test_audio_settings.py b/checkbox_support/scripts/tests/test_audio_settings.py
index dc98084..9f81f97 100644
--- a/checkbox_support/scripts/tests/test_audio_settings.py
+++ b/checkbox_support/scripts/tests/test_audio_settings.py
@@ -155,6 +155,21 @@ class SetProfileTest(unittest.TestCase, PactlDataMixIn):
155 "desktop-raring-t430s-dp-available")),155 "desktop-raring-t430s-dp-available")),
156 ('2', 'output:hdmi-stereo'))156 ('2', 'output:hdmi-stereo'))
157157
158 def test_desktop_bionic_x13(self):
159 """
160 Bionic system with a Intel UHD Graphics chipset, it's DMIC system.
161 HDMI1, HDMI2 and HDMI3 are present in the card ports list, HDMI2 shown in the sinks list.
162 DMIC don't use "HDMI / DisplayPort " as keyword, now we use "HDMI" and "DP" keywords to find output port.
163 And in profile, there are not "hdmi-stereo" keyword any more, now we use "Hdmi".
164 Ports:
165 [...]
166 [Out] HDMI2: HDMI2/DP2 Output (priority: 400, latency offset: 0 usec, available)
167 Part of profile(s): Hdmi2
168 """
169 self.assertEqual(
170 _guess_hdmi_profile(self.get_text("desktop-bionic-x13")),
171 ('0', 'Hdmi2'))
172
158class RegexTest(unittest.TestCase):173class RegexTest(unittest.TestCase):
159 174
160 def test_volume_regex_trusty(self):175 def test_volume_regex_trusty(self):

Subscribers

People subscribed via source and target branches