Page 1 of 1
keyboard integration?
Posted: 9. Mar 2015, 03:11
by Cadet Mahoney
I would like to have the keyboard inputs in the Guest (xp) mirrored to the host (win7). So keyboard inputs are mirrored from guest to host (but not in reverse).
This is to enable my controller inputs from a game controller which runs in XP (but not in Win7).
So for example the gamepad controller has the directional inputs Up down left right assigned to it's D-PAD. I can see this still functions even when I'm in another window in WIN7. I assign letters to the buttons and see they still type out in notepad (for example) even when the VBOX window is not in focus - since the usb gamepad controller is locked/assigned to vbox.
So basically I get my controller function to work in Win7 using Vbox as a bridge of sorts as long as the keyboard inputs are mirrored from guest to host. Anyway this is possible?
Re: keyboard integration?
Posted: 9. Mar 2015, 16:04
by scottgus1
Sounds like you have the controller set to be used in the guest, and have successfully got the controller sending keys in the guest. Then you want to send those keys back to your host as well? I don't think I've ever seen anything in Virtualbox that can do that. Only suggestion I could make is to google if someone has made a utility to do that across networked PCs. If so, you can network the host & guest and try the utility.
Re: keyboard integration?
Posted: 9. Mar 2015, 17:55
by mpack
To clarify: there is no "keyboard mirroring" going on in VirtualBox. VirtualBox is simulating the hardware of a guest keyboard, using inputs from the host (usually but not always the host keyboard). In fact that is in line with any normal host application -> key presses eventually translate into action messages inside the application.
I'm not at all clear on how this process could be done in reverse... <host key press> translates to <simulated guest kbd press> translates to <host key press?> oops! Infinite loop!
Re: keyboard integration?
Posted: 9. Mar 2015, 18:30
by scottgus1
I think OP is shooting for "game controller ignored by host and USB-attached to guest" -> keyboard input in guest -> keyboard input into host.
Final result apparently - game controller not compatible with host OS is jury-rigged to produce results in the host consistent with its having been compatible.
Sounds like he has step 1 and 2 working. Step 3 is the wonky one, which I reckon does not exist (yet).
Re: keyboard integration?
Posted: 9. Mar 2015, 19:56
by mpack
scottgus1 wrote:I think OP is shooting for "game controller ignored by host and USB-attached to guest" -> keyboard input in guest -> keyboard input into host.
... which just leads to another
-> keyboard input to guest step doesn't it? I.e. the infinite loop again. How does the guest or even the host know which host application to direct guest keystrokes to?
But still, as you say the conversation is moot anyway. Whether or not such a feature is possible, VirtualBox doesn't currently have it.
Re: keyboard integration?
Posted: 10. Mar 2015, 13:10
by Cadet Mahoney
mpack wrote:scottgus1 wrote:I think OP is shooting for "game controller ignored by host and USB-attached to guest" -> keyboard input in guest -> keyboard input into host.
... which just leads to another
-> keyboard input to guest step doesn't it? I.e. the infinite loop again. How does the guest or even the host know which host application to direct guest keystrokes to?
But still, as you say the conversation is moot anyway. Whether or not such a feature is possible, VirtualBox doesn't currently have it.
As I understand it the usb gamepad inputs are locked/assigned to the guest in vbox, when the vbox window is not in focus (i.e. in the background or not the top window) any keyboard inputs from the host (in this case win7) are ignored by vbox.
However when the gamepad is used inputs still register in vbox (i.e. I can see letters are still typed out in notepad which have been assigned to buttons when I press them on the controller) despite vbox not being the focused window and I'm doing something else in Windows 7.
So if I can mirror keyboard presses in vbox to host it acts as a bridge allowing the game controller to work in win7. The keyboard isn't actually being pressed, the game controller's software is mimicking the keyboard in winXP so when you press a button on the controller (which is a usb device locked/reserved to the Guest in vbox) WinXP thinks a key is being pressed. Hope that makes sense.
I understand the feature is not available, just wondering if it is a plausible solution and throwing the idea out there. . . as it would be cool and not just for me. Something other virtual software wouldn't have if someone got it running.
Re: keyboard integration?
Posted: 10. Mar 2015, 13:15
by mpack
Well yes, the USB gamepad can be directly connected to the guest, but the point at which data enters the loop doesn't stop it being a loop! The guest (somehow) injects the keystrokes into the host keyboard driver, which passed them right back to the guest.
Even leaving aside all other considerations, the malware potential alone would probably rule out consideration of this suggestion. One of the major selling points of a VM is that it's a secure sandbox, which it can hardly be if it's capable of injecting keyboard commands into the host.
Re: keyboard integration?
Posted: 10. Mar 2015, 14:32
by scottgus1
Cadet, you may be able to make this yourself, if the latency can be dealt with enough to make a game still playable. There may be a way to receive keyboard presses in a program running in the guest, then transmit the entered key to the host through a network pipe, then a VBscript-style SendKeys script to fire the received keys at the window that's active in the host (hopefully the game window). If your guest windows is not then selected, then Virtualbox's keyboard integration won't be active and you won't get an infinite loop. Just got to figure out fast scripts and you're in like Flynn.
Or, get a new controller...

Re: keyboard integration?
Posted: 10. Mar 2015, 19:38
by Cadet Mahoney
thanks for the replies both, will look into it.