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

Subscribers

People subscribed via source and target branches