Watch
1
0
Fork
You've already forked hp-envy-27-p014-hda
0
hp-envy-27-p014-hda/results/sep11-standard-reset/probe-standard-reset.sh
Casey Tunturi 4ce9e03773 evidence: publish HP ENVY HDA records
Source-Sha: df779aa3e2cdb4774c0012b2f4f44791307634c6
Policy-Sha: 4c7fb444a162068e847747dd5a03c057631225e8eb05e44d0e358eae6c4e4266
Tree-Digest: 1c9cc7ba9fa0cdc70bcfa82d4eda9a4dbec0a391b9106858d0f69b944ac7cdb7
2026-09-14 13:44:54 -04:00

80 lines
3 KiB
Shell

#!/usr/bin/env bash
set -euo pipefail
baseline=/lib/modules/7.1.4-100.fc43.x86_64/updates/snd-hda-intel.ko
candidate=/lib/modules/hp27-experiment-L-wkJWVQET/snd-hda-intel.ko
expected=d7683f3e64a65614b53dd658343e6e80bfe76a5efd268cc87fbc2e69b7ba6115
audio_uid=$(id -u TARGET_USER)
removed=0
userctl() { runuser -u TARGET_USER -- env XDG_RUNTIME_DIR="/run/user/$audio_uid" systemctl --user "$@"; }
services=(pipewire.service pipewire.socket wireplumber.service pipewire-pulse.service pipewire-pulse.socket)
snapshot() {
date --iso-8601=seconds
od -An -tx1 /sys/module/snd_hda_intel/notes/.note.gnu.build-id
cat /proc/asound/cards /proc/asound/pcm
for codec in /proc/asound/card*/codec*; do
if test -f "$codec"; then head -n 6 "$codec"; fi
done
cat /sys/bus/pci/devices/0000:00:1f.3/power/control
}
unload_controller() { if test -e /sys/bus/pci/drivers/snd_hda_intel/0000:00:1f.3; then printf "%s" 0000:00:1f.3 > /sys/bus/pci/drivers/snd_hda_intel/unbind; fi; rmmod snd_hda_intel; }
recover() {
result=$?
trap - EXIT HUP INT TERM
set +e
if test "$removed" = 0; then
systemctl start alsa-state.service
userctl start "${services[@]}"
echo 'K was not unloaded; audio services restored'
exit "$result"
fi
echo 'Restoring verified K module'
if test -d /sys/module/snd_hda_intel; then
if ! unload_controller; then
echo 'RECOVERY FAILED: driver still in use'
systemctl start alsa-state.service
userctl start "${services[@]}"
exit 90
fi
fi
if ! modprobe snd_hda_intel; then
echo 'RECOVERY FAILED: K could not load'
systemctl start alsa-state.service
userctl start "${services[@]}"
exit 91
fi
sleep 5
snapshot
systemctl start alsa-state.service
userctl start "${services[@]}"
if ! grep -q 'Codec: Conexant CX20753/4' /proc/asound/card*/codec\#0; then
echo 'RECOVERY FAILED: Conexant absent'
exit 92
fi
echo 'K restored; Conexant enumerated; audio services restarted'
exit "$result"
}
test "$(id -u)" = 0
test "$(uname -r)" = 7.1.4-100.fc43.x86_64
test "$(cat /sys/bus/pci/devices/0000:00:1f.3/vendor)" = 0x8086
test "$(cat /sys/bus/pci/devices/0000:00:1f.3/device)" = 0xa170
test "$(cat /sys/bus/pci/devices/0000:00:1f.3/subsystem_vendor)" = 0x103c
test "$(cat /sys/bus/pci/devices/0000:00:1f.3/subsystem_device)" = 0x2b3e
test "$(sha256sum "$baseline" | cut -d ' ' -f 1)" = "$expected"
test "$(sha256sum /lib/modules/7.1.4-100.fc43.x86_64/updates/snd-hda-intel.ko | cut -d ' ' -f 1)" = "$expected"
test -s "$candidate"
test "$(modinfo -F vermagic "$candidate")" = "$(modinfo -F vermagic "$baseline")"
echo 'Baseline before test'
snapshot
trap recover EXIT
trap 'exit 129' HUP
trap 'exit 130' INT
trap 'exit 143' TERM
userctl stop "${services[@]}"
systemctl stop alsa-state.service
unload_controller
removed=1
echo 'Loading L standard-reset experiment'
insmod "$candidate"
sleep 8
snapshot
journalctl -b -k --since '-1 minute' --no-pager