Files
RedBear-OS/local/recipes/libs/libinput/source/src/libinput-plugin-mouse-wheel-lowres.c
T
vasilito f31522130f fix: comprehensive boot warnings and exceptions — fixable silenced, unfixable diagnosed
Build system (5 gaps hardened):
- COOKBOOK_OFFLINE defaults to true (fork-mode)
- normalize_patch handles diff -ruN format
- New 'repo validate-patches' command (25/25 relibc patches)
- 14 patched Qt/Wayland/display recipes added to protected list
- relibc archive regenerated with current patch chain

Boot fixes (fixable):
- Full ISO EFI partition: 16 MiB → 1 MiB (matches mini, BIOS hardcoded 2 MiB offset)
- D-Bus system bus: absolute /usr/bin/dbus-daemon path (was skipped)
- redbear-sessiond: absolute /usr/bin/redbear-sessiond path (was skipped)
- daemon framework: silenced spurious INIT_NOTIFY warnings for oneshot_async services (P0-daemon-silence-init-notify.patch)
- udev-shim: demoted INIT_NOTIFY warning to INFO (expected for oneshot_async)
- relibc: comprehensive named semaphores (sem_open/close/unlink) replacing upstream todo!() stubs
- greeterd: Wayland socket timeout 15s → 30s (compositor DRM wait)
- greeter-ui: built and linked (header guard unification, sem_compat stubs removed)
- mc: un-ignored in both configs, fixed glib/libiconv/pcre2 transitive deps
- greeter config: removed stale keymapd dependency from display/greeter services
- prefix toolchain: relibc headers synced, _RELIBC_STDLIB_H guard unified

Unfixable (diagnosed, upstream):
- i2c-hidd: abort on no-I2C-hardware (QEMU) — process::exit → relibc abort
- kded6/greeter-ui: page fault 0x8 — Qt library null deref
- Thread panics fd != -1 — Rust std library on Redox
- DHCP timeout / eth0 MAC — QEMU user-mode networking
- hwrngd/thermald — no hardware RNG/thermal in VM
- live preload allocation — BIOS memory fragmentation, continues on demand
2026-05-05 20:20:37 +01:00

124 lines
4.4 KiB
C

/*
* Copyright © 2025 Red Hat, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#include "config.h"
#include <libevdev/libevdev.h>
#include "evdev.h"
#include "libinput-plugin-mouse-wheel-lowres.h"
#include "libinput-plugin.h"
#include "src/evdev-frame.h"
static void
wheel_plugin_device_new(struct libinput_plugin *libinput_plugin,
struct libinput_device *device,
struct libevdev *libevdev,
struct udev_device *udev_device)
{
struct evdev_device *evdev = evdev_device(device);
if (libevdev_has_event_code(libevdev, EV_REL, REL_WHEEL_HI_RES) ||
libevdev_has_event_code(libevdev, EV_REL, REL_HWHEEL_HI_RES))
return;
if (libevdev_has_event_code(libevdev, EV_REL, REL_WHEEL) ||
libevdev_has_event_code(libevdev, EV_REL, REL_HWHEEL))
evdev_log_info(evdev,
"emulating high-resolution scroll wheel events.\n");
if (libevdev_has_event_code(libevdev, EV_REL, REL_WHEEL))
libevdev_enable_event_code(libevdev, EV_REL, REL_WHEEL_HI_RES, NULL);
if (libevdev_has_event_code(libevdev, EV_REL, REL_HWHEEL))
libevdev_enable_event_code(libevdev, EV_REL, REL_HWHEEL_HI_RES, NULL);
libinput_plugin_enable_device_event_frame(libinput_plugin, device, true);
libinput_plugin_enable_evdev_usage(libinput_plugin, EVDEV_REL_WHEEL);
libinput_plugin_enable_evdev_usage(libinput_plugin, EVDEV_REL_HWHEEL);
/* A device may have those disabled via a quirk but we just re-enabled it
* above. Make sure we get those events too to filter them out */
libinput_plugin_enable_evdev_usage(libinput_plugin, EVDEV_REL_WHEEL_HI_RES);
libinput_plugin_enable_evdev_usage(libinput_plugin, EVDEV_REL_HWHEEL_HI_RES);
}
static void
wheel_plugin_evdev_frame(struct libinput_plugin *libinput_plugin,
struct libinput_device *device,
struct evdev_frame *frame)
{
size_t nevents;
struct evdev_event *events = evdev_frame_get_events(frame, &nevents);
_unref_(evdev_frame) *filtered_frame = evdev_frame_new(nevents + 2);
for (size_t i = 0; i < nevents; i++) {
struct evdev_event *e = &events[i];
switch (evdev_usage_enum(e->usage)) {
case EVDEV_REL_WHEEL_HI_RES:
case EVDEV_REL_HWHEEL_HI_RES:
/* In the uncommon case that our device sends high-res events
* filter those out. This can happen on devices that have the
* highres scroll axes disabled via quirks. The device still
* sends events so when we re-enable the axis in
* wheel_plugin_device_new we get the device events again,
* effectively duplicating the high resolution scroll events.
*/
break;
case EVDEV_REL_WHEEL:
evdev_frame_append(filtered_frame, e, 1);
evdev_frame_append_one(filtered_frame,
evdev_usage_from(EVDEV_REL_WHEEL_HI_RES),
e->value * 120);
break;
case EVDEV_REL_HWHEEL:
evdev_frame_append(filtered_frame, e, 1);
evdev_frame_append_one(
filtered_frame,
evdev_usage_from(EVDEV_REL_HWHEEL_HI_RES),
e->value * 120);
break;
default:
evdev_frame_append(filtered_frame, e, 1);
break;
}
}
evdev_frame_set(frame,
evdev_frame_get_events(filtered_frame, NULL),
evdev_frame_get_count(filtered_frame));
}
static const struct libinput_plugin_interface interface = {
.device_new = wheel_plugin_device_new,
.evdev_frame = wheel_plugin_evdev_frame,
};
void
libinput_mouse_plugin_wheel_lowres(struct libinput *libinput)
{
_unref_(libinput_plugin) *p =
libinput_plugin_new(libinput, "mouse-wheel-lowres", &interface, NULL);
}