This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


[Xen-devel] Access to raw keycodes in xen domU

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] Access to raw keycodes in xen domU
From: "Maxim Gorbachyov" <maxim.gorbachyov@xxxxxxxxx>
Date: Thu, 14 Aug 2008 17:58:44 +0400
Delivery-date: Thu, 14 Aug 2008 06:59:09 -0700
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:mime-version:content-type:content-transfer-encoding :content-disposition; bh=KNoWbjtqiC5Ervi+PC1E6rSNb5iIckuPXQzTjId5/Bs=; b=iVPbJAjogODcqenFrGfIZ6Nys1+BKKei0Khg6U08nDrbB/kjqqQgCSviLQuGZgJp2u U8ZmZp0nWnZEp6KX2GDdL+AV8HzGkGshwHRHmyagjvgAyoL7zq49Vw0ynH3JTfTuOcJ7 HXQG1cvgtCcQ9aBWiYdB/kf560eIxl2QWDYlk=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type :content-transfer-encoding:content-disposition; b=box2VpRdMF7l6c1SnAyZM+iuFbqrZJA8f+5++ZPrzsLBxpzMjJCRaA5dWKGp2F4TYr uxd2gSQwT6NpZVFH52c6HkczuAW6Fwsr4u58kvOPwJCV9wYSyEMek0o0x46+bIRdtjKQ FB6ZTLGQmy38oeQ8Ru/bW56OSDtuN+n69XSjk=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx

There is a need to have access to raw keycodes in xen domU (like
showkey (1)). Using xen-hypervisor-3.2 and linux-2.6.18-xen-3.2.0 with
these parameters:

kernel = "/my/vmlinuz"
memory = 128
name = "dn1"
vif = [ '' ]
disk = [ 'tap:aio:/my/img,hda1,w' ]
root = "/dev/hda1 ro"
extra = "2 xencons=tty"

I run "# strace showkey" inside domU and get this:
open("/dev/tty", O_RDWR)                = 3
ioctl(3, KDGKBTYPE, 0x7fff91e9da17)     = -1 EINVAL (Invalid argument)

Indeed there is no ioctl() implementation assigned to
xencons_ops.ioctl in

I've tried assigning xencons_ops.ioctl to something like that:

static int xencons_ioctl(struct tty_struct *tty, struct file * file,
        unsigned int cmd, unsigned long arg)
        unsigned char ucval;
        long val;

        switch (cmd) {
        case KDGKBTYPE:
                ucval = KB_101;
                return put_user(ucval, (char __user *)arg);

        case KDGKBMODE:
                val = K_UNICODE;
                return put_user(val, (long __user *)arg);

        case KDSKBMODE:
                return 0;
        return -ENOIOCTLCMD;

It's enough to make showkey run, but it does not report correct
keycodes. I think I have to do something like

HYPERVISOR_console_io(CONSOLEIO_ioctl, ... )

but there is no CONSOLEIO_ioctl.

Could you please suggest what can I do to access raw keycodes?

Xen-devel mailing list