[vbox-dev] How-to put keyboard scancodes ?

Nikolay Igotti nikolay.igotti at oracle.com
Fri Mar 11 09:00:01 GMT 2011

vboxshell.py has typeGuest command which does exactly what you need. 
Function you may be interested in is
Also note that vboxshell.py  allows to capture guest input (keyboard, 
mouse or both) and later play it back:
see recordDemo and playbackDemo commands.


Alexey Eromenko wrote:
> Simple scancodes work fine, such as sending "q" letter:
> console.keyboard.putScancode(0x10)
> But how to put, say, caps lock, then "Q", then caps lock again, and small "q" ?
> # caps lock pressed, locked
> console.keyboard.putScancode(0x3a)
> # 'Q' should be sent
> console.keyboard.putScancode(0x10)
> # caps lock pressed, unlocked
> console.keyboard.putScancode(0x3a)
> # 'q' should be sent
> console.keyboard.putScancode(0x10)
> This doesn't work. What's wrong ?
> I tried to release caps lock with:
> console.keyboard.putScancodes([0xf0,0x3a])
> ..no effect...
> I got table here:
> http://www.win.tue.nl/~aeb/linux/kbd/scancodes-10.html#translationtable
> ..and have no idea which set corresponds to VirtualBox.
> I have read section "5.41.3 putScancode" of SDKRef.pdf, and
> unfortunately in mentions zero about scancodes, where to get the
> table, and how it should work...
> Can you add more data in the SDKRef.PDF about it?
> Qemu has much simpler architecture, where actual keys are translated
> by the software, so I can send:
> "tab" or "a" or "ctrl-alt-delete" or "alt-f4"... whatever.
> I would like to see something similar in VirtualBox.

More information about the vbox-dev mailing list