mirror of
https://github.com/libretro/RetroArch
synced 2025-04-10 15:45:19 +00:00
commit
fbb095cc06
@ -505,41 +505,40 @@ static bool udev_input_add_device(udev_input_t *udev,
|
|||||||
|
|
||||||
strlcpy(device->devnode, devnode, sizeof(device->devnode));
|
strlcpy(device->devnode, devnode, sizeof(device->devnode));
|
||||||
|
|
||||||
/* Touchpads report in absolute coords. */
|
|
||||||
if (type == UDEV_INPUT_TOUCHPAD)
|
|
||||||
{
|
|
||||||
if (ioctl(fd, EVIOCGABS(ABS_X), &absinfo) < 0 ||
|
|
||||||
absinfo.minimum >= absinfo.maximum)
|
|
||||||
goto error;
|
|
||||||
|
|
||||||
device->mouse.x_min = absinfo.minimum;
|
|
||||||
device->mouse.x_max = absinfo.maximum;
|
|
||||||
|
|
||||||
if (ioctl(fd, EVIOCGABS(ABS_Y), &absinfo) < 0 ||
|
|
||||||
absinfo.minimum >= absinfo.maximum)
|
|
||||||
goto error;
|
|
||||||
|
|
||||||
device->mouse.y_min = absinfo.minimum;
|
|
||||||
device->mouse.y_max = absinfo.maximum;
|
|
||||||
}
|
|
||||||
/* UDEV_INPUT_MOUSE may report in absolute coords too */
|
/* UDEV_INPUT_MOUSE may report in absolute coords too */
|
||||||
else if (type == UDEV_INPUT_MOUSE && ioctl(fd, EVIOCGABS(ABS_X), &absinfo) >= 0)
|
if (type == UDEV_INPUT_MOUSE || type == UDEV_INPUT_TOUCHPAD )
|
||||||
{
|
{
|
||||||
if (absinfo.minimum >= absinfo.maximum)
|
if (ioctl(fd, EVIOCGABS(ABS_X), &absinfo) >= 0)
|
||||||
goto error;
|
{
|
||||||
|
if (absinfo.minimum >= absinfo.maximum )
|
||||||
|
{
|
||||||
|
device->mouse.x_min = -1;
|
||||||
|
device->mouse.x_max = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
device->mouse.x_min = absinfo.minimum;
|
||||||
|
device->mouse.x_min = absinfo.maximum;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
device->mouse.x_min = absinfo.minimum;
|
if (ioctl(fd, EVIOCGABS(ABS_Y), &absinfo) >= 0)
|
||||||
device->mouse.x_max = absinfo.maximum;
|
{
|
||||||
|
if (absinfo.minimum >= absinfo.maximum )
|
||||||
if (ioctl(fd, EVIOCGABS(ABS_Y), &absinfo) < 0 ||
|
{
|
||||||
absinfo.minimum >= absinfo.maximum)
|
device->mouse.y_min = -1;
|
||||||
goto error;
|
device->mouse.y_max = 1;
|
||||||
|
}
|
||||||
device->mouse.y_min = absinfo.minimum;
|
else
|
||||||
device->mouse.y_max = absinfo.maximum;
|
{
|
||||||
|
device->mouse.y_min = absinfo.minimum;
|
||||||
|
device->mouse.y_min = absinfo.maximum;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tmp = ( udev_input_device_t**)realloc(udev->devices,
|
tmp = ( udev_input_device_t**)realloc(udev->devices,
|
||||||
(udev->num_devices + 1) * sizeof(*udev->devices));
|
(udev->num_devices + 1) * sizeof(*udev->devices));
|
||||||
|
|
||||||
if (!tmp)
|
if (!tmp)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user