LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-10-2014, 08:41 PM   #1
actmnophn
Member
 
Registered: Mar 2008
Posts: 53

Rep: Reputation: 15
map keyboard keys to commands (headless server)


I have a headless computer that is running as a server I want to add a wireless remote that works as HID keyboard to run scripts and the like. The remote is connected via usb and is recognized. the question I have is how to check what the kernel receives on keypresses and how to do "stuff" with those keypresses.

Thanks.

edit: I know it is connected and working somewhat because if i "cat /dev/input/event1" i see something when i press buttons.

Last edited by actmnophn; 03-10-2014 at 09:01 PM.
 
Old 03-11-2014, 07:04 AM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 26,177

Rep: Reputation: 6087Reputation: 6087Reputation: 6087Reputation: 6087Reputation: 6087Reputation: 6087Reputation: 6087Reputation: 6087Reputation: 6087Reputation: 6087Reputation: 6087
One suggestion would be to use lirc. (http://www.lirc.org/) It will do the decoding and can be configured to control the computer to do lots of stuff.
 
Old 03-11-2014, 10:06 AM   #3
heinblöd
Member
 
Registered: May 2004
Location: France
Distribution: Slackware Gentoo
Posts: 186

Rep: Reputation: 31
The command you can use is showkey .

The 'stuff' you could put in .bashrc or /etc/profile and define as aliases or have a look at this :
http://www.tldp.org/HOWTO/Keyboard-a...e-HOWTO-5.html
 
Old 03-11-2014, 07:05 PM   #4
actmnophn
Member
 
Registered: Mar 2008
Posts: 53

Original Poster
Rep: Reputation: 15
I am going to look into those ideas thanks. One point that I am wondering is that the console is not logged into so the keys are not going to work as aliases I imagine.
Thanks again
 
Old 03-11-2014, 11:12 PM   #5
actmnophn
Member
 
Registered: Mar 2008
Posts: 53

Original Poster
Rep: Reputation: 15
I got lirc setup but i still dont know how to run scripts based on key presses. I found xbindkeys but cannot run xbindkeys -k because i dont have x...
I am a little(?) lost...
Thanks
 
Old 03-12-2014, 09:51 AM   #6
michaelk
Moderator
 
Registered: Aug 2002
Posts: 26,177

Rep: Reputation: 6087Reputation: 6087Reputation: 6087Reputation: 6087Reputation: 6087Reputation: 6087Reputation: 6087Reputation: 6087Reputation: 6087Reputation: 6087Reputation: 6087
This might help:
http://www.g-loaded.eu/2006/01/10/ho...-and-use-lirc/
http://lifehacker.com/5527752/contro...ote-using-lirc
 
Old 07-29-2017, 04:27 AM   #7
charsi101
LQ Newbie
 
Registered: Jul 2017
Posts: 2

Rep: Reputation: Disabled
Apologies for being three years late but I am trying to do exactly the same thing.

xbindkeys is working perfectly for me and I don't mind having x running on my raspberry pi. But so far I haven't figured out a way to start x automatically on boot.

I have also found another method which doesn't require x running. https://github.com/wertarbyte/triggerhappy It runs as a daemon listening for keystrokes and runs scripts.
 
  


Reply


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How to match X keyboard layout with the the kernel keyboard map? Didier Spaier Slackware 11 03-24-2013 02:40 PM
[xkb, xmodmap] how to map keys to combos and combos to keys me-macias Linux - Software 0 08-21-2009 02:49 PM
USB keyboard function keys/numeric keys on boot raypen Linux - Hardware 4 04-17-2008 03:07 PM
Map Keys Under 3dDesktop michaeljh2000 Slackware 0 01-07-2005 02:38 PM
how to map extra keys on k/b need some help here! jollyjoice Slackware 1 07-24-2004 09:51 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:33 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration