Merge pull request #5987 from mcandre/multibyte-scancodes

send multibyte scancodes accurately to virtualbox
This commit is contained in:
Megan Marsh 2018-03-12 16:23:41 -07:00 committed by GitHub
commit 5055fa66aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 1 deletions

View File

@ -91,7 +91,16 @@ func (s *StepTypeBootCommand) Run(_ context.Context, state multistep.StateBag) m
return multistep.ActionHalt
}
if err := driver.VBoxManage("controlvm", vmName, "keyboardputscancode", code); err != nil {
var codes []string
for i := 0; i < len(code)/2; i++ {
codes = append(codes, code[i*2:i*2+2])
}
args := []string{"controlvm", vmName, "keyboardputscancode"}
args = append(args, codes...)
if err := driver.VBoxManage(args...); err != nil {
err := fmt.Errorf("Error sending boot command: %s", err)
state.Put("error", err)
ui.Error(err.Error())