Hi. 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 linux-2.6.18-xen-3.2.0/drivers/xen/console/console.c 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 Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Keyboard is owned by dom0. There''s not really an easy way to propagate the raw keycodes to a pv domU. For an hvm domU we reverse-map to the raw keycodes in qemu-dm and send those via the emulated pckeyboard. -- Keir On 14/8/08 14:58, "Maxim Gorbachyov" <maxim.gorbachyov@gmail.com> wrote:> Hi. > > 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 > linux-2.6.18-xen-3.2.0/drivers/xen/console/console.c > > 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 > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Maxim Gorbachyov, le Thu 14 Aug 2008 17:58:44 +0400, a écrit :> Could you please suggest what can I do to access raw keycodes?You could use a pvfb instead. That one should have raw keycodes. Samuel _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Keir Fraser writes ("Re: [Xen-devel] Access to raw keycodes in xen domU"):> Keyboard is owned by dom0. There''s not really an easy way to propagate the > raw keycodes to a pv domU. For an hvm domU we reverse-map to the raw > keycodes in qemu-dm and send those via the emulated pckeyboard.There was a discussion of some of this area on qemu-devel recently. Sadly it''s a bit of a mess (in part, inevitably), and it may be difficult to do exactly what you want. If you tell us why you want the raw keycodes - what overall result you''re trying to achieve etc. - then we may be able to suggest some kind of answer. Ian. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
On Thu, Aug 14, 2008 at 6:39 PM, Ian Jackson <Ian.Jackson@eu.citrix.com> wrote:> There was a discussion of some of this area on qemu-devel recently. > Sadly it''s a bit of a mess (in part, inevitably), and it may be > difficult to do exactly what you want. > > If you tell us why you want the raw keycodes - what overall result > you''re trying to achieve etc. - then we may be able to suggest some > kind of answer.There is a binary which sets K_RAW and expects certain codes from keyboard to work. It''s kind of dinosaur, but we have to use it.. Thanx you all who answered. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Maxim Gorbachyov, le Thu 14 Aug 2008 19:09:55 +0400, a écrit :> On Thu, Aug 14, 2008 at 6:39 PM, Ian Jackson <Ian.Jackson@eu.citrix.com> wrote: > > There was a discussion of some of this area on qemu-devel recently. > > Sadly it''s a bit of a mess (in part, inevitably), and it may be > > difficult to do exactly what you want. > > > > If you tell us why you want the raw keycodes - what overall result > > you''re trying to achieve etc. - then we may be able to suggest some > > kind of answer. > > There is a binary which sets K_RAW and expects certain codes from > keyboard to work. It''s kind of dinosaur, but we have to use it..Well, the problem is that since the xen console can be accessed e.g. through ssh, there is really no way to properly return keycodes. If you can not use pvfb, The only half-sane way I see is that you hardcode the translation that your dinosaur binary expects according to the keyboard layout you are using and use that patched version. I really don''t see how that could ever fit generically in xen console. Samuel _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Hello. On Thu, Aug 14, 2008 at 7:21 PM, Samuel Thibault <samuel.thibault@eu.citrix.com> wrote:> Well, the problem is that since the xen console can be accessed e.g. > through ssh, there is really no way to properly return keycodes. If you > can not use pvfb, The only half-sane way I see is that you hardcode the > translation that your dinosaur binary expects according to the keyboard > layout you are using and use that patched version. I really don''t see > how that could ever fit generically in xen console.There were doubts if anyone beside me needs it. Well, just informational, this is the way I did it (see diff attached). Note, some used esc-sequences are not in the default keymap. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel