@@ -857,8 +857,8 @@ static void set_abs_axis_value(struct unix_device *iface, int code, int value)
857857 if (!(code = impl -> hat_map [code - ABS_HAT0X ])) return ;
858858 if (impl -> is_gamepad )
859859 {
860- hid_device_set_button (iface , 11 , value < 0 );
861- hid_device_set_button (iface , 12 , value > 0 );
860+ hid_device_set_button (iface , 10 , value < 0 );
861+ hid_device_set_button (iface , 11 , value > 0 );
862862 }
863863 hid_device_set_hatswitch_y (iface , code - 1 , value );
864864 }
@@ -867,8 +867,8 @@ static void set_abs_axis_value(struct unix_device *iface, int code, int value)
867867 if (!(code = impl -> hat_map [code - ABS_HAT0X ])) return ;
868868 if (impl -> is_gamepad )
869869 {
870- hid_device_set_button (iface , 13 , value < 0 );
871- hid_device_set_button (iface , 14 , value > 0 );
870+ hid_device_set_button (iface , 12 , value < 0 );
871+ hid_device_set_button (iface , 13 , value > 0 );
872872 }
873873 hid_device_set_hatswitch_x (iface , code - 1 , value );
874874 }
@@ -989,10 +989,10 @@ static BOOL set_report_from_event(struct unix_device *iface, struct input_event
989989 if (!(button = impl -> button_map [ie -> code ])) return FALSE;
990990 if (impl -> is_gamepad && !impl -> hat_count )
991991 {
992- if (button == 12 ) hid_device_set_hatswitch_y (iface , 0 , -1 );
993- if (button == 13 ) hid_device_set_hatswitch_y (iface , 0 , +1 );
994- if (button == 14 ) hid_device_set_hatswitch_x (iface , 0 , -1 );
995- if (button == 15 ) hid_device_set_hatswitch_x (iface , 0 , +1 );
992+ if (button == 11 ) hid_device_set_hatswitch_y (iface , 0 , -1 );
993+ if (button == 12 ) hid_device_set_hatswitch_y (iface , 0 , +1 );
994+ if (button == 13 ) hid_device_set_hatswitch_x (iface , 0 , -1 );
995+ if (button == 14 ) hid_device_set_hatswitch_x (iface , 0 , +1 );
996996 }
997997 hid_device_set_button (iface , button - 1 , ie -> value );
998998 return FALSE;
@@ -1640,6 +1640,7 @@ static NTSTATUS lnxev_device_create(struct udev_device *dev, int fd, const char
16401640 if (!test_bit (info .key , button )) continue ;
16411641 if (impl -> button_count > (impl -> hat_count ? 10 : 14 )) break ;
16421642 impl -> button_map [button ] = ++ impl -> button_count ;
1643+ if (impl -> hat_count && impl -> button_count == 11 ) impl -> button_map [button ] = 17 ;
16431644 }
16441645
16451646 for (int i = BTN_MISC ; i < KEY_MAX ; i ++ )
@@ -1648,6 +1649,7 @@ static NTSTATUS lnxev_device_create(struct udev_device *dev, int fd, const char
16481649 if (impl -> button_count > (impl -> hat_count ? 10 : 14 )) break ;
16491650 if (!test_bit (info .key , i )) continue ;
16501651 impl -> button_map [i ] = ++ impl -> button_count ;
1652+ if (impl -> hat_count && impl -> button_count == 11 ) impl -> button_map [i ] = 17 ;
16511653 }
16521654 }
16531655
0 commit comments