rc.alsa 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #! /bin/sh -
  2. #
  3. # Script to start the Advanced Linux Sound Architecture (ALSA)
  4. #
  5. # Copyright (c) 2017, 2019 Matias Fonzo, <selk@dragora.org>.
  6. #
  7. # Licensed under the Apache License, Version 2.0 (the "License");
  8. # you may not use this file except in compliance with the License.
  9. # You may obtain a copy of the License at
  10. #
  11. # http://www.apache.org/licenses/LICENSE-2.0
  12. #
  13. # Unless required by applicable law or agreed to in writing, software
  14. # distributed under the License is distributed on an "AS IS" BASIS,
  15. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16. # See the License for the specific language governing permissions and
  17. # limitations under the License.
  18. # Sanity checks
  19. if ! type alsactl > /dev/null 2>&1
  20. then
  21. echo "${0}: Error: alsactl(1) is not available." 1>&2
  22. exit 127;
  23. fi
  24. if ! type amixer > /dev/null 2>&1
  25. then
  26. echo "${0}: Error: amixer(1) is not available." 1>&2
  27. exit 127;
  28. fi
  29. if test -d /proc/asound
  30. then
  31. if test -e /var/lib/alsa/asound.state
  32. then
  33. echo "Restoring mixer from /var/lib/alsa/asound.state ..."
  34. alsactl restore
  35. else
  36. echo "Setting local values for the ALSA mixer ..."
  37. amixer set Master 90% unmute > /dev/null 2>&1
  38. amixer set Front 80% unmute > /dev/null 2>&1
  39. amixer set PCM 80% unmute > /dev/null 2>&1
  40. amixer set Side 80% unmute > /dev/null 2>&1
  41. amixer set CD 90% unmute > /dev/null 2>&1
  42. amixer set Headphone unmute > /dev/null 2>&1
  43. amixer set Mic 90% unmute > /dev/null 2>&1
  44. amixer set 'Front Mic' 90% unmute > /dev/null 2>&1
  45. alsactl store
  46. fi
  47. fi