Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sof_remove.sh: make lib.sh optional #1220

Merged
merged 1 commit into from
Jul 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions tools/kmod/sof_remove.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,15 @@

TOPDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)

# shellcheck source=case-lib/lib.sh
source "$TOPDIR"/case-lib/lib.sh
# Used only by more advanced error handling
source_opt_libsh()
{
local libsh="$TOPDIR"/case-lib/lib.sh
if test -e "$libsh"; then
# shellcheck source=case-lib/lib.sh
source "$libsh"
fi
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you misunderstand what #1169 intends to do. The intend was to 'dumb' down the sof_remove.sh to be comparable with sof_insert.sh, to not check for PA, to not check for booted firmware, to do exactly what the script should do: remove the modules.

I don't think it makes much sense to have this workflow to just remove the modules when initially booted to legacy or DSPless mode:

cp ~/sof-test/tools/kmod/sof_remove.sh ~/
~/sof_remove.sh
rm ~/sof_remove.sh

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did understand.

This is software: it can be BOTH dumb and smart and this is what this PR does. Try it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The moved sof_remove.sh do work now.
Apparently it also works in place as well, not failing anymore if the device were booted in legacy or DSPless mode..

Copy link
Collaborator Author

@marc-hb marc-hb Jul 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently it also works in place as well, not failing anymore if the device were booted in legacy or DSPless mode..

Probably because of what I did it a while back in commit 7c2ede0 , PR #1187 and friends.

(that was much more work than this BTW)


remove_module() {

Expand All @@ -27,8 +34,9 @@ exit_handler()
# "non-deterministically". So even if we are successful this time,
# warn about any running pulseaudio because it could make us fail
# the next time.
# TODO: display any pipewire process too.
if pgrep -a pulseaudio; then
systemctl_show_pulseaudio
systemctl_show_pulseaudio || true
fi

if test "$exit_status" -ne 0; then
Expand Down Expand Up @@ -56,6 +64,7 @@ kill_trace_users()
)
}

source_opt_libsh
trap 'exit_handler $?' EXIT

# Breaks systemctl --user and "double sudo" is not great
Expand Down
Loading