Commit 2239aae9 authored by Andrew Eikum's avatar Andrew Eikum Committed by Alexandre Julliard

winebus.sys: Report hatswitch values correctly.

parent d0c5a5e8
...@@ -303,15 +303,18 @@ static void set_hat_value(struct platform_private *ext, int index, int value) ...@@ -303,15 +303,18 @@ static void set_hat_value(struct platform_private *ext, int index, int value)
offset = ext->hat_start + index; offset = ext->hat_start + index;
switch (value) switch (value)
{ {
case SDL_HAT_CENTERED: ext->report_buffer[offset] = 8; break; /* 8 1 2
case SDL_HAT_UP: ext->report_buffer[offset] = 0; break; * 7 0 3
case SDL_HAT_RIGHTUP: ext->report_buffer[offset] = 1; break; * 6 5 4 */
case SDL_HAT_RIGHT: ext->report_buffer[offset] = 2; break; case SDL_HAT_CENTERED: ext->report_buffer[offset] = 0; break;
case SDL_HAT_RIGHTDOWN: ext->report_buffer[offset] = 3; break; case SDL_HAT_UP: ext->report_buffer[offset] = 1; break;
case SDL_HAT_DOWN: ext->report_buffer[offset] = 4; break; case SDL_HAT_RIGHTUP: ext->report_buffer[offset] = 2; break;
case SDL_HAT_LEFTDOWN: ext->report_buffer[offset] = 5; break; case SDL_HAT_RIGHT: ext->report_buffer[offset] = 3; break;
case SDL_HAT_LEFT: ext->report_buffer[offset] = 6; break; case SDL_HAT_RIGHTDOWN: ext->report_buffer[offset] = 4; break;
case SDL_HAT_LEFTUP: ext->report_buffer[offset] = 7; break; case SDL_HAT_DOWN: ext->report_buffer[offset] = 5; break;
case SDL_HAT_LEFTDOWN: ext->report_buffer[offset] = 6; break;
case SDL_HAT_LEFT: ext->report_buffer[offset] = 7; break;
case SDL_HAT_LEFTUP: ext->report_buffer[offset] = 8; break;
} }
} }
......
...@@ -303,32 +303,35 @@ static void set_abs_axis_value(struct wine_input_private *ext, int code, int val ...@@ -303,32 +303,35 @@ static void set_abs_axis_value(struct wine_input_private *ext, int code, int val
ext->hat_values[index] = value; ext->hat_values[index] = value;
if ((code - ABS_HAT0X) % 2) if ((code - ABS_HAT0X) % 2)
index--; index--;
/* 8 1 2
* 7 0 3
* 6 5 4 */
if (ext->hat_values[index] == 0) if (ext->hat_values[index] == 0)
{ {
if (ext->hat_values[index+1] == 0) if (ext->hat_values[index+1] == 0)
value = 8;
else if (ext->hat_values[index+1] < 0)
value = 0; value = 0;
else if (ext->hat_values[index+1] < 0)
value = 1;
else else
value = 4; value = 5;
} }
else if (ext->hat_values[index] > 0) else if (ext->hat_values[index] > 0)
{ {
if (ext->hat_values[index+1] == 0) if (ext->hat_values[index+1] == 0)
value = 2; value = 3;
else if (ext->hat_values[index+1] < 0) else if (ext->hat_values[index+1] < 0)
value = 1; value = 2;
else else
value = 3; value = 4;
} }
else else
{ {
if (ext->hat_values[index+1] == 0) if (ext->hat_values[index+1] == 0)
value = 6;
else if (ext->hat_values[index+1] < 0)
value = 7; value = 7;
else if (ext->hat_values[index+1] < 0)
value = 8;
else else
value = 5; value = 6;
} }
ext->current_report_buffer[ext->hat_map[index]] = value; ext->current_report_buffer[ext->hat_map[index]] = value;
} }
......
...@@ -75,7 +75,7 @@ static const BYTE REPORT_REL_AXIS_TAIL[] = { ...@@ -75,7 +75,7 @@ static const BYTE REPORT_REL_AXIS_TAIL[] = {
static const BYTE REPORT_HATSWITCH[] = { static const BYTE REPORT_HATSWITCH[] = {
0x05, 0x01, /* USAGE_PAGE (Generic Desktop) */ 0x05, 0x01, /* USAGE_PAGE (Generic Desktop) */
0x09, 0x39, /* USAGE (Hatswitch) */ 0x09, 0x39, /* USAGE (Hatswitch) */
0x15, 0x00, /* LOGICAL_MINIMUM (0) */ 0x15, 0x01, /* LOGICAL_MINIMUM (1) */
0x25, 0x08, /* LOGICAL_MAXIMUM (0x08) */ 0x25, 0x08, /* LOGICAL_MAXIMUM (0x08) */
0x35, 0x00, /* PHYSICAL_MINIMUM (0) */ 0x35, 0x00, /* PHYSICAL_MINIMUM (0) */
0x45, 0x08, /* PHYSICAL_MAXIMUM (8) */ 0x45, 0x08, /* PHYSICAL_MAXIMUM (8) */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment