Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Hardware
User Name
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?


  Search this Thread
Old 05-13-2007, 06:00 AM   #1
Registered: Jun 2005
Distribution: Fedora 18, Ubuntu 11.10, Ubuntu Server 11.10, DamnSmallLinux 3.4.4, FreeDOS 1.1, OpenBSD 5.0
Posts: 194

Rep: Reputation: 31
IR Remote: Keycodes but no scancodes?


I have a Hauppauge WinTV-HVR110 TV-Card, and that infrared remote control that came along with it.

Now I'd like to use that remote as pseudo-keyboard for my desktop.

I learned, that there are many ways how to make that remote usable in linux.

First thing I tried, was assigning Keysymbols. This works semi-well, some keycodes are the same keycodes that my normal keybord sends. This isn't that much of a problem, since they match pretty well (Numpad on remote sends numbers, Media-key match the Media-keys on my keyboard). But some keys simply don't work.
xev doesn't get any readings from the device on those buttons, so my first thought was, that they're non-functional.

However, when I tried the remote under a text-terminal (no X), I discovered something rather interesting:

when I run showkey -k (keycodes output), I get Keycodes fore _every_ key. This leads to the conclusion, that every key on the remote actually _IS_ functional.
But when I run showkey -s (scancodes) I only get codes for the same keys, that I get keycodes under X with.

But how is this possible? I get Keycodes, for nonexistent scancodes?

The Keycodes for the scancode-less keys are strangely high: Ranging from 353 to 412.

Since I couldn't fix that problem in two days of work, I followed the advice of a friend of mine, and tried LIRC.

But this turned out not to be satisfactory as well.

Passing commands to irexec works well, however this is not really handy, when it comes to things like passing a "volume_up" event to the desktop environment.

I can send key-events to applications with irxevent, when I assign the proper keysymbol to be passed to that application.

This works well for some applications - like XINE - but I'd like to pass certain events so my KDesktop-Environment, "volupe_up" for instance. Sending XF86... keys seems to be a general problem for irxevent, though. I'd like them to have the functionality, the media key on my keyboard have, sending XF86... keycodes to the desktop.

Any ideas?



Last edited by polemon; 05-13-2007 at 06:11 AM.
Old 05-17-2007, 04:16 AM   #2
Senior Member
Registered: Jul 2004
Location: Lower Rhine region, Germany
Distribution: Slackware64 14.2 and current, SlackwareARM current
Posts: 1,602

Rep: Reputation: 126Reputation: 126
I hope I understood you right. You can edit $HOME/.Xmodmap. If you use a graphical login manager it's $HOME/.xresources if I remember right. Part of my .Xmodmap file:
keycode 174 = XF86AudioLowerVolume
keycode 176 = XF86AudioRaiseVolume
keycode 160 = XF86AudioMute
keycode 162 = XF86AudioPlay
keycode 164 = XF86AudioStop
keycode 144 = XF86AudioPrev
keycode 153 = XF86AudioNext
keycode 236 = XF86Mail
keycode 229 = XF86Search
keycode 230 = XF86Go
keycode 178 = XF86HomePage
keycode 223 = XF86Sleep
keycode 222 = XF86PowerOff
keycode 227 = XF86WakeUp
The keycodes come from my keyboards extra keys, so you of course have to modify them.
Then depending on your Desktop Environment or Window Manager you should use the specific way to assign shortcuts I guess. I am running IceWM and use aumix to deal with audio volume, but I think in KDE's control center you should find a way to assign shortcuts.
Old 02-12-2009, 06:58 PM   #3
LQ Newbie
Registered: Feb 2009
Location: Chile
Distribution: Debian lenny 2.6.26
Posts: 3

Rep: Reputation: 0
Question showkeys: keycode but no scancode

I have a similar problem, Did you solve your problem?

I have connected my aluminium apple keyboard in my linux box but some keys are not working (F3 for example), showkeys report keycodes but no scancode.

xev show nothing, not detected at all for those keys.

Last edited by pelainux; 02-12-2009 at 07:00 PM. Reason: error
Old 02-13-2009, 04:58 AM   #4
Senior Member
Registered: Jul 2004
Location: Lower Rhine region, Germany
Distribution: Slackware64 14.2 and current, SlackwareARM current
Posts: 1,602

Rep: Reputation: 126Reputation: 126
If you press the F3 key with your keyboard, do you get some scancode at the end of "dmesg" output?
Old 02-14-2009, 07:34 AM   #5
LQ Newbie
Registered: Feb 2009
Location: Chile
Distribution: Debian lenny 2.6.26
Posts: 3

Rep: Reputation: 0
Nop, I get no info in dmesg.

I have an interesting new piece of information: I have another Linux box (older), I plugged my apple keyboard on it, then I turned it on.
The keyboard didn't work until the SO start (seems the BIOS is not able to manage the USB keyboard) but after, the keyboard works with a wrong mapping but the F3 works.

After my reaserch (several hours) I conclude: "when no scancode but keycode in showkey() and no info in dmess is driver issue"
Next step: check the drivers in both computers.

Have somebody a diferent conclusion?
Old 02-15-2011, 06:15 PM   #6
LQ Newbie
Registered: Feb 2011
Posts: 3

Rep: Reputation: 1
my solution

Hi all!
I had this problem too with my hp pavilion, i had some mediakeys (dvd key) and some ir remote keys mapped to a keycode but no scancode!!
Problem is X reads only the first 255 keycodes, so you have to remap the key u wish to use to a lower keycode. However not having a scancode makes this impossible to do!
The fact is showkey -s does not get real scancode but a re-interpretation of the scancode! This happens with kernel 2.6, while in 2.4 this was not true!
However, as pointed out by Coacher on archlinux bbs, 2.6.9 and above kernels support atkbd.softraw=0 boot parameter.
All you have to do is boot with this parameter, use showkey -s to get the scancode and map it to a free keycode UNDER 255 (dumpkeys helps a lot here)!!

Oh i forgot: if no scancode is visible even with that kernel parameter then the driver is the problem!

Old 04-11-2013, 06:46 PM   #7
Registered: Apr 2013
Distribution: Snuckware
Posts: 240

Rep: Reputation: 16
Could anyone follow up on this and if they managed to solve it?

I'm having a similar problem. No scancodes from an input device but only keycodes. I want to reassign scancodes from the input device to other keys using keymap.


hauppauge, ir, kde, keycode, lirc, remote, xf86

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
How to make extra keys work on acer aspire 9113? They don't have scancodes! gkiagia Linux - Laptop and Netbook 4 10-20-2006 01:48 PM
mono keycodes trscookie Programming 0 10-10-2006 06:24 PM
External USB NumPad giving bad scancodes Kuhlemannp Linux - Hardware 0 07-26-2006 09:03 AM
Logitech Multimedia keys don't generate scancodes Itzac Linux - Hardware 1 03-22-2005 01:28 PM
ncurses and keycodes grantm Programming 0 07-24-2003 12:14 PM > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 07:50 PM.

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