Node-Virtualization/node-virtualbox

Update keyboardputscancode example in README

Stylizit opened this issue · 2 comments

The documentation defines the usage of keyboardputscancode as such:

var sequence = [
  { key: 'SHIFT', type: 'make',  code: SCAN_CODES['SHIFT']},
  { key: 'A',     type: 'make',  code: SCAN_CODES['A']},
  { key: 'SHIFT', type: 'break', code: SCAN_CODES.getBreakCode('SHIFT')},
  { key: 'A',     type: 'break', code: SCAN_CODES.getBreakCode('A')}
];
virtualbox.keyboardputscancode("machine_name", sequence, function keyscan_callback(err) {
    if (error) throw error;
    console.log('Sent SHIFT A');
});

But it throws an error:

VBoxManage: error: Error '[object' is not a hex byte!

To reflect the way scan-codes.js works, I think the example should be instead:

var sequence = [
  SCAN_CODES['SHIFT'][0],
  SCAN_CODES['A'][0],
  SCAN_CODES.getBreakCode('SHIFT')[0],
  SCAN_CODES.getBreakCode('A')[0]
];
stale commented

This issue has been automatically marked as stale because it has not received any attention in 90 days. It will be closed in 14 days if no further activity occurs. Thank you for your contribution! (I'm a bot.)

stale commented

This issue has been automatically closed due to inactivity. (I'm a bot.)