[PATCH v5 08/13] HID: Add Ordinal page defines

From: Rong Zhang

Date: Sun Nov 29 2026 - 12:57:35 EST


Currently, the only macro for the HID Ordinal Page is HID_UP_ORDINAL,
which only matches the usage page itself.

This leads to inconvenience when drivers need to match both Ordinal and
non-Ordinal HID usages at once. They must use either nested switch
statements (usage pages, and then usages) or mixed if-else and switch
statements, which are hard to read and maintain.

Meanwhile, only usage 0x1-0xffff within the page is defined, and usage 0
is reserved and should be rejected, so simply matching the Ordinal page
and extracting the usage ID is essentially not the correct way to match
valid Ordinal usages.

Introduce HID_OD_MINIMUM and HID_OD_MAXIMUM to properly describe the
valid range of Ordinal usages, as well as providing HID_OD_RANGE for
switch statements to match Ordinal usages with ease.

Link: https://usb.org/sites/default/files/hut1_7.pdf
Signed-off-by: Rong Zhang <i@xxxxxxxx>
---
include/linux/hid.h | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/include/linux/hid.h b/include/linux/hid.h
index 585b3336f4a7..7af2666ef426 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -231,6 +231,11 @@ struct hid_item {

#define HID_DC_BATTERYSTRENGTH 0x00060020

+#define HID_OD_MINIMUM 0x000a0001
+#define HID_OD_MAXIMUM 0x000affff
+/* Use in switch statements. */
+#define HID_OD_RANGE HID_OD_MINIMUM ... HID_OD_MAXIMUM
+
#define HID_CP_CONSUMER_CONTROL 0x000c0001
#define HID_CP_AC_PAN 0x000c0238


--
2.55.0