LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
LinkBack Search this Thread
Old 06-06-2010, 05:46 AM   #1
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,512
Blog Entries: 27

Rep: Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174
How to make special keys run commands without X?


Hello

I'm installing Slackware 13.1 on a Samsung N150 netbook and am stuck trying to make the special keys do their normal functions when using a virtual terminal, that is not under X. Under X + Xfce it can be done via Menu->Settings->Keyboard->"Application Shortcuts".

In essence the question is how to make a special key (example Fn+Up to increase screen brightness) run a command in the background.

EDIT: Changed title and text to make clear that the command should not run in a virtual terminal but while the display is being used for a virtual terminal, that is after Ctrl+Alt+F2 for example.

Best

Charles

Last edited by catkin; 06-06-2010 at 08:07 AM.
 
Old 06-06-2010, 11:14 PM   #2
T3slider
Senior Member
 
Registered: Jul 2007
Distribution: Slackware64-14.0
Posts: 2,231

Rep: Reputation: 573Reputation: 573Reputation: 573Reputation: 573Reputation: 573Reputation: 573
This page should be helpful. Also see /etc/inputrc and `man 3 readline` for more information. If you use screen you can always configure keybindings there as well.
 
Old 06-07-2010, 02:17 AM   #3
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,512
Blog Entries: 27

Original Poster
Rep: Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174
Thanks T3slider

Thinking this through some more it's a hardware-level requirement. Ideally it would work at a virtual terminal even before login. Maybe it is not possible because all (?) keystrokes are intercepted by the login process that replaces the getty-type process but Linux is very flexible and powerful so I still have some hope. Perhaps keystrokes are passed to the login process via the kernel or perhaps there is a hardware event in hal land ...
 
Old 06-07-2010, 02:48 AM   #4
dive
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Slackware
Posts: 3,183

Rep: Reputation: 284Reputation: 284Reputation: 284
Fn keys are usually controlled through acpi events if the hardware doesn't do it alone.

Check out /etc/acpi/acpi_handler.sh
 
1 members found this post helpful.
Old 06-07-2010, 03:38 AM   #5
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,512
Blog Entries: 27

Original Poster
Rep: Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174
Quote:
Originally Posted by dive View Post
Fn keys are usually controlled through acpi events if the hardware doesn't do it alone.

Check out /etc/acpi/acpi_handler.sh
Thanks dive

It looks as if Fn+<whatever> does not create ACPI events.

In the default installation, the /etc/acpi/events directory has a single file, defaults, which looks as if it simply passes all events to acpi_handler.sh:
Code:
root@CW9:~# cat /etc/acpi/events/default | grep -E -v '^#|^$'
event=.*
action=/etc/acpi/acpi_handler.sh %e
The as-installed acpi_handler.sh reports everything except the power button as "not defined":
Code:
root@CW9:~# cat /etc/acpi/acpi_handler.sh | grep -E -v '^#|^$'
IFS=${IFS}/
set $@
case "$1" in
  button)
    case "$2" in
      power) /sbin/init 0
         ;;
      *) logger "ACPI action $2 is not defined"
         ;;
    esac
    ;;
  *)
    logger "ACPI group $1 / action $2 is not defined"
    ;;
esac
Searching the /var/log/* files for such reports shows very few and none associated with Fn+ keys:
Code:
root@CW9:/var/log# grep 'ACPI group' * | sed 's/.*logger: //' | sort | uniq
ACPI group ac_adapter / action ADP1 is not defined
ACPI group battery / action BAT1 is not defined
ACPI group processor / action CPU0 is not defined
ACPI group processor / action CPU1 is not defined
 
  


Reply

Tags
command, virtual terminal


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Have to log out of a virtual terminal twice in order to exit virtual terminals narnie Linux - Newbie 5 02-24-2010 12:49 AM
How I Make More Virtual Terminal Other Than 6 Pre Available Terminals Tauseef Anwar Red Hat 2 05-25-2008 01:37 AM
special keys of laptop alinsoar Linux - Laptop and Netbook 2 11-01-2005 02:40 PM
how to make/run startup scripts/commands ViN86 Slackware 3 04-24-2004 10:02 AM
Special Keys raven Linux - Laptop and Netbook 0 10-16-2003 09:21 AM


All times are GMT -5. The time now is 02:25 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration