Hello, I enter this command in my console, and it performs these actions non-stop, how do I do it only 1 time?
VBoxManage.exe controlvm Win10 keyboardputscancode 51 1c
how to use the command correctly?
-
- Site Moderator
- Posts: 39156
- Joined: 4. Sep 2008, 17:09
- Primary OS: MS Windows 10
- VBox Version: PUEL
- Guest OSses: Mostly XP
Re: how to use the command correctly?
VirtualBox only sends a single event. What you are seeing is standard guest OS keyboard driver behaviour.
Keyboard events consist of a key press, hopefully followed some time later by a key release. In between those events the guest keyboard driver will typically implement an automatic key repeat.
If you don't want it to repeat then send the key release code (same code or'ed with 0x80).
Currently you are simulating two stuck keys.
Keyboard events consist of a key press, hopefully followed some time later by a key release. In between those events the guest keyboard driver will typically implement an automatic key repeat.
If you don't want it to repeat then send the key release code (same code or'ed with 0x80).
Currently you are simulating two stuck keys.
-
- Posts: 2
- Joined: 1. Jan 2023, 20:08
Re: how to use the command correctly?
I tried to type like this, am I doing something wrong?mpack wrote:VirtualBox only sends a single event. What you are seeing is standard guest OS keyboard driver behaviour.
Keyboard events consist of a key press, hopefully followed some time later by a key release. In between those events the guest keyboard driver will typically implement an automatic key repeat.
If you don't want it to repeat then send the key release code (same code or'ed with 0x80).
Currently you are simulating two stuck keys.
enter 2 commands
1- VBoxManage.exe controlvm Win10(11) keyboardputscancode 51 1c
2- VBoxManage.exe controlvm Win10(11) keyboardputscancode 80
not stop
i try
1- VBoxManage.exe controlvm Win10(11) keyboardputscancode 51 1c
2- VBoxManage.exe controlvm Win10(11) keyboardputscancode 51 1c
not stop...
-
- Site Moderator
- Posts: 20965
- Joined: 30. Dec 2009, 20:14
- Primary OS: MS Windows 10
- VBox Version: PUEL
- Guest OSses: Windows, Linux
Re: how to use the command correctly?
TLDR: You need to read and comprehend the Virtualbox manual and linked tutorials. You're still sending only the "press" codes, not the "release" codes. And sending code 80 isn't what was instructed nor what's needed to release the keys so they don't repeat in the VM OS.
*********************
From my read of your scan codes, you're trying to press Page Down (hex 51) then Enter (hex 1c)
From the manual on VBoxManage controlvm "vm name" keyboardputscancode
Mpack's instruction to "or the scan code with 0x80" does not mean to send scan code 80. It means to do a logic OR operation with the hex press scan code and the hex value 80, to get the hex release scan code. The linked tutorial in the manual mentions the same thing:
Alternative to hex math: web-search more for a list of scan codes that include both press and release codes for each key. The list is out there, I just found one.
*********************
From my read of your scan codes, you're trying to press Page Down (hex 51) then Enter (hex 1c)
From the manual on VBoxManage controlvm "vm name" keyboardputscancode
Going to that link reveals that keyboard scan codes require a "press" code and a "release" code. In other words, a code for the key going down, then another code for the key going up. So to simulate a use of the key 'A', you'd need the press code for A, then the release code for A. You're only entering the press code. Thus the key stays down and never comes up.: Sends commands using keycodes to the VM. Keycodes are documented in the public domain. For
example: http://www.win.tue.nl/~aeb/linux/kbd/scancodes-1.html.
Mpack's instruction to "or the scan code with 0x80" does not mean to send scan code 80. It means to do a logic OR operation with the hex press scan code and the hex value 80, to get the hex release scan code. The linked tutorial in the manual mentions the same thing:
Adding 0x80 is the same thing as OR'ing with 0x80. It's hexadecimal math, and you'll have to wrap your head around it to understand how to use hex keyboard scan codes. A decent host OS calculator will have a programming setting to allow you to do hexadecimal math. You simply set to hex input, enter the hex press scan code, then add hex 80. the result is the release scan code.The scancode for key release (`break') is obtained from it by setting the high order bit (adding 0x80 = 128).
Alternative to hex math: web-search more for a list of scan codes that include both press and release codes for each key. The list is out there, I just found one.
-
- Volunteer
- Posts: 5668
- Joined: 14. Feb 2019, 03:06
- Primary OS: Mac OS X other
- VBox Version: PUEL
- Guest OSses: Linux, Windows 10, ...
- Location: Germany
Re: how to use the command correctly?
One possible scan code sequence would be "51 d1 1c 9c". But I'd prefer "e0 51 e0 d1 1c 9c", because it'd be independent of the NumLock state then. VirtualBox automatically waits 10 ms between the scan codes, BTW.