A while back, I installed a keyboard backlight fix for Ubuntu from this site (I have an ASUS G73J that dual boots Windows 7 and Ubuntu 10.04). Today, I was trying to get the other hotkeys to work but had very little success.
I ran into problems when trying to figure out how to identify the hotkey.
For example, "event=hotkey (ATKD|HOTK) 0000002[0123456789abcdef]" activates when Fn+F3 are pressed but using showkey, I only get keycode 61 and scancode 0x3d. I also tried using xev and looking inside of kern.log but neither of them gave me readable results for what the hotkey was.
-
ALLurGroceries Vegan Vermin Super Moderator
acpi_listen may be what you're looking for, the event handlers are in /etc/acpi/asus-*.sh and the definitions are in asus-laptop.c around line 242:
git.kernel.org - linux/kernel/git/stable/linux-2.6.35.y.git/blob - drivers/platform/x86/asus-laptop.c
Most of the hotkeys except for the keyboard backlight ones should work out of the box, which aren't working for you? -
acpi_listen is exactly what I was looking for. Thank you.
The following hotkeys don't do anything:
Overdrive Button
Fn-F8
Fn-C
Fn-V
I might change some of the buttons so that they do different things than on Windows).
Thanks again for your help. -
ALLurGroceries Vegan Vermin Super Moderator
Yeah, you can bind the camera button in Gnome in System->Keyboard Shortcuts->Custom Shortcuts and Add one with whatever app you want to run.
For monitoring the keys on the desktop layer you can use dbus-monitor, something like this:
Code:sudo dbus-monitor --system | grep -i -A1 button
-
Okay, thanks.
After testing some of my hotkeys, I found out that my Fn-Enter (Calculator launcher) isn't associated with XF86-Calculator. Is there a way of fixing this?
It turns out that Fn-C and the Screen Key are associated with XF86Launch1 so I can use the Keyboard Shortcuts menu on them (as well as on Fn-F8 and Fn-V). The only thing is that it is already programmed to turn off the touchpad. Is there a way of stopping this? Considering Fn-F9 already does this, I don't see any reason to double/triple up on it.
So after assigning all the above keys using the Keyboard Shortcuts menu, I'll have roughly 2 keys that I will need t assign events to. The Overdrive button and the Lights button (I didn't think the OS was aware of this button until I used acpi_listen on it (sorta like the Fn key not having its own keycode)). -
ALLurGroceries Vegan Vermin Super Moderator
8a is being picked up by asus-f8sv-touchpad, so just comment out the lines like this:
Code:gksudo gedit /etc/acpi/events/asus-f8sv-touchpad
Code:# /etc/acpi/events/asus-f8sv-touchpad # This is called when the user presses the touchpad button on the ASUS F8SV # and calls /etc/acpi/asus-touchpad.sh for further processing. #event=hotkey ATKD 0000008a #action=/etc/acpi/asus-touchpad.sh
Code:sudo /etc/init.d/acpid restart
Code:acpi_fakekey $KEY_CALC
-
I'm sorry for the hassle but I ran into some more problems...
Commenting out those lined fixed the touchpad problem but I'm running into problems with the Calculator fix. It works but then again, it doesn't. I always need to hit another button on the keyboard before the calculator will show up. The event and shell files look identical to your suggested examples (with the obvious exceptions of fakekey and hotkey ID).
Also, I tried making another hotkey for Fn-Down so that it would start Rhythmbox (otherwise it would do its normal play/pause functions). After making the shell file executable, I was able to run it separately without any problems. Yet as soon as I try calling it by an acpi event, nothing happens. I double checked the hotkey ID. Heres what I got:
/etc/acpi/events/music-player
Code:event=hotkey (ATKD|HOTK) 00000045 action=/etc/acpi/music-player.sh
Code:#!/bin/sh #Starts Rhythmbox if it is not already running # Original/unnecessary coding: # ps -ef|grep -v grep|grep rhythmbox-client >/dev/null || rhythmbox-client rhythmbox-client
-
ALLurGroceries Vegan Vermin Super Moderator
I'm not sure what you're doing wrong there, that should work, since I just pasted your scripts in and they did, after restarting acpid of course. But, you don't need to make a script for that, just make an association in the System->Preferences->Keyboard Shortcuts->Custom Shortcuts for rhythmbox.
In terms of your calculator not working without hitting another key, I don't understand what you mean, so here are my scripts, which I substituted 0x8a for, since I had nothing bound there:
/etc/acpi/events/asus-calc
Code:event=hotkey ATKD 0000008a action=/etc/acpi/asus-calc.sh
Code:#!/bin/sh test -f /usr/share/acpi-support/key-constants || exit 0 . /usr/share/acpi-support/key-constants acpi_fakekey $KEY_CALC
-
The problem with using System->Preferences->Keyboard Shortcuts->Custom Shortcuts to make a rhythmbox shortcut is that I also want it to play/pause when the application is open. I'm limited to one shortcut per key when using that program (unless I'm unaware of something).
The only difference between my calculator scripts and yours is that you used
Code:event=hotkey ATKD 0000008a
Code:event=hotkey (ATKD|HOTK) 000000b5
Code:event=hotkey ATKD 000000b5
The problem is that after pressing Fn-Enter, nothing happens until I press something else on the keyboard (such as the spacebar). It doesn't seem to matter how long an interval is between the Calc button and the keyboard button but the calculator doesn't appear until I hit the keyboard button.
The shell file was compiled using "chmod 755 asus-calc.sh" and I have been remembering to restart acpid so I've got no idea what the problem is.
BTW, thanks for your help thus far. -
ALLurGroceries Vegan Vermin Super Moderator
double post ftl
continue here --------> -
ALLurGroceries Vegan Vermin Super Moderator
OK, I understand what you want to do with the play/pause button... did you get that working?
About the calculator, try running sudo dbus-monitor --system (without piping it to grep), does the event come through when you've pressed Fn+Enter or after the subsequent keypress? I'm assuming that the key gets picked up by acpi_listen immediately. You may want to run both at the same time in a separate window actually.
Maybe try changing it to 0x8a (Fn+C / 'Splendid') to see if you have the same problem as 0xb5.
Also, what distro/version are you on, I'm on Debian Sid AMD64.
I could give you instructions for modifying asus-laptop.c but I need to know if you're on a custom or stock kernel. -
The play/pause button is still not working to start rhythmbox.
I tried running "sudo dbus-monitor --system" but I'm not sure how to read its output. On a side note, while running that command, nothing was shown after pressing Fn-Enter until I hit a second button. If I used Fn-Enter as the second button, the first Fn-Enter activated but the second waited for a key press. Unfortunately, when I press Fn-Enter in the normal graphical interface, the calculator(s) won't show up until I hit a normal button (so I can't just get into the habit of hitting the hotkey twice).
I experienced the same problem after changing the hotkey to 0x8a (Fn+C / 'Splendid' Button). While running acpi_listen, most of my hotkeys start with "^@" but any hotkeys that I assign using my calculator script end with at least one "^@" (with nothing at the beginning). This seems like a side effect of something so I hope this helps diagnose my problem.
I am running "Ubuntu 10.04.1 LTS - Lucid Lynx" with a stock kernel.
Edit: I did a search of my File System but the only files labeled as asus-laptop were 3 files by the name of "asus-laptop.ko" (I even searched the hidden files). -
ALLurGroceries Vegan Vermin Super Moderator
That's weird, dbus doesn't show the event until you hit another key, and you're getting nulls (^@) before/after your scancodes?
Maybe this is a bug somewhere, I have no problems doing exactly what you want to do on Sid. Does the same thing happen for all other hotkeys?
Modifying the kernel module is not for beginners. At your own risk, here is how to accomplish that. It's not going to do anything for your play/pause idea, but it will fix your calculator issue, if it can be fixed at all.
First back up the existing module (don't run this twice, see below to restore):
Code:sudo cp /lib/modules/`uname -r`/kernel/drivers/platform/x86/asus-laptop.ko /lib/modules/`uname -r`/kernel/drivers/platform/x86/asus-laptop.ko.bak
Code:sudo apt-get install linux-source-2.6 linux-headers-`uname -r` build-essential libncurses5 libncurses5-dev kernel-package fakeroot
Code:mkdir ~/src cd ~/src tar jxvf /usr/src/linux-source-2.6.32.tar.bz2 cd linux-source-2.6.32 cp /boot/config-`uname -r` .config make oldconfig
Code:gedit +314 drivers/platform/x86/asus-laptop.c &
Code:{KE_KEY, 0xb5, KEY_CALC},
Code:make -C /usr/src/linux-headers-`uname -r` SUBDIRS=`pwd` drivers/platform/x86/asus-laptop.ko
Code:sudo modprobe -r asus_laptop sudo insmod drivers/platform/x86/asus-laptop.ko
Code:sudo modprobe -r asus_laptop sudo modprobe asus_laptop
Code:sudo cp drivers/platform/x86/asus-laptop.ko /lib/modules/`uname -r`/kernel/drivers/platform/x86/asus-laptop.ko
Code:sudo cp /lib/modules/`uname -r`/kernel/drivers/platform/x86/asus-laptop.ko.bak /lib/modules/`uname -r`/kernel/drivers/platform/x86/asus-laptop.ko
Question about custom events
Discussion in 'Linux Compatibility and Software' started by LostHero, Sep 23, 2010.