libevdev update

Signed-off-by: zhengyaozong <zhengyaozong@h-partners.com>
This commit is contained in:
zhengyaozong
2025-11-21 15:50:33 +08:00
parent 6c9aa8d147
commit c2b56bbf2a
@@ -1,4 +1,4 @@
Copyright (C) 2024 Huawei Device Co., Ltd.
Copyright (C) 2021-2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at\n
@@ -11,53 +11,206 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
diff -Naur old/include/event-names.h new/include/event-names.h
--- old/include/event-names.h 2024-01-01 00:00:00.000000000 +0000
+++ new/include/event-names.h 2024-01-01 00:00:00.000000000 +0000
@@ -63,6 +63,7 @@
[ABS_TOOL_WIDTH] = "ABS_TOOL_WIDTH",
[ABS_VOLUME] = "ABS_VOLUME",
[ABS_MISC] = "ABS_MISC",
+ [ABS_MT_MOVEFLAG] = "ABS_MT_MOVEFLAG",
[ABS_RESERVED] = "ABS_RESERVED",
[ABS_MT_SLOT] = "ABS_MT_SLOT",
[ABS_MT_TOUCH_MAJOR] = "ABS_MT_TOUCH_MAJOR",
@@ -731,6 +732,7 @@
[SW_MUTE_DEVICE] = "SW_MUTE_DEVICE",
[SW_PEN_INSERTED] = "SW_PEN_INSERTED",
[SW_MACHINE_COVER] = "SW_MACHINE_COVER",
+ [SW_SUPER_PRIVACY] = "SW_SUPER_PRIVACY",
};
diff --git a/include/linux/freebsd/input-event-codes.h b/include/linux/freebsd/input-event-codes.h
index c5713e4..c514cb0 100644
--- a/include/linux/freebsd/input-event-codes.h
+++ b/include/linux/freebsd/input-event-codes.h
@@ -519,6 +519,7 @@
#define KEY_NOTIFICATION_CENTER 0x1bc /* Show/hide the notification center */
#define KEY_PICKUP_PHONE 0x1bd /* Answer incoming call */
#define KEY_HANGUP_PHONE 0x1be /* Decline incoming call */
+#define KEY_LINK_PHONE 0x1bf /* AL Phone Syncing */
static const char * const ff_map[FF_MAX + 1] = {
@@ -877,6 +879,7 @@
};
#define KEY_DEL_EOL 0x1c0
#define KEY_DEL_EOS 0x1c1
@@ -600,8 +601,14 @@
#define BTN_DPAD_LEFT 0x222
#define BTN_DPAD_RIGHT 0x223
static const struct name_entry code_names[] = {
+ { .name = "ABS_MT_MOVEFLAG", .value = ABS_MT_MOVEFLAG },
{ .name = "ABS_BRAKE", .value = ABS_BRAKE },
{ .name = "ABS_DISTANCE", .value = ABS_DISTANCE },
{ .name = "ABS_GAS", .value = ABS_GAS },
diff -Naur old/include/linux/linux/input-event-codes.h new/include/linux/linux/input-event-codes.h
--- old/include/linux/linux/input-event-codes.h 2024-01-01 00:00:00.000000000 +0000
+++ new/include/linux/linux/input-event-codes.h 2024-01-01 00:00:00.000000000 +0000
@@ -843,6 +843,7 @@
#define ABS_VOLUME 0x20
+#define BTN_GRIPL 0x224
+#define BTN_GRIPR 0x225
+#define BTN_GRIPL2 0x226
+#define BTN_GRIPR2 0x227
+
#define KEY_ALS_TOGGLE 0x230 /* Ambient light sensor */
#define KEY_ROTATE_LOCK_TOGGLE 0x231 /* Display rotation lock */
+#define KEY_REFRESH_RATE_TOGGLE 0x232 /* Display refresh rate toggle */
#define ABS_MISC 0x28
+#define ABS_MT_MOVEFLAG 0x29
#define KEY_BUTTONCONFIG 0x240 /* AL Button Configuration */
#define KEY_TASKMANAGER 0x241 /* AL Task/Project Manager */
@@ -617,6 +624,8 @@
#define KEY_CAMERA_ACCESS_ENABLE 0x24b /* Enables programmatic access to camera devices. (HUTRR72) */
#define KEY_CAMERA_ACCESS_DISABLE 0x24c /* Disables programmatic access to camera devices. (HUTRR72) */
#define KEY_CAMERA_ACCESS_TOGGLE 0x24d /* Toggles the current state of the camera access control. (HUTRR72) */
+#define KEY_ACCESSIBILITY 0x24e /* Toggles the system bound accessibility UI/command (HUTRR116) */
+#define KEY_DO_NOT_DISTURB 0x24f /* Toggles the system-wide "Do Not Disturb" control (HUTRR94)*/
#define KEY_BRIGHTNESS_MIN 0x250 /* Set Brightness to Minimum */
#define KEY_BRIGHTNESS_MAX 0x251 /* Set Brightness to Maximum */
@@ -761,6 +770,9 @@
#define KEY_KBD_LCD_MENU4 0x2bb
#define KEY_KBD_LCD_MENU5 0x2bc
+/* Performance Boost key (Alienware)/G-Mode key (Dell) */
+#define KEY_PERFORMANCE 0x2bd
+
#define BTN_TRIGGER_HAPPY 0x2c0
#define BTN_TRIGGER_HAPPY1 0x2c0
#define BTN_TRIGGER_HAPPY2 0x2c1
diff --git a/include/linux/linux/input-event-codes.h b/include/linux/linux/input-event-codes.h
index 539acc9..acc4574 100644
--- a/include/linux/linux/input-event-codes.h
+++ b/include/linux/linux/input-event-codes.h
@@ -519,6 +519,7 @@
#define KEY_NOTIFICATION_CENTER 0x1bc /* Show/hide the notification center */
#define KEY_PICKUP_PHONE 0x1bd /* Answer incoming call */
#define KEY_HANGUP_PHONE 0x1be /* Decline incoming call */
+#define KEY_LINK_PHONE 0x1bf /* AL Phone Syncing */
#define KEY_DEL_EOL 0x1c0
#define KEY_DEL_EOS 0x1c1
@@ -600,8 +601,14 @@
#define BTN_DPAD_LEFT 0x222
#define BTN_DPAD_RIGHT 0x223
+#define BTN_GRIPL 0x224
+#define BTN_GRIPR 0x225
+#define BTN_GRIPL2 0x226
+#define BTN_GRIPR2 0x227
+
#define KEY_ALS_TOGGLE 0x230 /* Ambient light sensor */
#define KEY_ROTATE_LOCK_TOGGLE 0x231 /* Display rotation lock */
+#define KEY_REFRESH_RATE_TOGGLE 0x232 /* Display refresh rate toggle */
#define KEY_BUTTONCONFIG 0x240 /* AL Button Configuration */
#define KEY_TASKMANAGER 0x241 /* AL Task/Project Manager */
@@ -617,6 +624,8 @@
#define KEY_CAMERA_ACCESS_ENABLE 0x24b /* Enables programmatic access to camera devices. (HUTRR72) */
#define KEY_CAMERA_ACCESS_DISABLE 0x24c /* Disables programmatic access to camera devices. (HUTRR72) */
#define KEY_CAMERA_ACCESS_TOGGLE 0x24d /* Toggles the current state of the camera access control. (HUTRR72) */
+#define KEY_ACCESSIBILITY 0x24e /* Toggles the system bound accessibility UI/command (HUTRR116) */
+#define KEY_DO_NOT_DISTURB 0x24f /* Toggles the system-wide "Do Not Disturb" control (HUTRR94)*/
#define KEY_BRIGHTNESS_MIN 0x250 /* Set Brightness to Minimum */
#define KEY_BRIGHTNESS_MAX 0x251 /* Set Brightness to Maximum */
@@ -761,6 +770,9 @@
#define KEY_KBD_LCD_MENU4 0x2bb
#define KEY_KBD_LCD_MENU5 0x2bc
+/* Performance Boost key (Alienware)/G-Mode key (Dell) */
+#define KEY_PERFORMANCE 0x2bd
+
#define BTN_TRIGGER_HAPPY 0x2c0
#define BTN_TRIGGER_HAPPY1 0x2c0
#define BTN_TRIGGER_HAPPY2 0x2c1
diff --git a/include/linux/linux/input.h b/include/linux/linux/input.h
index 7f37e6e..fff30fa 100644
--- a/include/linux/linux/input.h
+++ b/include/linux/linux/input.h
@@ -6,14 +6,16 @@
* under the terms of the GNU General Public License version 2 as published by
* the Free Software Foundation.
*/
-#ifndef _INPUT_H
-#define _INPUT_H
+#ifndef _UAPI_INPUT_H
+#define _UAPI_INPUT_H
+#ifndef __KERNEL__
#include <sys/time.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <linux/types.h>
+#endif
#include "input-event-codes.h"
@@ -273,6 +275,7 @@ struct input_mask {
#define BUS_CEC 0x1E
#define BUS_INTEL_ISHTP 0x1F
#define BUS_AMD_SFH 0x20
+#define BUS_SDW 0x21
/*
* 0x2e is reserved and should not be used in input drivers.
@@ -896,8 +897,9 @@
#define SW_MUTE_DEVICE 0x0e /* set = device disabled */
#define SW_PEN_INSERTED 0x0f /* set = pen inserted */
#define SW_MACHINE_COVER 0x10 /* set = cover closed */
-#define SW_MAX 0x10
-#define SW_CNT (SW_MAX+1)
+#define SW_SUPER_PRIVACY 0x11 /* set = super privacy open */
+#define SW_MAX 0x11
+#define SW_CNT (SW_MAX+1)
* MT_TOOL types
@@ -513,4 +516,4 @@ struct ff_effect {
#define FF_MAX 0x7f
#define FF_CNT (FF_MAX+1)
-#endif /* _INPUT_H */
+#endif /* _UAPI_INPUT_H */
diff --git a/libevdev/libevdev-util.h b/libevdev/libevdev-util.h
index ed85c95..cab8067 100644
--- a/libevdev/libevdev-util.h
+++ b/libevdev/libevdev-util.h
@@ -42,19 +42,19 @@ startswith(const char *str, size_t len, const char *prefix, size_t plen)
static inline int
bit_is_set(const unsigned long *array, int bit)
{
- return !!(array[bit / LONG_BITS] & (1LL << (bit % LONG_BITS)));
+ return !!(array[bit / LONG_BITS] & (1ULL << (bit % LONG_BITS)));
}
static inline void
set_bit(unsigned long *array, int bit)
{
- array[bit / LONG_BITS] |= (1LL << (bit % LONG_BITS));
+ array[bit / LONG_BITS] |= (1ULL << (bit % LONG_BITS));
}
static inline void
clear_bit(unsigned long *array, int bit)
{
- array[bit / LONG_BITS] &= ~(1LL << (bit % LONG_BITS));
+ array[bit / LONG_BITS] &= ~(1ULL << (bit % LONG_BITS));
}
static inline void
diff --git a/libevdev/libevdev.c b/libevdev/libevdev.c
index 6931177..3eefc87 100644
--- a/libevdev/libevdev.c
+++ b/libevdev/libevdev.c
@@ -805,23 +805,34 @@ push_mt_sync_events(struct libevdev *dev,
int rc;
for (int slot = 0; slot < dev->num_slots; slot++) {
- /* stopped touches were already terminated in
- * terminate_slots */
- if (changes[slot].state == TOUCH_STOPPED ||
- !bit_is_set(changes[slot].axes, ABS_MT_SLOT))
- continue;
+ bool have_slot_event = false;
- queue_push_event(dev, EV_ABS, ABS_MT_SLOT, slot);
- last_reported_slot = slot;
+ if (!bit_is_set(changes[slot].axes, ABS_MT_SLOT))
+ continue;
for (int axis = ABS_MT_MIN; axis <= ABS_MT_MAX; axis++) {
if (axis == ABS_MT_SLOT ||
!libevdev_has_event_code(dev, EV_ABS, axis))
continue;
- if (bit_is_set(changes[slot].axes, axis))
+ if (bit_is_set(changes[slot].axes, axis)) {
+ /* We already sent the tracking id -1 in
+ * terminate_slots so don't do that again. There
+ * may be other axes like ABS_MT_TOOL_TYPE that
+ * need to be synced despite no touch being active */
+ if (axis == ABS_MT_TRACKING_ID &&
+ *slot_value(dev, slot, axis) == -1)
+ continue;
+
+ if (!have_slot_event) {
+ queue_push_event(dev, EV_ABS, ABS_MT_SLOT, slot);
+ last_reported_slot = slot;
+ have_slot_event = true;
+ }
+
queue_push_event(dev, EV_ABS, axis,
*slot_value(dev, slot, axis));
+ }
}
}
/*
* Misc events