Ubuntu On Sony Vaio FW Series

Tips & Tricks related to Sony Vaio FW series laptops

Posts Tagged ‘alsa

Headphones/Front switch script

with 4 comments

I’m not defining a “hippo” model for “snd-hda-intel” to make headphones detection about we talk earlier. Because I’m using my headphones plug very rarely, I decided to write a shell script to switch sound to headphone and back and link it to to S1 button. This information could help you if you want to make S1 button to do something else too.

Here is a switch script, when you run it, it detects if headphones are switched on then it switch it off and vice-versa. Front mixer channel will be switched off if headphones switched on and vice-versa.


#!/bin/bash
# by Anton Veretenenko <anton&#91;email sign&#93;veretenenko.ru>

is_front_on=`amixer -c 0 cget numid=2,iface=MIXER,name='Front Playback Switch' | grep -i -c -P -e "values=on,on"`

if [ "$is_front_on" == "1" ]
then
 amixer -c 0 cset numid=2,iface=MIXER,name='Front Playback Switch' off
 amixer -c 0 cset numid=3,iface=MIXER,name='Headphone Playback Switch' on
else
 amixer -c 0 cset numid=2,iface=MIXER,name='Front Playback Switch' on
 amixer -c 0 cset numid=3,iface=MIXER,name='Headphone Playback Switch' off
fi

To link S1 button to this script (make a shortcut) you need to delete shortcut from System->Preferences->Keyboard Shortcuts for this button, if you have it. I guess you saw that S1 button named as “XF86Launch1” in keyboard shortcuts, you need this name later.

Open gconf-editor (Alt+F2, type gconf-editor, Run). On the left tree select apps->metacity->global_keybindings the on the right you should see a list of keys, select one you like (I choose “run_command_1”) and edit it (right click, Edit Key), enter name of S1 button (“XF86Launch1”) into value field. Then select “keybinding_commands”  on the left.

Edit “command_1” key, into value field you should enter path to the script, in my case it is “/home/egaistek/scripts/alsa-front-mute”. That’s all, it should work now.

P.S. Do not forget to add executable permissions to a script file (chmod +x in terminal or File->Properties, Permissions tab, set “Allow executing file as program” in Nautilus/File Explorer)

P.P.S. This works only for Gnome without Compiz running. If you want to add shortcuts with Compiz, use Compiz configuration tools.

Advertisements

Written by egaistek

July 7, 2009 at 07:49

Posted in Vaio

Tagged with , , , , ,

Moved to Intrepid

with 5 comments

So I have updates to 8.10 completly.

Wifi works out of box.

Fglrx installed from Hardware Drivers works. Compiz works with fglrx (but there is still a scrolling lag in Firefox, so I’m not using Combiz because of that).

Audio works (using ALSA everywhere). When you plugin headphones laptop speakers does not turn off.

I can’t make work a radeonhd driver from repos, I guess I need to compile a new one.

Edu mentioned that we can enable brightness control with radeonhd, I’m going to do that after I make radeonhd works. (checked, xbacklight does not work)

Bluetooth works (my switcher not).

My wireless mouse works (well it works anywhere 🙂

Undervolting stops working, need update for new kernel. My CPU is cool enough I guess (41C right now).UPD

I have moved back to powernowd from cpufreqd (cpu is hotter with it, maybe someone saw that too?)

I thought there will be new OpenOffice 3, but there is only 2.4, and old Firefox (3.0.3)

P.S. Tried to update another laptop today, but repos speed is too low, maybe it’s overloaded, seems people update their Ubuntu today too =)

P.P.S. I’ll update post if remember something bad =)

UPD: xbacklight does not work.

Written by egaistek

November 9, 2008 at 01:54

Posted in Vaio

Tagged with , , , , , ,

Make it Surround

with 7 comments

If you have movies with 5.1 or 4 channels, e.g. DVD, Blue-Ray etc. You can listen all this channels in you headphones! Without any expensive sound system.

Our Realtek chip which is installed in FW series have Virtual Surround technology based on HRTF.

Windows drivers have a switch to enable it in settings. But for Ubuntu it’s a little bit different. Ubuntu have ALSA audio system/drivers and have special plugin for HRTF which is not installed by default. You need to install alsa plugins package libasound2-plugins. Then open/create a file in your home directory named .asoundrc and type this text inside:

pcm.!surround51 {
        type vdownmix
        slave.pcm default
}

pcm.!surround40 {
        type vdownmix
        slave.pcm default
}

Now if player using all channels, vdownmix plugin downmix all channels into 2.

Here is how to enable all channels in SMPlayer (based on MPlayer). Goto Option->Preferences, on the left select General, select Audio tab and change there Channels by default to 6.

P.S. You can test surround with this command in terminal:


speaker-test -Dsurround51 -c6 -l1 -twav

This will make sound for each channel.

UPD: If you have some problems about can not open device etc, try this:


sudo alsa force-reload

Written by egaistek

September 15, 2008 at 05:49

Posted in Vaio

Tagged with , , , ,