#!/bin/sh # This script will recompile the ALSA drivers for Ubuntu # This procedure was gotten from # https://help.ubuntu.com/community/HdaIntelSoundHowto # # 2007 Bob Nelson admin@stchman.com # 2009 Aldeby http://aldeby.org/blog: various tweaks in order to prompt you with a choice among few most common modes to try out # # This script last updated 29/3/2009 script_name="alsa_setup.sh" # Script must run as root if [ $USER != "root" ]; then echo "You need to run this script as root." echo "Use 'sudo ./$script_name' then enter your password when prompted." exit 1 fi # Install the required tools sudo apt-get -y install build-essential ncurses-dev gettext # Install your kernel headers sudo apt-get -y install linux-headers-`uname -r` # Change to users home folder cd ~ # Get the files from www.stchman.com wget ftp://ftp.alsa-project.org/pub/driver/alsa-driver-1.0.21.tar.bz2 wget ftp://ftp.alsa-project.org/pub/firmware/alsa-firmware-1.0.20.tar.bz2 wget ftp://ftp.alsa-project.org/pub/lib/alsa-lib-1.0.21a.tar.bz2 wget ftp://ftp.alsa-project.org/pub/utils/alsa-utils-1.0.21.tar.bz2 # make a new folder sudo mkdir -p /usr/src/alsa # Change to that folder cd /usr/src/alsa # Copy the downloaded files to the newly made folder sudo cp ~/alsa* . # Unpack the tar archive files sudo tar xjf alsa-driver* sudo tar xjf alsa-lib* sudo tar xjf alsa-utils* sudo tar xjf alsa-firmware* #Compile and install alsa-driver cd alsa-driver* sudo ./configure --with-cards=hda-intel --with-kernel=/usr/src/linux-headers-$(uname -r) sudo make sudo make install # Compile and install alsa-lib cd ../alsa-lib* sudo ./configure sudo make sudo make install # Compile and install alsa-utils cd ../alsa-utils* sudo ./configure sudo make sudo make install # Compile and install alsa-firmware cd ../alsa-firmware* sudo ./configure sudo make sudo make install # Remove the archives as they are no longer needed rm -f ~/alsa-driver* rm -f ~/alsa-lib* rm -f ~/alsa-utils* rm -f ~/alsa-firmware* # Add the following line to the file, replace 'auto' with your model sudo echo -e '\n' >> /etc/modprobe.d/alsa-base.conf #sudo echo "options snd-hda-intel model=auto" >> /etc/modprobe.d/alsa-base.conf while : do clear echo "Choose the mode which best fits you" echo "1. AUTO (default)" echo "2. HP generic laptop" echo "3. Fujitsu" echo "4. Acer" echo "5. Dell" echo "6. Lenovo Thinkpad" echo "7. 3-stack desktop [AD1884A / AD1883 / AD1984A / AD1984B]" echo "8. laptop with HP jack sensing [AD1884A / AD1883 / AD1984A / AD1984B]" echo "9. mobile devices with HP jack sensing [AD1884A / AD1883 / AD1984A / AD1984B]" echo "10. Reference board" echo "11. Intel Mac (detect type according to subsystem id)" echo "12. 3-stack 3-jack" echo "13. 3-stack (2-channel) with SPDIF" echo "14. 3-stack (6-channel)" echo "15. 3-stack (6-channel) with SPDIF" echo "16. 6-stack mode" echo "17. 6-stack with SPDIF" echo "18. UNDO TWEAK / CHANGE MODE / PRESSED WRONG DIGIT" echo "19. DONE TWEAKING!" echo -n "Please enter option [1 - 19]" read opt case $opt in 1) echo;; 2) sudo echo "options snd-hda-intel model=hp" >> /etc/modprobe.d/alsa-base.conf;; 3) sudo echo "options snd-hda-intel model=fujitsu" >> /etc/modprobe.d/alsa-base.conf;; 4) sudo echo "options snd-hda-intel model=acer" >> /etc/modprobe.d/alsa-base.conf;; 5) sudo echo "options snd-hda-intel model=dell" >> /etc/modprobe.d/alsa-base.conf;; 6) sudo echo "options snd-hda-intel model=thinkpad" >> /etc/modprobe.d/alsa-base.conf;; 7) sudo echo "options snd-hda-intel model=desktop" >> /etc/modprobe.d/alsa-base.conf;; 8) sudo echo "options snd-hda-intel model=laptop" >> /etc/modprobe.d/alsa-base.conf;; 9) sudo echo "options snd-hda-intel model=mobile" >> /etc/modprobe.d/alsa-base.conf;; 10) sudo echo "options snd-hda-intel model=ref" >> /etc/modprobe.d/alsa-base.conf;; 11) sudo echo "options snd-hda-intel model=intel-mac-auto" >> /etc/modprobe.d/alsa-base.conf;; 12) sudo echo "options snd-hda-intel model=3stack" >> /etc/modprobe.d/alsa-base.conf;; 13) sudo echo "options snd-hda-intel model=3stack-dig" >> /etc/modprobe.d/alsa-base.conf;; 14) sudo echo "options snd-hda-intel model=3stack-6ch" >> /etc/modprobe.d/alsa-base.conf;; 15) sudo echo "options snd-hda-intel model=3stack-6ch-dig" >> /etc/modprobe.d/alsa-base.confv;; 16) sudo echo "options snd-hda-intel model=6stack" >> /etc/modprobe.d/alsa-base.conf;; 17) sudo echo "options snd-hda-intel model=6stack-dig" >> /etc/modprobe.d/alsa-base.conf;; 18) sudo sed '$d' /etc/modprobe.d/alsa-base.conf /tmp/alsa-base.conf ; mv /tmp/alsa-base.conf /etc/modprobe.d/alsa-base.conf;; 19) echo "Bye $USER"; exit 1;; *) echo "$opt is an invaild option. Please select option between 1-17 only"; echo "Press [enter] key to continue. . ."; read enterKey;; esac done # Reboot the computer echo "Save your work and REBOOT your computer to make changes effective!"