Skip to content

Commit

Permalink
update audio_card_resource
Browse files Browse the repository at this point in the history
  • Loading branch information
diohe0311 committed Jul 18, 2023
1 parent 4114e22 commit 6abcce0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 18 deletions.
18 changes: 2 additions & 16 deletions providers/base/units/audio/jobs.pxu
Original file line number Diff line number Diff line change
Expand Up @@ -695,32 +695,18 @@ _summary: Check that at least one audio playback device exits
plugin: shell
category_id: com.canonical.plainbox::audio
flags: also-after-suspend
imports: from com.canonical.plainbox import manifest
requires:
audio_card.Playback == 'True'
command:
COUNT=$(alsa_pcm_info.py | grep -c Playback)
echo "Count: $COUNT"
if [ "$COUNT" -eq 0 ]; then
exit 1
fi
estimated_duration: 1s
estimated_duration: 0.5

id: audio/detect-capture-devices
_summary: Check that at least one audio capture device exists
plugin: shell
category_id: com.canonical.plainbox::audio
flags: also-after-suspend
imports: from com.canonical.plainbox import manifest
requires:
audio_card.Capture == 'True'
command:
COUNT=$(alsa_pcm_info.py | grep -c Capture)
echo "Count: $COUNT"
if [ "$COUNT" -eq 0 ]; then
exit 1
fi
esimated_duration: 1s
esimated_duration: 0.5

id: audio/alsa-playback
_summary: Playback works
Expand Down
4 changes: 2 additions & 2 deletions providers/resource/bin/audio_card_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ def get_audio_cards():
'Card': card_id,
'Device': device_id,
'Name': device_name,
'Playback': any(cap.startswith('playback') for cap in capabilities),
'Capture': any(cap.startswith('capture') for cap in capabilities)
'Playback': "supported" if any(cap.startswith('playback') for cap in capabilities) else "unsupported",
'Capture': "supported" if any(cap.startswith('capture') for cap in capabilities) else "unsupported"
})
return audio_cards

Expand Down

0 comments on commit 6abcce0

Please sign in to comment.