- Timestamp:
- May 7, 2008 5:43:00 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManage.cpp
r8611 r8675 443 443 " pause|resume|reset|poweroff|savestate|\n" 444 444 " acpipowerbutton|acpisleepbutton|\n" 445 " keyboardputscancode <hex> [<hex> ...]|\n" 445 446 " setlinkstate<1-4> on|off |\n" 446 447 " usbattach <uuid>|<address> |\n" … … 5564 5565 CHECK_ERROR_BREAK (console, SleepButton()); 5565 5566 } 5567 else if (strcmp(argv[1], "keyboardputscancode") == 0) 5568 { 5569 ComPtr<IKeyboard> keyboard; 5570 CHECK_ERROR_BREAK(console, COMGETTER(Keyboard)(keyboard.asOutParam())); 5571 5572 if (argc <= 1 + 1) 5573 { 5574 errorArgument("Missing argument to '%s'. Expected IBM PC AT set 2 keyboard scancode(s) as hex byte(s).", argv[1]); 5575 rc = E_FAIL; 5576 break; 5577 } 5578 5579 /* Arbitrary restrict the length of a sequence of scancodes to 1024. */ 5580 LONG alScancodes[1024]; 5581 int cScancodes = 0; 5582 5583 /* Process the command line. */ 5584 int i; 5585 for (i = 1 + 1; i < argc && cScancodes < RT_ELEMENTS(alScancodes); i++, cScancodes++) 5586 { 5587 if ( isxdigit (argv[i][0]) 5588 && isxdigit (argv[i][1]) 5589 && argv[i][2] == 0) 5590 { 5591 uint8_t u8Scancode; 5592 int rc = RTStrToUInt8Ex(argv[i], NULL, 16, &u8Scancode); 5593 if (RT_FAILURE (rc)) 5594 { 5595 RTPrintf("Error: converting '%s' returned %Vrc!\n", argv[i], rc); 5596 rc = E_FAIL; 5597 break; 5598 } 5599 5600 alScancodes[cScancodes] = u8Scancode; 5601 } 5602 else 5603 { 5604 RTPrintf("Error: '%s' is not a hex byte!\n", argv[i]); 5605 rc = E_FAIL; 5606 break; 5607 } 5608 } 5609 5610 if (FAILED(rc)) 5611 break; 5612 5613 if ( cScancodes == RT_ELEMENTS(alScancodes) 5614 && i < argc) 5615 { 5616 RTPrintf("Error: too many scancodes, maximum %d allowed!\n", RT_ELEMENTS(alScancodes)); 5617 rc = E_FAIL; 5618 break; 5619 } 5620 5621 /* Send scancodes to the VM. 5622 * Note: 'PutScancodes' did not work here. Only the first scancode was transmitted. 5623 */ 5624 for (i = 0; i < cScancodes; i++) 5625 { 5626 CHECK_ERROR_BREAK(keyboard, PutScancode(alScancodes[i])); 5627 RTPrintf("Scancode[%d]: 0x%02X\n", i, alScancodes[i]); 5628 } 5629 } 5566 5630 else if (strncmp(argv[1], "setlinkstate", 12) == 0) 5567 5631 {
Note:
See TracChangeset
for help on using the changeset viewer.