Skip to contentSkip to conversation

usb-hid: Fix 0/0 position for Windows in tablet mode

PATCH In review Jan Kiszka 4 participants 9 messages Jun 24, 2011 – Jul 30, 2011

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 usb-hid: Fix 0/0 position for Windows in tablet mode

For unknown reasons, Windows drivers (tested with XP and Win7) ignore usb-tablet events that move the pointer to 0/0. So always set bit 0 of the coordinates.

---
 hw/usb-hid.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
hw/usb-hid.c +4 -2
index d711b5c..2b9a451 100644
@@ -457,8 +457,10 @@ static void usb_pointer_event_combine(USBPointerEvent *e, int xyrel,
         e->xdx += x1;
         e->ydy += y1;
     } else {
-        e->xdx = x1;
-        e->ydy = y1;
+        /* Windows drivers do not like the 0/0 position and ignore such
+         * events. */
+        e->xdx = x1 | 1;
+        e->ydy = y1 | 1;
     }
     e->dz += z1;
 }
#1 lore raw

Am 24.06.2011 um 16:27 schrieb Jan Kiszka:

Quoted 22 lines

For unknown reasons, Windows drivers (tested with XP and Win7) ignore usb-tablet events that move the pointer to 0/0. So always set bit 0 of the coordinates.

---
hw/usb-hid.c | 6 ++++--

1 files changed, 4 insertions(+), 2 deletions(-)
hw/usb-hid.c +1 -2
index d711b5c..2b9a451 100644
@@ -457,8 +457,10 @@ static void  
 usb_pointer_event_combine(USBPointerEvent *e, int xyrel,
        e->xdx += x1;
        e->ydy += y1;
    } else {
-        e->xdx = x1;
-        e->ydy = y1;
+        /* Windows drivers do not like the 0/0 position and ignore  

such

hw/usb-hid.c static void usb_pointer_event_combine(USBPointerEvent *e, int xyrel, · line 463

Quoted 3 lines
hw/usb-hid.c +3 -0
+         * events. */
+        e->xdx = x1 | 1;
+        e->ydy = y1 | 1;

Doesn't this change mean we can't access any other even pixel either?

Andreas

Quoted 3 lines
    }
    e->dz += z1;
}
#2 lore raw
Quoted 20 lines · Andreas Färber

Am 24.06.2011 um 16:27 schrieb Jan Kiszka:

Quoted 18 lines

For unknown reasons, Windows drivers (tested with XP and Win7) ignore usb-tablet events that move the pointer to 0/0. So always set bit 0 of the coordinates.

---
hw/usb-hid.c | 6 ++++--

1 files changed, 4 insertions(+), 2 deletions(-)
hw/usb-hid.c +0 -0
index d711b5c..2b9a451 100644
@@ -457,8 +457,10 @@ static void
 usb_pointer_event_combine(USBPointerEvent *e, int xyrel,
        e->xdx += x1;
        e->ydy += y1;
    } else {
Quoted 8 lines

hw/usb-hid.c static void usb_pointer_event_combine(USBPointerEvent *e, int xyrel, · line 463

Quoted 6 lines
hw/usb-hid.c +4 -2
-        e->xdx = x1;
-        e->ydy = y1;
+        /* Windows drivers do not like the 0/0 position and ignore such
+         * events. */
+        e->xdx = x1 | 1;
+        e->ydy = y1 | 1;

Doesn't this change mean we can't access any other even pixel either?

Only on 32767x32767 screens (that's the resolution of the tablet).

Jan

#3 lore raw

Am 25.06.2011 um 14:55 schrieb Jan Kiszka:

Quoted 31 lines · Andreas Färber
Quoted 21 lines

Am 24.06.2011 um 16:27 schrieb Jan Kiszka:

Quoted 19 lines

For unknown reasons, Windows drivers (tested with XP and Win7) ignore usb-tablet events that move the pointer to 0/0. So always set bit 0 of the coordinates.

---
hw/usb-hid.c | 6 ++++--

1 files changed, 4 insertions(+), 2 deletions(-)
hw/usb-hid.c +0 -1
index d711b5c..2b9a451 100644
@@ -457,8 +457,10 @@ static void
 usb_pointer_event_combine(USBPointerEvent *e, int xyrel,
       e->xdx += x1;
       e->ydy += y1;
   } else {
-        e->xdx = x1;
Quoted 8 lines

hw/usb-hid.c static void usb_pointer_event_combine(USBPointerEvent *e, int xyrel, · line 463

Quoted 6 lines
hw/usb-hid.c +1 -1
-        e->ydy = y1;
+        /* Windows drivers do not like the 0/0 position and  

ignore such

hw/usb-hid.c +3 -0
+         * events. */
+        e->xdx = x1 | 1;
+        e->ydy = y1 | 1;

Doesn't this change mean we can't access any other even pixel either?

Quoted 1 line

Only on 32767x32767 screens (that's the resolution of the tablet).

Well, if it's just a fix for 0/0 I would've expected something like:

e->xdx = x1 ? x1 : 1;
e->ydy = y1 ? y1 : 1;

Andreas

#4 lore raw
Quoted 33 lines · Andreas Färber

Am 25.06.2011 um 14:55 schrieb Jan Kiszka:

Quoted 31 lines · Andreas Färber
Quoted 29 lines

Am 24.06.2011 um 16:27 schrieb Jan Kiszka:

Quoted 22 lines

For unknown reasons, Windows drivers (tested with XP and Win7) ignore usb-tablet events that move the pointer to 0/0. So always set bit 0 of the coordinates.

---
hw/usb-hid.c | 6 ++++--

1 files changed, 4 insertions(+), 2 deletions(-)
hw/usb-hid.c +1 -2
index d711b5c..2b9a451 100644
@@ -457,8 +457,10 @@ static void
 usb_pointer_event_combine(USBPointerEvent *e, int xyrel,
       e->xdx += x1;
       e->ydy += y1;
   } else {
-        e->xdx = x1;
-        e->ydy = y1;
+        /* Windows drivers do not like the 0/0 position and ignore

such

hw/usb-hid.c static void usb_pointer_event_combine(USBPointerEvent *e, int xyrel, · line 463

Quoted 3 lines
hw/usb-hid.c +3 -0
+         * events. */
+        e->xdx = x1 | 1;
+        e->ydy = y1 | 1;

Doesn't this change mean we can't access any other even pixel either?

Quoted 6 lines
Quoted 1 line

Only on 32767x32767 screens (that's the resolution of the tablet).

Well, if it's just a fix for 0/0 I would've expected something like:

e->xdx = x1 ? x1 : 1;
e->ydy = y1 ? y1 : 1;

Works as well, my version is a little bit simpler. But I don't mind, will post whatever is preferred to fix this.

Jan

#5 lore raw
Quoted 36 lines · Jan Kiszka
Quoted 35 lines · Andreas Färber

Am 25.06.2011 um 14:55 schrieb Jan Kiszka:

Quoted 32 lines · Andreas Färber
Quoted 21 lines

Am 24.06.2011 um 16:27 schrieb Jan Kiszka:

Quoted 19 lines

For unknown reasons, Windows drivers (tested with XP and Win7) ignore usb-tablet events that move the pointer to 0/0. So always set bit 0 of the coordinates.

---
hw/usb-hid.c |    6 ++++--

1 files changed, 4 insertions(+), 2 deletions(-)
hw/usb-hid.c +0 -1
index d711b5c..2b9a451 100644
@@ -457,8 +457,10 @@ static void
 usb_pointer_event_combine(USBPointerEvent *e, int xyrel,
        e->xdx += x1;
        e->ydy += y1;
    } else {
-        e->xdx = x1;
Quoted 8 lines
Quoted 6 lines
hw/usb-hid.c +1 -1
-        e->ydy = y1;
+        /* Windows drivers do not like the 0/0 position and ignore

such
+         * events. */
+        e->xdx = x1 | 1;
+        e->ydy = y1 | 1;

Doesn't this change mean we can't access any other even pixel either?

Only on 32767x32767 screens (that's the resolution of the tablet).

Quoted 7 lines
Quoted 4 lines

Well, if it's just a fix for 0/0 I would've expected something like:

e->xdx = x1 ? x1 : 1;
e->ydy = y1 ? y1 : 1;

Works as well, my version is a little bit simpler. But I don't mind, will post whatever is preferred to fix this.

Would it be enough to just do this for x or y, not both?

Cheers

#6 lore raw

PATCH v2 1/1 usb-hid: Fix 0/0 position for Windows in tablet mode

Quoted 39 lines · andrzej zaborowski
Quoted 38 lines · Jan Kiszka
Quoted 37 lines · Andreas Färber

Am 25.06.2011 um 14:55 schrieb Jan Kiszka:

Quoted 31 lines · Andreas Färber
Quoted 21 lines

Am 24.06.2011 um 16:27 schrieb Jan Kiszka:

Quoted 19 lines

For unknown reasons, Windows drivers (tested with XP and Win7) ignore usb-tablet events that move the pointer to 0/0. So always set bit 0 of the coordinates.

---
hw/usb-hid.c | 6 ++++--

1 files changed, 4 insertions(+), 2 deletions(-)
hw/usb-hid.c +0 -1
index d711b5c..2b9a451 100644
@@ -457,8 +457,10 @@ static void
 usb_pointer_event_combine(USBPointerEvent *e, int xyrel,
       e->xdx += x1;
       e->ydy += y1;
   } else {
-        e->xdx = x1;
Quoted 8 lines

hw/usb-hid.c

Quoted 6 lines
hw/usb-hid.c +1 -1
-        e->ydy = y1;
+        /* Windows drivers do not like the 0/0 position and ignore

such

hw/usb-hid.c +3 -0
+         * events. */
+        e->xdx = x1 | 1;
+        e->ydy = y1 | 1;

Doesn't this change mean we can't access any other even pixel either?

Quoted 1 line

Only on 32767x32767 screens (that's the resolution of the tablet).

Well, if it's just a fix for 0/0 I would've expected something like:

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

e->xdx = x1 ? x1 : 1;
e->ydy = y1 ? y1 : 1;

Works as well, my version is a little bit simpler. But I don't mind, will post whatever is preferred to fix this.

Would it be enough to just do this for x or y, not both?

Yes, looks like. Is this one better?

Jan

----------8<---------

From: Jan Kiszka <[email protected]>

For unknown reasons, Windows drivers (tested with XP and Win7) ignore usb-tablet events that move the pointer to 0/0. So always report 0/0 as 1/0.

---
 hw/usb-hid.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
hw/usb-hid.c +5 -0
index d711b5c..faf91c4 100644
@@ -459,6 +459,11 @@ static void usb_pointer_event_combine(USBPointerEvent *e, int xyrel,
     } else {
         e->xdx = x1;
         e->ydy = y1;
+        /* Windows drivers do not like the 0/0 position and ignore such
+         * events. */
+        if (!(x1 | y1)) {
+            x1 = 1;
+        }
     }
     e->dz += z1;
 }
Signature · 1 line
1.7.3.4
#7 lore raw

Am 12.07.2011 um 09:47 schrieb Jan Kiszka:

Quoted 44 lines · andrzej zaborowski
Quoted 43 lines · Jan Kiszka
Quoted 42 lines · Andreas Färber
Quoted 40 lines

Am 25.06.2011 um 14:55 schrieb Jan Kiszka:

Quoted 32 lines · Andreas Färber
Quoted 22 lines

Am 24.06.2011 um 16:27 schrieb Jan Kiszka:

Quoted 20 lines

For unknown reasons, Windows drivers (tested with XP and Win7) ignore usb-tablet events that move the pointer to 0/0. So always set bit 0 of the coordinates.

---
hw/usb-hid.c | 6 ++++--

1 files changed, 4 insertions(+), 2 deletions(-)
hw/usb-hid.c +0 -2
index d711b5c..2b9a451 100644
@@ -457,8 +457,10 @@ static void
 usb_pointer_event_combine(USBPointerEvent *e, int xyrel,
      e->xdx += x1;
      e->ydy += y1;
  } else {
-        e->xdx = x1;
-        e->ydy = y1;
Quoted 8 lines

hw/usb-hid.c

Quoted 6 lines
hw/usb-hid.c +1 -0
+        /* Windows drivers do not like the 0/0 position and  

ignore
such

hw/usb-hid.c +3 -0
+         * events. */
+        e->xdx = x1 | 1;
+        e->ydy = y1 | 1;

Doesn't this change mean we can't access any other even pixel either?

Quoted 1 line

Only on 32767x32767 screens (that's the resolution of the tablet).

Well, if it's just a fix for 0/0 I would've expected something like:

e->xdx = x1 ? x1 : 1;
e->ydy = y1 ? y1 : 1;

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

Works as well, my version is a little bit simpler. But I don't mind, will post whatever is preferred to fix this.

Would it be enough to just do this for x or y, not both?

Yes, looks like. Is this one better?

To me it looks better, yes.

Thanks,
Andreas

Quoted 33 lines

----------8<---------

From: Jan Kiszka <[email protected]>

For unknown reasons, Windows drivers (tested with XP and Win7) ignore usb-tablet events that move the pointer to 0/0. So always report 0/0 as 1/0.

---
hw/usb-hid.c | 5 +++++

1 files changed, 5 insertions(+), 0 deletions(-)
hw/usb-hid.c +1 -0
index d711b5c..faf91c4 100644
@@ -459,6 +459,11 @@ static void  
 usb_pointer_event_combine(USBPointerEvent *e, int xyrel,
    } else {
        e->xdx = x1;
        e->ydy = y1;
+        /* Windows drivers do not like the 0/0 position and ignore  

such

hw/usb-hid.c +4 -0
+         * events. */
+        if (!(x1 | y1)) {
+            x1 = 1;
+        }
    }
    e->dz += z1;

}

Signature · 1 line
1.7.3.4
#8 lore raw
Quoted 57 lines · Andreas Färber

Am 12.07.2011 um 09:47 schrieb Jan Kiszka:

Quoted 55 lines · andrzej zaborowski
Quoted 45 lines · Jan Kiszka
Quoted 43 lines · Andreas Färber
Quoted 41 lines

Am 25.06.2011 um 14:55 schrieb Jan Kiszka:

Quoted 34 lines · Andreas Färber
Quoted 24 lines

Am 24.06.2011 um 16:27 schrieb Jan Kiszka:

Quoted 21 lines

For unknown reasons, Windows drivers (tested with XP and Win7) ignore
usb-tablet events that move the pointer to 0/0. So always set bit 0 of
the coordinates.

---
hw/usb-hid.c |    6 ++++--

1 files changed, 4 insertions(+), 2 deletions(-)
hw/usb-hid.c +0 -1
index d711b5c..2b9a451 100644
@@ -457,8 +457,10 @@ static void
 usb_pointer_event_combine(USBPointerEvent *e, int xyrel,
      e->xdx += x1;
      e->ydy += y1;
  } else {
-        e->xdx = x1;
Quoted 8 lines
Quoted 6 lines
hw/usb-hid.c +1 -1
-        e->ydy = y1;
+        /* Windows drivers do not like the 0/0 position and ignore

such
+         * events. */
+        e->xdx = x1 | 1;
+        e->ydy = y1 | 1;

Doesn't this change mean we can't access any other even pixel either?

Quoted 1 line

Only on 32767x32767 screens (that's the resolution of the tablet).

Well, if it's just a fix for 0/0 I would've expected something like:

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

e->xdx = x1 ? x1 : 1;
e->ydy = y1 ? y1 : 1;

Works as well, my version is a little bit simpler. But I don't mind, will post whatever is preferred to fix this.

Would it be enough to just do this for x or y, not both?

Yes, looks like. Is this one better?

I pushed this version, thanks.

Cheers