WARNING - OLD ARCHIVES

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/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] Re: [patch] pvfb: Split mouse and keyboard into separate dev

To: Gerd Hoffmann <kraxel@xxxxxxx>
Subject: [Xen-devel] Re: [patch] pvfb: Split mouse and keyboard into separate devices.
From: Markus Armbruster <armbru@xxxxxxxxxx>
Date: Wed, 07 Feb 2007 15:31:24 +0100
Cc: Xen devel list <xen-devel@xxxxxxxxxxxxxxxxxxx>, "Daniel P. Berrange" <berrange@xxxxxxxxxx>
Delivery-date: Wed, 07 Feb 2007 06:31:01 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <45C9B880.5060107@xxxxxxx> (Gerd Hoffmann's message of "Wed, 07 Feb 2007 12:31:12 +0100")
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/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <45C9B880.5060107@xxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux)
Gerd Hoffmann <kraxel@xxxxxxx> writes:

>   Hi,
>
> This patch creates two separate input devices for keyboard and mouse
> events.  Also includes some key bitmap fixes (allow all keyboard keys,
> allow eight mouse buttons).
>
> I hope everyone is happy with that now after the lengthy discussion ;)
>
> please apply,
>   Gerd
>
> -- 
> Gerd Hoffmann <kraxel@xxxxxxx>
> pvfb: Split mouse and keyboard into separate devices.
>
> This patch creates two separate input devices for keyboard and mouse
> events.  The reason for this is to separate them in the linux input
> layer and allow them being routed different ways.
>
> Use case:  Configure the X-Server like this to get the mouse
> events directly from the linux input layer, which has the major
> advantage that absolute coordinates work correctly:
>
> Section "InputDevice"
>   Driver       "evdev"
>   Identifier   "Mouse"
>   Option       "Device" "/dev/input/event<nr>"
> EndSection
>
> This makes the keyboard stop working though in case mouse and
> keyboard events are coming through the same input device, at least
> with older Xorg (6.9) versions.
>
> Signed-off-by: Gerd Hoffmann <kraxel@xxxxxxx>

New, not mentioned in the changelog:

* Initialization of struct input_dev members phys, id.bustype,
  id.vendor, id.product.

* Take care of the FIXME regarding initialization struct input_dev
  member keybit (thanks!).

* Take care of the TODO to enable all pointer buttons.  Perhaps should
  better go in together with the fix to tools/xenfb/vncfb.c posted by
  Daniel.

No objections to any of these.  They ought to be documented in the
changelog, though.  You might prefer separate changesets for some of
them.

> ---
>  linux-2.6-xen-sparse/drivers/xen/fbfront/xenkbd.c |   93 
> +++++++++++++++-------
>  1 file changed, 65 insertions(+), 28 deletions(-)
>
> Index: 
> build-32-unstable-13816/linux-2.6-xen-sparse/drivers/xen/fbfront/xenkbd.c
> ===================================================================
> --- 
> build-32-unstable-13816.orig/linux-2.6-xen-sparse/drivers/xen/fbfront/xenkbd.c
> +++
> build-32-unstable-13816/linux-2.6-xen-sparse/drivers/xen/fbfront/xenkbd.c
[...]
> @@ -56,23 +58,36 @@ static irqreturn_t input_handler(int rq,
>       rmb();                  /* ensure we see ring contents up to prod */
>       for (cons = page->in_cons; cons != prod; cons++) {
>               union xenkbd_in_event *event;
> +             struct input_dev *dev;
>               event = &XENKBD_IN_RING_REF(page, cons);
>  
> +             dev = info->ptr;
>               switch (event->type) {
>               case XENKBD_TYPE_MOTION:
> -                     input_report_rel(info->dev, REL_X, event->motion.rel_x);
> -                     input_report_rel(info->dev, REL_Y, event->motion.rel_y);
> +                     input_report_rel(dev, REL_X, event->motion.rel_x);
> +                     input_report_rel(dev, REL_Y, event->motion.rel_y);
>                       break;
>               case XENKBD_TYPE_KEY:
> -                     input_report_key(info->dev, event->key.keycode, 
> event->key.pressed);
> +                     dev = NULL;
> +                     if (test_bit(event->key.keycode, info->kbd->keybit))
> +                             dev = info->kbd;
> +                     if (test_bit(event->key.keycode, info->ptr->keybit))
> +                             dev = info->ptr;
> +                     if (dev)
> +                             input_report_key(dev, event->key.keycode,
> +                                              event->key.pressed);
> +                     else
> +                             printk("xenkbd: unhandled keycode 0x%x\n",
> +                                    event->key.keycode);
>                       break;
>               case XENKBD_TYPE_POS:
> -                     input_report_abs(info->dev, ABS_X, event->pos.abs_x);
> -                     input_report_abs(info->dev, ABS_Y, event->pos.abs_y);
> +                     input_report_abs(dev, ABS_X, event->pos.abs_x);
> +                     input_report_abs(dev, ABS_Y, event->pos.abs_y);
>                       break;
>               }
> +             if (dev)
> +                     input_sync(dev);

Can !dev happen?

>       }
> -     input_sync(info->dev);
>       mb();                   /* ensure we got ring contents */
>       page->in_cons = cons;
>       notify_remote_via_irq(info->irq);
[...]

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel