* [RFC, PATCH] horizontal mouse wheel in mousedrv
@ 2007-12-25 15:49 Pierre Ossman
2008-01-03 16:25 ` Dmitry Torokhov
0 siblings, 1 reply; 4+ messages in thread
From: Pierre Ossman @ 2007-12-25 15:49 UTC (permalink / raw)
To: dmitry.torokhov, linux-input
From: Pierre Ossman <drzeus@drzeus.cx>
Support the horizontal wheel present on many mice via the
/dev/input/mice device by using the somewhat odd protocol extension
of sending double wheel movements for the extra wheel.
This is of course a rather error prone protocol extension, but it is
found in some hardware and works well enough in practice. It is also
the only horizontal wheel protocol supported by Xorg's mouse driver.
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
diff --git a/drivers/input/mousedev.c b/drivers/input/mousedev.c
index 78c3ea7..2976b42 100644
--- a/drivers/input/mousedev.c
+++ b/drivers/input/mousedev.c
@@ -50,7 +50,7 @@ module_param(tap_time, uint, 0644);
MODULE_PARM_DESC(tap_time, "Tap time for touchpads in absolute mode (msecs)");
struct mousedev_hw_data {
- int dx, dy, dz;
+ int dx, dy, dz, dw;
int x, y;
int abs_event;
unsigned long buttons;
@@ -85,7 +85,7 @@ enum mousedev_emul {
};
struct mousedev_motion {
- int dx, dy, dz;
+ int dx, dy, dz, dw;
unsigned long buttons;
};
@@ -215,6 +215,10 @@ static void mousedev_rel_event(struct mousedev *mousedev,
case REL_WHEEL:
mousedev->packet.dz -= value;
break;
+
+ case REL_HWHEEL:
+ mousedev->packet.dw += value;
+ break;
}
}
@@ -297,9 +301,10 @@ static void mousedev_notify_readers(struct mousedev *mousedev,
p->dx += packet->dx;
p->dy += packet->dy;
p->dz += packet->dz;
+ p->dw += packet->dw;
p->buttons = mousedev->packet.buttons;
- if (p->dx || p->dy || p->dz ||
+ if (p->dx || p->dy || p->dz || p->dw ||
p->buttons != client->last_buttons)
client->ready = 1;
@@ -394,7 +399,7 @@ static void mousedev_event(struct input_handle *handle,
mousedev_notify_readers(mousedev_mix, &mousedev->packet);
mousedev->packet.dx = mousedev->packet.dy =
- mousedev->packet.dz = 0;
+ mousedev->packet.dz = mousedev->packet.dw = 0;
mousedev->packet.abs_event = 0;
}
break;
@@ -602,8 +607,13 @@ static void mousedev_packet(struct mousedev_client *client,
switch (client->mode) {
case MOUSEDEV_EMUL_EXPS:
- ps2_data[3] = mousedev_limit_delta(p->dz, 7);
- p->dz -= ps2_data[3];
+ if (p->dw) {
+ ps2_data[3] = mousedev_limit_delta(2 * p->dw, 7);
+ p->dw -= ps2_data[3] / 2;
+ } else {
+ ps2_data[3] = mousedev_limit_delta(p->dz, 7);
+ p->dz -= ps2_data[3];
+ }
ps2_data[3] = (ps2_data[3] & 0x0f) | ((p->buttons & 0x18) << 1);
client->bufsiz = 4;
break;
@@ -625,7 +635,7 @@ static void mousedev_packet(struct mousedev_client *client,
break;
}
- if (!p->dx && !p->dy && !p->dz) {
+ if (!p->dx && !p->dy && !p->dz && !p->dw) {
if (client->tail == client->head) {
client->ready = 0;
client->last_buttons = p->buttons;
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [RFC, PATCH] horizontal mouse wheel in mousedrv
2007-12-25 15:49 [RFC, PATCH] horizontal mouse wheel in mousedrv Pierre Ossman
@ 2008-01-03 16:25 ` Dmitry Torokhov
2008-01-03 17:27 ` Pierre Ossman
0 siblings, 1 reply; 4+ messages in thread
From: Dmitry Torokhov @ 2008-01-03 16:25 UTC (permalink / raw)
To: Pierre Ossman; +Cc: linux-input
Hi Pierre,
On Dec 25, 2007 10:49 AM, Pierre Ossman <drzeus-list@drzeus.cx> wrote:
> From: Pierre Ossman <drzeus@drzeus.cx>
>
> Support the horizontal wheel present on many mice via the
> /dev/input/mice device by using the somewhat odd protocol extension
> of sending double wheel movements for the extra wheel.
>
> This is of course a rather error prone protocol extension, but it is
> found in some hardware and works well enough in practice. It is also
> the only horizontal wheel protocol supported by Xorg's mouse driver.
>
I'd rather not change the legacy mousedev driver. The extension is
rather non-standard and there is no telling what applications might
break. Please use evdev driver, it should support horizontal scrolling
AFAIK.
--
Dmitry
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFC, PATCH] horizontal mouse wheel in mousedrv
2008-01-03 16:25 ` Dmitry Torokhov
@ 2008-01-03 17:27 ` Pierre Ossman
2008-01-03 18:27 ` Dmitry Torokhov
0 siblings, 1 reply; 4+ messages in thread
From: Pierre Ossman @ 2008-01-03 17:27 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: linux-input
On Thu, 3 Jan 2008 11:25:21 -0500
"Dmitry Torokhov" <dmitry.torokhov@gmail.com> wrote:
>
> I'd rather not change the legacy mousedev driver. The extension is
> rather non-standard and there is no telling what applications might
> break. Please use evdev driver, it should support horizontal scrolling
> AFAIK.
>
It does, but it doesn't support hot-plug. Not something the kernel can be blamed for, but for my use case it was easier to do this modification to the kernel rather than to teach Xorg hot-plug.
Rgds
--
-- Pierre Ossman
Linux kernel, MMC maintainer http://www.kernel.org
PulseAudio, core developer http://pulseaudio.org
rdesktop, core developer http://www.rdesktop.org
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFC, PATCH] horizontal mouse wheel in mousedrv
2008-01-03 17:27 ` Pierre Ossman
@ 2008-01-03 18:27 ` Dmitry Torokhov
0 siblings, 0 replies; 4+ messages in thread
From: Dmitry Torokhov @ 2008-01-03 18:27 UTC (permalink / raw)
To: Pierre Ossman; +Cc: linux-input
On Jan 3, 2008 12:27 PM, Pierre Ossman <drzeus-list@drzeus.cx> wrote:
> On Thu, 3 Jan 2008 11:25:21 -0500
> "Dmitry Torokhov" <dmitry.torokhov@gmail.com> wrote:
>
> >
> > I'd rather not change the legacy mousedev driver. The extension is
> > rather non-standard and there is no telling what applications might
> > break. Please use evdev driver, it should support horizontal scrolling
> > AFAIK.
> >
>
> It does, but it doesn't support hot-plug. Not something the kernel can be blamed for, but for my use case it was easier to do this modification to the kernel rather than to teach Xorg hot-plug.
>
As far as I remember the hotplug for X is being actively developed at
the moment.
--
Dmitry
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-01-03 18:27 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-25 15:49 [RFC, PATCH] horizontal mouse wheel in mousedrv Pierre Ossman
2008-01-03 16:25 ` Dmitry Torokhov
2008-01-03 17:27 ` Pierre Ossman
2008-01-03 18:27 ` Dmitry Torokhov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).