* [Qemu-devel] Windows vioinput guest driver tablet input bug
@ 2018-02-25 10:21 Justin Gatzen
2018-02-25 11:41 ` Justin Gatzen
0 siblings, 1 reply; 3+ messages in thread
From: Justin Gatzen @ 2018-02-25 10:21 UTC (permalink / raw)
To: qemu-devel; +Cc: Ladi Prosek
Hi,
The vioinput Windows guest driver does not seem to work with mouse wheel or
side buttons for virtio-tablet-pci devices, while virtio-mouse-pci works as
expected. Linux guest drivers are unaffected. Tablets are being categorized as
mice due to the EXPOSE_ABS_AXES_WITH_BUTTONS_AS_MOUSE compile flag. But when
there are no relative REL_X or REL_Y input axes the driver ignores all other
relative axis entries. Mouse wheel is one such relative axis. I've attached a
proof of concept fix for the guest driver that seems to fix both the mouse
wheel and side buttons but I believe this needs a more robust fix and deeper
look at the HIDMouseProbe function.
Thanks,
Justin
diff --git a/vioinput/sys/HidMouse.c b/vioinput/sys/HidMouse.c
index 69dac235..ea188991 100644
--- a/vioinput/sys/HidMouse.c
+++ b/vioinput/sys/HidMouse.c
@@ -325,7 +325,11 @@ HIDMouseProbe(
DynamicArrayReserve(&AxisMap, AXIS_MAP_INITIAL_LENGTH * 2 * sizeof(ULONG));
// Windows won't drive a mouse without at least the X and Y relative axes
- if (InputCfgDataHasBit(pRelAxes, REL_X) &&
InputCfgDataHasBit(pRelAxes, REL_Y))
+ if (InputCfgDataHasBit(pRelAxes, REL_X) &&
InputCfgDataHasBit(pRelAxes, REL_Y)
+#ifdef EXPOSE_ABS_AXES_WITH_BUTTONS_AS_MOUSE
+ || (pMouseDesc->uNumOfButtons > 0 &&
InputCfgDataHasBit(pAbsAxes, ABS_X) && InputCfgDataHasBit(pAbsAxes,
ABS_Y))
+#endif // EXPOSE_ABS_AXES_WITH_BUTTONS_AS_MOUSE
+ )
{
for (i = 0; i < pRelAxes->size; i++)
{
@@ -391,7 +395,7 @@ HIDMouseProbe(
}
#ifdef EXPOSE_ABS_AXES_WITH_BUTTONS_AS_MOUSE
- if (uNumOfRelAxes == 0 &&
+ if ((!InputCfgDataHasBit(pRelAxes, REL_X) ||
!InputCfgDataHasBit(pRelAxes, REL_Y)) &&
pMouseDesc->uNumOfButtons > 0 &&
InputCfgDataHasBit(pAbsAxes, ABS_X) &&
InputCfgDataHasBit(pAbsAxes, ABS_Y))
{
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] Windows vioinput guest driver tablet input bug
2018-02-25 10:21 [Qemu-devel] Windows vioinput guest driver tablet input bug Justin Gatzen
@ 2018-02-25 11:41 ` Justin Gatzen
2018-02-25 15:32 ` Yan Vugenfirer
0 siblings, 1 reply; 3+ messages in thread
From: Justin Gatzen @ 2018-02-25 11:41 UTC (permalink / raw)
To: qemu-devel; +Cc: Ladi Prosek
The last email's diff got mangled due to long lines. The original
source has long lines still but it shouldnt get cut off his time.
Justin,
diff --git a/vioinput/sys/HidMouse.c b/vioinput/sys/HidMouse.c
index 69dac235..528bd3d6 100644
--- a/vioinput/sys/HidMouse.c
+++ b/vioinput/sys/HidMouse.c
@@ -325,7 +325,12 @@ HIDMouseProbe(
DynamicArrayReserve(&AxisMap, AXIS_MAP_INITIAL_LENGTH * 2 * sizeof(ULONG));
// Windows won't drive a mouse without at least the X and Y relative axes
- if (InputCfgDataHasBit(pRelAxes, REL_X) && InputCfgDataHasBit(pRelAxes, REL_Y))
+ if (InputCfgDataHasBit(pRelAxes, REL_X) && InputCfgDataHasBit(pRelAxes, REL_Y)
+#ifdef EXPOSE_ABS_AXES_WITH_BUTTONS_AS_MOUSE
+ || (pMouseDesc->uNumOfButtons > 0 && InputCfgDataHasBit(pAbsAxes, ABS_X)
+ && InputCfgDataHasBit(pAbsAxes, ABS_Y))
+#endif // EXPOSE_ABS_AXES_WITH_BUTTONS_AS_MOUSE
+ )
{
for (i = 0; i < pRelAxes->size; i++)
{
@@ -391,7 +396,8 @@ HIDMouseProbe(
}
#ifdef EXPOSE_ABS_AXES_WITH_BUTTONS_AS_MOUSE
- if (uNumOfRelAxes == 0 &&
+ if ((!InputCfgDataHasBit(pRelAxes, REL_X) ||
+ !InputCfgDataHasBit(pRelAxes, REL_Y)) &&
pMouseDesc->uNumOfButtons > 0 &&
InputCfgDataHasBit(pAbsAxes, ABS_X) && InputCfgDataHasBit(pAbsAxes, ABS_Y))
{
On Sun, Feb 25, 2018 at 05:21:29AM -0500, Justin Gatzen wrote:
> Hi,
>
> The vioinput Windows guest driver does not seem to work with mouse wheel or
> side buttons for virtio-tablet-pci devices, while virtio-mouse-pci works as
> expected. Linux guest drivers are unaffected. Tablets are being categorized as
> mice due to the EXPOSE_ABS_AXES_WITH_BUTTONS_AS_MOUSE compile flag. But when
> there are no relative REL_X or REL_Y input axes the driver ignores all other
> relative axis entries. Mouse wheel is one such relative axis. I've attached a
> proof of concept fix for the guest driver that seems to fix both the mouse
> wheel and side buttons but I believe this needs a more robust fix and deeper
> look at the HIDMouseProbe function.
>
> Thanks,
> Justin
>
>
> diff --git a/vioinput/sys/HidMouse.c b/vioinput/sys/HidMouse.c
> index 69dac235..ea188991 100644
> --- a/vioinput/sys/HidMouse.c
> +++ b/vioinput/sys/HidMouse.c
> @@ -325,7 +325,11 @@ HIDMouseProbe(
> DynamicArrayReserve(&AxisMap, AXIS_MAP_INITIAL_LENGTH * 2 * sizeof(ULONG));
>
> // Windows won't drive a mouse without at least the X and Y relative axes
> - if (InputCfgDataHasBit(pRelAxes, REL_X) &&
> InputCfgDataHasBit(pRelAxes, REL_Y))
> + if (InputCfgDataHasBit(pRelAxes, REL_X) &&
> InputCfgDataHasBit(pRelAxes, REL_Y)
> +#ifdef EXPOSE_ABS_AXES_WITH_BUTTONS_AS_MOUSE
> + || (pMouseDesc->uNumOfButtons > 0 &&
> InputCfgDataHasBit(pAbsAxes, ABS_X) && InputCfgDataHasBit(pAbsAxes,
> ABS_Y))
> +#endif // EXPOSE_ABS_AXES_WITH_BUTTONS_AS_MOUSE
> + )
> {
> for (i = 0; i < pRelAxes->size; i++)
> {
> @@ -391,7 +395,7 @@ HIDMouseProbe(
> }
>
> #ifdef EXPOSE_ABS_AXES_WITH_BUTTONS_AS_MOUSE
> - if (uNumOfRelAxes == 0 &&
> + if ((!InputCfgDataHasBit(pRelAxes, REL_X) ||
> !InputCfgDataHasBit(pRelAxes, REL_Y)) &&
> pMouseDesc->uNumOfButtons > 0 &&
> InputCfgDataHasBit(pAbsAxes, ABS_X) &&
> InputCfgDataHasBit(pAbsAxes, ABS_Y))
> {
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] Windows vioinput guest driver tablet input bug
2018-02-25 11:41 ` Justin Gatzen
@ 2018-02-25 15:32 ` Yan Vugenfirer
0 siblings, 0 replies; 3+ messages in thread
From: Yan Vugenfirer @ 2018-02-25 15:32 UTC (permalink / raw)
To: Justin Gatzen; +Cc: qemu-devel, Ladi Prosek
Hello Justin,
Thanks a lot for the patch proposal.
I opened the issue on virtio-win GitHub page to track the issue: https://github.com/virtio-win/kvm-guest-drivers-windows/issues/249
Best regards,
Yan.
> On 25 Feb 2018, at 13:41, Justin Gatzen <justin.gatzen@gmail.com> wrote:
>
> The last email's diff got mangled due to long lines. The original
> source has long lines still but it shouldnt get cut off his time.
>
> Justin,
>
>
> diff --git a/vioinput/sys/HidMouse.c b/vioinput/sys/HidMouse.c
> index 69dac235..528bd3d6 100644
> --- a/vioinput/sys/HidMouse.c
> +++ b/vioinput/sys/HidMouse.c
> @@ -325,7 +325,12 @@ HIDMouseProbe(
> DynamicArrayReserve(&AxisMap, AXIS_MAP_INITIAL_LENGTH * 2 * sizeof(ULONG));
>
> // Windows won't drive a mouse without at least the X and Y relative axes
> - if (InputCfgDataHasBit(pRelAxes, REL_X) && InputCfgDataHasBit(pRelAxes, REL_Y))
> + if (InputCfgDataHasBit(pRelAxes, REL_X) && InputCfgDataHasBit(pRelAxes, REL_Y)
> +#ifdef EXPOSE_ABS_AXES_WITH_BUTTONS_AS_MOUSE
> + || (pMouseDesc->uNumOfButtons > 0 && InputCfgDataHasBit(pAbsAxes, ABS_X)
> + && InputCfgDataHasBit(pAbsAxes, ABS_Y))
> +#endif // EXPOSE_ABS_AXES_WITH_BUTTONS_AS_MOUSE
> + )
> {
> for (i = 0; i < pRelAxes->size; i++)
> {
> @@ -391,7 +396,8 @@ HIDMouseProbe(
> }
>
> #ifdef EXPOSE_ABS_AXES_WITH_BUTTONS_AS_MOUSE
> - if (uNumOfRelAxes == 0 &&
> + if ((!InputCfgDataHasBit(pRelAxes, REL_X) ||
> + !InputCfgDataHasBit(pRelAxes, REL_Y)) &&
> pMouseDesc->uNumOfButtons > 0 &&
> InputCfgDataHasBit(pAbsAxes, ABS_X) && InputCfgDataHasBit(pAbsAxes, ABS_Y))
> {
>
>
> On Sun, Feb 25, 2018 at 05:21:29AM -0500, Justin Gatzen wrote:
>> Hi,
>>
>> The vioinput Windows guest driver does not seem to work with mouse wheel or
>> side buttons for virtio-tablet-pci devices, while virtio-mouse-pci works as
>> expected. Linux guest drivers are unaffected. Tablets are being categorized as
>> mice due to the EXPOSE_ABS_AXES_WITH_BUTTONS_AS_MOUSE compile flag. But when
>> there are no relative REL_X or REL_Y input axes the driver ignores all other
>> relative axis entries. Mouse wheel is one such relative axis. I've attached a
>> proof of concept fix for the guest driver that seems to fix both the mouse
>> wheel and side buttons but I believe this needs a more robust fix and deeper
>> look at the HIDMouseProbe function.
>>
>> Thanks,
>> Justin
>>
>>
>> diff --git a/vioinput/sys/HidMouse.c b/vioinput/sys/HidMouse.c
>> index 69dac235..ea188991 100644
>> --- a/vioinput/sys/HidMouse.c
>> +++ b/vioinput/sys/HidMouse.c
>> @@ -325,7 +325,11 @@ HIDMouseProbe(
>> DynamicArrayReserve(&AxisMap, AXIS_MAP_INITIAL_LENGTH * 2 * sizeof(ULONG));
>>
>> // Windows won't drive a mouse without at least the X and Y relative axes
>> - if (InputCfgDataHasBit(pRelAxes, REL_X) &&
>> InputCfgDataHasBit(pRelAxes, REL_Y))
>> + if (InputCfgDataHasBit(pRelAxes, REL_X) &&
>> InputCfgDataHasBit(pRelAxes, REL_Y)
>> +#ifdef EXPOSE_ABS_AXES_WITH_BUTTONS_AS_MOUSE
>> + || (pMouseDesc->uNumOfButtons > 0 &&
>> InputCfgDataHasBit(pAbsAxes, ABS_X) && InputCfgDataHasBit(pAbsAxes,
>> ABS_Y))
>> +#endif // EXPOSE_ABS_AXES_WITH_BUTTONS_AS_MOUSE
>> + )
>> {
>> for (i = 0; i < pRelAxes->size; i++)
>> {
>> @@ -391,7 +395,7 @@ HIDMouseProbe(
>> }
>>
>> #ifdef EXPOSE_ABS_AXES_WITH_BUTTONS_AS_MOUSE
>> - if (uNumOfRelAxes == 0 &&
>> + if ((!InputCfgDataHasBit(pRelAxes, REL_X) ||
>> !InputCfgDataHasBit(pRelAxes, REL_Y)) &&
>> pMouseDesc->uNumOfButtons > 0 &&
>> InputCfgDataHasBit(pAbsAxes, ABS_X) &&
>> InputCfgDataHasBit(pAbsAxes, ABS_Y))
>> {
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-02-25 15:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-25 10:21 [Qemu-devel] Windows vioinput guest driver tablet input bug Justin Gatzen
2018-02-25 11:41 ` Justin Gatzen
2018-02-25 15:32 ` Yan Vugenfirer
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).