Opened 15 years ago

Closed 5 years ago

#5764 closed defect (fixed)

Arrow and other keys not working when starting with VBoxSDL => Fixed in SVN

Reported by: harmscon Owned by:
Component: other Version: VirtualBox 3.1.0
Keywords: VBoxSDL arrow keys Cc:
Guest type: other Host type: other

Description (last modified by Michael Thayer)

Host: Ubuntu 9.10 32bit i386
Guest: Windows XP SP3 32bit i386
VirtualBox: 3.1

After upgrading the Host OS (from Ubuntu 8.04) the arrow keys, Home, End, Insert, PgUp, PgDwn, and / on the numeric keypad no longer work when starting the virtual machine with VBoxSDL.

The upgrade was an export VBox virtual machine, format hard drive, clean install new OS and then import the vbox Virtual machine.

I use the following command to start VirtualBox:

/usr/bin/gksudo -u fred 'VBoxSDL --startvm freds_VM --nofstoggle --termacpi'

After the upgrade mentioned above, the keyboard keys stopped working (sometimes the Start menu will open, other times it's like a right mouse click is pressed.)

If I start Virtual box like this:

/usr/bin/gksudo -u fred VBoxManage startvm freds_VM

all keys work as expected and as they always have, no matter which of these two methods I use to start the VM.

So this appears to be specific to VBoxSDL.

Attachments (2)

VBox.log (51.7 KB ) - added by harmscon 15 years ago.
VBoxSDL.cpp.cursorkeys.diff (622 bytes ) - added by lsbz 14 years ago.
Vbox SDL frontend cursor keys patch

Download all attachments as: .zip

Change History (18)

by harmscon, 15 years ago

Attachment: VBox.log added

comment:1 by Frank Mehnert, 14 years ago

Description: modified (diff)
Resolution: worksforme
Status: newclosed

I'm quite sure your problems are gone when you append the --evdevkeymap switch to your VBoxSDL parameters.

comment:2 by Michel Petit, 14 years ago

Resolution: worksforme
Status: closedreopened


I have the same problem on a windows vista host. I tried option '--evdevkeymap' but this option doesn't exist (Version 3.1.6 r59338).

Any idea?

Thanks in advance.

comment:3 by Frank Mehnert, 14 years ago

That option does exist in VBox 3.1.6. What happens if you start your VM with

VBoxSDL --evdevkeymap --startvm VM_NAME

(replace VM_NAME with the name of a VM)?

comment:4 by Michel Petit, 14 years ago

It displays the usage message :

PS C:\Program Files\Sun\VirtualBox> & 'C:\Program Files\Sun\VirtualBox\VBoxSDL.exe' --evdevkeymap --startvm Debian
Sun VirtualBox SDL GUI version 3.1.6
(C) 2005-2010 Sun Microsystems, Inc.
All rights reserved.

Error: unrecognized switch '--evdevkeymap'
 --startvm <uuid|name>    Virtual machine to start, either UUID or name
 --hda <file>             Set temporary first hard disk to file
 --fda <file>             Set temporary first floppy disk to file

comment:5 by Frank Mehnert, 14 years ago

Which host is that?

comment:6 by Frank Mehnert, 14 years ago

Hmm, looks like this is a Windows host. The --evdevkeymap switch is only available for Linux hosts. Yours must be another issue then.

comment:7 by Michel Petit, 14 years ago

Yes it is a windows host (as mentionned in my first message). Do I have to create to create a new ticket?

comment:8 by Frederic, 14 years ago


I have a the same problem with VirtualBox 3.2.0 (ubuntu 10.4 host + ubuntu 9.10 guest). '--evdevkeymap' helps but the new command "VBoxManage --startvm uuid --type sdl" does not allows to pass this option.

I would use the VBoxSDL command, but since this release, VBoxSDL does not set the title attribute of the X windows anymore (tested with xlsclients command line util), which is a MUST in my integration setup. Actually I am stuck.

Regards, Frederic

comment:9 by Frank Mehnert, 14 years ago

Summary: Arrow and other keys not working when starting with VBoxSDLArrow and other keys not working when starting with VBoxSDL => Fixed in SVN

This will be fixed in the next maintenance release. VBoxSDL will inherit the keyboard handling from the Qt GUI.

comment:10 by Frank Mehnert, 14 years ago

Resolution: fixed
Status: reopenedclosed

comment:11 by rbhkamal, 14 years ago

Resolution: fixed
Status: closedreopened

Did the fix go into the OSE? I'm still having the same exact problem with VirtualBox 3.2.12 OSE and 3.2.8 OSE (both self compiled)

Windows 7 32bit Guest: All operating systems have the problem

There are other strange issues with keyboard mapping, one user complained about the "\" key mapping to the "]" key... still investigating.

I tried to launch the same VM using VirtualBox.exe and the problem was NOT there, so there must be something wrong with vboxsdl.exe.

I also noticed that the first "UP Arrow" key works and prints "[[A" but the second and on print "8"

comment:12 by rbhkamal, 14 years ago

Sorry, the first up arrow key press prints the following:


Then it starts printing the following:


VirtualBox is running on Windows 7 32bit

Guest machine is a debian linux 2.6 with Xorg 7.4

comment:13 by lsbz, 14 years ago

Below patch against 3.2.12 seems to work for Windows hosts.

--- VBoxSDL-org.cpp 2010-12-01 18:09:24 +0100 +++ VBoxSDL.cpp 2010-12-29 23:50:35 +0100 @@ -2919,7 +2919,7 @@

return (gfAbsoluteMouseHost && gfAbsoluteMouseGuest);


-#if defined(RT_OS_DARWIN) +#if defined(RT_OS_DARWIN)
defined(RT_OS_OS2) defined(RT_OS_WINDOWS)


  • Fallback keycode conversion using SDL symbols. *

@@ -3392,7 +3392,7 @@

RTPrintf("scancode=%#x -> %#x\n", ev->keysym.scancode, keycode);


-#elif RT_OS_OS2

+#elif defined(RT_OS_OS2)

keycode = Keyevent2KeycodeFallback(ev);

#endif /* RT_OS_DARWIN */

return keycode;

by lsbz, 14 years ago

Attachment: VBoxSDL.cpp.cursorkeys.diff added

Vbox SDL frontend cursor keys patch

comment:14 by rbhkamal, 14 years ago

Verified that the fix works for the arrow keys. I tested on Windows 7 64bit with Linux 2.4 guest.

I know this is not the place to ask questions, but do you think this would fix the cases were the "\" key maps to the "]" key?

Thanks, RK

comment:15 by lsbz, 14 years ago


Backslash '\' works OK on my keyboard in Win7 host and Fedora 14 guest. Maybe this is caused by a keyboard mapping in the guest?!

About the patch: it converts the SDL internal key codes back to "raw" key input for the guest. The source file has it prepared, but did not have it connected for Windows hosts.

comment:16 by Michael Thayer, 5 years ago

Description: modified (diff)
Resolution: fixed
Status: reopenedclosed
Note: See TracTickets for help on using tickets.

© 2023 Oracle
ContactPrivacy policyTerms of Use