Topic: HP Pavilion Volume Buttons

HP Pavilion's touch sensitive volume control buttons does not work out of the box with CrunchBang.
Here's How to get the buttons functioning again. (this is my first how to ever so please correct me if there any mistakes)

First you want to install the aumix package from ubuntu's repositories

           

 sudo apt-get install aumix 

with the package install now you want to know the keycodes for the mute, volume up, & volume down via using xev from a terminal

           

 xev 

now just press the corresponding button to get the keycode like the picture below

            http://www.freeimagehosting.net/uploads/8fe630eda4.jpg

Here i pressed the mute button on my laptop (HP Pavilion dv2810us) and the keycode came out to be 121.
for the volume down mine came out to be 122 and for volume up 123

now that we know keycodes for hp the volume control buttons we now need to bind them to any key
for this tutorial I'll be using F21, F22, F23 using xmodmap in a terminal

           

xmodmap -e "keycode 121 = F21"

Here we bind my mute button to F21, so every time i press the mute button X thinks im pressing F21

Now we bind the volume up and volume down button to F22, F23

           

xmodmap -e "keycode 122 = F22" 

           

xmodmap -e "keycode 123 = F23" 

Now the we that we have the buttons bind to another key we can use shortcut keybindings in the rc.xml file
in openbox. Under the Keybindings for Windows add the following:

   <keybind key="F21">
      <action name="Execute">
        <execute>aumix -v0</execute>
      </action>
    </keybind>
    <keybind key="F22">
      <action name="Execute">
        <execute>aumix -v-10</execute>
      </action>
    </keybind>
    <keybind key="F23">
      <action name="Execute">
        <execute>aumix -v+10</execute>
      </action>
    </keybind>

Restart openbox and now your volume control buttons for your HP Pavilion Notebook should now be functioning big_smile
(if there is any mistakes please do tell)

Re: HP Pavilion Volume Buttons

IPPON wrote:

now that we know keycodes for hp the volume control buttons we now need to bind them to any key
for this tutorial I'll be using F21, F22, F23 using xmodmap in a terminal


Hey, this looks promising. Did you arbitrarily choose F21-F23 or does 21, 22, and 23 that was produced in your xev output correspond to those F buttons.

My mute, volume down and volume up are accessed via FN+F5, 6 and 7 respectively. How do I know what F-keys these correspond to?
I tried using F21-F23 as you did, but that didn't seem to work. Also, when I used xmodmap, I didn't get any type of confirmation after binding a key. Should I have gotton some indicator that would let me know that a key was bound?

Thanks.

#! 10 “Statler” r20110207 32-bit & Openbox

Re: HP Pavilion Volume Buttons

I arbitrarily choose F21, F22, F23. You can chose any F key as long as it between F1-F24. If the xmodmap command didn't return any errors then the command was a success. Hope that helps? if not can you please post ur xev output? (Sorry that screenshot of my xev output was after i did binded the key. It should of been something like X86VolumeMute before i binded the key).


oh after successfully binding the volume keys you want to add this to your autostart.sh because after i restarted my comp i had to do the xmodmap command all over again.

# bind volume keys
xmodmap -e "keycode 121 = F21"
xmodmap -e "keycode 122 = F22"
xmodmap -e "keycode 123 = F23"

#

Re: HP Pavilion Volume Buttons

IPPON wrote:

I arbitrarily choose F21, F22, F23. You can chose any F key as long as it between F1-F24.

Okay, I figured as much. My question now is, how did you know what keys on your keyboard corresponded to F21-F23. On my Laptop I have the standard F1-F12 and I don't see any other F-keys. The volume adjustments are already on Fn-F5 through Fn-F7, however I don't know how to figure out what F-keys those Fn-F's actually correspond to. Thanks for the update about the autostart.sh addition as well.

Also, does this adjust the volume in Volume Control Menu>Sound & Video>Volume Control, or will it also adjust the volume of the volume indicator in the systray? Thanks!

#! 10 “Statler” r20110207 32-bit & Openbox

Re: HP Pavilion Volume Buttons

Open up a terminal and type 'xev'.
This allows you to see all of the X events that are generated when you move and click the mouse, or press and release keys. If you look carefully at the text printed when you press the keys, you will see the keycode number of the key (along with other information).
Just close the little window with the mouse to kill the application.
Good luck!

radioz

____________
#! on EEE 701

Re: HP Pavilion Volume Buttons

radioz wrote:

Open up a terminal and type 'xev'.
This allows you to see all of the X events that are generated when you move and click the mouse, or press and release keys. If you look carefully at the text printed when you press the keys, you will see the keycode number of the key (along with other information).
Just close the little window with the mouse to kill the application.
Good luck!

radioz


xev output:

KeyPress event, serial 32, synthetic NO, window 0x2400001,
    root 0x5e, subw 0x0, time 578513, (240,165), root:(266,459),
    state 0x0, keycode 121 (keysym 0x1008ff12, XF86AudioMute), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 35, synthetic NO, window 0x2400001,
    root 0x5e, subw 0x0, time 578596, (240,165), root:(266,459),
    state 0x0, keycode 121 (keysym 0x1008ff12, XF86AudioMute), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyPress event, serial 35, synthetic NO, window 0x2400001,
    root 0x5e, subw 0x0, time 579504, (240,165), root:(266,459),
    state 0x0, keycode 122 (keysym 0x1008ff11, XF86AudioLowerVolume), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 35, synthetic NO, window 0x2400001,
    root 0x5e, subw 0x0, time 579593, (240,165), root:(266,459),
    state 0x0, keycode 122 (keysym 0x1008ff11, XF86AudioLowerVolume), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyPress event, serial 35, synthetic NO, window 0x2400001,
    root 0x5e, subw 0x0, time 580430, (240,165), root:(266,459),
    state 0x0, keycode 123 (keysym 0x1008ff13, XF86AudioRaiseVolume), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 35, synthetic NO, window 0x2400001,
    root 0x5e, subw 0x0, time 580511, (240,165), root:(266,459),
    state 0x0, keycode 123 (keysym 0x1008ff13, XF86AudioRaiseVolume), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

FocusOut event, serial 35, synthetic NO, window 0x2400001,
    mode NotifyNormal, detail NotifyNonlinear

@radioz: I see the keycode number that you mentioned, however I don't see how to use this information to bind the volume keys like IPPON was talking about. IPPON reassigned the keycode 121 to F21. I want to assign the keycode 121 function to the same button that the keycode 121 came from.

Last edited by nabilalk (2009-03-10 00:09:53)

#! 10 “Statler” r20110207 32-bit & Openbox

Re: HP Pavilion Volume Buttons

They worked out of the box for me (8.10.01 Pavillion dv5t), but this is a good thing to know smile

All in an effort to learn...
Delves deeper into code...

Re: HP Pavilion Volume Buttons

Instead of using aumix, I used amixer and put these lines in rc.xml:

    <keybind key="F21">
      <action name="Execute">
        <execute>amixer sset Master playback toggle</execute>
      </action>
    </keybind>
    <keybind key="F22">
      <action name="Execute">
        <execute>amixer sset Master playback 3.2-</execute>
      </action>
    </keybind>
    <keybind key="F23">
      <action name="Execute">
        <execute>amixer sset Master playback 3.2+</execute>
      </action>
    </keybind>

I couldn't get aumix to play nice with alsa on Crunchee/Acer Aspire One

Re: HP Pavilion Volume Buttons

IPPON: Short answer - great post! I have an HP nc6120 and loaded Crunchbang 9.04 over the weekend ("had" to have that ext4!). Have been enjoying the results but couldn't quite figure out what was going on with the Volume controls. The strangest thing was before loading #!, I was running Ubuntu 9.04 and the volume controls just worked. But after swapping to #!, they didn't work which was really bizarre to me. Nevertheless, I mucked around the Ubuntu forums and found some related posts but couldn't quite get them to work, including a recompile of a modified evdev_drv.so file that I totally got lost on...yikes... You keycodes matched mine perfectly, so I didn't have to do much more than a cut/paste and it just worked!

Huge Thanks!

M

Re: HP Pavilion Volume Buttons

Thanks, worked great on my Latitude E6400!

Re: HP Pavilion Volume Buttons

This also works for my Gateway laptop and remote keyboard.  Now I have to assign stop, play/pause, forward, back.

I view KDE like I view snow. It looks fun and marvelous, it's fun to play in, but after a while I just want someone to take it all away.

Re: HP Pavilion Volume Buttons

Update: mapped the "I" button to launch my browser which is really slick. Last button that isn't being used is the Presentation button - will work on that next when I get the chance. Not sure what I'm gonna map to it though - any suggestions out there? Thanks!

Re: HP Pavilion Volume Buttons

Instead of mapping the keys to a different "function", I just used:

<!– Keybindings for volume control –>
<keybind key=”XF86AudioMute”>
<action name=”Execute”>
<execute>amixer sset Master playback toggle</execute>
</action>
</keybind>
<keybind key=”XF86AudioLowerVolume”>
<action name=”Execute”>
<execute>amixer sset Master playback 3.2-</execute>
</action>
</keybind>
<keybind key=”XF86AudioRaiseVolume”>
<action name=”Execute”>
<execute>amixer sset Master playback 3.2+</execute>
</action>
</keybind>

Re: HP Pavilion Volume Buttons

Worked great.

I used changed to Clarkies settings (above) though, as IPPONs mute button didn't toggle the sound. Also, no need to map the keys if you use XF86AudioMute etc.

Thanks all

B

Re: HP Pavilion Volume Buttons

This works for my Thinkpad T61 as well. I used amixer like Clarkie said, since it's installed by default within alsa-utils. Only thing, I don't get the nice meter thingy which goes up or down when I use the volume buttons. Any ideas on how to fix that?

Re: HP Pavilion Volume Buttons

Texus wrote:

This works for my Thinkpad T61 as well. I used amixer like Clarkie said, since it's installed by default within alsa-utils. Only thing, I don't get the nice meter thingy which goes up or down when I use the volume buttons. Any ideas on how to fix that?

Did you find a solution yet? I have the same laptop. Searching on my side.

Re: HP Pavilion Volume Buttons

Thanks alot guys! It was a realy big help for me!

Dell Studio 1537+#! Statler Alpha2 || http://taklertamas.deviantart.com/gallery/

Re: HP Pavilion Volume Buttons

Only one question:

When I restart the machine, or logout from the session, the volume keybindings are not saved!
How can I fix the problem?
I don't like to type the
xmodmap -e "keycode 121 = F21"
xmodmap -e "keycode 122 = F22"
xmodmap -e "keycode 123 = F23"
combination in terminator anytime I start a new session.....
Sorry for the stupid queries of mine!

Dell Studio 1537+#! Statler Alpha2 || http://taklertamas.deviantart.com/gallery/

Re: HP Pavilion Volume Buttons

that is weird that the changes don't stick. If you find they never stick and no one knows why then just put those lines one by one in a script

#! /bin/bash
the stuff
you need
to do
exit

save it, make it executable then have autostart.sh call it when you login.

and you won't have to do it again... but it is still odd they don't stick and maybe someone can tell you why.

I blog too much....       geek stuff LinuxMintDebian | linux noob stuff LinuxMintNoob | spiritual stuff Daily Cup of Tao

Re: HP Pavilion Volume Buttons

Thank You!

Dell Studio 1537+#! Statler Alpha2 || http://taklertamas.deviantart.com/gallery/

Re: HP Pavilion Volume Buttons

Hey I did this (the top mod, with aumix) as followed, and I forgot to close the rc.xml correctly (I left off </action> and then the </keybind> !!!)
now when #! boots, it shows the desktop, and after awhile the screen saver.
nothing else works.

How do I get into the rc/xml to add those closing tags?
In MS windows we have a "safe mode" when we boot, so we can get into things like that and then reboot.
Does #!/Linux have something similar?

Thanks for the mod- very necessary for the laptop volume buttons!!!

JP

85% #! user, 10% Other distros, 5% M$Bill"Satan"Gates
IBM T-22 server + Dell e1505 + Old dualie socket 370 server (why not? Runs GREAT with #! 10 +4gb ECC ram)
OSs: #! 10 (openbox), AVLinux5, LinuxMINT 11, Fluxbuntu 7 (pah!), Fedorah 15, + WinXP*cough-cough*"pro" for
VST & DAW, CAD, Media, Composing & Pro-Music Studio work, Image editing, etc.

Re: HP Pavilion Volume Buttons

Method 1. Rescue mode:

http://www.brunolinux.com/09-Distro_Spe … _Mode.html

Select the shell or root shell. From there you can edit your rc.xml file using nano.

Method 2. LIve CD

Just boot any Live CD, mount your #! partition, look in your home and edit your rc.xml.

Note: ** Please read before posting **

BTW if you wish to contact me, send me an e-mail instead of a PM.

Re: HP Pavilion Volume Buttons

This same technique worked with my Acer Aspire 4720z hardware volume dial. It was very helpful and easy to follow big_smile

Re: HP Pavilion Volume Buttons

For reference, this is how I got volume keys working on a Toshiba -

http://crunchbanglinux.org/forums/topic … um-solved/

Re: HP Pavilion Volume Buttons

Dell D620

Exact same codes... works beautifully!  Thanks!!