Dec 22, 2012

HP Pavilion Dv7 with Debian GNU/Linux

I recently sent my HP Pavilion Dv7 laptop back to the HP repair service while it was still under warranty due to what I think was a loose connector or cable between the graphics chip and the LCD screen, causing flickering colors when the screen was moved. This would happen at the BIOS, in the bootloader, and in both Windows and GNU/Linux, so I'm confident it was a hardware problem. (This exact problem had happened before, and I had sent it back to be fixed; the problem started happening again several months later and had been getting steadily worse.) Ever helpful, HP again fixed the problem and this time additionally decided to wipe my hard drive to the factory state.

Luckily, I had backed up all my important files, so nothing was lost. It did, however, give me the opportunity to install Debian again, and try to work out some annoyances I had had before.

Beats Audio

On Windows, the Dv7 has a very nice sound (for laptop speakers) due to Beats Audio auxiliary speakers—a subwoofer in the back and extra speakers in the front that complement

In fact, it's quite easy to enable this on Debian (it's not enabled by default, because the default configuration uses the BIOS to detect what pin configuration to use, which erroneously reports the wrong one). Following the process in comment 8 on this thread on the Ubuntu Forums, you can easily turn the Beats Audio speakers on. That process is:

  1. Open the file /etc/modprobe.d/alsa-base.conf.
  2. Append the line options snd-hda-intel model=ref.
  3. Reboot and test.

The subwoofer now automatically starts up. There will be a warning from ALSA during the system boot about trying to load the mixer properties from the old configuration; this is safe to ignore.

There is an additional problem, though: although the normal speakers turn off when headphones are plugged into the computer, the subwoofer stays on, defeating the purpose of the headphones. As was suggested in the thread, I tested with other models (I have the same codec, but I checked using the list in the ALSA distribution) to no avail.

The solution is a very ugly hack. If someone knows how to do this correctly, please alert me. Here's what I did.

Playing around with the ALSA HDA Analyzer, I found that pin 0x10 controls the Beats Audio speakers. Using the Python script output of the analyzer, I wrote a script and hooked it up to the acpid event handler. Whenever the headphones are plugged in or unplugged, the script is run. I've put the script and configuration file in a Git repository. To configure, put the headphones file in the /etc/acpi/events/ directory and put the file in the /etc/acpi/ directory and make it executable.

The folder in the repository is here.

After a reboot, this should work. I've tested it with multiple headphones in at once, plugged in a and unplugged in different orders, with suspending and changing headphones while suspended, and it seems to work. The only problem is booting up with headphones in. To make it work, just unplug and replug the headphones.

I'm going to file a report to the ALSA Project, but their bug reporter appears to be down right now.

Wifi after Suspend-to-RAM

I also had difficulty getting my wifi driver, iwlwifi, to allow me to reconnect after Suspend-to-RAM. After being connected to a network and closing the lid of the laptop and causing the laptop to suspend, NetworkManager would loose the ability to connect to any network. It would detect the networks that were in the area, but when trying to connect, it would fail to authenticate and prompt me for different authentication information. After a reboot, NetworkManager would again connect correctly. I had figured this out before but forgot to write down how I did, so for future reference, these are the steps I followed (see comment 27 on this Launchpad bug):

  1. Create a new file /etc/modprobe.d/iwlwifi.conf.
  2. Enter the line options iwlwifi bt_coex_active=0 and save. (I recall this line disabling something with Bluetooth, which I don't use (I'm not sure if my model even has Bluetooth hardware), so research that further if you do use Bluetooth.)
  3. Reboot and test.

Even after a suspend, I was able to connect to wireless networks.

Backlight Hotkeys

Out of the box, I wasn't able to change the LCD screen backlight via the hotkeys that share the same space as F2 and F3. This was another problem I had fixed and never written down. Luckily, though, the solution was only a few search results away, on comment 27 on this Launchpad bug:

  1. Open your /etc/default/grub.
  2. Add acpi_backlight=vendor to the GRUB_CMDLINE_LINUX_DEFAULT line.
  3. Reboot and test.

An annoyance of mine is that there seems to be no way to have the backlight automatically change power when the AC cable is plugged in versus when it is not on GNOME 3. It seems that it's possible to do this with either pm-utils or with acpid (or with both). I'll post again if I get this to work.


  1. You know, your script doesn't have to be in python. It can be a 4 line bash script:
    case $3 in
    "plug" ) amixer set Front mute;;
    "unplug") amixer set Front unmute;;

    1. Hi pfdint_,

      It doesn't have to be python, but as I describe in the post, the python script is the output of the generator that allows you to select the pins to shut off or turn on on the given event interactively. As for the speakers on the screen that aren't on the body, my dv7 doesn't have those. That's why you should use the generator program to make a python script, because you can interactively turn pins on and off until you are satisfied with the result.

      I don't check this blog anymore, so I'm sorry for the delayed response.

  2. Also, have you noticed that the speakers on the bottom of the screen (not on the body) don't work under this solution?

  3. Thanks!!!
    It was very useful, now my beats audio speakers work under Ubuntu system!

  4. Thanks your trick works! Hopefully they will fix it in a new release

  5. How to enable the speakers that re off, you need to turn the sub woofer and do this.

  6. I truly enjoy looking through on this website , it holds fantastic blog posts.


Disqus for freeSoftwareHacker();