Skip to content

Commit 7fceaf7

Browse files
committed
winebus.sys: Also pass axis and button count to is_hidraw_enabled()
This is useful to detect some devices which do not have a well-known PID set. Link: ValveSoftware/Proton#6839 (comment)
1 parent 95ebcfa commit 7fceaf7

3 files changed

Lines changed: 7 additions & 8 deletions

File tree

dlls/winebus.sys/bus_udev.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1622,6 +1622,7 @@ static void udev_add_device(struct udev_device *dev, int fd)
16221622
const char *subsystem;
16231623
const char *devnode;
16241624
int bus = 0;
1625+
int axes = -1, buttons = -1;
16251626

16261627
if (!(devnode = udev_device_get_devnode(dev)))
16271628
{
@@ -1644,6 +1645,9 @@ static void udev_add_device(struct udev_device *dev, int fd)
16441645
close(fd);
16451646
return;
16461647
}
1648+
1649+
axes = count_abs_axis(fd);
1650+
buttons = count_buttons(fd, NULL);
16471651
#endif
16481652

16491653
get_device_subsystem_info(dev, "hid", &desc, &bus);
@@ -1697,7 +1701,7 @@ static void udev_add_device(struct udev_device *dev, int fd)
16971701
memcpy(desc.serialnumber, zeros, sizeof(zeros));
16981702
}
16991703

1700-
if (!is_hidraw_enabled(desc.vid, desc.pid))
1704+
if (!is_hidraw_enabled(desc.vid, desc.pid, axes, buttons))
17011705
{
17021706
TRACE("hidraw %s: deferring %s to a different backend\n", debugstr_a(devnode), debugstr_device_desc(&desc));
17031707
close(fd);
@@ -1712,12 +1716,7 @@ static void udev_add_device(struct udev_device *dev, int fd)
17121716
}
17131717
#ifdef HAS_PROPER_INPUT_HEADER
17141718
else
1715-
{
1716-
int axes=0, buttons=0;
1717-
axes = count_abs_axis(fd);
1718-
buttons = count_buttons(fd, NULL);
17191719
desc.is_gamepad = (axes == 6 && buttons >= 14);
1720-
}
17211720
#endif
17221721

17231722
TRACE("dev %p, node %s, desc %s.\n", dev, debugstr_a(devnode), debugstr_device_desc(&desc));

dlls/winebus.sys/unix_private.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,6 @@ BOOL is_wine_blacklisted(WORD vid, WORD pid) DECLSPEC_HIDDEN;
271271
BOOL is_dualshock4_gamepad(WORD vid, WORD pid) DECLSPEC_HIDDEN;
272272
BOOL is_dualsense_gamepad(WORD vid, WORD pid) DECLSPEC_HIDDEN;
273273
BOOL is_logitech_g920(WORD vid, WORD pid) DECLSPEC_HIDDEN;
274-
BOOL is_hidraw_enabled(WORD vid, WORD pid) DECLSPEC_HIDDEN;
274+
BOOL is_hidraw_enabled(WORD vid, WORD pid, INT axes, INT buttons) DECLSPEC_HIDDEN;
275275

276276
#endif /* __WINEBUS_UNIX_PRIVATE_H */

dlls/winebus.sys/unixlib.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ static BOOL is_fanatec_pedals(WORD vid, WORD pid)
105105
return FALSE;
106106
}
107107

108-
BOOL is_hidraw_enabled(WORD vid, WORD pid)
108+
BOOL is_hidraw_enabled(WORD vid, WORD pid, INT axes, INT buttons)
109109
{
110110
const char *enabled = getenv("PROTON_ENABLE_HIDRAW");
111111
char needle[16];

0 commit comments

Comments
 (0)