From: Markus Armbruster <armbru@redhat.com> Date: Tue, 8 Jul 2008 17:15:58 -0400 Subject: [xen] pvfb: frontend mouse wheel support Message-id: m3tzf0axgx.fsf@crossbow.pond.sub.org O-Subject: [PATCH RHEL-5.3] bz 446235: Xen PVFB frontend mouse wheel support Bugzilla: 446235 RH-Acked-by: Gerd Hoffmann <kraxel@redhat.com> RH-Acked-by: Bill Burns <bburns@redhat.com> Mouse wheel support straightforwardly ported from the driver in XenSource's 2.6.18. Changesets: http://xenbits.xensource.com/linux-2.6.18-xen.hg?rev/354 http://xenbits.xensource.com/linux-2.6.18-xen.hg?rev/439 http://xenbits.xensource.com/linux-2.6.18-xen.hg?rev/449 Fully backward compatible, but of course it needs the backend patched to do anything useful (bug 250401). Please ACK. diff --git a/drivers/xen/fbfront/xenkbd.c b/drivers/xen/fbfront/xenkbd.c index ad04c54..cb409ed 100644 --- a/drivers/xen/fbfront/xenkbd.c +++ b/drivers/xen/fbfront/xenkbd.c @@ -61,6 +61,9 @@ static irqreturn_t input_handler(int rq, void *dev_id, struct pt_regs *regs) switch (event->type) { case XENKBD_TYPE_MOTION: + if (event->motion.rel_z) + input_report_rel(info->dev, REL_WHEEL, + -event->motion.rel_z); input_report_rel(info->dev, REL_X, event->motion.rel_x); input_report_rel(info->dev, REL_Y, event->motion.rel_y); break; @@ -68,6 +71,9 @@ static irqreturn_t input_handler(int rq, void *dev_id, struct pt_regs *regs) input_report_key(info->dev, event->key.keycode, event->key.pressed); break; case XENKBD_TYPE_POS: + if (event->pos.rel_z) + input_report_rel(info->dev, REL_WHEEL, + -event->pos.rel_z); input_report_abs(info->dev, ABS_X, event->pos.abs_x); input_report_abs(info->dev, ABS_Y, event->pos.abs_y); break; @@ -109,7 +115,7 @@ int __devinit xenkbd_probe(struct xenbus_device *dev, input_dev->keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT); /* TODO additional buttons */ - input_dev->relbit[0] = BIT(REL_X) | BIT(REL_Y); + input_dev->relbit[0] = BIT(REL_X) | BIT(REL_Y) | BIT(REL_WHEEL); /* FIXME not sure this is quite right */ for (i = 0; i < 256; i++) diff --git a/include/xen/interface/io/kbdif.h b/include/xen/interface/io/kbdif.h index be8c915..e9160c3 100644 --- a/include/xen/interface/io/kbdif.h +++ b/include/xen/interface/io/kbdif.h @@ -38,6 +38,7 @@ struct xenkbd_motion __u8 type; /* XENKBD_TYPE_MOTION */ __s32 rel_x; /* relative X motion */ __s32 rel_y; /* relative Y motion */ + __s32 rel_z; /* relative Z motion (wheel) */ }; struct xenkbd_key @@ -52,6 +53,7 @@ struct xenkbd_position __u8 type; /* XENKBD_TYPE_POS */ __s32 abs_x; /* absolute X position (in FB pixels) */ __s32 abs_y; /* absolute Y position (in FB pixels) */ + __s32 rel_z; /* relative Z motion (wheel) */ }; #define XENKBD_IN_EVENT_SIZE 40