From 445733f3a13f26d5de8f6f278211fd1c9830eb66 Mon Sep 17 00:00:00 2001 From: Dawid Zamirski Date: Tue, 7 Apr 2015 11:37:35 -0400 Subject: [PATCH] vbox: Register IKeyboard with the unified API. The IKeyboard COM object is needed to implement virDomainSendKey and is available in all supported VBOX versions. --- src/vbox/vbox_tmpl.c | 27 +++++++++++++++++++++++++++ src/vbox/vbox_uniformed_api.h | 8 ++++++++ 2 files changed, 35 insertions(+) diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c index 37ec8e1c44..22eecd4fba 100644 --- a/src/vbox/vbox_tmpl.c +++ b/src/vbox/vbox_tmpl.c @@ -3436,6 +3436,12 @@ _consoleGetDisplay(IConsole *console, IDisplay **display) return console->vtbl->GetDisplay(console, display); } +static nsresult +_consoleGetKeyboard(IConsole *console, IKeyboard **keyboard) +{ + return console->vtbl->GetKeyboard(console, keyboard); +} + static nsresult _progressWaitForCompletion(IProgress *progress, PRInt32 timeout) { @@ -4599,6 +4605,20 @@ _hardDiskGetFormat(IHardDisk *hardDisk, PRUnichar **format) return hardDisk->vtbl->GetFormat(hardDisk, format); } +static nsresult +_keyboardPutScancode(IKeyboard *keyboard, PRInt32 scancode) +{ + return keyboard->vtbl->PutScancode(keyboard, scancode); +} + +static nsresult +_keyboardPutScancodes(IKeyboard *keyboard, PRUint32 scancodesSize, + PRInt32 *scanCodes, PRUint32 *codesStored) +{ + return keyboard->vtbl->PutScancodes(keyboard, scancodesSize, scanCodes, + codesStored); +} + static bool _machineStateOnline(PRUint32 state) { return ((state >= MachineState_FirstOnline) && @@ -4757,6 +4777,7 @@ static vboxUniformedIConsole _UIConsole = { .TakeSnapshot = _consoleTakeSnapshot, .DeleteSnapshot = _consoleDeleteSnapshot, .GetDisplay = _consoleGetDisplay, + .GetKeyboard = _consoleGetKeyboard, }; static vboxUniformedIProgress _UIProgress = { @@ -4951,6 +4972,11 @@ static vboxUniformedIHardDisk _UIHardDisk = { .GetFormat = _hardDiskGetFormat, }; +static vboxUniformedIKeyboard _UIKeyboard = { + .PutScancode = _keyboardPutScancode, + .PutScancodes = _keyboardPutScancodes, +}; + static uniformedMachineStateChecker _machineStateChecker = { .Online = _machineStateOnline, .Inactive = _machineStateInactive, @@ -5008,6 +5034,7 @@ void NAME(InstallUniformedAPI)(vboxUniformedAPI *pVBoxAPI) pVBoxAPI->UIHNInterface = _UIHNInterface; pVBoxAPI->UIDHCPServer = _UIDHCPServer; pVBoxAPI->UIHardDisk = _UIHardDisk; + pVBoxAPI->UIKeyboard = _UIKeyboard; pVBoxAPI->machineStateChecker = _machineStateChecker; #if VBOX_API_VERSION <= 2002000 || VBOX_API_VERSION >= 4000000 diff --git a/src/vbox/vbox_uniformed_api.h b/src/vbox/vbox_uniformed_api.h index babc1e6e5f..5d190ced77 100644 --- a/src/vbox/vbox_uniformed_api.h +++ b/src/vbox/vbox_uniformed_api.h @@ -286,6 +286,7 @@ typedef struct { PRUnichar *description, IProgress **progress); nsresult (*DeleteSnapshot)(IConsole *console, vboxIIDUnion *iidu, IProgress **progress); nsresult (*GetDisplay)(IConsole *console, IDisplay **display); + nsresult (*GetKeyboard)(IConsole *console, IKeyboard **keyboard); } vboxUniformedIConsole; /* Functions for IProgress */ @@ -533,6 +534,12 @@ typedef struct { nsresult (*GetFormat)(IHardDisk *hardDisk, PRUnichar **format); } vboxUniformedIHardDisk; +typedef struct { + nsresult (*PutScancode)(IKeyboard *keyboard, PRInt32 scancode); + nsresult (*PutScancodes)(IKeyboard *keyboard, PRUint32 scancodesSize, + PRInt32 *scanCodes, PRUint32 *codesStored); +} vboxUniformedIKeyboard; + typedef struct { bool (*Online)(PRUint32 state); bool (*Inactive)(PRUint32 state); @@ -591,6 +598,7 @@ typedef struct { vboxUniformedIHNInterface UIHNInterface; vboxUniformedIDHCPServer UIDHCPServer; vboxUniformedIHardDisk UIHardDisk; + vboxUniformedIKeyboard UIKeyboard; uniformedMachineStateChecker machineStateChecker; /* vbox API features */ bool domainEventCallbacks; -- GitLab