winebus.sys: Fix non-Linux builds.

commit 40a9f69a1d

   winebus.sys: Rename UDEV bus device variables to be consistent.

   Introducing a struct base_device, and hidraw_device / lnxev_device
   depending on the sub-type of the device.

moved an existing use of ABS_VOLUME that was guarded by

  #ifdef HAS_PROPER_INPUT_HEADER

outside that guard, breaking the build on non-Linux platforms.

Address this by putting appropriate guards in place.

Signed-off-by: Gerald Pfeifer <gerald@pfeifer.com>
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Gerald Pfeifer 2021-09-27 11:32:47 +02:00 committed by Alexandre Julliard
parent 5227259043
commit 0c81dc223d
1 changed files with 26 additions and 22 deletions

View File

@ -110,11 +110,23 @@ struct base_device
int device_fd;
};
static inline struct base_device *impl_from_unix_device(struct unix_device *iface)
{
return CONTAINING_RECORD(iface, struct base_device, unix_device);
}
struct hidraw_device
{
struct base_device base;
};
static inline struct hidraw_device *hidraw_impl_from_unix_device(struct unix_device *iface)
{
return CONTAINING_RECORD(impl_from_unix_device(iface), struct hidraw_device, base);
}
#ifdef HAS_PROPER_INPUT_HEADER
#define HID_REL_MAX (REL_MISC+1)
#define HID_ABS_MAX (ABS_VOLUME+1)
@ -130,21 +142,13 @@ struct lnxev_device
int haptic_effect_id;
};
static inline struct base_device *impl_from_unix_device(struct unix_device *iface)
{
return CONTAINING_RECORD(iface, struct base_device, unix_device);
}
static inline struct hidraw_device *hidraw_impl_from_unix_device(struct unix_device *iface)
{
return CONTAINING_RECORD(impl_from_unix_device(iface), struct hidraw_device, base);
}
static inline struct lnxev_device *lnxev_impl_from_unix_device(struct unix_device *iface)
{
return CONTAINING_RECORD(impl_from_unix_device(iface), struct lnxev_device, base);
}
#endif /* HAS_PROPER_INPUT_HEADER */
#define MAX_DEVICES 128
static int close_fds[MAX_DEVICES];
static struct pollfd poll_fds[MAX_DEVICES];
@ -201,6 +205,18 @@ static struct base_device *find_device_from_fd(int fd)
return NULL;
}
static struct base_device *find_device_from_udev(struct udev_device *dev)
{
struct base_device *impl;
LIST_FOR_EACH_ENTRY(impl, &device_list, struct base_device, unix_device.entry)
if (impl->udev_device == dev) return impl;
return NULL;
}
#ifdef HAS_PROPER_INPUT_HEADER
static const char *get_device_syspath(struct udev_device *dev)
{
struct udev_device *parent;
@ -224,18 +240,6 @@ static struct base_device *find_device_from_syspath(const char *path)
return NULL;
}
static struct base_device *find_device_from_udev(struct udev_device *dev)
{
struct base_device *impl;
LIST_FOR_EACH_ENTRY(impl, &device_list, struct base_device, unix_device.entry)
if (impl->udev_device == dev) return impl;
return NULL;
}
#ifdef HAS_PROPER_INPUT_HEADER
static const BYTE ABS_TO_HID_MAP[][2] = {
{HID_USAGE_PAGE_GENERIC, HID_USAGE_GENERIC_X}, /*ABS_X*/
{HID_USAGE_PAGE_GENERIC, HID_USAGE_GENERIC_Y}, /*ABS_Y*/