Sunday, August 24, 2014

Gentoo, ALSA, mute speakers when headphones are used

Lenovo G400s 

Specifications:
lspci: 00:1b.0 Audio device: Intel Corporation 7 Series/C210 Series Chipset Family High Definition Audio Controller (rev 04)

cat /proc/asound/card0/code* |grep Codec :
Codec: Conexant CX20757
Codec: Intel PantherPoint HDMI

Kernel configuration: CONFIG_SND_HDA_INTEL=y and a hosts of other CONFIG_SND_HDA_xxx options.

I initially encountered a problem where the laptop speakers do not mute when I use headphones. As usual, the solution is very simple. 

Bring up the configuration for sound settings by typing alsamixer in the terminal. 

Enable the Auto-Mute Mode



Thursday, August 14, 2014

Gentoo, Black screen, Integrated Intel graphics

This is a record of a black screen problem that I initially faced after I installed Gentoo with kernel version 3.10 and below. 

Laptop: Lenovo G400S with rEFind as bootloader.
Integrated Intel graphics with Nvidia GT720M

** This problem has somehow been fixed in kernel 3.14.14 which I just compiled and the black screen problem is finally gone! 

1. During bootup into Gentoo, the screen goes blank after the initial few lines. (I wasn't patient enough to wait for the system to bootup completely and kept thinking it was kernel panic and went through countless of times recompiling the kernel only to realise much later that the backlight wasn't switched on! Duh. *face palm*)

2. This problem occurs when I enable KMS for Intel together with EFI framebuffer. I just have to press the hotkey to increase the brightness of the backlight. (/sys/class/backlight/acpi_video0/brightness is somehow always set to zero), It doesn't solve the problem completely, but at least I am able to view the screen. If I disable KMS for Intel, no problems with backlight, but I am not able to start the X-server without KMS.

3. A few suggestions on the net are to add i915.invert_brightness=1 or acpi_backlight=vendor as a kernel option. That doesn't work quite well for me because:

a. If I boot the kernel with the option i915.invert_brightness=1, the backlight doesn't switch off. But everything is inverted. If I press the key to increase brightness, the display dims and vice versa. Same thing happens if I change the value in /sys/class/backlight/acpi_video0/brightness. If I increase the value, the display dims. If I decrease it, the display brightens. 

b. If I boot the kernel with the option acpi_backlight=vendor, the backlight also doesn't switch off. But brightness is at maximum and I am unable to change it at all.

4. My solution is to  create a file called "backlight.start" (Remember to chmod +x the file) in "/etc/local.d" The content of the file is as follows: 

 #!/bin/sh

echo 60 >> /sys/class/backlight/acpi_video0/brightness

 This will cause the backlight to be set at 60 when I see the login prompt. You may have to check your system first to see if setting value in /sys/class/backlight/acpi_video0/brightness will actually change the brightness or not. For some people it might be /sys/class/backlight/acpi_video1 or /sys/class/backlight/intel_backlight. 

5. There are, by the way, 3 ways (in my case) to adjust the brightness of the screen: The brightness keys on the keyboard, adjusting the values in /sys/class/backlight/acpi_video0 or /sys/class/backlight/intel_backlight and using xbacklight.

Well, all these solutions are now redundant as the problem has been fixed in the latest kernel. But it has been interesting researching for a temporary fix. :)