[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] Tips for adding "sendkeys"

From: David Barrett
Subject: Re: [Qemu-devel] Tips for adding "sendkeys"
Date: Thu, 28 Feb 2008 16:19:58 -0800
User-agent: Thunderbird (X11/20071022)

I agree, it's only for convenience. Sendkey is great for individual keystrokes, but it's not super convenient for batches of keystrokes.

Incidentally, what's the policy for patch submission to Qemu? If I write this patch and submit it, what are the odds that it would get accepted in the mainline?

If the policy is only bugfixes and functional enhancements are accepted (a reasonable policy), then I'll just make due -- I don't want to tie myself to a custom fork forever.

But if the policy includes convenience additions like this, then I might take a crack at it.



Alexander Graf wrote:
Hi David,

On Feb 28, 2008, at 10:39 PM, David Barrett wrote:

Hi there, can you give me any tips for where to get started adding a new function "sendkeys" to the monitor that is essentially like "sendkey" except for multiple keystrokes?

I don't really think that is needed. The sendkey command was implemented to send real keystrokes. A 'sendkeys' can always be simulated using multiple strokes.

I'm using Qemu for some automated testing (in conjunction with AutoIt on the guest XP image) and it's working great. Essentially, I've set up:

1) A stock XP guest image with all windows closed except for a big command prompt that has keyboard focus.

2) A script on the Linux host that launches the guest with "-loadvm" and "-monitor stdio" that uses "sendkey" to start an AutoIt script inside the guest.

The AutoIt script does all the heavy lifting of actually running the automated test. However, I need "sendkey" in order to download the latest test script into the guest OS, and then to run it.

This works fine today, but I'm finding my Linux host scripts full of long strings of:

    sendkey ret
    sendkey a
    sendkey kp_decimal
    sendkey a
    sendkey u
    sendkey 3
    sendkey ret

I'd much rather do something like:

    sendkeys wget\ret
    sendkeys script.au3\ret

You could just create a script/program that converts your command line to several 'sendkey' commands. An idea of how to implement that in C is attached.

I'm guessing this is a very straightforward addition to the monitor code. However, the Qemu source is rather imposing and I'm not sure where to start.

This would be monitor.c. Afaik every handling of the monitor command line is done there. I still don't really think it's necessary.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]