Index: vws ================================================================== --- vws +++ vws @@ -161,10 +161,11 @@ if options.snapshot or options.args: print >>sys.stderr, ("Cannot change qemu options. " + "VM is already running") if options.cdrom: options.file = options.cdrom[0] + options.id = None cmd_cdrom(options) if options.gui: uri = spiceurl(options) os.system((config.get('tools', 'viewer') + "&") % uri) elif not options.stopped: @@ -354,10 +355,15 @@ if not match: print >>sys.stderr, "No sound recording in progress" sys.exit(1) else: print send_command(options.sock, "stopcapture " + match.group(1)) + +def cmd_sendkey(options): + """ vws sendkey """ + print send_command(options.sock,"sendkey "+options.keyspec); + def cmd_version(dummy_options): """ vws cersion """ print VERSION @@ -710,10 +716,12 @@ p = new_command(cmds, 'screenshot', help='take a screenshot') p.add_argument('filename', help='PPM image filename to write screenshot to') p = new_command(cmds, 'record', help='Record audio output from VM') p.add_argument('filename', help='wav file to record autdio to') new_command(cmds, 'stoprecord', help='stop recording audio') +p = new_command(cmds, 'sendkey', help='Send a keystroke to VM') +p.add_argument('keyspec',help='key specification like ctrl-alt-delete'); # Create new VM p = new_command(cmds, 'create', help="Create new VW") p.add_argument("--no-usb", help="Disable USB controller", action='store_const', const=False, default=True, dest="usb") p.add_argument("--size", metavar='size', help="Size of primary disk images", Index: vws.mkd ================================================================== --- vws.mkd +++ vws.mkd @@ -44,10 +44,12 @@ **vws record** *name* *filename.wav* **vws stoprecord** *name* +**vws sendkey** *name* *keyspec* + **vws monitor** *name* **vws spiceuri** *name* **vws version** @@ -260,10 +262,44 @@ **vws spiceuri** *machine* Prints out URI you should feed into your spice viewer to access this machine. + +**vws sendkey** *machine* *keyspec* + +Allows to send some key combination to the virtual machine. For example +if windows screen is locked spice client is sometimes unable to deliver +key stroke to the virtual machine in order to get it out of sleep. + +In this case **vws sendkey** *machine* **ctrl-alt-delete** helps. + +One **vws sendkey** command sends only one key combination + +See **KEY SPECS** below about format of key specification. + +KEY SPECS +========= + +Following key names are avalable: + +shift shift_r alti alt_r altgr altgr_r ctrl ctrl_r menu + +esc 1 2 3 4 5 6 7 8 +9 0 minus equal backspace tab +q w e r t y u i o p ret +a s d f g h j k l +z x c v b n m comma dot slash +asterisk spc caps_lock f1 f2 f3 f4 f5 f6 f7 f8 f9 +f10 num_lock scroll_lock kp_divide kp_multiply +kp_subtract kp_add kp_enter kp_decimal sysrq kp_0 kp_1 +kp_2 kp_3 kp_4 kp_5 kp_6 kp_7 kp_8 kp_9 < f11 f12 +print home pgup pgdn end left up +down right insert delete + +Several key names can be joined together with '-' sign to form key with +modificators sequence. CONFIGURATION FILE ================== Configuration file for [vws], which uses standard .ini format.