| 0/0 |
2026/09/25 00:22 |
flow |
assessment-security |
35m
Results: map[DenialOfService:true Explanation:**Bug Analysis**
The bug is a NULL pointer dereference in `wacom_report_numbered_buttons()` which
is called unconditionally by `wacom_intuos_pad()`.
**Root Cause:**
1. During device initialization, the Wacom driver allocates input devices for
the pen, touch, and pad interfaces.
2. It then parses the device's HID descriptor in `wacom_wac_pad_usage_mapping()`
to determine the device's capabilities. If specific Wacom pad usages are found,
it sets the `WACOM_DEVICETYPE_PAD` flag in `features->device_type`.
3. For certain device models like `WACOM_21UX2` (Wacom Cintiq 21UX), the driver
relies entirely on the HID descriptor to set this flag (it is not set by default
quirks).
4. If a crafted HID descriptor is provided that lacks any pad usages, the
`WACOM_DEVICETYPE_PAD` flag remains unset.
5. Consequently, `wacom_setup_pad_input_capabilities()` returns `-ENODEV`,
causing `wacom_setup_inputs()` to free the pad input device and set
`wacom_wac->pad_input = NULL`.
6. However, the interrupt handler `wacom_intuos_irq()` does not check if the pad
input device exists. If the device sends a pad report (e.g.,
`WACOM_REPORT_INTUOSPAD` / `0x0c`), the handler unconditionally calls
`wacom_intuos_pad()`.
7. `wacom_intuos_pad()` then passes the `NULL` `wacom->pad_input` pointer to
`wacom_report_numbered_buttons()`, which dereferences it at an offset (`0x360`),
causing a kernel oops.
**Security Impact:**
* **Exploitable:** False. The crash is caused by a read from a NULL pointer
offset (`0x360`). On modern systems with `mmap_min_addr` protections, mapping
the NULL page is prevented, making this bug unexploitable for privilege
escalation or memory corruption.
* **Denial of Service:** True. Triggering the bug results in a kernel panic,
crashing the system.
* **Peripheral Trigger:** True. An attacker with physical access can plug in a
malicious USB device (e.g., a Teensy or Raspberry Pi Pico) that spoofs the Wacom
Vendor/Product IDs and provides the crafted HID descriptor and reports to
trigger the crash.
* **Unprivileged / User Namespace:** False. The reproducer uses `/dev/uhid` to
emulate the USB device, but this character device is restricted to root or
specific privileged groups by default, and is not accessible within unprivileged
user namespaces. Exploitable:false FilesystemTrigger:false NetworkTrigger:false PeripheralTrigger:true RemoteTrigger:false Unprivileged:false UserNamespace:false VMGuestTrigger:false VMHostTrigger:false]
|
| 1/1 |
2026/09/25 00:22 |
action |
syz-repro-to-c-repro |
0m
Results: map[SimplifiedCRepro:// autogenerated by syzkaller (https://github.com/google/syzkaller)
#define _GNU_SOURCE
#include <endian.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mount.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <unistd.h>
#define BITMASK(bf_off,bf_len) (((1ull << (bf_len)) - 1) << (bf_off))
#define STORE_BY_BITMASK(type,htobe,addr,val,bf_off,bf_len) *(type*)(addr) = htobe((htobe(*(type*)(addr)) & ~BITMASK((bf_off), (bf_len))) | (((type)(val) << (bf_off)) & BITMASK((bf_off), (bf_len))))
uint64_t r[1] = {0xffffffffffffffff};
int main(void)
{
syscall(__NR_mmap, /*addr=*/0x1ffffffff000ul, /*len=*/0x1000, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul);
syscall(__NR_mmap, /*addr=*/0x200000000000ul, /*len=*/0x1000000, /*prot=PROT_WRITE|PROT_READ|PROT_EXEC*/7ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul);
syscall(__NR_mmap, /*addr=*/0x200001000000ul, /*len=*/0x1000, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul);
const char* reason;
(void)reason;
intptr_t res = 0;
if (write(1, "executing program\n", sizeof("executing program\n") - 1)) {}
// openat$uhid arguments: [
// fd: const = 0xffffffffffffff9c (8 bytes)
// file: ptr[in, buffer] {
// buffer: {2f 64 65 76 2f 75 68 69 64 00} (length 0xa)
// }
// flags: uhid_open_flags = 0x2 (4 bytes)
// mode: const = 0x0 (2 bytes)
// ]
// returns fd_uhid
memcpy((void*)0x200000000000, "/dev/uhid\000", 10);
res = syscall(__NR_openat, /*fd=*/0xffffffffffffff9cul, /*file=*/0x200000000000ul, /*flags=O_RDWR*/2, /*mode=*/0);
if (res != -1)
r[0] = res;
// sendmsg$IPSET_CMD_CREATE arguments: [
// fd: sock_nl_netfilter (resource)
// msg: ptr[in, msghdr_netlink[netlink_msg_netfilter_t[NFNL_SUBSYS_IPSET, IPSET_CMD_CREATE, ip_set_create_policy]]] {
// msghdr_netlink[netlink_msg_netfilter_t[NFNL_SUBSYS_IPSET, IPSET_CMD_CREATE, ip_set_create_policy]] {
// addr: nil
// addrlen: len = 0x0 (4 bytes)
// pad = 0x0 (4 bytes)
// vec: ptr[in, iovec[in, netlink_msg_netfilter_t[NFNL_SUBSYS_IPSET, IPSET_CMD_CREATE, ip_set_create_policy]]] {
// iovec[in, netlink_msg_netfilter_t[NFNL_SUBSYS_IPSET, IPSET_CMD_CREATE, ip_set_create_policy]] {
// addr: ptr[in, netlink_msg_netfilter_tt[NFNL_SUBSYS_IPSET, IPSET_CMD_CREATE, array[ip_set_create_policy]]] {
// netlink_msg_netfilter_tt[NFNL_SUBSYS_IPSET, IPSET_CMD_CREATE, array[ip_set_create_policy]] {
// len: len = 0x58 (4 bytes)
// type: const = 0x2 (1 bytes)
// subsys: const = 0x6 (1 bytes)
// flags: netlink_netfilter_msg_flags = 0x801 (2 bytes)
// seq: const = 0x0 (4 bytes)
// pid: const = 0x0 (4 bytes)
// hdr: nfgenmsg {
// nfgen_family: nfproto = 0x0 (1 bytes)
// version: const = 0x0 (1 bytes)
// res_id: int16be = 0x2 (2 bytes)
// }
// attrs: array[ip_set_create_policy] {
// union ip_set_create_policy {
// IPSET_ATTR_DATA: nlattr_tt[const[IPSET_ATTR_DATA, int16:14], 0, 1, array[ip_set_type_create_policy]] {
// nla_len: offsetof = 0xc (2 bytes)
// nla_type: const = 0x7 (1 bytes)
// NLA_F_NET_BYTEORDER: const = 0x0 (0 bytes)
// NLA_F_NESTED: const = 0x1 (1 bytes)
// payload: array[ip_set_type_create_policy] {
// union ip_set_type_create_policy {
// IPSET_ATTR_BUCKETSIZE: nlattr_t[const[IPSET_ATTR_BUCKETSIZE, int16], int8] {
// nla_len: offsetof = 0x5 (2 bytes)
// nla_type: const = 0x15 (2 bytes)
// payload: int8 = 0x7 (1 bytes)
// size: buffer: {} (length 0x0)
// pad = 0x0 (3 bytes)
// }
// }
// }
// size: buffer: {} (length 0x0)
// }
// }
// union ip_set_create_policy {
// IPSET_ATTR_PROTOCOL: nlattr_t[const[IPSET_ATTR_PROTOCOL, int16], const[IPSET_PROTOCOL, int8]] {
// nla_len: offsetof = 0x5 (2 bytes)
// nla_type: const = 0x1 (2 bytes)
// payload: const = 0x6 (1 bytes)
// size: buffer: {} (length 0x0)
// pad = 0x0 (3 bytes)
// }
// }
// union ip_set_create_policy {
// IPSET_ATTR_FAMILY: nlattr_t[const[IPSET_ATTR_FAMILY, int16], flags[nfproto, int8]] {
// nla_len: offsetof = 0x5 (2 bytes)
// nla_type: const = 0x5 (2 bytes)
// payload: nfproto = 0xa (1 bytes)
// size: buffer: {} (length 0x0)
// pad = 0x0 (3 bytes)
// }
// }
// union ip_set_create_policy {
// IPSET_ATTR_REVISION: nlattr_t[const[IPSET_ATTR_REVISION, int16], int8[0:3]] {
// nla_len: offsetof = 0x5 (2 bytes)
// nla_type: const = 0x4 (2 bytes)
// payload: int8 = 0x0 (1 bytes)
// size: buffer: {} (length 0x0)
// pad = 0x0 (3 bytes)
// }
// }
// union ip_set_create_policy {
// IPSET_ATTR_SETNAME: nlattr_t[const[IPSET_ATTR_SETNAME, int16], string[ipset_name]] {
// nla_len: offsetof = 0x9 (2 bytes)
// nla_type: const = 0x2 (2 bytes)
// payload: buffer: {73 79 7a 30 00} (length 0x5)
// size: buffer: {} (length 0x0)
// pad = 0x0 (3 bytes)
// }
// }
// union ip_set_create_policy {
// IPSET_ATTR_TYPENAME: nlattr_t[const[IPSET_ATTR_TYPENAME, int16], string[ipset_type]] {
// nla_len: offsetof = 0x13 (2 bytes)
// nla_type: const = 0x3 (2 bytes)
// payload: buffer: {68 61 73 68 3a 6e 65 74 2c 69 66 61 63 65 00} (length 0xf)
// size: buffer: {} (length 0x0)
// }
// }
// }
// }
// }
// len: len = 0x58 (8 bytes)
// }
// }
// vlen: const = 0x1 (8 bytes)
// ctrl: const = 0x0 (8 bytes)
// ctrllen: const = 0x0 (8 bytes)
// f: send_flags = 0x0 (4 bytes)
// pad = 0x0 (4 bytes)
// }
// }
// f: send_flags = 0x80 (8 bytes)
// ]
*(uint64_t*)0x2000000000c0 = 0;
*(uint32_t*)0x2000000000c8 = 0;
*(uint64_t*)0x2000000000d0 = 0x2000000001c0;
*(uint64_t*)0x2000000001c0 = 0x2000000002c0;
*(uint32_t*)0x2000000002c0 = 0x58;
*(uint8_t*)0x2000000002c4 = 2;
*(uint8_t*)0x2000000002c5 = 6;
*(uint16_t*)0x2000000002c6 = 0x801;
*(uint32_t*)0x2000000002c8 = 0;
*(uint32_t*)0x2000000002cc = 0;
*(uint8_t*)0x2000000002d0 = 0;
*(uint8_t*)0x2000000002d1 = 0;
*(uint16_t*)0x2000000002d2 = htobe16(2);
*(uint16_t*)0x2000000002d4 = 0xc;
STORE_BY_BITMASK(uint16_t, , 0x2000000002d6, 7, 0, 14);
STORE_BY_BITMASK(uint16_t, , 0x2000000002d7, 0, 6, 1);
STORE_BY_BITMASK(uint16_t, , 0x2000000002d7, 1, 7, 1);
*(uint16_t*)0x2000000002d8 = 5;
*(uint16_t*)0x2000000002da = 0x15;
*(uint8_t*)0x2000000002dc = 7;
*(uint16_t*)0x2000000002e0 = 5;
*(uint16_t*)0x2000000002e2 = 1;
*(uint8_t*)0x2000000002e4 = 6;
*(uint16_t*)0x2000000002e8 = 5;
*(uint16_t*)0x2000000002ea = 5;
*(uint8_t*)0x2000000002ec = 0xa;
*(uint16_t*)0x2000000002f0 = 5;
*(uint16_t*)0x2000000002f2 = 4;
*(uint8_t*)0x2000000002f4 = 0;
*(uint16_t*)0x2000000002f8 = 9;
*(uint16_t*)0x2000000002fa = 2;
memcpy((void*)0x2000000002fc, "syz0\000", 5);
*(uint16_t*)0x200000000304 = 0x13;
*(uint16_t*)0x200000000306 = 3;
memcpy((void*)0x200000000308, "hash:net,iface\000", 15);
*(uint64_t*)0x2000000001c8 = 0x58;
*(uint64_t*)0x2000000000d8 = 1;
*(uint64_t*)0x2000000000e0 = 0;
*(uint64_t*)0x2000000000e8 = 0;
*(uint32_t*)0x2000000000f0 = 0;
syscall(__NR_sendmsg, /*fd=*/(intptr_t)-1, /*msg=*/0x2000000000c0ul, /*f=MSG_EOR*/0x80ul);
// write$UHID_CREATE2 arguments: [
// fd: fd_uhid (resource)
// data: ptr[in, uhid_req[UHID_CREATE2, uhid_create2_req]] {
// uhid_req[UHID_CREATE2, uhid_create2_req] {
// type: const = 0xb (4 bytes)
// data: uhid_create2_req {
// name: buffer: {73 79 7a 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00} (length 0x80)
// phys: buffer: {73 79 7a 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00} (length 0x40)
// uniq: buffer: {73 79 7a 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00} (length 0x40)
// rd_size: len = 0x1d (2 bytes)
// bus: int16 = 0x3 (2 bytes)
// vendor: int32 = 0x56a (4 bytes)
// product: int32 = 0x3f (4 bytes)
// version: int32 = 0x0 (4 bytes)
// country: int32 = 0x0 (4 bytes)
// rd_data: buffer: {05 01 09 05 a1 01 05 09 19 01 29 0a 15 00 25 01 75 01 95 0a 81 02 95 01 75 06 81 03 c0} (length 0x1d)
// }
// }
// }
// len: len = 0x135 (8 bytes)
// ]
*(uint32_t*)0x200000001000 = 0xb;
memcpy((void*)0x200000001004, "... [truncated large byte array] ...", 128);
memcpy((void*)0x200000001084, "... [truncated large byte array] ...", 64);
memcpy((void*)0x2000000010c4, "... [truncated large byte array] ...", 64);
*(uint16_t*)0x200000001104 = 0x1d;
*(uint16_t*)0x200000001106 = 3;
*(uint32_t*)0x200000001108 = 0x56a;
*(uint32_t*)0x20000000110c = 0x3f;
*(uint32_t*)0x200000001110 = 0;
*(uint32_t*)0x200000001114 = 0;
memcpy((void*)0x200000001118, "\x05\x01\x09\x05\xa1\x01\x05\x09\x19\x01\x29\x0a\x15\x00\x25\x01\x75\x01\x95\x0a\x81\x02\x95\x01\x75\x06\x81\x03\xc0", 29);
syscall(__NR_write, /*fd=*/r[0], /*data=*/0x200000001000ul, /*len=*/0x135ul);
// write$UHID_INPUT2 arguments: [
// fd: fd_uhid (resource)
// data: ptr[inout, array[ANYUNION]] {
// array[ANYUNION] {
// union ANYUNION {
// ANYBLOB: buffer: {0c 00 00 00 0a 17} (length 0x6)
// }
// }
// }
// len: len = 0x10 (8 bytes)
// ]
memcpy((void*)0x200000000300, "\x0c\x00\x00\x00\x0a\x17", 6);
syscall(__NR_write, /*fd=*/r[0], /*data=*/0x200000000300ul, /*len=*/0x10ul);
return 0;
}
]
|
| 2/1 |
2026/09/25 00:22 |
action |
kernel-checkouter |
0m
Results: map[KernelSrc:/app/workdir/cache/src/7bbbe98fc7e7403fc6601ec214a3d473bdb106e5]
|
| 3/1 |
2026/09/25 00:23 |
action |
kernel-builder |
18m
Results: map[KernelObj:/app/workdir/cache/build/06316eb999c9469f4798bd7d1fb486b165c1460a]
|
| 4/1 |
2026/09/25 00:42 |
action |
codesearch-prepare |
12m
Results: map[Index:codesearch-index]
|
| 5/1 |
2026/09/25 00:54 |
agent |
expert |
3m
Model:
Results: map[DenialOfService:true Exploitable:false FilesystemTrigger:false NetworkTrigger:false PeripheralTrigger:true RemoteTrigger:false Unprivileged:false UserNamespace:false VMGuestTrigger:false VMHostTrigger:false]
Instruction: You are an experienced Linux kernel security engineer. Your task is to analyze given kernel bug report
and determine its security impact based on the following dimensions.
Use the provided tools to examine the source code, check for capability checks (e.g., capable(), ns_capable()),
and understand the nature of the bug. Analyze the given kernel build and configuration.
You can check the kernel config by grepping ".config" file; you can check kernel cmdline by grepping
".config" file for "CONFIG_CMDLINE=". Assume sysctl parameters have default values.
But analyze for the corresponding production build w/o debugging tools enabled (like KASAN, KMSAN, UBSAN).
Try different strategies when analyzing the bug:
- think of ways in which the vulnerable code is unreachable
- or the other way around: try to come up with different ideas of how an unprivileged user can reach the bug
If still unsure err on the side of the bug being non-exploitable/not-accessible.
In the final reply, provide a reasoning for your assessment.
Analysis dimensions:
* Exploitable:
Determine if the bug can result in memory corruption, elevated privileges, or an information leak.
Memory safety issues are almost always exploitable (KASAN or UBSAN reports for use-after-free, out-of-bounds;
refcounting issues, corrupted lists, etc). When kernel is crashing on a completely wild pointer access
(e.g. user-space address, or non-canonical address, but not on NULL or address corresponding to KASAN shadow
for NULL address), including both data accesses and control transfers, that also usually implies possibility
of exploitation. Such reports usually say "unable to handle kernel paging request".
Uses of uninitialized values detected by KMSAN may be exploitable b/c attacker frequently can affect uninit
values with spraying techniques. However, for these exploitability depends on how exactly the uninit value
is used in the code, and what it affects.
Information leaks are exploitable on their own and should be classified as such. A bug that copies kernel
memory contents to userspace (e.g. an out-of-bounds read whose result is returned to the caller, or
uninitialized stack/heap bytes written to a user buffer) is exploitable: it can reveal kernel pointer
values and defeat KASLR, expose sensitive data such as cryptographic keys or other processes' memory, and
serves as a necessary building block in most modern kernel privilege-escalation exploit chains. Do not classify
an information leak as non-exploitable solely because it does not directly cause a memory write or control-flow
hijack; the leak itself is the exploit primitive.
Think of what happens after the bug is triggered. Some bugs cause kernel panic and halt execution,
they are harder to exploit. For example, BUG reports halts the kernel. However, WARNING reports don't halt
execution in production builds. Debug bug detection tools (like KASAN, KMSAN, KCSAN, UBSAN) are also not enabled
in production builds, so attacker can freely exploit these bugs w/o being detected by these tools.
If you see an integer overflow, think how the overflowed value used later (if it's used as allocation size,
or an array index). If you see an out-of-bounds read, think if it's followed by an out-of-bounds write as well.
Some KCSAN data-races may be exploitable by skilled attackers as well. Think what data structures got corrupted
as the result of data races and how. However, note that kernel has lots of "benign" data races that don't lead
to any runtime misbehavior at all.
* Denial Of Service:
Determine if the bug can result in denial-of-service. Most bugs can, since they cause system crash,
hangs, deadlocks, or resource leaks. This is mostly applicable to WARNING bugs that won't cause system crash
in production. For these think what will be consequences of the violation of the kernel assumptions flagged
by the WARNING. In some cases the unexpected condition is also properly handled by the normal control flow
(e.g. with "if (WARN_ON(...))"), these won't cause denial-of-service. If the condition is not handled,
then it may or may not cause denial-of-service.
* Accessible From Unprivileged Processes:
Determine if the bug can be reached from a typical (non-root) user process that does NOT have any special capabilities
(like CAP_SYS_ADMIN, CAP_NET_ADMIN, CAP_NET_RAW, CAP_PERFMON) or access to device nodes restricted to root.
Assume that unprivileged_bpf_disabled=1, that is eBPF loading is not accessible. However, cBPF (classical BPF)
is still accessible to non-root processes.
Assume that user namespaces are not accessible, that is, the process cannot get the mentioned capabilities even
within a new user namespace (checked by ns_capable() function in the kernel sources).
* Accessible From User Namespaces:
Determine if the bug can be reached within a user-namespace where the process has all capabilities
(including CAP_SYS_ADMIN, CAP_NET_ADMIN, CAP_NET_RAW, CAP_PERFMON). Such capabilities are checked with ns_capable()
function in the kernel sources.
* VM Guest Trigger:
Determine if the bug can be triggered from the context of a typical KVM guest (e.g., set up by a QEMU VMM).
Consider accesses to standard Linux host paravirtualized features (virtio-blk, virtio-net, etc.),
and handling of VM exits in the KVM code.
* VM Host Trigger in The Confidential Computing Context:
Determine if the bug can be triggered in a confidential computing guest kernel from the context of a KVM host.
Consider access to standard Linux guest paravirtualized features (virtio-blk, virtio-net, etc.).
* Ethernet Network Trigger:
Determine if the bug can be triggered by processing ingress network Ethernet traffic, either directly (network stack)
or via drivers exposed to network data.
* Other Remote Trigger:
Determine if the bug can be triggered by processing remote traffic other than Ethernet (Wifi, Bluetooth, NFC, etc).
* Peripheral Trigger:
Determine if the bug can be triggered via an untrusted peripheral device that can be physically plugged
into a system, such as a USB device or a niche hardware driver handling external hardware inputs.
This is particularly important for mobile and desktop environments where users can plug in unknown devices.
* Malicious Filesystem Trigger:
Determine if the bug can be triggered by the kernel mounting and parsing a malicious filesystem image.
This is highly critical for Desktop and Mobile environments where external media or downloaded images
might be auto-mounted.
Don't make assumptions about the kernel source code (it may be different from what you assume it is).
Extensively use the provided code access tools (codesearch-*, git-*, grepper, etc)
to examine the actual source code, and confirm any assumptions.
Prefer calling several tools at the same time to save round-trips.
Use set-results tool to provide results of the analysis.
It must be called exactly once before the final reply.
Ignore results of this tool.
Prompt:
The kernel bug report is:
Oops: general protection fault, probably for non-canonical address 0xdffffc000000006c: 0000 [#1] SMP KASAN NOPTI
KASAN: null-ptr-deref in range [0x0000000000000360-0x0000000000000367]
CPU: 2 UID: 0 PID: 6256 Comm: syz.0.237 Not tainted syzkaller #0 PREEMPT(full)
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
RIP: 0010:dev_get_drvdata include/linux/device.h:991 [inline]
RIP: 0010:input_get_drvdata include/linux/input.h:396 [inline]
RIP: 0010:wacom_report_numbered_buttons+0x37/0x210 drivers/hid/wacom_wac.c:4225
Code: f5 53 48 89 fb 48 83 ec 10 48 89 3c 24 e8 71 92 f1 f8 48 8d bb 60 03 00 00 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f 85 b7 01 00 00 48 8b 04 24 4c 8b a0 60 03 00 00 49
RSP: 0018:ffffc90027b5f9a0 EFLAGS: 00010206
RAX: dffffc0000000000 RBX: 0000000000000000 RCX: 0000000000000000
RDX: 000000000000006c RSI: ffffffff891a901f RDI: 0000000000000360
RBP: 0000000000000008 R08: 0000000000000005 R09: 000000000000001f
R10: 0000000000000008 R11: 0000000000000000 R12: 0000000000000000
R13: 00000000000002a8 R14: 0000000000000000 R15: 0000000000000000
FS: 000055558f635500(0000) GS:ffff8880d5d53000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000200000001000 CR3: 000000003797a000 CR4: 0000000000352ef0
Call Trace:
<TASK>
wacom_intuos_pad drivers/hid/wacom_wac.c:643 [inline]
wacom_intuos_irq+0x2f8/0x3430 drivers/hid/wacom_wac.c:1042
wacom_bpt_irq drivers/hid/wacom_wac.c:3290 [inline]
wacom_wac_irq+0x196b/0xab80 drivers/hid/wacom_wac.c:3560
wacom_raw_event+0x6bb/0xba0 drivers/hid/wacom_sys.c:183
__hid_input_report.constprop.0+0x319/0x470 drivers/hid/hid-core.c:2175
uhid_dev_input2 drivers/hid/uhid.c:609 [inline]
uhid_char_write+0xb6b/0x10e0 drivers/hid/uhid.c:767
vfs_write+0x2aa/0x1050 fs/read_write.c:685
ksys_write+0x1f8/0x250 fs/read_write.c:739
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x123/0x790 arch/x86/entry/syscall_64.c:84
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f6e4899e159
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffee1ed0688 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00007f6e48c25fa0 RCX: 00007f6e4899e159
RDX: 0000000000000010 RSI: 0000200000000300 RDI: 0000000000000003
RBP: 00007f6e48a3506b R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f6e48c25fac R14: 00007f6e48c25fa0 R15: 00007f6e48c25fa0
</TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:dev_get_drvdata include/linux/device.h:991 [inline]
RIP: 0010:input_get_drvdata include/linux/input.h:396 [inline]
RIP: 0010:wacom_report_numbered_buttons+0x37/0x210 drivers/hid/wacom_wac.c:4225
Code: f5 53 48 89 fb 48 83 ec 10 48 89 3c 24 e8 71 92 f1 f8 48 8d bb 60 03 00 00 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f 85 b7 01 00 00 48 8b 04 24 4c 8b a0 60 03 00 00 49
RSP: 0018:ffffc90027b5f9a0 EFLAGS: 00010206
RAX: dffffc0000000000 RBX: 0000000000000000 RCX: 0000000000000000
RDX: 000000000000006c RSI: ffffffff891a901f RDI: 0000000000000360
RBP: 0000000000000008 R08: 0000000000000005 R09: 000000000000001f
R10: 0000000000000008 R11: 0000000000000000 R12: 0000000000000000
R13: 00000000000002a8 R14: 0000000000000000 R15: 0000000000000000
FS: 000055558f635500(0000) GS:ffff8880d5d53000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000200000001000 CR3: 000000003797a000 CR4: 0000000000352ef0
----------------
Code disassembly (best guess):
0: f5 cmc
1: 53 push %rbx
2: 48 89 fb mov %rdi,%rbx
5: 48 83 ec 10 sub $0x10,%rsp
9: 48 89 3c 24 mov %rdi,(%rsp)
d: e8 71 92 f1 f8 call 0xf8f19283
12: 48 8d bb 60 03 00 00 lea 0x360(%rbx),%rdi
19: 48 b8 00 00 00 00 00 movabs $0xdffffc0000000000,%rax
20: fc ff df
23: 48 89 fa mov %rdi,%rdx
26: 48 c1 ea 03 shr $0x3,%rdx
* 2a: 80 3c 02 00 cmpb $0x0,(%rdx,%rax,1) <-- trapping instruction
2e: 0f 85 b7 01 00 00 jne 0x1eb
34: 48 8b 04 24 mov (%rsp),%rax
38: 4c 8b a0 60 03 00 00 mov 0x360(%rax),%r12
3f: 49 rex.WB
It is reproducible with the followint program.
Keep in mind that it may lack the precise threading, sandboxing, and some arguments of a working reproducer.
But it should give an idea of the involved syscalls.
// autogenerated by syzkaller (https://github.com/google/syzkaller)
#define _GNU_SOURCE
#include <endian.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mount.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <unistd.h>
#define BITMASK(bf_off,bf_len) (((1ull << (bf_len)) - 1) << (bf_off))
#define STORE_BY_BITMASK(type,htobe,addr,val,bf_off,bf_len) *(type*)(addr) = htobe((htobe(*(type*)(addr)) & ~BITMASK((bf_off), (bf_len))) | (((type)(val) << (bf_off)) & BITMASK((bf_off), (bf_len))))
uint64_t r[1] = {0xffffffffffffffff};
int main(void)
{
syscall(__NR_mmap, /*addr=*/0x1ffffffff000ul, /*len=*/0x1000, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul);
syscall(__NR_mmap, /*addr=*/0x200000000000ul, /*len=*/0x1000000, /*prot=PROT_WRITE|PROT_READ|PROT_EXEC*/7ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul);
syscall(__NR_mmap, /*addr=*/0x200001000000ul, /*len=*/0x1000, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul);
const char* reason;
(void)reason;
intptr_t res = 0;
if (write(1, "executing program\n", sizeof("executing program\n") - 1)) {}
// openat$uhid arguments: [
// fd: const = 0xffffffffffffff9c (8 bytes)
// file: ptr[in, buffer] {
// buffer: {2f 64 65 76 2f 75 68 69 64 00} (length 0xa)
// }
// flags: uhid_open_flags = 0x2 (4 bytes)
// mode: const = 0x0 (2 bytes)
// ]
// returns fd_uhid
memcpy((void*)0x200000000000, "/dev/uhid\000", 10);
res = syscall(__NR_openat, /*fd=*/0xffffffffffffff9cul, /*file=*/0x200000000000ul, /*flags=O_RDWR*/2, /*mode=*/0);
if (res != -1)
r[0] = res;
// sendmsg$IPSET_CMD_CREATE arguments: [
// fd: sock_nl_netfilter (resource)
// msg: ptr[in, msghdr_netlink[netlink_msg_netfilter_t[NFNL_SUBSYS_IPSET, IPSET_CMD_CREATE, ip_set_create_policy]]] {
// msghdr_netlink[netlink_msg_netfilter_t[NFNL_SUBSYS_IPSET, IPSET_CMD_CREATE, ip_set_create_policy]] {
// addr: nil
// addrlen: len = 0x0 (4 bytes)
// pad = 0x0 (4 bytes)
// vec: ptr[in, iovec[in, netlink_msg_netfilter_t[NFNL_SUBSYS_IPSET, IPSET_CMD_CREATE, ip_set_create_policy]]] {
// iovec[in, netlink_msg_netfilter_t[NFNL_SUBSYS_IPSET, IPSET_CMD_CREATE, ip_set_create_policy]] {
// addr: ptr[in, netlink_msg_netfilter_tt[NFNL_SUBSYS_IPSET, IPSET_CMD_CREATE, array[ip_set_create_policy]]] {
// netlink_msg_netfilter_tt[NFNL_SUBSYS_IPSET, IPSET_CMD_CREATE, array[ip_set_create_policy]] {
// len: len = 0x58 (4 bytes)
// type: const = 0x2 (1 bytes)
// subsys: const = 0x6 (1 bytes)
// flags: netlink_netfilter_msg_flags = 0x801 (2 bytes)
// seq: const = 0x0 (4 bytes)
// pid: const = 0x0 (4 bytes)
// hdr: nfgenmsg {
// nfgen_family: nfproto = 0x0 (1 bytes)
// version: const = 0x0 (1 bytes)
// res_id: int16be = 0x2 (2 bytes)
// }
// attrs: array[ip_set_create_policy] {
// union ip_set_create_policy {
// IPSET_ATTR_DATA: nlattr_tt[const[IPSET_ATTR_DATA, int16:14], 0, 1, array[ip_set_type_create_policy]] {
// nla_len: offsetof = 0xc (2 bytes)
// nla_type: const = 0x7 (1 bytes)
// NLA_F_NET_BYTEORDER: const = 0x0 (0 bytes)
// NLA_F_NESTED: const = 0x1 (1 bytes)
// payload: array[ip_set_type_create_policy] {
// union ip_set_type_create_policy {
// IPSET_ATTR_BUCKETSIZE: nlattr_t[const[IPSET_ATTR_BUCKETSIZE, int16], int8] {
// nla_len: offsetof = 0x5 (2 bytes)
// nla_type: const = 0x15 (2 bytes)
// payload: int8 = 0x7 (1 bytes)
// size: buffer: {} (length 0x0)
// pad = 0x0 (3 bytes)
// }
// }
// }
// size: buffer: {} (length 0x0)
// }
// }
// union ip_set_create_policy {
// IPSET_ATTR_PROTOCOL: nlattr_t[const[IPSET_ATTR_PROTOCOL, int16], const[IPSET_PROTOCOL, int8]] {
// nla_len: offsetof = 0x5 (2 bytes)
// nla_type: const = 0x1 (2 bytes)
// payload: const = 0x6 (1 bytes)
// size: buffer: {} (length 0x0)
// pad = 0x0 (3 bytes)
// }
// }
// union ip_set_create_policy {
// IPSET_ATTR_FAMILY: nlattr_t[const[IPSET_ATTR_FAMILY, int16], flags[nfproto, int8]] {
// nla_len: offsetof = 0x5 (2 bytes)
// nla_type: const = 0x5 (2 bytes)
// payload: nfproto = 0xa (1 bytes)
// size: buffer: {} (length 0x0)
// pad = 0x0 (3 bytes)
// }
// }
// union ip_set_create_policy {
// IPSET_ATTR_REVISION: nlattr_t[const[IPSET_ATTR_REVISION, int16], int8[0:3]] {
// nla_len: offsetof = 0x5 (2 bytes)
// nla_type: const = 0x4 (2 bytes)
// payload: int8 = 0x0 (1 bytes)
// size: buffer: {} (length 0x0)
// pad = 0x0 (3 bytes)
// }
// }
// union ip_set_create_policy {
// IPSET_ATTR_SETNAME: nlattr_t[const[IPSET_ATTR_SETNAME, int16], string[ipset_name]] {
// nla_len: offsetof = 0x9 (2 bytes)
// nla_type: const = 0x2 (2 bytes)
// payload: buffer: {73 79 7a 30 00} (length 0x5)
// size: buffer: {} (length 0x0)
// pad = 0x0 (3 bytes)
// }
// }
// union ip_set_create_policy {
// IPSET_ATTR_TYPENAME: nlattr_t[const[IPSET_ATTR_TYPENAME, int16], string[ipset_type]] {
// nla_len: offsetof = 0x13 (2 bytes)
// nla_type: const = 0x3 (2 bytes)
// payload: buffer: {68 61 73 68 3a 6e 65 74 2c 69 66 61 63 65 00} (length 0xf)
// size: buffer: {} (length 0x0)
// }
// }
// }
// }
// }
// len: len = 0x58 (8 bytes)
// }
// }
// vlen: const = 0x1 (8 bytes)
// ctrl: const = 0x0 (8 bytes)
// ctrllen: const = 0x0 (8 bytes)
// f: send_flags = 0x0 (4 bytes)
// pad = 0x0 (4 bytes)
// }
// }
// f: send_flags = 0x80 (8 bytes)
// ]
*(uint64_t*)0x2000000000c0 = 0;
*(uint32_t*)0x2000000000c8 = 0;
*(uint64_t*)0x2000000000d0 = 0x2000000001c0;
*(uint64_t*)0x2000000001c0 = 0x2000000002c0;
*(uint32_t*)0x2000000002c0 = 0x58;
*(uint8_t*)0x2000000002c4 = 2;
*(uint8_t*)0x2000000002c5 = 6;
*(uint16_t*)0x2000000002c6 = 0x801;
*(uint32_t*)0x2000000002c8 = 0;
*(uint32_t*)0x2000000002cc = 0;
*(uint8_t*)0x2000000002d0 = 0;
*(uint8_t*)0x2000000002d1 = 0;
*(uint16_t*)0x2000000002d2 = htobe16(2);
*(uint16_t*)0x2000000002d4 = 0xc;
STORE_BY_BITMASK(uint16_t, , 0x2000000002d6, 7, 0, 14);
STORE_BY_BITMASK(uint16_t, , 0x2000000002d7, 0, 6, 1);
STORE_BY_BITMASK(uint16_t, , 0x2000000002d7, 1, 7, 1);
*(uint16_t*)0x2000000002d8 = 5;
*(uint16_t*)0x2000000002da = 0x15;
*(uint8_t*)0x2000000002dc = 7;
*(uint16_t*)0x2000000002e0 = 5;
*(uint16_t*)0x2000000002e2 = 1;
*(uint8_t*)0x2000000002e4 = 6;
*(uint16_t*)0x2000000002e8 = 5;
*(uint16_t*)0x2000000002ea = 5;
*(uint8_t*)0x2000000002ec = 0xa;
*(uint16_t*)0x2000000002f0 = 5;
*(uint16_t*)0x2000000002f2 = 4;
*(uint8_t*)0x2000000002f4 = 0;
*(uint16_t*)0x2000000002f8 = 9;
*(uint16_t*)0x2000000002fa = 2;
memcpy((void*)0x2000000002fc, "syz0\000", 5);
*(uint16_t*)0x200000000304 = 0x13;
*(uint16_t*)0x200000000306 = 3;
memcpy((void*)0x200000000308, "hash:net,iface\000", 15);
*(uint64_t*)0x2000000001c8 = 0x58;
*(uint64_t*)0x2000000000d8 = 1;
*(uint64_t*)0x2000000000e0 = 0;
*(uint64_t*)0x2000000000e8 = 0;
*(uint32_t*)0x2000000000f0 = 0;
syscall(__NR_sendmsg, /*fd=*/(intptr_t)-1, /*msg=*/0x2000000000c0ul, /*f=MSG_EOR*/0x80ul);
// write$UHID_CREATE2 arguments: [
// fd: fd_uhid (resource)
// data: ptr[in, uhid_req[UHID_CREATE2, uhid_create2_req]] {
// uhid_req[UHID_CREATE2, uhid_create2_req] {
// type: const = 0xb (4 bytes)
// data: uhid_create2_req {
// name: buffer: {73 79 7a 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00} (length 0x80)
// phys: buffer: {73 79 7a 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00} (length 0x40)
// uniq: buffer: {73 79 7a 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00} (length 0x40)
// rd_size: len = 0x1d (2 bytes)
// bus: int16 = 0x3 (2 bytes)
// vendor: int32 = 0x56a (4 bytes)
// product: int32 = 0x3f (4 bytes)
// version: int32 = 0x0 (4 bytes)
// country: int32 = 0x0 (4 bytes)
// rd_data: buffer: {05 01 09 05 a1 01 05 09 19 01 29 0a 15 00 25 01 75 01 95 0a 81 02 95 01 75 06 81 03 c0} (length 0x1d)
// }
// }
// }
// len: len = 0x135 (8 bytes)
// ]
*(uint32_t*)0x200000001000 = 0xb;
memcpy((void*)0x200000001004, "... [truncated large byte array] ...", 128);
memcpy((void*)0x200000001084, "... [truncated large byte array] ...", 64);
memcpy((void*)0x2000000010c4, "... [truncated large byte array] ...", 64);
*(uint16_t*)0x200000001104 = 0x1d;
*(uint16_t*)0x200000001106 = 3;
*(uint32_t*)0x200000001108 = 0x56a;
*(uint32_t*)0x20000000110c = 0x3f;
*(uint32_t*)0x200000001110 = 0;
*(uint32_t*)0x200000001114 = 0;
memcpy((void*)0x200000001118, "\x05\x01\x09\x05\xa1\x01\x05\x09\x19\x01\x29\x0a\x15\x00\x25\x01\x75\x01\x95\x0a\x81\x02\x95\x01\x75\x06\x81\x03\xc0", 29);
syscall(__NR_write, /*fd=*/r[0], /*data=*/0x200000001000ul, /*len=*/0x135ul);
// write$UHID_INPUT2 arguments: [
// fd: fd_uhid (resource)
// data: ptr[inout, array[ANYUNION]] {
// array[ANYUNION] {
// union ANYUNION {
// ANYBLOB: buffer: {0c 00 00 00 0a 17} (length 0x6)
// }
// }
// }
// len: len = 0x10 (8 bytes)
// ]
memcpy((void*)0x200000000300, "\x0c\x00\x00\x00\x0a\x17", 6);
syscall(__NR_write, /*fd=*/r[0], /*data=*/0x200000000300ul, /*len=*/0x10ul);
return 0;
}
Reply: **Bug Analysis**
The bug is a NULL pointer dereference in `wacom_report_numbered_buttons()` which is called unconditionally by `wacom_intuos_pad()`.
**Root Cause:**
1. During device initialization, the Wacom driver allocates input devices for the pen, touch, and pad interfaces.
2. It then parses the device's HID descriptor in `wacom_wac_pad_usage_mapping()` to determine the device's capabilities. If specific Wacom pad usages are found, it sets the `WACOM_DEVICETYPE_PAD` flag in `features->device_type`.
3. For certain device models like `WACOM_21UX2` (Wacom Cintiq 21UX), the driver relies entirely on the HID descriptor to set this flag (it is not set by default quirks).
4. If a crafted HID descriptor is provided that lacks any pad usages, the `WACOM_DEVICETYPE_PAD` flag remains unset.
5. Consequently, `wacom_setup_pad_input_capabilities()` returns `-ENODEV`, causing `wacom_setup_inputs()` to free the pad input device and set `wacom_wac->pad_input = NULL`.
6. However, the interrupt handler `wacom_intuos_irq()` does not check if the pad input device exists. If the device sends a pad report (e.g., `WACOM_REPORT_INTUOSPAD` / `0x0c`), the handler unconditionally calls `wacom_intuos_pad()`.
7. `wacom_intuos_pad()` then passes the `NULL` `wacom->pad_input` pointer to `wacom_report_numbered_buttons()`, which dereferences it at an offset (`0x360`), causing a kernel oops.
**Security Impact:**
* **Exploitable:** False. The crash is caused by a read from a NULL pointer offset (`0x360`). On modern systems with `mmap_min_addr` protections, mapping the NULL page is prevented, making this bug unexploitable for privilege escalation or memory corruption.
* **Denial of Service:** True. Triggering the bug results in a kernel panic, crashing the system.
* **Peripheral Trigger:** True. An attacker with physical access can plug in a malicious USB device (e.g., a Teensy or Raspberry Pi Pico) that spoofs the Wacom Vendor/Product IDs and provides the crafted HID descriptor and reports to trigger the crash.
* **Unprivileged / User Namespace:** False. The reproducer uses `/dev/uhid` to emulate the USB device, but this character device is restricted to root or specific privileged groups by default, and is not accessible within unprivileged user namespaces.
|
| 6/2 |
2026/09/25 00:54 |
llm |
expert |
0m
Model:
Tokens:
input: 14775
output: 43
thoughts: 588
Thoughts: **Analyzing a Kernel Oops on Wacom Tablet Driver**
Okay, so I've got a kernel bug report in front of me: a general protection fault. From the looks of it, it's a null-pointer dereference triggered by KASAN. The crash occurred within the Wacom driver, specifically during the `wacom_report_numbered_buttons` function. That's a good starting point. I can see the exact line: `include/linux/device.h:991` where it all went south. That points directly to a `dev_get_drvdata` call, which is a common source of these kinds of issues if the device data isn't properly initialized or is accessed at the wrong time.
The call trace provides a clear picture. The problem seems to originate from `uhid_char_write`, and it looks like a virtual HID device is involved. I see a reproducer using `/dev/uhid` to inject an event. The report includes vendor and product IDs: Wacom (0x56a) and a Cintiq 21UX2 (0x3f) over USB, which is good context.
My first thought is to dig into the `wacom_report_numbered_buttons` function in `drivers/hid/wacom_wac.c`. I need to figure out how it's getting the device data in the first place, and what could be causing a null pointer. I'll check how `dev_get_drvdata` is used within that function. I'll also want to understand the event flow from `uhid_char_write` through the HID core and into the Wacom driver. Specifically, the path from the virtual HID device, through the USB bus. Are there any race conditions, or initialization problems associated with the virtual device, maybe the Wacom data isn't initialized when the event is processed? I suspect the issue has to do with some kind of data mis-handling associated with the way the virtual device is created or used, especially given it's triggered by a specific event. I need to reproduce this.
|
| 7/2 |
2026/09/25 00:54 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/hid/wacom_wac.c Name:wacom_report_numbered_buttons]
Results: map[SourceCode:4222: static void wacom_report_numbered_buttons(struct input_dev *input_dev,
4223: int button_count, int mask)
4224: {
4225: struct wacom *wacom = input_get_drvdata(input_dev);
4226: int i;
4227:
4228: for (i = 0; i < wacom->led.count; i++)
4229: wacom_update_led(wacom, button_count, mask, i);
4230:
4231: for (i = 0; i < button_count; i++) {
4232: int key = wacom_numbered_button_to_key(i);
4233:
4234: if (key)
4235: input_report_key(input_dev, key, mask & (1 << i));
4236: }
4237: }
SourceFile:drivers/hid/wacom_wac.c]
|
| 8/2 |
2026/09/25 00:54 |
llm |
expert |
0m
Model:
Tokens:
input: 16141
output: 37
thoughts: 100
Thoughts: **Debugging a Wacom Driver Crash**
Okay, so I've hit a crash β line 4225, specifically: `struct wacom *wacom = input_get_drvdata(input_dev);`. That's where it's happening. Hmm, let's step back... right, `input_get_drvdata` essentially calls `dev_get_drvdata(&dev->dev)`. I see a possible issue here: if `input_dev` is, for some reason, a null pointer, then dereferencing `&input_dev->dev` is going to lead to some offset from a null address. And since `dev` is going to be offset by 0x360 from the start, we might be seeing some garbage. Let's dig deeper into the code of `input_get_drvdata` to confirm if my hunch is correct.
|
| 9/2 |
2026/09/25 00:54 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:include/linux/input.h Name:input_get_drvdata]
Results: map[SourceCode: 394: static inline void *input_get_drvdata(struct input_dev *dev)
395: {
396: return dev_get_drvdata(&dev->dev);
397: }
SourceFile:include/linux/input.h]
|
| 10/2 |
2026/09/25 00:54 |
llm |
expert |
0m
Model:
Tokens:
input: 16559
output: 37
thoughts: 12
Thoughts: Okay, here's my take on those thoughts, tailored for an expert audience and presented in the first person:
**Checking `dev_get_drvdata`**
Alright, let's take a look at `dev_get_drvdata`. I need to ensure I'm using this correctly, and that the data I'm expecting to retrieve is actually what's being returned. It's a fundamental part of accessing driver-specific data associated with a device, so understanding its behavior in this context is crucial. I need to quickly verify that the calls are aligned with the proper device contexts and that no implicit assumptions have been made regarding the underlying data structure. I'm going to focus on:
* **The context**: Making sure I'm calling it with the correct `struct device *` pointer, especially if there's any nesting or indirection involved. A slip-up here could lead to accessing the wrong data, or even a kernel panic, so I'll double-check that first.
* **Data type and consistency**: I have to confirm that I'm interpreting the returned `void *` correctly. Is it pointing to a structure I defined? If so, is the struct definition accurate, or is there a discrepancy in the versions? Are there any data races or memory ordering issues to consider around this data?
* **Error Handling**: How the function is used in relation to proper error checking. This is important to ensure the code handles unexpected results gracefully. Is the function itself returning any sort of error code that needs to be addressed, or am I reliant on null pointer checking, etc.
* **The underlying device model**: Are there any quirks or variations in the device model (like platform devices, PCI devices, etc.) that could affect how `dev_get_drvdata` behaves? This is especially critical if I'm working with a newer or less common driver architecture. It's time to refresh myself on how the underlying device is represented and what data is being passed around, if any.
* **Potential Alternatives**: I'm going to quickly consider if there may be a better approach to get the data, or if `dev_get_drvdata` is most appropriate.
So, let's get down to it, dissecting the code and ensuring that data retrieval from the driver's perspective is rock-solid.
|
| 11/2 |
2026/09/25 00:54 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:include/linux/device.h Name:dev_get_drvdata]
Results: map[SourceCode: 989: static inline void *dev_get_drvdata(const struct device *dev)
990: {
991: return dev->driver_data;
992: }
SourceFile:include/linux/device.h]
|
| 12/2 |
2026/09/25 00:54 |
llm |
expert |
0m
Model:
Tokens:
input: 17187
output: 39
thoughts: 56
Thoughts: Okay, let's break this down.
**Diving into the `input_dev` Structure**
Right, so I'm looking at this code, and the key thing to understand is that `dev` seems to be a pointer, derived from `&input_dev->dev`. Okay, got it. But what if `input_dev` is NULL? That's where things get interesting and potentially dangerous. If it *is* NULL, then `&input_dev->dev` effectively becomes `offsetof(struct input_dev, dev)`. I need to make sure I understand how the compiler handles this type of situation. Now, let me quickly refresh my mental map of how `struct input_dev` is actually laid out in memory. I should be able to reason this through quickly. Let me take another look at the structure to be certain of what I'm dealing with.
|
| 13/2 |
2026/09/25 00:54 |
tool |
codesearch-struct-layout |
0m
Args: map[ContextFile:include/linux/input.h FieldOffset:<nil> Name:input_dev]
Results: map[Fields:[map[Name:name OffsetBits:0 SizeBits:64] map[Name:phys OffsetBits:64 SizeBits:64] map[Name:uniq OffsetBits:128 SizeBits:64] map[Name:id OffsetBits:192 SizeBits:64] map[Name:propbit OffsetBits:256 SizeBits:64] map[Name:evbit OffsetBits:320 SizeBits:64] map[Name:keybit OffsetBits:384 SizeBits:768] map[Name:relbit OffsetBits:1152 SizeBits:64] map[Name:absbit OffsetBits:1216 SizeBits:64] map[Name:mscbit OffsetBits:1280 SizeBits:64] map[Name:ledbit OffsetBits:1344 SizeBits:64] map[Name:sndbit OffsetBits:1408 SizeBits:64] map[Name:ffbit OffsetBits:1472 SizeBits:128] map[Name:swbit OffsetBits:1600 SizeBits:64] map[Name:hint_events_per_packet OffsetBits:1664 SizeBits:32] map[Name:keycodemax OffsetBits:1696 SizeBits:32] map[Name:keycodesize OffsetBits:1728 SizeBits:32] map[Name:keycode OffsetBits:1792 SizeBits:64] map[Name:setkeycode OffsetBits:1856 SizeBits:64] map[Name:getkeycode OffsetBits:1920 SizeBits:64] map[Name:ff OffsetBits:1984 SizeBits:64] map[Name:poller OffsetBits:2048 SizeBits:64] map[Name:repeat_key OffsetBits:2112 SizeBits:32] map[Name:timer OffsetBits:2176 SizeBits:640] map[Name:rep OffsetBits:2816 SizeBits:64] map[Name:mt OffsetBits:2880 SizeBits:64] map[Name:absinfo OffsetBits:2944 SizeBits:64] map[Name:key OffsetBits:3008 SizeBits:768] map[Name:led OffsetBits:3776 SizeBits:64] map[Name:snd OffsetBits:3840 SizeBits:64] map[Name:sw OffsetBits:3904 SizeBits:64] map[Name:open OffsetBits:3968 SizeBits:64] map[Name:close OffsetBits:4032 SizeBits:64] map[Name:flush OffsetBits:4096 SizeBits:64] map[Name:event OffsetBits:4160 SizeBits:64] map[Name:grab OffsetBits:4224 SizeBits:64] map[Name:event_lock OffsetBits:4288 SizeBits:512] map[Name:mutex OffsetBits:4800 SizeBits:1088] map[Name:users OffsetBits:5888 SizeBits:32] map[Name:going_away OffsetBits:5920 SizeBits:8] map[Name:dev OffsetBits:5952 SizeBits:9792] map[Name:h_list OffsetBits:15744 SizeBits:128] map[Name:node OffsetBits:15872 SizeBits:128] map[Name:num_vals OffsetBits:16000 SizeBits:32] map[Name:max_vals OffsetBits:16032 SizeBits:32] map[Name:vals OffsetBits:16064 SizeBits:64] map[Name:devres_managed OffsetBits:16128 SizeBits:8] map[Name:timestamp OffsetBits:16192 SizeBits:192] map[Name:inhibited OffsetBits:16384 SizeBits:8] map[Name:ready OffsetBits:16392 SizeBits:8]]]
|
| 14/2 |
2026/09/25 00:54 |
llm |
expert |
0m
Model:
Tokens:
input: 18529
output: 32
thoughts: 56
Thoughts: Here's my thought process, as requested:
**Navigating Device Data Structures**
Okay, so I'm looking at this driver and I need to figure out how it's interacting with the device's internal data. I've pinpointed `dev` to an offset of 5952 bits, or 744 bytes, which is 0x2e8 in hex. That's a good starting point, but I need to understand where `dev->driver_data` fits within the broader `struct device`. I need to understand the layout of that `struct device` to accurately determine how `driver_data` is being accessed. Time to refresh my memory of the structure definition. Let me double check how it's defined.
|
| 15/2 |
2026/09/25 00:55 |
tool |
codesearch-struct-layout |
0m
Args: map[ContextFile:include/linux/device.h Name:device]
Results: map[Fields:[map[Name:kobj OffsetBits:0 SizeBits:512] map[Name:parent OffsetBits:512 SizeBits:64] map[Name:p OffsetBits:576 SizeBits:64] map[Name:init_name OffsetBits:640 SizeBits:64] map[Name:type OffsetBits:704 SizeBits:64] map[Name:bus OffsetBits:768 SizeBits:64] map[Name:driver OffsetBits:832 SizeBits:64] map[Name:platform_data OffsetBits:896 SizeBits:64] map[Name:driver_data OffsetBits:960 SizeBits:64] map[Name:driver_override OffsetBits:1024 SizeBits:576] map[Name:mutex OffsetBits:1600 SizeBits:1088] map[Name:links OffsetBits:2688 SizeBits:448] map[Name:power OffsetBits:3136 SizeBits:4416] map[Name:pm_domain OffsetBits:7552 SizeBits:64] map[Name:msi OffsetBits:7616 SizeBits:128] map[Name:dma_mask OffsetBits:7744 SizeBits:64] map[Name:coherent_dma_mask OffsetBits:7808 SizeBits:64] map[Name:bus_dma_limit OffsetBits:7872 SizeBits:64] map[Name:dma_range_map OffsetBits:7936 SizeBits:64] map[Name:dma_parms OffsetBits:8000 SizeBits:64] map[Name:dma_pools OffsetBits:8064 SizeBits:128] map[Name:dma_mem OffsetBits:8192 SizeBits:64] map[Name:cma_area OffsetBits:8256 SizeBits:64] map[Name:dma_io_tlb_mem OffsetBits:8320 SizeBits:64] map[Name:archdata OffsetBits:8384 SizeBits:0] map[Name:of_node OffsetBits:8384 SizeBits:64] map[Name:fwnode OffsetBits:8448 SizeBits:64] map[Name:numa_node OffsetBits:8512 SizeBits:32] map[Name:devt OffsetBits:8544 SizeBits:32] map[Name:id OffsetBits:8576 SizeBits:32] map[Name:devres_lock OffsetBits:8640 SizeBits:512] map[Name:devres_head OffsetBits:9152 SizeBits:128] map[Name:class OffsetBits:9280 SizeBits:64] map[Name:groups OffsetBits:9344 SizeBits:64] map[Name:release OffsetBits:9408 SizeBits:64] map[Name:iommu_group OffsetBits:9472 SizeBits:64] map[Name:iommu OffsetBits:9536 SizeBits:64] map[Name:physical_location OffsetBits:9600 SizeBits:64] map[Name:removable OffsetBits:9664 SizeBits:32] map[Name:flags OffsetBits:9728 SizeBits:64]]]
|
| 16/2 |
2026/09/25 00:55 |
llm |
expert |
0m
Model:
Tokens:
input: 19665
output: 42
thoughts: 120
Thoughts: Okay, here's my breakdown of what's going on.
**Debugging a Suspected Null Pointer Dereference**
Alright, I'm tracing this crash, and it looks like a null pointer dereference. The crash happened at address `0x0000000000000360`. I'm trying to figure out how we got there. First thing I see is that the `driver_data` field within a structure called `input_dev` is at an offset of 960 bits, or 120 bytes, which is `0x78` in hex. Now, the code's trying to access `input_dev->dev.driver_data`, and according to my understanding of the relevant structure's layout, if `driver_data` is at `0x78` and the `dev` field is at offset `0x2e8`, then the full offset to `input_dev->dev.driver_data` should be `0x2e8 + 0x78 = 0x360`. Bingo! That's exactly where the crash occurred. This solidifies my suspicion.
The fact that the crash is at address `0x360` means that `input_dev` itself must be NULL, because trying to dereference a null pointer will land you exactly on the offset location. This has narrowed down my debugging, now I need to find out where `input_dev` is coming from, and why it's potentially null. The next step is to examine the `wacom_intuos_pad` code to see where that `input_dev` variable is initialized and handled, in order to identify the root cause of this crash.
|
| 17/2 |
2026/09/25 00:55 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/hid/wacom_wac.c Name:wacom_intuos_pad]
Results: map[SourceCode: 513: static int wacom_intuos_pad(struct wacom_wac *wacom)
514: {
515: struct wacom_features *features = &wacom->features;
516: unsigned char *data = wacom->data;
517: struct input_dev *input = wacom->pad_input;
518: int i;
519: int buttons = 0, nbuttons = features->numbered_buttons;
520: int keys = 0, nkeys = 0;
521: int ring1 = 0, ring2 = 0;
522: int strip1 = 0, strip2 = 0;
523: bool prox = false;
524: bool wrench = false, keyboard = false, mute_touch = false, menu = false,
525: info = false;
526:
527: /* pad packets. Works as a second tool and is always in prox */
528: if (!(data[0] == WACOM_REPORT_INTUOSPAD || data[0] == WACOM_REPORT_INTUOS5PAD ||
529: data[0] == WACOM_REPORT_CINTIQPAD))
530: return 0;
531:
532: if (features->type >= INTUOS4S && features->type <= INTUOS4L) {
533: buttons = (data[3] << 1) | (data[2] & 0x01);
534: ring1 = data[1];
535: } else if (features->type == DTK) {
536: buttons = data[6];
537: } else if (features->type == WACOM_13HD) {
538: buttons = (data[4] << 1) | (data[3] & 0x01);
539: } else if (features->type == WACOM_24HD) {
540: buttons = (data[8] << 8) | data[6];
541: ring1 = data[1];
542: ring2 = data[2];
543:
544: /*
545: * Three "buttons" are available on the 24HD which are
546: * physically implemented as a touchstrip. Each button
547: * is approximately 3 bits wide with a 2 bit spacing.
548: * The raw touchstrip bits are stored at:
549: * ((data[3] & 0x1f) << 8) | data[4])
550: */
551: nkeys = 3;
552: keys = ((data[3] & 0x1C) ? 1<<2 : 0) |
553: ((data[4] & 0xE0) ? 1<<1 : 0) |
554: ((data[4] & 0x07) ? 1<<0 : 0);
555: keyboard = !!(data[4] & 0xE0);
556: info = !!(data[3] & 0x1C);
557:
558: if (features->oPid) {
559: mute_touch = !!(data[4] & 0x07);
560: if (mute_touch)
561: wacom->shared->is_touch_on =
562: !wacom->shared->is_touch_on;
563: } else {
564: wrench = !!(data[4] & 0x07);
565: }
566: } else if (features->type == WACOM_27QHD) {
567: nkeys = 3;
568: keys = data[2] & 0x07;
569:
570: wrench = !!(data[2] & 0x01);
571: keyboard = !!(data[2] & 0x02);
572:
573: if (features->oPid) {
574: mute_touch = !!(data[2] & 0x04);
575: if (mute_touch)
576: wacom->shared->is_touch_on =
577: !wacom->shared->is_touch_on;
578: } else {
579: menu = !!(data[2] & 0x04);
580: }
581: input_report_abs(input, ABS_X, be16_to_cpup((__be16 *)&data[4]));
582: input_report_abs(input, ABS_Y, be16_to_cpup((__be16 *)&data[6]));
583: input_report_abs(input, ABS_Z, be16_to_cpup((__be16 *)&data[8]));
584: } else if (features->type == CINTIQ_HYBRID) {
585: /*
586: * Do not send hardware buttons under Android. They
587: * are already sent to the system through GPIO (and
588: * have different meaning).
589: *
590: * d-pad right -> data[4] & 0x10
591: * d-pad up -> data[4] & 0x20
592: * d-pad left -> data[4] & 0x40
593: * d-pad down -> data[4] & 0x80
594: * d-pad center -> data[3] & 0x01
595: */
596: buttons = (data[4] << 1) | (data[3] & 0x01);
597: } else if (features->type == CINTIQ_COMPANION_2) {
598: /* d-pad right -> data[2] & 0x10
599: * d-pad up -> data[2] & 0x20
600: * d-pad left -> data[2] & 0x40
601: * d-pad down -> data[2] & 0x80
602: * d-pad center -> data[1] & 0x01
603: */
604: buttons = ((data[2] >> 4) << 7) |
605: ((data[1] & 0x04) << 4) |
606: ((data[2] & 0x0F) << 2) |
607: (data[1] & 0x03);
608: } else if (features->type >= INTUOS5S && features->type <= INTUOSPL) {
609: /*
610: * ExpressKeys on Intuos5/Intuos Pro have a capacitive sensor in
611: * addition to the mechanical switch. Switch data is
612: * stored in data[4], capacitive data in data[5].
613: *
614: * Touch ring mode switch (data[3]) has no capacitive sensor
615: */
616: buttons = (data[4] << 1) | (data[3] & 0x01);
617: ring1 = data[2];
618: } else {
619: if (features->type == WACOM_21UX2 || features->type == WACOM_22HD) {
620: buttons = (data[8] << 10) | ((data[7] & 0x01) << 9) |
621: (data[6] << 1) | (data[5] & 0x01);
622:
623: if (features->type == WACOM_22HD) {
624: nkeys = 3;
625: keys = data[9] & 0x07;
626:
627: info = !!(data[9] & 0x01);
628: wrench = !!(data[9] & 0x02);
629: }
630: } else {
631: buttons = ((data[6] & 0x10) << 5) |
632: ((data[5] & 0x10) << 4) |
633: ((data[6] & 0x0F) << 4) |
634: (data[5] & 0x0F);
635: }
636: strip1 = ((data[1] & 0x1f) << 8) | data[2];
637: strip2 = ((data[3] & 0x1f) << 8) | data[4];
638: }
639:
640: prox = (buttons & ~(~0U << nbuttons)) | (keys & ~(~0U << nkeys)) |
641: (ring1 & 0x80) | (ring2 & 0x80) | strip1 | strip2;
642:
643: wacom_report_numbered_buttons(input, nbuttons, buttons);
644:
645: for (i = 0; i < nkeys; i++)
646: input_report_key(input, KEY_PROG1 + i, keys & (1 << i));
647:
648: input_report_key(input, KEY_BUTTONCONFIG, wrench);
649: input_report_key(input, KEY_ONSCREEN_KEYBOARD, keyboard);
650: input_report_key(input, KEY_CONTROLPANEL, menu);
651: input_report_key(input, KEY_INFO, info);
652:
653: if (wacom->shared && wacom->shared->touch_input) {
654: input_report_switch(wacom->shared->touch_input,
655: SW_MUTE_DEVICE,
656: !wacom->shared->is_touch_on);
657: input_sync(wacom->shared->touch_input);
658: }
659:
660: input_report_abs(input, ABS_RX, strip1);
661: input_report_abs(input, ABS_RY, strip2);
662:
663: input_report_abs(input, ABS_WHEEL, (ring1 & 0x80) ? (ring1 & 0x7f) : 0);
664: input_report_abs(input, ABS_THROTTLE, (ring2 & 0x80) ? (ring2 & 0x7f) : 0);
665:
666: input_report_key(input, wacom->tool[1], prox ? 1 : 0);
667: input_report_abs(input, ABS_MISC, prox ? PAD_DEVICE_ID : 0);
668:
669: input_event(input, EV_MSC, MSC_SERIAL, 0xffffffff);
670:
671: return 1;
672: }
SourceFile:drivers/hid/wacom_wac.c]
|
| 18/2 |
2026/09/25 00:55 |
llm |
expert |
0m
Model:
Tokens:
input: 23327
output: 55
thoughts: 35
Thoughts: Okay, here's my take on those thoughts, tailored for an expert audience:
**Debugging a Null Pointer Exception in Wacom Pad Input**
Alright, so `wacom->pad_input` is coming up as NULL. That's a red flag. We've got a pointer dereference issue brewing, and it's time to get to the bottom of it. My first thought is always "why?" Why is this pointer not initialized? It's the most likely source of the problem. Now, I need to trace this `wacom->pad_input` back to its allocation. Let's see where the kernel allocates this and if there are any obvious failure paths or races I might have missed. Time to fire up the debugger and dig into the code.
|
| 19/2 |
2026/09/25 00:55 |
tool |
codesearch-find-references |
0m
Error:
Args: map[ContextFile:drivers/hid/wacom_wac.c IncludeSnippetLines:2 Name:pad_input SourceTreePrefix:drivers/hid/]
Results: map[References:<nil> TruncatedOutput:false]
|
| 20/2 |
2026/09/25 00:55 |
llm |
expert |
0m
Model:
Tokens:
input: 23600
output: 61
thoughts: 16
Thoughts: Okay, here's the summary, expressed as though I'm the one having the thoughts, keeping in mind I'm an expert in this field:
**Digging into the `struct wacom_wac` Structure**
Right, so I'm taking another look at the code, and my focus has landed on the `struct wacom_wac` β which makes perfect sense, of course. It's the central data structure here, the core of the Wacom driver, and naturally, I'm expecting to find what I'm looking for somewhere inside it. It's a fundamental element of the driver, so any key functionality or associated data structures should have a representation within it. Time to poke around and see what's in there. I'm going to start digging into that structure to understand its composition and what kind of details it contains.
|
| 21/2 |
2026/09/25 00:55 |
tool |
codesearch-find-references |
0m
Args: map[ContextFile:drivers/hid/wacom_wac.c IncludeSnippetLines:2 Name:wacom_wac::pad_input SourceTreePrefix:drivers/hid/]
Results: map[References:[map[ReferenceKind:writes ReferencingEntityKind:function ReferencingEntityName:wacom_allocate_inputs SourceFile:drivers/hid/wacom_sys.c SourceLine:2115 SourceSnippet:2113: wacom_wac->pen_input = wacom_allocate_input(wacom);
2114: wacom_wac->touch_input = wacom_allocate_input(wacom);
2115: wacom_wac->pad_input = wacom_allocate_input(wacom);
2116: if (!wacom_wac->pen_input ||
2117: !wacom_wac->touch_input ||
] map[ReferenceKind:reads ReferencingEntityKind:function ReferencingEntityName:wacom_allocate_inputs SourceFile:drivers/hid/wacom_sys.c SourceLine:2118 SourceSnippet:2116: if (!wacom_wac->pen_input ||
2117: !wacom_wac->touch_input ||
2118: !wacom_wac->pad_input)
2119: return -ENOMEM;
2120:
] map[ReferenceKind:reads ReferencingEntityKind:function ReferencingEntityName:wacom_allocate_inputs SourceFile:drivers/hid/wacom_sys.c SourceLine:2123 SourceSnippet:2121: wacom_wac->pen_input->name = wacom_wac->pen_name;
2122: wacom_wac->touch_input->name = wacom_wac->touch_name;
2123: wacom_wac->pad_input->name = wacom_wac->pad_name;
2124:
2125: return 0;
] map[ReferenceKind:reads ReferencingEntityKind:function ReferencingEntityName:wacom_bpt3_button_msg SourceFile:drivers/hid/wacom_wac.c SourceLine:3164 SourceSnippet:3162: static void wacom_bpt3_button_msg(struct wacom_wac *wacom, unsigned char *data)
3163: {
3164: struct input_dev *input = wacom->pad_input;
3165: struct wacom_features *features = &wacom->features;
3166:
] map[ReferenceKind:reads ReferencingEntityKind:function ReferencingEntityName:wacom_bpt_touch SourceFile:drivers/hid/wacom_wac.c SourceLine:3082 SourceSnippet:3080: struct wacom_features *features = &wacom->features;
3081: struct input_dev *input = wacom->touch_input;
3082: struct input_dev *pad_input = wacom->pad_input;
3083: unsigned char *data = wacom->data;
3084: int i;
] map[ReferenceKind:reads ReferencingEntityKind:function ReferencingEntityName:wacom_dtus_irq SourceFile:drivers/hid/wacom_wac.c SourceLine:301 SourceSnippet: 299: return 0;
300: } else if (data[0] == WACOM_REPORT_DTUSPAD) {
301: input = wacom->pad_input;
302: input_report_key(input, BTN_0, (data[1] & 0x01));
303: input_report_key(input, BTN_1, (data[1] & 0x02));
] map[ReferenceKind:reads ReferencingEntityKind:function ReferencingEntityName:wacom_graphire_irq SourceFile:drivers/hid/wacom_wac.c SourceLine:346 SourceSnippet: 344: unsigned char *data = wacom->data;
345: struct input_dev *input = wacom->pen_input;
346: struct input_dev *pad_input = wacom->pad_input;
347: int battery_capacity, ps_connected;
348: int prox;
] map[ReferenceKind:reads ReferencingEntityKind:function ReferencingEntityName:wacom_intuos_bt_process_data SourceFile:drivers/hid/wacom_wac.c SourceLine:1202 SourceSnippet:1200:
1201: input_sync(wacom->pen_input);
1202: if (wacom->pad_input)
1203: input_sync(wacom->pad_input);
1204: }
] map[ReferenceKind:reads ReferencingEntityKind:function ReferencingEntityName:wacom_intuos_bt_process_data SourceFile:drivers/hid/wacom_wac.c SourceLine:1203 SourceSnippet:1201: input_sync(wacom->pen_input);
1202: if (wacom->pad_input)
1203: input_sync(wacom->pad_input);
1204: }
] map[ReferenceKind:reads ReferencingEntityKind:function ReferencingEntityName:wacom_intuos_gen3_bt_pad SourceFile:drivers/hid/wacom_wac.c SourceLine:1518 SourceSnippet:1516: static void wacom_intuos_gen3_bt_pad(struct wacom_wac *wacom)
1517: {
1518: struct input_dev *pad_input = wacom->pad_input;
1519: unsigned char *data = wacom->data;
1520:
] map[ReferenceKind:reads ReferencingEntityKind:function ReferencingEntityName:wacom_intuos_pad SourceFile:drivers/hid/wacom_wac.c SourceLine:517 SourceSnippet: 515: struct wacom_features *features = &wacom->features;
516: unsigned char *data = wacom->data;
517: struct input_dev *input = wacom->pad_input;
518: int i;
519: int buttons = 0, nbuttons = features->numbered_buttons;
] map[ReferenceKind:reads ReferencingEntityKind:function ReferencingEntityName:wacom_intuos_pro2_bt_pad SourceFile:drivers/hid/wacom_wac.c SourceLine:1477 SourceSnippet:1475: static void wacom_intuos_pro2_bt_pad(struct wacom_wac *wacom)
1476: {
1477: struct input_dev *pad_input = wacom->pad_input;
1478: unsigned char *data = wacom->data;
1479: int nbuttons = wacom->features.numbered_buttons;
] map[ReferenceKind:reads ReferencingEntityKind:function ReferencingEntityName:wacom_leds_alloc_and_register SourceFile:drivers/hid/wacom_sys.c SourceLine:1588 SourceSnippet:1586: int i, error;
1587:
1588: if (!wacom->wacom_wac.pad_input)
1589: return -EINVAL;
1590:
] map[ReferenceKind:reads ReferencingEntityKind:function ReferencingEntityName:wacom_leds_alloc_and_register SourceFile:drivers/hid/wacom_sys.c SourceLine:1591 SourceSnippet:1589: return -EINVAL;
1590:
1591: dev = &wacom->wacom_wac.pad_input->dev;
1592:
1593: error = wacom_led_groups_allocate(wacom, group_count);
] map[ReferenceKind:reads ReferencingEntityKind:function ReferencingEntityName:wacom_register_inputs SourceFile:drivers/hid/wacom_sys.c SourceLine:2176 SourceSnippet:2174: pen_input_dev = wacom_wac->pen_input;
2175: touch_input_dev = wacom_wac->touch_input;
2176: pad_input_dev = wacom_wac->pad_input;
2177:
2178: if (pen_input_dev) {
] map[ReferenceKind:writes ReferencingEntityKind:function ReferencingEntityName:wacom_register_inputs SourceFile:drivers/hid/wacom_sys.c SourceLine:2199 SourceSnippet:2197:
2198: fail:
2199: wacom_wac->pad_input = NULL;
2200: wacom_wac->touch_input = NULL;
2201: wacom_wac->pen_input = NULL;
] map[ReferenceKind:writes ReferencingEntityKind:function ReferencingEntityName:wacom_release_resources SourceFile:drivers/hid/wacom_sys.c SourceLine:2342 SourceSnippet:2340: wacom->wacom_wac.pen_input = NULL;
2341: wacom->wacom_wac.touch_input = NULL;
2342: wacom->wacom_wac.pad_input = NULL;
2343: }
] map[ReferenceKind:reads ReferencingEntityKind:function ReferencingEntityName:wacom_setup_inputs SourceFile:drivers/hid/wacom_sys.c SourceLine:2136 SourceSnippet:2134: pen_input_dev = wacom_wac->pen_input;
2135: touch_input_dev = wacom_wac->touch_input;
2136: pad_input_dev = wacom_wac->pad_input;
2137:
2138: if (!pen_input_dev || !touch_input_dev || !pad_input_dev)
] map[ReferenceKind:writes ReferencingEntityKind:function ReferencingEntityName:wacom_setup_inputs SourceFile:drivers/hid/wacom_sys.c SourceLine:2161 SourceSnippet:2159: /* no pad events using this interface */
2160: input_free_device(pad_input_dev);
2161: wacom_wac->pad_input = NULL;
2162: pad_input_dev = NULL;
2163: }
] map[ReferenceKind:reads ReferencingEntityKind:function ReferencingEntityName:wacom_setup_pad_input_capabilities SourceFile:drivers/hid/wacom_wac.c SourceLine:4250 SourceSnippet:4248: return -ENODEV;
4249:
4250: if (features->type == REMOTE && input_dev == wacom_wac->pad_input)
4251: return -ENODEV;
4252:
] map[ReferenceKind:reads ReferencingEntityKind:function ReferencingEntityName:wacom_wac_irq SourceFile:drivers/hid/wacom_wac.c SourceLine:3589 SourceSnippet:3587: if (wacom_wac->touch_input)
3588: input_sync(wacom_wac->touch_input);
3589: if (wacom_wac->pad_input)
3590: input_sync(wacom_wac->pad_input);
3591: }
] map[ReferenceKind:reads ReferencingEntityKind:function ReferencingEntityName:wacom_wac_irq SourceFile:drivers/hid/wacom_wac.c SourceLine:3590 SourceSnippet:3588: input_sync(wacom_wac->touch_input);
3589: if (wacom_wac->pad_input)
3590: input_sync(wacom_wac->pad_input);
3591: }
3592: }
] map[ReferenceKind:reads ReferencingEntityKind:function ReferencingEntityName:wacom_wac_pad_event SourceFile:drivers/hid/wacom_wac.c SourceLine:2144 SourceSnippet:2142: struct wacom *wacom = hid_get_drvdata(hdev);
2143: struct wacom_wac *wacom_wac = &wacom->wacom_wac;
2144: struct input_dev *input = wacom_wac->pad_input;
2145: struct wacom_features *features = &wacom_wac->features;
2146: unsigned equivalent_usage = wacom_equivalent_usage(usage->hid);
] map[ReferenceKind:reads ReferencingEntityKind:function ReferencingEntityName:wacom_wac_pad_report SourceFile:drivers/hid/wacom_wac.c SourceLine:2308 SourceSnippet:2306: struct wacom *wacom = hid_get_drvdata(hdev);
2307: struct wacom_wac *wacom_wac = &wacom->wacom_wac;
2308: struct input_dev *input = wacom_wac->pad_input;
2309: bool active = wacom_wac->hid_data.inrange_state != 0;
2310:
] map[ReferenceKind:reads ReferencingEntityKind:function ReferencingEntityName:wacom_wac_pad_usage_mapping SourceFile:drivers/hid/wacom_wac.c SourceLine:2020 SourceSnippet:2018: struct wacom_wac *wacom_wac = &wacom->wacom_wac;
2019: struct wacom_features *features = &wacom_wac->features;
2020: struct input_dev *input = wacom_wac->pad_input;
2021: unsigned equivalent_usage = wacom_equivalent_usage(usage->hid);
2022:
] map[ReferenceKind:reads ReferencingEntityKind:function ReferencingEntityName:wacom_wac_report SourceFile:drivers/hid/wacom_wac.c SourceLine:3054 SourceSnippet:3052: wacom_wac_battery_pre_report(hdev, report);
3053:
3054: if (pad_in_hid_field && wacom_wac->pad_input)
3055: wacom_wac_pad_pre_report(hdev, report);
3056: if (pen_in_hid_field && wacom_wac->pen_input)
] map[ReferenceKind:reads ReferencingEntityKind:function ReferencingEntityName:wacom_wac_report SourceFile:drivers/hid/wacom_wac.c SourceLine:3074 SourceSnippet:3072: wacom_wac_battery_report(hdev, report);
3073:
3074: if (true_pad && wacom_wac->pad_input)
3075: wacom_wac_pad_report(hdev, report, field);
3076: }
]] TruncatedOutput:false]
|
| 22/2 |
2026/09/25 00:55 |
llm |
expert |
0m
Model:
Tokens:
input: 27999
output: 40
thoughts: 55
Thoughts: Here's my understanding of the situation:
**Wacom Pad Input Handling**
Okay, so looking at this code, it's pretty clear: `wacom_setup_inputs` is responsible for cleaning up and resetting the input device associated with the Wacom pad. Specifically, it seems to be releasing the resources held by `pad_input_dev` and setting `wacom_wac->pad_input` to NULL. The key here is the conditional check: this whole clean-up sequence *only* happens if the `features->device_type` doesn't include the `WACOM_DEVICETYPE_PAD` flag. That makes perfect sense; if the device isn't a pad, we don't need to be managing pad-specific input resources. It's a targeted release, avoiding unnecessary operations. The goal is to avoid leaving any dangling pointers or resources.
|
| 23/2 |
2026/09/25 00:55 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/hid/wacom_sys.c Name:wacom_setup_inputs]
Results: map[SourceCode:2128: static int wacom_setup_inputs(struct wacom *wacom)
2129: {
2130: struct input_dev *pen_input_dev, *touch_input_dev, *pad_input_dev;
2131: struct wacom_wac *wacom_wac = &(wacom->wacom_wac);
2132: int error = 0;
2133:
2134: pen_input_dev = wacom_wac->pen_input;
2135: touch_input_dev = wacom_wac->touch_input;
2136: pad_input_dev = wacom_wac->pad_input;
2137:
2138: if (!pen_input_dev || !touch_input_dev || !pad_input_dev)
2139: return -EINVAL;
2140:
2141: error = wacom_setup_pen_input_capabilities(pen_input_dev, wacom_wac);
2142: if (error) {
2143: /* no pen in use on this interface */
2144: input_free_device(pen_input_dev);
2145: wacom_wac->pen_input = NULL;
2146: pen_input_dev = NULL;
2147: }
2148:
2149: error = wacom_setup_touch_input_capabilities(touch_input_dev, wacom_wac);
2150: if (error) {
2151: /* no touch in use on this interface */
2152: input_free_device(touch_input_dev);
2153: wacom_wac->touch_input = NULL;
2154: touch_input_dev = NULL;
2155: }
2156:
2157: error = wacom_setup_pad_input_capabilities(pad_input_dev, wacom_wac);
2158: if (error) {
2159: /* no pad events using this interface */
2160: input_free_device(pad_input_dev);
2161: wacom_wac->pad_input = NULL;
2162: pad_input_dev = NULL;
2163: }
2164:
2165: return 0;
2166: }
SourceFile:drivers/hid/wacom_sys.c]
|
| 24/2 |
2026/09/25 00:55 |
llm |
expert |
0m
Model:
Tokens:
input: 28954
output: 45
thoughts: 16
Thoughts: Okay, let's dive into this. Here's my take on those thoughts, as if they're my own:
**Analyzing Wacom Pad Input Capabilities**
Alright, let's see what we're working with here. My initial thought is to examine `wacom_setup_pad_input_capabilities`. This likely relates to the core functionality of configuring and understanding the input capabilities of a Wacom tablet or pen display. I'm immediately thinking this function probably handles setting up the device drivers, initializing input handlers, perhaps even detecting the hardware configuration like pressure sensitivity, tilt, number of buttons, and any other relevant parameters specific to a given Wacom model. I suspect it's the foundation upon which all other input processing and event handling will be built. This is where the initial handshake between the system and the Wacom hardware likely occurs. I need to understand this function intimately to properly utilize Wacom devices in my current system. My primary interest is likely focused on figuring out how to get precise control and reliable readings from the tablet and pen.
|
| 25/2 |
2026/09/25 00:55 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/hid/wacom_wac.c Name:wacom_setup_pad_input_capabilities]
Results: map[SourceCode:4239: int wacom_setup_pad_input_capabilities(struct input_dev *input_dev,
4240: struct wacom_wac *wacom_wac)
4241: {
4242: struct wacom_features *features = &wacom_wac->features;
4243:
4244: if ((features->type == HID_GENERIC) && features->numbered_buttons > 0)
4245: features->device_type |= WACOM_DEVICETYPE_PAD;
4246:
4247: if (!(features->device_type & WACOM_DEVICETYPE_PAD))
4248: return -ENODEV;
4249:
4250: if (features->type == REMOTE && input_dev == wacom_wac->pad_input)
4251: return -ENODEV;
4252:
4253: input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
4254:
4255: /* kept for making legacy xf86-input-wacom working with the wheels */
4256: __set_bit(ABS_MISC, input_dev->absbit);
4257:
4258: /* kept for making legacy xf86-input-wacom accepting the pad */
4259: if (!(input_dev->absinfo && (input_dev->absinfo[ABS_X].minimum ||
4260: input_dev->absinfo[ABS_X].maximum)))
4261: input_set_abs_params(input_dev, ABS_X, 0, 1, 0, 0);
4262: if (!(input_dev->absinfo && (input_dev->absinfo[ABS_Y].minimum ||
4263: input_dev->absinfo[ABS_Y].maximum)))
4264: input_set_abs_params(input_dev, ABS_Y, 0, 1, 0, 0);
4265:
4266: /* kept for making udev and libwacom accepting the pad */
4267: __set_bit(BTN_STYLUS, input_dev->keybit);
4268:
4269: wacom_setup_numbered_buttons(input_dev, features->numbered_buttons);
4270:
4271: switch (features->type) {
4272:
4273: case CINTIQ_HYBRID:
4274: case CINTIQ_COMPANION_2:
4275: case DTK:
4276: case DTUS:
4277: case GRAPHIRE_BT:
4278: break;
4279:
4280: case WACOM_MO:
4281: __set_bit(BTN_BACK, input_dev->keybit);
4282: __set_bit(BTN_LEFT, input_dev->keybit);
4283: __set_bit(BTN_FORWARD, input_dev->keybit);
4284: __set_bit(BTN_RIGHT, input_dev->keybit);
4285: input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0);
4286: break;
4287:
4288: case WACOM_G4:
4289: __set_bit(BTN_BACK, input_dev->keybit);
4290: __set_bit(BTN_FORWARD, input_dev->keybit);
4291: input_set_capability(input_dev, EV_REL, REL_WHEEL);
4292: break;
4293:
4294: case WACOM_24HD:
4295: __set_bit(KEY_PROG1, input_dev->keybit);
4296: __set_bit(KEY_PROG2, input_dev->keybit);
4297: __set_bit(KEY_PROG3, input_dev->keybit);
4298:
4299: __set_bit(KEY_ONSCREEN_KEYBOARD, input_dev->keybit);
4300: __set_bit(KEY_INFO, input_dev->keybit);
4301:
4302: if (!features->oPid)
4303: __set_bit(KEY_BUTTONCONFIG, input_dev->keybit);
4304:
4305: input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0);
4306: input_set_abs_params(input_dev, ABS_THROTTLE, 0, 71, 0, 0);
4307: break;
4308:
4309: case WACOM_27QHD:
4310: __set_bit(KEY_PROG1, input_dev->keybit);
4311: __set_bit(KEY_PROG2, input_dev->keybit);
4312: __set_bit(KEY_PROG3, input_dev->keybit);
4313:
4314: __set_bit(KEY_ONSCREEN_KEYBOARD, input_dev->keybit);
4315: __set_bit(KEY_BUTTONCONFIG, input_dev->keybit);
4316:
4317: if (!features->oPid)
4318: __set_bit(KEY_CONTROLPANEL, input_dev->keybit);
4319: input_set_abs_params(input_dev, ABS_X, -2048, 2048, 0, 0);
4320: input_abs_set_res(input_dev, ABS_X, 1024); /* points/g */
4321: input_set_abs_params(input_dev, ABS_Y, -2048, 2048, 0, 0);
4322: input_abs_set_res(input_dev, ABS_Y, 1024);
4323: input_set_abs_params(input_dev, ABS_Z, -2048, 2048, 0, 0);
4324: input_abs_set_res(input_dev, ABS_Z, 1024);
4325: __set_bit(INPUT_PROP_ACCELEROMETER, input_dev->propbit);
4326: break;
4327:
4328: case WACOM_22HD:
4329: __set_bit(KEY_PROG1, input_dev->keybit);
4330: __set_bit(KEY_PROG2, input_dev->keybit);
4331: __set_bit(KEY_PROG3, input_dev->keybit);
4332:
4333: __set_bit(KEY_BUTTONCONFIG, input_dev->keybit);
4334: __set_bit(KEY_INFO, input_dev->keybit);
4335: fallthrough;
4336:
4337: case WACOM_21UX2:
4338: case WACOM_BEE:
4339: case CINTIQ:
4340: input_set_abs_params(input_dev, ABS_RX, 0, 4096, 0, 0);
4341: input_set_abs_params(input_dev, ABS_RY, 0, 4096, 0, 0);
4342: break;
4343:
4344: case WACOM_13HD:
4345: input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0);
4346: break;
4347:
4348: case INTUOS3:
4349: case INTUOS3L:
4350: input_set_abs_params(input_dev, ABS_RY, 0, 4096, 0, 0);
4351: fallthrough;
4352:
4353: case INTUOS3S:
4354: input_set_abs_params(input_dev, ABS_RX, 0, 4096, 0, 0);
4355: break;
4356:
4357: case INTUOS5:
4358: case INTUOS5L:
4359: case INTUOSPM:
4360: case INTUOSPL:
4361: case INTUOS5S:
4362: case INTUOSPS:
4363: case INTUOSP2_BT:
4364: case INTUOSP2S_BT:
4365: input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0);
4366: break;
4367:
4368: case INTUOS4WL:
4369: /*
4370: * For Bluetooth devices, the udev rule does not work correctly
4371: * for pads unless we add a stylus capability, which forces
4372: * ID_INPUT_TABLET to be set.
4373: */
4374: __set_bit(BTN_STYLUS, input_dev->keybit);
4375: fallthrough;
4376:
4377: case INTUOS4:
4378: case INTUOS4L:
4379: case INTUOS4S:
4380: input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0);
4381: break;
4382:
4383: case INTUOSHT:
4384: case BAMBOO_PT:
4385: case BAMBOO_TOUCH:
4386: case INTUOSHT2:
4387: __clear_bit(ABS_MISC, input_dev->absbit);
4388:
4389: __set_bit(BTN_LEFT, input_dev->keybit);
4390: __set_bit(BTN_FORWARD, input_dev->keybit);
4391: __set_bit(BTN_BACK, input_dev->keybit);
4392: __set_bit(BTN_RIGHT, input_dev->keybit);
4393:
4394: break;
4395:
4396: case REMOTE:
4397: input_set_capability(input_dev, EV_MSC, MSC_SERIAL);
4398: input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0);
4399: break;
4400:
4401: case INTUOSHT3_BT:
4402: case HID_GENERIC:
4403: break;
4404:
4405: default:
4406: /* no pad supported */
4407: return -ENODEV;
4408: }
4409: return 0;
4410: }
SourceFile:drivers/hid/wacom_wac.c]
|
| 26/2 |
2026/09/25 00:55 |
llm |
expert |
0m
Model:
Tokens:
input: 32309
output: 59
thoughts: 76
Thoughts: Okay, here's my take on those thoughts, framed from my expert perspective:
**Debugging a Wacom Driver Initialization**
Alright, so the reproducer's set up a device, a Wacom, vendor ID 0x56a and product ID 0x3f. The product ID rings a bell. Let me just double-check⦠yeah, `WACOM_21UX2` is indeed 0x3f. Good, good. Now, the key here is likely the feature set associated with that specific Cintiq model. I need to dive into `wacom_features` and look specifically for the entry associated with `WACOM_21UX2`. That's where I'll find the device-specific configuration details or any potential issues related to device initialization. That's the first place I'd look to understand its behaviour!
|
| 27/2 |
2026/09/25 00:55 |
tool |
codesearch-find-references |
0m
Error:
Args: map[ContextFile:drivers/hid/wacom_wac.c IncludeSnippetLines:2 Name:WACOM_21UX2 SourceTreePrefix:drivers/hid/]
Results: map[References:<nil> TruncatedOutput:false]
|
| 28/2 |
2026/09/25 00:55 |
llm |
expert |
0m
Model:
Tokens:
input: 32648
output: 31
thoughts: 46
Thoughts: Okay, here's my interpretation of that thought process, tailored for an expert audience:
**Investigating a Suspect Enum Value**
Right, so I see `WACOM_21UX2` β that screams enum member. My gut says it's likely representing some hardware identifier or configuration value. My next move is clear: I need to trace where this enum value is defined and, more importantly, *used*. Given the context, I'm betting the relevant code resides within either `wacom_wac.c` or `wacom_sys.c`. These are the usual suspects in the Wacom driver world. Therefore, I need to do a quick search within those files for the hexadecimal value `0x3f`. That should get me to the definition.
|
| 29/2 |
2026/09/25 00:55 |
tool |
grepper |
0m
Error:
Args: map[Expression:0x3f PathPrefix:drivers/hid/wacom_]
Results:
|
| 30/2 |
2026/09/25 00:55 |
llm |
expert |
0m
Model:
Tokens:
input: 32902
output: 34
thoughts: 28
Thoughts: Okay, here's my attempt at summarizing the thought process, as if I were a seasoned professional in the field:
**Investigating the Wacom Driver for the 21UX2**
Alright, time to get to the bottom of this. My initial thought is, "Let's zero in on the `WACOM_21UX2` identifier within the `drivers/hid/wacom_wac.c` file." This is where I'd logically expect to find the relevant code for a Wacom device with that specific product ID. I want to jump directly into the source code, targeting the driver responsible for handling the 21UX2. The goal is to efficiently locate the device-specific initialization, feature handling, and any potential bug sources. I need to understand how the driver interacts with this particular model.
|
| 31/2 |
2026/09/25 00:55 |
tool |
grepper |
0m
Error:
Args: map[Expression:WACOM_21UX2 PathPrefix:drivers/hid/wacom_]
Results:
|
| 32/2 |
2026/09/25 00:55 |
llm |
expert |
0m
Model:
Tokens:
input: 33152
output: 40
thoughts: 77
Thoughts: Okay, let me break this down.
**Investigating a Wacom Driver Configuration**
Hold on a minute... I'm seeing a reference to `WACOM_21UX2` right there, specifically within `wacom_setup_pad_input_capabilities`! That's interesting, and potentially relevant. It's making me wonder about the `grepper` failure, and what that might mean. Is it because the search term I used was incorrect? Perhaps I was too specific. I should probably investigate further before making a judgment. It might not be the exact identifier I'm looking for.
I should check line 4337 in `wacom_wac.c` to see if that reveals more.
|
| 33/2 |
2026/09/25 00:55 |
tool |
read-file |
0m
Args: map[File:drivers/hid/wacom_wac.c FirstLine:4330 LineCount:20]
Results: map[Contents:4330: __set_bit(KEY_PROG2, input_dev->keybit);
4331: __set_bit(KEY_PROG3, input_dev->keybit);
4332:
4333: __set_bit(KEY_BUTTONCONFIG, input_dev->keybit);
4334: __set_bit(KEY_INFO, input_dev->keybit);
4335: fallthrough;
4336:
4337: case WACOM_21UX2:
4338: case WACOM_BEE:
4339: case CINTIQ:
4340: input_set_abs_params(input_dev, ABS_RX, 0, 4096, 0, 0);
4341: input_set_abs_params(input_dev, ABS_RY, 0, 4096, 0, 0);
4342: break;
4343:
4344: case WACOM_13HD:
4345: input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0);
4346: break;
4347:
4348: case INTUOS3:
4349: case INTUOS3L:
]
|
| 34/2 |
2026/09/25 00:55 |
llm |
expert |
0m
Model:
Tokens:
input: 33788
output: 59
thoughts: 32
Thoughts: Okay, here's my interpretation of those thoughts, tailored for an expert audience, presented in the first person:
**Navigating the Digital Canvas: A Quick Diagnostic**
Right, there it is β `WACOM_21UX2`. Good, good. Now, the first step in troubleshooting or understanding this system is to trace this identifier. Where exactly is `WACOM_21UX2` defined within this architecture? Is it a configuration variable, an input device descriptor, a driver-specific constant, or something else entirely? I need to quickly identify its origin to fully understand how it is being used. Let's see if it's in a header, some config file, the device tree, or even the kernel's source code. Time to dig in and find its definition.
|
| 35/2 |
2026/09/25 00:55 |
tool |
codesearch-find-references |
0m
Error:
Args: map[ContextFile:drivers/hid/wacom_wac.c IncludeSnippetLines:2 Name:WACOM_21UX2 SourceTreePrefix:drivers/hid/]
Results: map[References:<nil> TruncatedOutput:false]
|
| 36/2 |
2026/09/25 00:55 |
llm |
expert |
0m
Model:
Tokens:
input: 34066
output: 31
thoughts: 34
Thoughts: Okay, here's my take on those thoughts, tailored for an expert audience:
**Enum Value Verification and Code Exploration**
Alright, hang on a second... `WACOM_21UX2`... that rings a bell. Pretty sure that's an *enumeration* value. I need to confirm that, and I know exactly how I'll do it. Let's fire up grepper and hunt down every instance of that symbol within the codebase. Quick search, focusing on the definition and how it's used β I want to see how that enum is structured and what other related constants or data structures are defined alongside it. I want to see its context; this is probably critical for understanding the underlying logic. It's a key identifier, and I need to see how it's used.
|
| 37/2 |
2026/09/25 00:55 |
tool |
grepper |
0m
Args: map[Expression:WACOM_21UX2 PathPrefix:drivers/hid/]
Results: map[Output:drivers/hid/wacom_sys.c=927=static int wacom_led_control(struct wacom *wacom)
--
drivers/hid/wacom_sys.c-990-
drivers/hid/wacom_sys.c:991: if (wacom->wacom_wac.features.type == WACOM_21UX2 ||
drivers/hid/wacom_sys.c-992- wacom->wacom_wac.features.type == WACOM_24HD)
--
drivers/hid/wacom_sys.c=1608=int wacom_initialize_leds(struct wacom *wacom)
--
drivers/hid/wacom_sys.c-1655- case WACOM_24HD:
drivers/hid/wacom_sys.c:1656: case WACOM_21UX2:
drivers/hid/wacom_sys.c-1657- wacom->led.llv = 0;
--
drivers/hid/wacom_wac.c=513=static int wacom_intuos_pad(struct wacom_wac *wacom)
--
drivers/hid/wacom_wac.c-618- } else {
drivers/hid/wacom_wac.c:619: if (features->type == WACOM_21UX2 || features->type == WACOM_22HD) {
drivers/hid/wacom_wac.c-620- buttons = (data[8] << 10) | ((data[7] & 0x01) << 9) |
--
drivers/hid/wacom_wac.c=849=static int wacom_intuos_general(struct wacom_wac *wacom)
--
drivers/hid/wacom_wac.c-876- if ((!((wacom->id[idx] >> 16) & 0x01) &&
drivers/hid/wacom_wac.c:877: (features->type == WACOM_21UX2)) ||
drivers/hid/wacom_wac.c-878- /* Only large Intuos support Lense Cursor */
--
drivers/hid/wacom_wac.c=3461=void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len)
--
drivers/hid/wacom_wac.c-3503- case WACOM_13HD:
drivers/hid/wacom_wac.c:3504: case WACOM_21UX2:
drivers/hid/wacom_wac.c-3505- case WACOM_22HD:
--
drivers/hid/wacom_wac.c=3648=void wacom_setup_device_quirks(struct wacom *wacom)
--
drivers/hid/wacom_wac.c-3737- case DTUSX:
drivers/hid/wacom_wac.c:3738: case WACOM_21UX2:
drivers/hid/wacom_wac.c-3739- case WACOM_22HD:
--
drivers/hid/wacom_wac.c=3801=int wacom_setup_pen_input_capabilities(struct input_dev *input_dev,
--
drivers/hid/wacom_wac.c-3864- case WACOM_22HD:
drivers/hid/wacom_wac.c:3865: case WACOM_21UX2:
drivers/hid/wacom_wac.c-3866- case WACOM_BEE:
--
drivers/hid/wacom_wac.c=4159=static bool wacom_is_led_toggled(struct wacom *wacom, int button_count,
--
drivers/hid/wacom_wac.c-4168- */
drivers/hid/wacom_wac.c:4169: if (wacom->wacom_wac.features.type == WACOM_21UX2)
drivers/hid/wacom_wac.c-4170- group = 1 - group;
--
drivers/hid/wacom_wac.c=4239=int wacom_setup_pad_input_capabilities(struct input_dev *input_dev,
--
drivers/hid/wacom_wac.c-4336-
drivers/hid/wacom_wac.c:4337: case WACOM_21UX2:
drivers/hid/wacom_wac.c-4338- case WACOM_BEE:
--
drivers/hid/wacom_wac.c=4703=static const struct wacom_features wacom_features_0xCC =
drivers/hid/wacom_wac.c-4704- { "Wacom Cintiq 21UX2", 87200, 65600, 2047, 63,
drivers/hid/wacom_wac.c:4705: WACOM_21UX2, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 18,
drivers/hid/wacom_wac.c-4706- WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET,
--
drivers/hid/wacom_wac.h=190=enum {
--
drivers/hid/wacom_wac.h-216- INTUOSHT3_BT,
drivers/hid/wacom_wac.h:217: WACOM_21UX2,
drivers/hid/wacom_wac.h-218- WACOM_22HD,
]
|
| 38/2 |
2026/09/25 00:55 |
llm |
expert |
0m
Model:
Tokens:
input: 35761
output: 33
thoughts: 60
Thoughts: Okay, here's my interpretation of that thought process, tailored for an expert audience:
**Analyzing Wacom Device IDs and Feature Sets**
Right, so I'm seeing this `wacom_features_0xCC` data structure and it appears to be associated with a `WACOM_21UX2` device. Hmm, interesting. Let me quickly verify, the reproducer they're using seems to be identifying a vendor ID of 0x56a and a product ID of 0x3f. Okay, that doesn't immediately strike me as the 21UX2. Time to cross-reference and check the feature flags for `wacom_features_0x3F` against the known specifications. I need to understand if the features set on this device aligns with the expectations for this hardware, or if this requires a firmware update.
|
| 39/2 |
2026/09/25 00:55 |
tool |
grepper |
0m
Args: map[Expression:wacom_features_0x3F PathPrefix:drivers/hid/]
Results: map[Output:drivers/hid/wacom_wac.c=4636=static const struct wacom_features wacom_features_0x32C =
--
drivers/hid/wacom_wac.c-4638- .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x32B, .touch_max = 10 };
drivers/hid/wacom_wac.c:4639:static const struct wacom_features wacom_features_0x3F =
drivers/hid/wacom_wac.c-4640- { "Wacom Cintiq 21UX", 87200, 65600, 1023, 63,
]
|
| 40/2 |
2026/09/25 00:55 |
llm |
expert |
0m
Model:
Tokens:
input: 36228
output: 40
thoughts: 15
Thoughts: Okay, here's my interpretation of that thought process, tailored for an expert audience, and written in the first person:
**Initial Assessment of `wacom_features_0x3F`**
Alright, let's dive into this. The instruction "Let's read `wacom_features_0x3F`" immediately tells me we're likely looking at some configuration or status information related to a Wacom tablet or pen, specifically targeting memory location `0x3F`. The naming convention `wacom_features_...` suggests this data holds some kind of feature flags, capabilities, or potentially even raw hardware registers. Given my experience, I'd expect this might contain information about pressure sensitivity levels, tilt support, button configurations, perhaps even firmware version or supported communication protocols. The hexadecimal notation is standard for memory addresses, of course, but it's crucial to understand the underlying hardware or driver context to interpret the content properly. My immediate question is: what tool will I be using to read this? A debugger? A dedicated utility? And what's the environment β OS, driver version, etc.? This is where the real investigation begins.
|
| 41/2 |
2026/09/25 00:55 |
tool |
read-file |
0m
Args: map[File:drivers/hid/wacom_wac.c FirstLine:4639 LineCount:10]
Results: map[Contents:4639: static const struct wacom_features wacom_features_0x3F =
4640: { "Wacom Cintiq 21UX", 87200, 65600, 1023, 63,
4641: CINTIQ, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 8 };
4642: static const struct wacom_features wacom_features_0xC5 =
4643: { "Wacom Cintiq 20WSX", 86680, 54180, 1023, 63,
4644: WACOM_BEE, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 10 };
4645: static const struct wacom_features wacom_features_0xC6 =
4646: { "Wacom Cintiq 12WX", 53020, 33440, 1023, 63,
4647: WACOM_BEE, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 10 };
4648: static const struct wacom_features wacom_features_0x304 =
]
|
| 42/2 |
2026/09/25 00:55 |
llm |
expert |
0m
Model:
Tokens:
input: 36871
output: 45
thoughts: 43
Thoughts: Okay, here's my take on those thoughts, tailored for an expert audience:
**Analyzing Wacom Device Capabilities**
Alright, so `wacom_features_0x3F` is definitively tagged as a `CINTIQ`. Good, that narrows down the scope considerably. Now, let's drill down into the device-specific setup. My immediate next step is to examine `wacom_setup_pad_input_capabilities` function. Specifically, I need to see how it handles `CINTIQ` devices. I'm looking for the instantiation and/or assignment of the input capabilities for this particular device class. I want to see how the pad input β button mappings, pressure sensitivity (if relevant for this model), and any other CINTIQ-specific input capabilities β are being set up. I'm expecting to see specific calls or data structures tailored to this device family, given the type of data that the previous variable provided.
|
| 43/2 |
2026/09/25 00:55 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/hid/wacom_wac.c Name:wacom_setup_pad_input_capabilities]
Results: map[SourceCode:4239: int wacom_setup_pad_input_capabilities(struct input_dev *input_dev,
4240: struct wacom_wac *wacom_wac)
4241: {
4242: struct wacom_features *features = &wacom_wac->features;
4243:
4244: if ((features->type == HID_GENERIC) && features->numbered_buttons > 0)
4245: features->device_type |= WACOM_DEVICETYPE_PAD;
4246:
4247: if (!(features->device_type & WACOM_DEVICETYPE_PAD))
4248: return -ENODEV;
4249:
4250: if (features->type == REMOTE && input_dev == wacom_wac->pad_input)
4251: return -ENODEV;
4252:
4253: input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
4254:
4255: /* kept for making legacy xf86-input-wacom working with the wheels */
4256: __set_bit(ABS_MISC, input_dev->absbit);
4257:
4258: /* kept for making legacy xf86-input-wacom accepting the pad */
4259: if (!(input_dev->absinfo && (input_dev->absinfo[ABS_X].minimum ||
4260: input_dev->absinfo[ABS_X].maximum)))
4261: input_set_abs_params(input_dev, ABS_X, 0, 1, 0, 0);
4262: if (!(input_dev->absinfo && (input_dev->absinfo[ABS_Y].minimum ||
4263: input_dev->absinfo[ABS_Y].maximum)))
4264: input_set_abs_params(input_dev, ABS_Y, 0, 1, 0, 0);
4265:
4266: /* kept for making udev and libwacom accepting the pad */
4267: __set_bit(BTN_STYLUS, input_dev->keybit);
4268:
4269: wacom_setup_numbered_buttons(input_dev, features->numbered_buttons);
4270:
4271: switch (features->type) {
4272:
4273: case CINTIQ_HYBRID:
4274: case CINTIQ_COMPANION_2:
4275: case DTK:
4276: case DTUS:
4277: case GRAPHIRE_BT:
4278: break;
4279:
4280: case WACOM_MO:
4281: __set_bit(BTN_BACK, input_dev->keybit);
4282: __set_bit(BTN_LEFT, input_dev->keybit);
4283: __set_bit(BTN_FORWARD, input_dev->keybit);
4284: __set_bit(BTN_RIGHT, input_dev->keybit);
4285: input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0);
4286: break;
4287:
4288: case WACOM_G4:
4289: __set_bit(BTN_BACK, input_dev->keybit);
4290: __set_bit(BTN_FORWARD, input_dev->keybit);
4291: input_set_capability(input_dev, EV_REL, REL_WHEEL);
4292: break;
4293:
4294: case WACOM_24HD:
4295: __set_bit(KEY_PROG1, input_dev->keybit);
4296: __set_bit(KEY_PROG2, input_dev->keybit);
4297: __set_bit(KEY_PROG3, input_dev->keybit);
4298:
4299: __set_bit(KEY_ONSCREEN_KEYBOARD, input_dev->keybit);
4300: __set_bit(KEY_INFO, input_dev->keybit);
4301:
4302: if (!features->oPid)
4303: __set_bit(KEY_BUTTONCONFIG, input_dev->keybit);
4304:
4305: input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0);
4306: input_set_abs_params(input_dev, ABS_THROTTLE, 0, 71, 0, 0);
4307: break;
4308:
4309: case WACOM_27QHD:
4310: __set_bit(KEY_PROG1, input_dev->keybit);
4311: __set_bit(KEY_PROG2, input_dev->keybit);
4312: __set_bit(KEY_PROG3, input_dev->keybit);
4313:
4314: __set_bit(KEY_ONSCREEN_KEYBOARD, input_dev->keybit);
4315: __set_bit(KEY_BUTTONCONFIG, input_dev->keybit);
4316:
4317: if (!features->oPid)
4318: __set_bit(KEY_CONTROLPANEL, input_dev->keybit);
4319: input_set_abs_params(input_dev, ABS_X, -2048, 2048, 0, 0);
4320: input_abs_set_res(input_dev, ABS_X, 1024); /* points/g */
4321: input_set_abs_params(input_dev, ABS_Y, -2048, 2048, 0, 0);
4322: input_abs_set_res(input_dev, ABS_Y, 1024);
4323: input_set_abs_params(input_dev, ABS_Z, -2048, 2048, 0, 0);
4324: input_abs_set_res(input_dev, ABS_Z, 1024);
4325: __set_bit(INPUT_PROP_ACCELEROMETER, input_dev->propbit);
4326: break;
4327:
4328: case WACOM_22HD:
4329: __set_bit(KEY_PROG1, input_dev->keybit);
4330: __set_bit(KEY_PROG2, input_dev->keybit);
4331: __set_bit(KEY_PROG3, input_dev->keybit);
4332:
4333: __set_bit(KEY_BUTTONCONFIG, input_dev->keybit);
4334: __set_bit(KEY_INFO, input_dev->keybit);
4335: fallthrough;
4336:
4337: case WACOM_21UX2:
4338: case WACOM_BEE:
4339: case CINTIQ:
4340: input_set_abs_params(input_dev, ABS_RX, 0, 4096, 0, 0);
4341: input_set_abs_params(input_dev, ABS_RY, 0, 4096, 0, 0);
4342: break;
4343:
4344: case WACOM_13HD:
4345: input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0);
4346: break;
4347:
4348: case INTUOS3:
4349: case INTUOS3L:
4350: input_set_abs_params(input_dev, ABS_RY, 0, 4096, 0, 0);
4351: fallthrough;
4352:
4353: case INTUOS3S:
4354: input_set_abs_params(input_dev, ABS_RX, 0, 4096, 0, 0);
4355: break;
4356:
4357: case INTUOS5:
4358: case INTUOS5L:
4359: case INTUOSPM:
4360: case INTUOSPL:
4361: case INTUOS5S:
4362: case INTUOSPS:
4363: case INTUOSP2_BT:
4364: case INTUOSP2S_BT:
4365: input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0);
4366: break;
4367:
4368: case INTUOS4WL:
4369: /*
4370: * For Bluetooth devices, the udev rule does not work correctly
4371: * for pads unless we add a stylus capability, which forces
4372: * ID_INPUT_TABLET to be set.
4373: */
4374: __set_bit(BTN_STYLUS, input_dev->keybit);
4375: fallthrough;
4376:
4377: case INTUOS4:
4378: case INTUOS4L:
4379: case INTUOS4S:
4380: input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0);
4381: break;
4382:
4383: case INTUOSHT:
4384: case BAMBOO_PT:
4385: case BAMBOO_TOUCH:
4386: case INTUOSHT2:
4387: __clear_bit(ABS_MISC, input_dev->absbit);
4388:
4389: __set_bit(BTN_LEFT, input_dev->keybit);
4390: __set_bit(BTN_FORWARD, input_dev->keybit);
4391: __set_bit(BTN_BACK, input_dev->keybit);
4392: __set_bit(BTN_RIGHT, input_dev->keybit);
4393:
4394: break;
4395:
4396: case REMOTE:
4397: input_set_capability(input_dev, EV_MSC, MSC_SERIAL);
4398: input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0);
4399: break;
4400:
4401: case INTUOSHT3_BT:
4402: case HID_GENERIC:
4403: break;
4404:
4405: default:
4406: /* no pad supported */
4407: return -ENODEV;
4408: }
4409: return 0;
4410: }
SourceFile:drivers/hid/wacom_wac.c]
|
| 44/2 |
2026/09/25 00:55 |
llm |
expert |
0m
Model:
Tokens:
input: 40232
output: 60
thoughts: 518
Thoughts: **Analyzing Wacom Cintiq Device Initialization**
Okay, so I'm looking at this code and I've spotted something interesting. I see that `wacom_features_0x3F` is associated with `CINTIQ`. I know the `CINTIQ` device is handled in `wacom_setup_pad_input_capabilities` where `ABS_RX` and `ABS_RY` are set. But what's really catching my eye is that `wacom_features_0x3F` also has `numbered_buttons = 8`, which suggests some kind of pad functionality.
Now, does `CINTIQ` get the `WACOM_DEVICETYPE_PAD` flag set in its `features->device_type`? I'm going back to examine `wacom_features_0x3F`. Ah, I see a potential gotcha. The `device_type` field isn't explicitly initialized in the struct definition, so it's effectively zero.
Looking at the logic in `wacom_setup_pad_input_capabilities` again, if `features->type` is `HID_GENERIC` and `numbered_buttons` is greater than zero, then `WACOM_DEVICETYPE_PAD` is added to the `device_type`. If the `device_type` does *not* have `WACOM_DEVICETYPE_PAD` set, it returns `-ENODEV`. Since `features->type` is `CINTIQ` (not `HID_GENERIC`) and `device_type` is 0, this will indeed return `-ENODEV`.
This means `wacom_setup_inputs` will subsequently free `pad_input_dev` and set `wacom_wac->pad_input = NULL`, effectively disabling the pad functionality for the Cintiq.
I wonder where `device_type` might be set elsewhere? Let me check the `wacom_probe` and `wacom_parse_and_register` functions to see if anything is missing.
|
| 45/2 |
2026/09/25 00:56 |
tool |
codesearch-find-references |
0m
Error:
Args: map[ContextFile:drivers/hid/wacom_sys.c IncludeSnippetLines:2 Name:WACOM_DEVICETYPE_PAD SourceTreePrefix:drivers/hid/]
Results: map[References:<nil> TruncatedOutput:false]
|
| 46/2 |
2026/09/25 00:56 |
llm |
expert |
0m
Model:
Tokens:
input: 41270
output: 33
thoughts: 16
Thoughts: Here's a summary of my immediate thought process, keeping in mind my expertise:
**My Immediate Diagnostic Impulse**
Alright, my internal diagnostic engine just revved up. The first thing I'm doing is reaching for `grep` and a specific string: `WACOM_DEVICETYPE_PAD`. This suggests to me we're likely dealing with a Wacom tablet or pad issue, specifically within a Linux or Unix-like environment where `grep` is standard. My brain immediately connects this to device identification or configuration. I'm probably looking for where this constant is defined, used, or referenced within source code, configuration files, or system logs. It's a very targeted search, indicating I already have a suspicion about the problem's root cause, or at least a specific area to investigate. Knowing the context surrounding this `WACOM_DEVICETYPE_PAD` identifier is key, but this is my starting point to narrow the scope of the problem.
|
| 47/2 |
2026/09/25 00:56 |
tool |
grepper |
0m
Args: map[Expression:WACOM_DEVICETYPE_PAD PathPrefix:drivers/hid/]
Results: map[Output:drivers/hid/wacom_sys.c=1608=int wacom_initialize_leds(struct wacom *wacom)
--
drivers/hid/wacom_sys.c-1611-
drivers/hid/wacom_sys.c:1612: if (!(wacom->wacom_wac.features.device_type & WACOM_DEVICETYPE_PAD))
drivers/hid/wacom_sys.c-1613- return 0;
--
drivers/hid/wacom_sys.c=2371=static int wacom_parse_and_register(struct wacom *wacom, bool wireless)
--
drivers/hid/wacom_sys.c-2438- ((features->device_type & WACOM_DEVICETYPE_TOUCH) ||
drivers/hid/wacom_sys.c:2439: (features->device_type & WACOM_DEVICETYPE_PAD))) {
drivers/hid/wacom_sys.c-2440- error = -ENODEV;
--
drivers/hid/wacom_sys.c-2465-
drivers/hid/wacom_sys.c:2466: if (wacom->wacom_wac.features.device_type & WACOM_DEVICETYPE_PAD) {
drivers/hid/wacom_sys.c-2467- error = wacom_initialize_leds(wacom);
--
drivers/hid/wacom_wac.c=2014=static void wacom_wac_pad_usage_mapping(struct hid_device *hdev,
--
drivers/hid/wacom_wac.c-2026- wacom_map_usage(input, usage, field, EV_ABS, ABS_X, 0);
drivers/hid/wacom_wac.c:2027: features->device_type |= WACOM_DEVICETYPE_PAD;
drivers/hid/wacom_wac.c-2028- break;
--
drivers/hid/wacom_wac.c-2031- wacom_map_usage(input, usage, field, EV_ABS, ABS_Y, 0);
drivers/hid/wacom_wac.c:2032: features->device_type |= WACOM_DEVICETYPE_PAD;
drivers/hid/wacom_wac.c-2033- break;
--
drivers/hid/wacom_wac.c-2036- wacom_map_usage(input, usage, field, EV_ABS, ABS_Z, 0);
drivers/hid/wacom_wac.c:2037: features->device_type |= WACOM_DEVICETYPE_PAD;
drivers/hid/wacom_wac.c-2038- break;
--
drivers/hid/wacom_wac.c-2048- features->numbered_buttons++;
drivers/hid/wacom_wac.c:2049: features->device_type |= WACOM_DEVICETYPE_PAD;
drivers/hid/wacom_wac.c-2050- break;
--
drivers/hid/wacom_wac.c-2069- wacom_map_usage(input, usage, field, EV_ABS, ABS_RX, 0);
drivers/hid/wacom_wac.c:2070: features->device_type |= WACOM_DEVICETYPE_PAD;
drivers/hid/wacom_wac.c-2071- break;
--
drivers/hid/wacom_wac.c-2073- wacom_map_usage(input, usage, field, EV_ABS, ABS_RY, 0);
drivers/hid/wacom_wac.c:2074: features->device_type |= WACOM_DEVICETYPE_PAD;
drivers/hid/wacom_wac.c-2075- break;
--
drivers/hid/wacom_wac.c-2093- }
drivers/hid/wacom_wac.c:2094: features->device_type |= WACOM_DEVICETYPE_PAD;
drivers/hid/wacom_wac.c-2095- break;
--
drivers/hid/wacom_wac.c-2103- set_bit(EV_ABS, input->evbit);
drivers/hid/wacom_wac.c:2104: features->device_type |= WACOM_DEVICETYPE_PAD;
drivers/hid/wacom_wac.c-2105- break;
--
drivers/hid/wacom_wac.c-2107- wacom_map_usage(input, usage, field, EV_KEY, KEY_BUTTONCONFIG, 0);
drivers/hid/wacom_wac.c:2108: features->device_type |= WACOM_DEVICETYPE_PAD;
drivers/hid/wacom_wac.c-2109- break;
--
drivers/hid/wacom_wac.c-2111- wacom_map_usage(input, usage, field, EV_KEY, KEY_ONSCREEN_KEYBOARD, 0);
drivers/hid/wacom_wac.c:2112: features->device_type |= WACOM_DEVICETYPE_PAD;
drivers/hid/wacom_wac.c-2113- break;
--
drivers/hid/wacom_wac.c-2115- wacom_map_usage(input, usage, field, EV_KEY, KEY_CONTROLPANEL, 0);
drivers/hid/wacom_wac.c:2116: features->device_type |= WACOM_DEVICETYPE_PAD;
drivers/hid/wacom_wac.c-2117- break;
--
drivers/hid/wacom_wac.c-2123- }
drivers/hid/wacom_wac.c:2124: features->device_type |= WACOM_DEVICETYPE_PAD;
drivers/hid/wacom_wac.c-2125- break;
--
drivers/hid/wacom_wac.c-2133- features->numbered_buttons++;
drivers/hid/wacom_wac.c:2134: features->device_type |= WACOM_DEVICETYPE_PAD;
drivers/hid/wacom_wac.c-2135- break;
--
drivers/hid/wacom_wac.c=3648=void wacom_setup_device_quirks(struct wacom *wacom)
--
drivers/hid/wacom_wac.c-3657- if (features->device_type & WACOM_DEVICETYPE_PEN)
drivers/hid/wacom_wac.c:3658: features->device_type |= WACOM_DEVICETYPE_PAD;
drivers/hid/wacom_wac.c-3659- }
--
drivers/hid/wacom_wac.c-3678- if (features->type >= INTUOSHT && features->type <= BAMBOO_PT)
drivers/hid/wacom_wac.c:3679: features->device_type |= WACOM_DEVICETYPE_PAD;
drivers/hid/wacom_wac.c-3680-
--
drivers/hid/wacom_wac.c-3690- else if (features->pktlen == WACOM_PKGLEN_BBTOUCH) {
drivers/hid/wacom_wac.c:3691: features->device_type |= WACOM_DEVICETYPE_PAD;
drivers/hid/wacom_wac.c-3692- }
--
drivers/hid/wacom_wac.c-3699- * ghost interface, and we can not detect it unless we set it here
drivers/hid/wacom_wac.c:3700: * to WACOM_DEVICETYPE_PAD or WACOM_DEVICETYPE_TOUCH.
drivers/hid/wacom_wac.c-3701- */
--
drivers/hid/wacom_wac.c-3703- features->pktlen == WACOM_PKGLEN_BBTOUCH3)
drivers/hid/wacom_wac.c:3704: features->device_type |= WACOM_DEVICETYPE_PAD;
drivers/hid/wacom_wac.c-3705-
--
drivers/hid/wacom_wac.c-3716- if (features->type == REMOTE)
drivers/hid/wacom_wac.c:3717: features->device_type = WACOM_DEVICETYPE_PAD;
drivers/hid/wacom_wac.c-3718-
--
drivers/hid/wacom_wac.c-3721- features->device_type |= WACOM_DEVICETYPE_PEN |
drivers/hid/wacom_wac.c:3722: WACOM_DEVICETYPE_PAD |
drivers/hid/wacom_wac.c-3723- WACOM_DEVICETYPE_TOUCH;
--
drivers/hid/wacom_wac.c-3728- features->device_type |= WACOM_DEVICETYPE_PEN |
drivers/hid/wacom_wac.c:3729: WACOM_DEVICETYPE_PAD;
drivers/hid/wacom_wac.c-3730- features->quirks |= WACOM_QUIRK_BATTERY;
--
drivers/hid/wacom_wac.c=4239=int wacom_setup_pad_input_capabilities(struct input_dev *input_dev,
--
drivers/hid/wacom_wac.c-4244- if ((features->type == HID_GENERIC) && features->numbered_buttons > 0)
drivers/hid/wacom_wac.c:4245: features->device_type |= WACOM_DEVICETYPE_PAD;
drivers/hid/wacom_wac.c-4246-
drivers/hid/wacom_wac.c:4247: if (!(features->device_type & WACOM_DEVICETYPE_PAD))
drivers/hid/wacom_wac.c-4248- return -ENODEV;
--
drivers/hid/wacom_wac.h-91-#define WACOM_DEVICETYPE_TOUCH 0x0002
drivers/hid/wacom_wac.h:92:#define WACOM_DEVICETYPE_PAD 0x0004
drivers/hid/wacom_wac.h-93-#define WACOM_DEVICETYPE_WL_MONITOR 0x0008
]
|
| 48/2 |
2026/09/25 00:56 |
llm |
expert |
0m
Model:
Tokens:
input: 44250
output: 44
thoughts: 46
Thoughts: Okay, here's my take on those thoughts, tailored for an expert audience:
**Analyzing `wacom_setup_device_quirks` and Pad Device Type Assignment**
Right, so I'm focusing in on how these Wacom devices are being categorized. My immediate thought is, "Okay, `wacom_setup_device_quirks`...that's where we're probably setting the `WACOM_DEVICETYPE_PAD` flag for specific hardware." I need to understand *why* certain devices get classified this way. What triggers the quirk assignment? What are the specific criteria, and what are the implications downstream for driver behavior? Time to dig into the `wacom_setup_device_quirks` function itself. I need to see the logic, the specific device IDs or other identifying characteristics it's using, and then determine if there are devices that are misclassified or potential areas for improvement in the classification process. I need to understand whether this classification is working as designed.
|
| 49/2 |
2026/09/25 00:56 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/hid/wacom_wac.c Name:wacom_setup_device_quirks]
Results: map[SourceCode:3648: void wacom_setup_device_quirks(struct wacom *wacom)
3649: {
3650: struct wacom_wac *wacom_wac = &wacom->wacom_wac;
3651: struct wacom_features *features = &wacom->wacom_wac.features;
3652:
3653: /* The pen and pad share the same interface on most devices */
3654: if (features->type == GRAPHIRE_BT || features->type == WACOM_G4 ||
3655: features->type == DTUS ||
3656: (features->type >= INTUOS3S && features->type <= WACOM_MO)) {
3657: if (features->device_type & WACOM_DEVICETYPE_PEN)
3658: features->device_type |= WACOM_DEVICETYPE_PAD;
3659: }
3660:
3661: /* touch device found but size is not defined. use default */
3662: if (features->device_type & WACOM_DEVICETYPE_TOUCH && !features->x_max) {
3663: features->x_max = 1023;
3664: features->y_max = 1023;
3665: }
3666:
3667: /*
3668: * Intuos5/Pro and Bamboo 3rd gen have no useful data about its
3669: * touch interface in its HID descriptor. If this is the touch
3670: * interface (PacketSize of WACOM_PKGLEN_BBTOUCH3), override the
3671: * tablet values.
3672: */
3673: if ((features->type >= INTUOS5S && features->type <= INTUOSPL) ||
3674: (features->type >= INTUOSHT && features->type <= BAMBOO_PT)) {
3675: if (features->pktlen == WACOM_PKGLEN_BBTOUCH3) {
3676: if (features->touch_max)
3677: features->device_type |= WACOM_DEVICETYPE_TOUCH;
3678: if (features->type >= INTUOSHT && features->type <= BAMBOO_PT)
3679: features->device_type |= WACOM_DEVICETYPE_PAD;
3680:
3681: if (features->type == INTUOSHT2) {
3682: features->x_max = features->x_max / 10;
3683: features->y_max = features->y_max / 10;
3684: }
3685: else {
3686: features->x_max = 4096;
3687: features->y_max = 4096;
3688: }
3689: }
3690: else if (features->pktlen == WACOM_PKGLEN_BBTOUCH) {
3691: features->device_type |= WACOM_DEVICETYPE_PAD;
3692: }
3693: }
3694:
3695: /*
3696: * Hack for the Bamboo One:
3697: * the device presents a PAD/Touch interface as most Bamboos and even
3698: * sends ghosts PAD data on it. However, later, we must disable this
3699: * ghost interface, and we can not detect it unless we set it here
3700: * to WACOM_DEVICETYPE_PAD or WACOM_DEVICETYPE_TOUCH.
3701: */
3702: if (features->type == BAMBOO_PEN &&
3703: features->pktlen == WACOM_PKGLEN_BBTOUCH3)
3704: features->device_type |= WACOM_DEVICETYPE_PAD;
3705:
3706: /*
3707: * Raw Wacom-mode pen and touch events both come from interface
3708: * 0, whose HID descriptor has an application usage of 0xFF0D
3709: * (i.e., WACOM_HID_WD_DIGITIZER). We route pen packets back
3710: * out through the HID_GENERIC device created for interface 1,
3711: * so rewrite this one to be of type WACOM_DEVICETYPE_TOUCH.
3712: */
3713: if (features->type == BAMBOO_PAD)
3714: features->device_type = WACOM_DEVICETYPE_TOUCH;
3715:
3716: if (features->type == REMOTE)
3717: features->device_type = WACOM_DEVICETYPE_PAD;
3718:
3719: if (features->type == INTUOSP2_BT ||
3720: features->type == INTUOSP2S_BT) {
3721: features->device_type |= WACOM_DEVICETYPE_PEN |
3722: WACOM_DEVICETYPE_PAD |
3723: WACOM_DEVICETYPE_TOUCH;
3724: features->quirks |= WACOM_QUIRK_BATTERY;
3725: }
3726:
3727: if (features->type == INTUOSHT3_BT) {
3728: features->device_type |= WACOM_DEVICETYPE_PEN |
3729: WACOM_DEVICETYPE_PAD;
3730: features->quirks |= WACOM_QUIRK_BATTERY;
3731: }
3732:
3733: switch (features->type) {
3734: case PL:
3735: case DTU:
3736: case DTUS:
3737: case DTUSX:
3738: case WACOM_21UX2:
3739: case WACOM_22HD:
3740: case DTK:
3741: case WACOM_24HD:
3742: case WACOM_27QHD:
3743: case CINTIQ_HYBRID:
3744: case CINTIQ_COMPANION_2:
3745: case CINTIQ:
3746: case WACOM_BEE:
3747: case WACOM_13HD:
3748: case WACOM_24HDT:
3749: case WACOM_27QHDT:
3750: case TABLETPC:
3751: case TABLETPCE:
3752: case TABLETPC2FG:
3753: case MTSCREEN:
3754: case MTTPC:
3755: case MTTPC_B:
3756: features->device_type |= WACOM_DEVICETYPE_DIRECT;
3757: break;
3758: }
3759:
3760: if (wacom->hdev->bus == BUS_BLUETOOTH)
3761: features->quirks |= WACOM_QUIRK_BATTERY;
3762:
3763: /* quirk for bamboo touch with 2 low res touches */
3764: if ((features->type == BAMBOO_PT || features->type == BAMBOO_TOUCH) &&
3765: features->pktlen == WACOM_PKGLEN_BBTOUCH) {
3766: features->x_max <<= 5;
3767: features->y_max <<= 5;
3768: features->x_fuzz <<= 5;
3769: features->y_fuzz <<= 5;
3770: features->quirks |= WACOM_QUIRK_BBTOUCH_LOWRES;
3771: }
3772:
3773: if (features->type == WIRELESS) {
3774: if (features->device_type == WACOM_DEVICETYPE_WL_MONITOR) {
3775: features->quirks |= WACOM_QUIRK_BATTERY;
3776: }
3777: }
3778:
3779: if (features->type == REMOTE)
3780: features->device_type |= WACOM_DEVICETYPE_WL_MONITOR;
3781:
3782: /* HID descriptor for DTK-2451 / DTH-2452 claims to report lots
3783: * of things it shouldn't. Lets fix up the damage...
3784: */
3785: if (wacom->hdev->product == 0x382 || wacom->hdev->product == 0x37d) {
3786: features->quirks &= ~WACOM_QUIRK_TOOLSERIAL;
3787: __clear_bit(BTN_TOOL_BRUSH, wacom_wac->pen_input->keybit);
3788: __clear_bit(BTN_TOOL_PENCIL, wacom_wac->pen_input->keybit);
3789: __clear_bit(BTN_TOOL_AIRBRUSH, wacom_wac->pen_input->keybit);
3790: __clear_bit(ABS_Z, wacom_wac->pen_input->absbit);
3791: __clear_bit(ABS_DISTANCE, wacom_wac->pen_input->absbit);
3792: __clear_bit(ABS_TILT_X, wacom_wac->pen_input->absbit);
3793: __clear_bit(ABS_TILT_Y, wacom_wac->pen_input->absbit);
3794: __clear_bit(ABS_WHEEL, wacom_wac->pen_input->absbit);
3795: __clear_bit(ABS_MISC, wacom_wac->pen_input->absbit);
3796: __clear_bit(MSC_SERIAL, wacom_wac->pen_input->mscbit);
3797: __clear_bit(EV_MSC, wacom_wac->pen_input->evbit);
3798: }
3799: }
SourceFile:drivers/hid/wacom_wac.c]
|
| 50/2 |
2026/09/25 00:56 |
llm |
expert |
0m
Model:
Tokens:
input: 47311
output: 46
thoughts: 483
Thoughts: **Analyzing Wacom Device Type Detection**
Okay, so I'm digging into how Wacom tablets are classified, specifically within the `wacom_setup_device_quirks` function. I see that for `CINTIQ` devices (which are defined by `wacom_features_0x3F`), we're only setting `WACOM_DEVICETYPE_DIRECT`. That seems... incomplete. It *doesn't* set `WACOM_DEVICETYPE_PAD`. This immediately raises a red flag.
If the `PAD` device type isn't set, then the `wacom_setup_pad_input_capabilities` function will return `-ENODEV`, which in turn, means that later, `wacom_setup_inputs` will end up freeing `pad_input_dev` and setting `wacom_wac->pad_input = NULL`. That's not what we want.
But wait a minute, where *else* is `WACOM_DEVICETYPE_PAD` being set? I need to figure out where the "PAD" device type is being associated with a device.
Ah, I see it! It's in `wacom_wac_pad_usage_mapping`. This function is called during HID parsing. Inside this, I see that the `WACOM_DEVICETYPE_PAD` flag *is* set, but only when certain HID usages are present in the descriptor. Excellent! So it's not a hardcoded "this is a pad", it's based on the capabilities advertised by the device itself.
Now, let's drill down into `wacom_wac_pad_usage_mapping` to understand exactly which HID usages are triggering the `WACOM_DEVICETYPE_PAD` setting. This is key to understanding how the driver accurately detects and handles the various Wacom device configurations. The `WACOM_HID_WD_ACCELEROMETER_X` is an example, but there may be more. This gives me a clearer picture of how device type is determined dynamically.
|
| 51/2 |
2026/09/25 00:56 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/hid/wacom_wac.c Name:wacom_wac_pad_usage_mapping]
Results: map[SourceCode:2014: static void wacom_wac_pad_usage_mapping(struct hid_device *hdev,
2015: struct hid_field *field, struct hid_usage *usage)
2016: {
2017: struct wacom *wacom = hid_get_drvdata(hdev);
2018: struct wacom_wac *wacom_wac = &wacom->wacom_wac;
2019: struct wacom_features *features = &wacom_wac->features;
2020: struct input_dev *input = wacom_wac->pad_input;
2021: unsigned equivalent_usage = wacom_equivalent_usage(usage->hid);
2022:
2023: switch (equivalent_usage) {
2024: case WACOM_HID_WD_ACCELEROMETER_X:
2025: __set_bit(INPUT_PROP_ACCELEROMETER, input->propbit);
2026: wacom_map_usage(input, usage, field, EV_ABS, ABS_X, 0);
2027: features->device_type |= WACOM_DEVICETYPE_PAD;
2028: break;
2029: case WACOM_HID_WD_ACCELEROMETER_Y:
2030: __set_bit(INPUT_PROP_ACCELEROMETER, input->propbit);
2031: wacom_map_usage(input, usage, field, EV_ABS, ABS_Y, 0);
2032: features->device_type |= WACOM_DEVICETYPE_PAD;
2033: break;
2034: case WACOM_HID_WD_ACCELEROMETER_Z:
2035: __set_bit(INPUT_PROP_ACCELEROMETER, input->propbit);
2036: wacom_map_usage(input, usage, field, EV_ABS, ABS_Z, 0);
2037: features->device_type |= WACOM_DEVICETYPE_PAD;
2038: break;
2039: case WACOM_HID_WD_BUTTONCENTER:
2040: case WACOM_HID_WD_BUTTONHOME:
2041: case WACOM_HID_WD_BUTTONUP:
2042: case WACOM_HID_WD_BUTTONDOWN:
2043: case WACOM_HID_WD_BUTTONLEFT:
2044: case WACOM_HID_WD_BUTTONRIGHT:
2045: wacom_map_usage(input, usage, field, EV_KEY,
2046: wacom_numbered_button_to_key(features->numbered_buttons),
2047: 0);
2048: features->numbered_buttons++;
2049: features->device_type |= WACOM_DEVICETYPE_PAD;
2050: break;
2051: case WACOM_HID_WD_MUTE_DEVICE:
2052: /* softkey touch switch */
2053: wacom_wac->is_soft_touch_switch = true;
2054: fallthrough;
2055: case WACOM_HID_WD_TOUCHONOFF:
2056: /*
2057: * These two usages, which are used to mute touch events, come
2058: * from the pad packet, but are reported on the touch
2059: * interface. Because the touch interface may not have
2060: * been created yet, we cannot call wacom_map_usage(). In
2061: * order to process the usages when we receive them, we set
2062: * the usage type and code directly.
2063: */
2064: wacom_wac->has_mute_touch_switch = true;
2065: usage->type = EV_SW;
2066: usage->code = SW_MUTE_DEVICE;
2067: break;
2068: case WACOM_HID_WD_TOUCHSTRIP:
2069: wacom_map_usage(input, usage, field, EV_ABS, ABS_RX, 0);
2070: features->device_type |= WACOM_DEVICETYPE_PAD;
2071: break;
2072: case WACOM_HID_WD_TOUCHSTRIP2:
2073: wacom_map_usage(input, usage, field, EV_ABS, ABS_RY, 0);
2074: features->device_type |= WACOM_DEVICETYPE_PAD;
2075: break;
2076: case WACOM_HID_WD_TOUCHRING:
2077: if (field->flags & HID_MAIN_ITEM_RELATIVE) {
2078: wacom_wac->relring_count++;
2079: if (wacom_wac->relring_count == 1) {
2080: wacom_map_usage(input, usage, field, EV_REL, REL_WHEEL_HI_RES, 0);
2081: set_bit(REL_WHEEL, input->relbit);
2082: }
2083: else if (wacom_wac->relring_count == 2) {
2084: wacom_map_usage(input, usage, field, EV_REL, REL_HWHEEL_HI_RES, 0);
2085: set_bit(REL_HWHEEL, input->relbit);
2086: }
2087: } else {
2088: wacom_wac->absring_count++;
2089: if (wacom_wac->absring_count == 1)
2090: wacom_map_usage(input, usage, field, EV_ABS, ABS_WHEEL, 0);
2091: else if (wacom_wac->absring_count == 2)
2092: wacom_map_usage(input, usage, field, EV_ABS, ABS_THROTTLE, 0);
2093: }
2094: features->device_type |= WACOM_DEVICETYPE_PAD;
2095: break;
2096: case WACOM_HID_WD_TOUCHRINGSTATUS:
2097: /*
2098: * Only set up type/code association. Completely mapping
2099: * this usage may overwrite the axis resolution and range.
2100: */
2101: usage->type = EV_ABS;
2102: usage->code = ABS_WHEEL;
2103: set_bit(EV_ABS, input->evbit);
2104: features->device_type |= WACOM_DEVICETYPE_PAD;
2105: break;
2106: case WACOM_HID_WD_BUTTONCONFIG:
2107: wacom_map_usage(input, usage, field, EV_KEY, KEY_BUTTONCONFIG, 0);
2108: features->device_type |= WACOM_DEVICETYPE_PAD;
2109: break;
2110: case WACOM_HID_WD_ONSCREEN_KEYBOARD:
2111: wacom_map_usage(input, usage, field, EV_KEY, KEY_ONSCREEN_KEYBOARD, 0);
2112: features->device_type |= WACOM_DEVICETYPE_PAD;
2113: break;
2114: case WACOM_HID_WD_CONTROLPANEL:
2115: wacom_map_usage(input, usage, field, EV_KEY, KEY_CONTROLPANEL, 0);
2116: features->device_type |= WACOM_DEVICETYPE_PAD;
2117: break;
2118: case WACOM_HID_WD_MODE_CHANGE:
2119: /* do not overwrite previous data */
2120: if (!wacom_wac->has_mode_change) {
2121: wacom_wac->has_mode_change = true;
2122: wacom_wac->is_direct_mode = true;
2123: }
2124: features->device_type |= WACOM_DEVICETYPE_PAD;
2125: break;
2126: }
2127:
2128: switch (equivalent_usage & 0xfffffff0) {
2129: case WACOM_HID_WD_EXPRESSKEY00:
2130: wacom_map_usage(input, usage, field, EV_KEY,
2131: wacom_numbered_button_to_key(features->numbered_buttons),
2132: 0);
2133: features->numbered_buttons++;
2134: features->device_type |= WACOM_DEVICETYPE_PAD;
2135: break;
2136: }
2137: }
SourceFile:drivers/hid/wacom_wac.c]
|
| 52/2 |
2026/09/25 00:56 |
llm |
expert |
0m
Model:
Tokens:
input: 50654
output: 64
thoughts: 398
Thoughts: **Decoding the HID Descriptor: A Gamepad's Secrets**
Okay, so the reproducer's sending a `UHID_CREATE2` message, and the key here is that it's using a custom HID descriptor. Let's dig in and break this thing down.
First, I see the descriptor data itself: `05 01 09 05 a1 01 05 09 19 01 29 0a 15 00 25 01 75 01 95 0a 81 02 95 01 75 06 81 03 c0`. Right away, I recognize that this is a gamepad. The `05 01` (Generic Desktop Usage Page) and `09 05` (Game Pad Usage) are dead giveaways. Following the structure, we see an Application collection (`a1 01`). Within that, we have `05 09` (Button Usage Page) and a range of usages from 1 to 10 (`19 01 29 0a`). These are button presses.
The button definitions have a logical range of 0 to 1, as one would expect, and each button is reported as a single bit (`75 01 95 0a 81 02`). There are 10 of them (`95 0a`). Then we have a 6 bit padding constant (`95 01 75 06 81 03`). Finally, we hit the end collection (`c0`).
So, it's a standard button mapping. But is this a Wacom gamepad? I have to consider whether this is associated with a Wacom device, in particular, whether the usage of this button definition has a critical role in setting `WACOM_DEVICETYPE_PAD`. I'll have to check the relevant definitions in `wacom_wac.h` and check the values associated with `WACOM_HID_WD_EXPRESSKEY00` and others. I'll need to know which Usages are significant for this device type.
|
| 53/2 |
2026/09/25 00:56 |
tool |
codesearch-find-references |
0m
Error:
Args: map[ContextFile:drivers/hid/wacom_wac.h IncludeSnippetLines:2 Name:WACOM_HID_WD_EXPRESSKEY00 SourceTreePrefix:drivers/hid/]
Results: map[References:<nil> TruncatedOutput:false]
|
| 54/2 |
2026/09/25 00:56 |
llm |
expert |
0m
Model:
Tokens:
input: 51618
output: 36
thoughts: 21
Thoughts: Here's my thought process, summarized as if I were considering this myself:
**Investigating a HID Event**
Okay, so I'm looking at something, and the first thing that jumps into my head is, "Let's use `grep`." That's my go-to tool for this kind of investigation. Specifically, I need to search for the string `WACOM_HID_WD_EXPRESSKEY00`. That string is likely a specific identifier. The "WACOM" part almost certainly points towards a Wacom device, which means I'm dealing with HID (Human Interface Device) events related to something like a Wacom tablet or pen display. The "EXPRESSKEY00" part suggests I'm looking at a specific express key. I should be able to narrow down what I'm looking at by searching for this key. This is a good starting point to gather more information.
|
| 55/2 |
2026/09/25 00:56 |
tool |
grepper |
0m
Args: map[Expression:WACOM_HID_WD_EXPRESSKEY00 PathPrefix:drivers/hid/]
Results: map[Output:drivers/hid/wacom_wac.c=2014=static void wacom_wac_pad_usage_mapping(struct hid_device *hdev,
--
drivers/hid/wacom_wac.c-2128- switch (equivalent_usage & 0xfffffff0) {
drivers/hid/wacom_wac.c:2129: case WACOM_HID_WD_EXPRESSKEY00:
drivers/hid/wacom_wac.c-2130- wacom_map_usage(input, usage, field, EV_KEY,
--
drivers/hid/wacom_wac.h-123-#define WACOM_HID_WD_BATTERY_LEVEL (WACOM_HID_UP_WACOMDIGITIZER | 0x043b)
drivers/hid/wacom_wac.h:124:#define WACOM_HID_WD_EXPRESSKEY00 (WACOM_HID_UP_WACOMDIGITIZER | 0x0910)
drivers/hid/wacom_wac.h-125-#define WACOM_HID_WD_EXPRESSKEYCAP00 (WACOM_HID_UP_WACOMDIGITIZER | 0x0940)
]
|
| 56/2 |
2026/09/25 00:56 |
llm |
expert |
0m
Model:
Tokens:
input: 52183
output: 41
thoughts: 73
Thoughts: Here's my summary, as I see it:
**Analyzing the HID Descriptor**
Okay, so I'm looking at this HID descriptor in the reproducer, and the first thing I notice is that it *doesn't* contain the expected `WACOM_HID_UP_WACOMDIGITIZER` usage. That's usually what I'd expect, and I'm pretty sure that maps to `0xff0d0000`, right? But no, it's not there. Instead, the descriptor *does* have a `Usage Page (Button)` entry, which is defined as `0x0009`. Hmm...this is interesting. It could be that `wacom_equivalent_usage` will come into play to translate this.
|
| 57/2 |
2026/09/25 00:56 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/hid/wacom_wac.c Name:wacom_equivalent_usage]
Results: map[SourceCode:1851: int wacom_equivalent_usage(int usage)
1852: {
1853: if ((usage & HID_USAGE_PAGE) == WACOM_HID_UP_WACOMDIGITIZER) {
1854: int subpage = (usage & 0xFF00) << 8;
1855: int subusage = (usage & 0xFF);
1856:
1857: if (subpage == WACOM_HID_SP_PAD ||
1858: subpage == WACOM_HID_SP_BUTTON ||
1859: subpage == WACOM_HID_SP_DIGITIZER ||
1860: subpage == WACOM_HID_SP_DIGITIZERINFO ||
1861: usage == WACOM_HID_WD_SENSE ||
1862: usage == WACOM_HID_WD_SERIALHI ||
1863: usage == WACOM_HID_WD_TOOLTYPE ||
1864: usage == WACOM_HID_WD_DISTANCE ||
1865: usage == WACOM_HID_WD_TOUCHSTRIP ||
1866: usage == WACOM_HID_WD_TOUCHSTRIP2 ||
1867: usage == WACOM_HID_WD_TOUCHRING ||
1868: usage == WACOM_HID_WD_TOUCHRINGSTATUS ||
1869: usage == WACOM_HID_WD_REPORT_VALID ||
1870: usage == WACOM_HID_WD_BARRELSWITCH3 ||
1871: usage == WACOM_HID_WD_SEQUENCENUMBER) {
1872: return usage;
1873: }
1874:
1875: if (subpage == HID_UP_UNDEFINED)
1876: subpage = HID_UP_DIGITIZER;
1877:
1878: return subpage | subusage;
1879: }
1880:
1881: if ((usage & HID_USAGE_PAGE) == WACOM_HID_UP_WACOMTOUCH) {
1882: int subpage = (usage & 0xFF00) << 8;
1883: int subusage = (usage & 0xFF);
1884:
1885: if (usage == WACOM_HID_WT_REPORT_VALID)
1886: return usage;
1887:
1888: if (subpage == HID_UP_UNDEFINED)
1889: subpage = WACOM_HID_SP_DIGITIZER;
1890:
1891: return subpage | subusage;
1892: }
1893:
1894: return usage;
1895: }
SourceFile:drivers/hid/wacom_wac.c]
|
| 58/2 |
2026/09/25 00:56 |
llm |
expert |
0m
Model:
Tokens:
input: 53229
output: 43
thoughts: 244
Thoughts: **Analyzing the Wacom Pad Input Path**
Okay, let's break this down. My initial observation is that `wacom_equivalent_usage` seems straightforward β it just passes through usages if they're *not* Wacom-specific. Then I look at this reproducer, and the HID descriptor shows a "Button" usage page (0x00090000). So, I know immediately that `wacom_wac_pad_usage_mapping` won't find a match because it's only looking for those custom `WACOM_HID_WD_*` usages.
This means `WACOM_DEVICETYPE_PAD` will *not* be set. If that flag isn't set, then `wacom_setup_pad_input_capabilities` will return `-ENODEV`. And that triggers a sequence of events. `wacom_setup_inputs` then proceeds to free `pad_input_dev` and sets `wacom_wac->pad_input` to `NULL`.
Here's the problem: Later, I see that `wacom_intuos_pad` is still called when input events arrive! That's odd. Why is that happening? This is not expected. This warrants a deeper look into the interrupt handling path. I need to trace `wacom_intuos_irq` to understand how `wacom_intuos_pad` gets called when I think the pad input device should have been cleaned up. I need to figure out how we're getting events even when the setup presumably failed.
|
| 59/2 |
2026/09/25 00:56 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/hid/wacom_wac.c Name:wacom_intuos_irq]
Results: map[SourceCode:1022: static int wacom_intuos_irq(struct wacom_wac *wacom)
1023: {
1024: unsigned char *data = wacom->data;
1025: struct input_dev *input = wacom->pen_input;
1026: int result;
1027:
1028: if (data[0] != WACOM_REPORT_PENABLED &&
1029: data[0] != WACOM_REPORT_INTUOS_ID1 &&
1030: data[0] != WACOM_REPORT_INTUOS_ID2 &&
1031: data[0] != WACOM_REPORT_INTUOSPAD &&
1032: data[0] != WACOM_REPORT_INTUOS_PEN &&
1033: data[0] != WACOM_REPORT_CINTIQ &&
1034: data[0] != WACOM_REPORT_CINTIQPAD &&
1035: data[0] != WACOM_REPORT_INTUOS5PAD) {
1036: dev_dbg(input->dev.parent,
1037: "%s: received unknown report #%d\n", __func__, data[0]);
1038: return 0;
1039: }
1040:
1041: /* process pad events */
1042: result = wacom_intuos_pad(wacom);
1043: if (result)
1044: return result;
1045:
1046: /* process in/out prox events */
1047: result = wacom_intuos_inout(wacom);
1048: if (result)
1049: return result - 1;
1050:
1051: /* process general packets */
1052: result = wacom_intuos_general(wacom);
1053: if (result)
1054: return result - 1;
1055:
1056: return 0;
1057: }
SourceFile:drivers/hid/wacom_wac.c]
|
| 60/2 |
2026/09/25 00:56 |
llm |
expert |
0m
Model:
Tokens:
input: 54446
output: 42
thoughts: 64
Thoughts: Here's my take on those thoughts:
**Analyzing the WACOM IRQ Handler**
Right, so `wacom_intuos_irq` gets triggered when we're dealing with the `WACOM_21UX2` model, which I know is the CINTIQ. And the crucial thing I'm noticing immediately is that the code unconditionally calls `wacom_intuos_pad(wacom)` after that. That's interesting, I need to understand that. I'm going to dig into the `wacom_intuos_pad` function now to figure out exactly what it does in this context. It's almost certainly the key to understanding how this specific device is handled.
|
| 61/2 |
2026/09/25 00:56 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/hid/wacom_wac.c Name:wacom_intuos_pad]
Results: map[SourceCode: 513: static int wacom_intuos_pad(struct wacom_wac *wacom)
514: {
515: struct wacom_features *features = &wacom->features;
516: unsigned char *data = wacom->data;
517: struct input_dev *input = wacom->pad_input;
518: int i;
519: int buttons = 0, nbuttons = features->numbered_buttons;
520: int keys = 0, nkeys = 0;
521: int ring1 = 0, ring2 = 0;
522: int strip1 = 0, strip2 = 0;
523: bool prox = false;
524: bool wrench = false, keyboard = false, mute_touch = false, menu = false,
525: info = false;
526:
527: /* pad packets. Works as a second tool and is always in prox */
528: if (!(data[0] == WACOM_REPORT_INTUOSPAD || data[0] == WACOM_REPORT_INTUOS5PAD ||
529: data[0] == WACOM_REPORT_CINTIQPAD))
530: return 0;
531:
532: if (features->type >= INTUOS4S && features->type <= INTUOS4L) {
533: buttons = (data[3] << 1) | (data[2] & 0x01);
534: ring1 = data[1];
535: } else if (features->type == DTK) {
536: buttons = data[6];
537: } else if (features->type == WACOM_13HD) {
538: buttons = (data[4] << 1) | (data[3] & 0x01);
539: } else if (features->type == WACOM_24HD) {
540: buttons = (data[8] << 8) | data[6];
541: ring1 = data[1];
542: ring2 = data[2];
543:
544: /*
545: * Three "buttons" are available on the 24HD which are
546: * physically implemented as a touchstrip. Each button
547: * is approximately 3 bits wide with a 2 bit spacing.
548: * The raw touchstrip bits are stored at:
549: * ((data[3] & 0x1f) << 8) | data[4])
550: */
551: nkeys = 3;
552: keys = ((data[3] & 0x1C) ? 1<<2 : 0) |
553: ((data[4] & 0xE0) ? 1<<1 : 0) |
554: ((data[4] & 0x07) ? 1<<0 : 0);
555: keyboard = !!(data[4] & 0xE0);
556: info = !!(data[3] & 0x1C);
557:
558: if (features->oPid) {
559: mute_touch = !!(data[4] & 0x07);
560: if (mute_touch)
561: wacom->shared->is_touch_on =
562: !wacom->shared->is_touch_on;
563: } else {
564: wrench = !!(data[4] & 0x07);
565: }
566: } else if (features->type == WACOM_27QHD) {
567: nkeys = 3;
568: keys = data[2] & 0x07;
569:
570: wrench = !!(data[2] & 0x01);
571: keyboard = !!(data[2] & 0x02);
572:
573: if (features->oPid) {
574: mute_touch = !!(data[2] & 0x04);
575: if (mute_touch)
576: wacom->shared->is_touch_on =
577: !wacom->shared->is_touch_on;
578: } else {
579: menu = !!(data[2] & 0x04);
580: }
581: input_report_abs(input, ABS_X, be16_to_cpup((__be16 *)&data[4]));
582: input_report_abs(input, ABS_Y, be16_to_cpup((__be16 *)&data[6]));
583: input_report_abs(input, ABS_Z, be16_to_cpup((__be16 *)&data[8]));
584: } else if (features->type == CINTIQ_HYBRID) {
585: /*
586: * Do not send hardware buttons under Android. They
587: * are already sent to the system through GPIO (and
588: * have different meaning).
589: *
590: * d-pad right -> data[4] & 0x10
591: * d-pad up -> data[4] & 0x20
592: * d-pad left -> data[4] & 0x40
593: * d-pad down -> data[4] & 0x80
594: * d-pad center -> data[3] & 0x01
595: */
596: buttons = (data[4] << 1) | (data[3] & 0x01);
597: } else if (features->type == CINTIQ_COMPANION_2) {
598: /* d-pad right -> data[2] & 0x10
599: * d-pad up -> data[2] & 0x20
600: * d-pad left -> data[2] & 0x40
601: * d-pad down -> data[2] & 0x80
602: * d-pad center -> data[1] & 0x01
603: */
604: buttons = ((data[2] >> 4) << 7) |
605: ((data[1] & 0x04) << 4) |
606: ((data[2] & 0x0F) << 2) |
607: (data[1] & 0x03);
608: } else if (features->type >= INTUOS5S && features->type <= INTUOSPL) {
609: /*
610: * ExpressKeys on Intuos5/Intuos Pro have a capacitive sensor in
611: * addition to the mechanical switch. Switch data is
612: * stored in data[4], capacitive data in data[5].
613: *
614: * Touch ring mode switch (data[3]) has no capacitive sensor
615: */
616: buttons = (data[4] << 1) | (data[3] & 0x01);
617: ring1 = data[2];
618: } else {
619: if (features->type == WACOM_21UX2 || features->type == WACOM_22HD) {
620: buttons = (data[8] << 10) | ((data[7] & 0x01) << 9) |
621: (data[6] << 1) | (data[5] & 0x01);
622:
623: if (features->type == WACOM_22HD) {
624: nkeys = 3;
625: keys = data[9] & 0x07;
626:
627: info = !!(data[9] & 0x01);
628: wrench = !!(data[9] & 0x02);
629: }
630: } else {
631: buttons = ((data[6] & 0x10) << 5) |
632: ((data[5] & 0x10) << 4) |
633: ((data[6] & 0x0F) << 4) |
634: (data[5] & 0x0F);
635: }
636: strip1 = ((data[1] & 0x1f) << 8) | data[2];
637: strip2 = ((data[3] & 0x1f) << 8) | data[4];
638: }
639:
640: prox = (buttons & ~(~0U << nbuttons)) | (keys & ~(~0U << nkeys)) |
641: (ring1 & 0x80) | (ring2 & 0x80) | strip1 | strip2;
642:
643: wacom_report_numbered_buttons(input, nbuttons, buttons);
644:
645: for (i = 0; i < nkeys; i++)
646: input_report_key(input, KEY_PROG1 + i, keys & (1 << i));
647:
648: input_report_key(input, KEY_BUTTONCONFIG, wrench);
649: input_report_key(input, KEY_ONSCREEN_KEYBOARD, keyboard);
650: input_report_key(input, KEY_CONTROLPANEL, menu);
651: input_report_key(input, KEY_INFO, info);
652:
653: if (wacom->shared && wacom->shared->touch_input) {
654: input_report_switch(wacom->shared->touch_input,
655: SW_MUTE_DEVICE,
656: !wacom->shared->is_touch_on);
657: input_sync(wacom->shared->touch_input);
658: }
659:
660: input_report_abs(input, ABS_RX, strip1);
661: input_report_abs(input, ABS_RY, strip2);
662:
663: input_report_abs(input, ABS_WHEEL, (ring1 & 0x80) ? (ring1 & 0x7f) : 0);
664: input_report_abs(input, ABS_THROTTLE, (ring2 & 0x80) ? (ring2 & 0x7f) : 0);
665:
666: input_report_key(input, wacom->tool[1], prox ? 1 : 0);
667: input_report_abs(input, ABS_MISC, prox ? PAD_DEVICE_ID : 0);
668:
669: input_event(input, EV_MSC, MSC_SERIAL, 0xffffffff);
670:
671: return 1;
672: }
SourceFile:drivers/hid/wacom_wac.c]
|
| 62/2 |
2026/09/25 00:56 |
llm |
expert |
0m
Model:
Tokens:
input: 57829
output: 61
thoughts: 358
Thoughts: **Analyzing the Wacom Tablet Input**
Okay, let's break this down. I see we're looking at the `wacom_intuos_pad` code, specifically the input handling for a Wacom Intuos pad. First, it looks like `wacom->pad_input` is the input device structure. Then, it's filtering for specific report types, and those report types determine whether to proceed: I can see that `WACOM_REPORT_INTUOSPAD`, `WACOM_REPORT_INTUOS5PAD`, and `WACOM_REPORT_CINTIQPAD` are the relevant constants here. If the incoming data's first byte isn't one of those, it returns. This makes sense; it's a quick way to reject packets that aren't intended for the pad functionality. And, if the packet is of the right type, then it'll report numbered buttons.
Now, the reproducer comes into play. It appears that it's sending an event to `fd_uhid` with data. I see that the data starts with `0x0c`, and then memcpy's the data over to the input structure. I'm noting that the first byte is `0x0c`. The important bit! Because `0x0c` corresponds to `WACOM_REPORT_INTUOSPAD`. This is interesting; the reproducer is specifically trying to trigger the pad logic. We need to follow this! Let's examine the structure and usage of `WACOM_REPORT_INTUOSPAD` and the subsequent processing steps.
|
| 63/2 |
2026/09/25 00:57 |
tool |
codesearch-find-references |
0m
Error:
Args: map[ContextFile:drivers/hid/wacom_wac.c IncludeSnippetLines:2 Name:WACOM_REPORT_INTUOSPAD SourceTreePrefix:drivers/hid/]
Results: map[References:<nil> TruncatedOutput:false]
|
| 64/2 |
2026/09/25 00:57 |
llm |
expert |
0m
Model:
Tokens:
input: 58606
output: 33
thoughts: 16
Thoughts: Here's a summary of my immediate thought process, focusing on the technical aspect, tailored for someone who knows their way around this kind of problem:
**Initial Diagnostic Query**
Okay, so I need to figure out what's going on. The first thing that jumps to mind is to use `grep`. I want to search for the string `WACOM_REPORT_INTUOSPAD`. This string is likely associated with the Wacom driver and, specifically, the Intuos Pad device. By searching for this specific string, I'm hoping to quickly identify relevant log entries, configuration files, or code snippets that might shed light on the issue. This grep command will allow me to narrow down the problem in a targeted way, by searching for instances of Wacom's reporting on this specific device. I'm essentially using this as the first of several filters.
|
| 65/2 |
2026/09/25 00:57 |
tool |
grepper |
0m
Args: map[Expression:WACOM_REPORT_INTUOSPAD PathPrefix:drivers/hid/]
Results: map[Output:drivers/hid/wacom_wac.c=513=static int wacom_intuos_pad(struct wacom_wac *wacom)
--
drivers/hid/wacom_wac.c-527- /* pad packets. Works as a second tool and is always in prox */
drivers/hid/wacom_wac.c:528: if (!(data[0] == WACOM_REPORT_INTUOSPAD || data[0] == WACOM_REPORT_INTUOS5PAD ||
drivers/hid/wacom_wac.c-529- data[0] == WACOM_REPORT_CINTIQPAD))
--
drivers/hid/wacom_wac.c=1022=static int wacom_intuos_irq(struct wacom_wac *wacom)
--
drivers/hid/wacom_wac.c-1030- data[0] != WACOM_REPORT_INTUOS_ID2 &&
drivers/hid/wacom_wac.c:1031: data[0] != WACOM_REPORT_INTUOSPAD &&
drivers/hid/wacom_wac.c-1032- data[0] != WACOM_REPORT_INTUOS_PEN &&
--
drivers/hid/wacom_wac.h-45-#define WACOM_REPORT_INTUOS_ID2 6
drivers/hid/wacom_wac.h:46:#define WACOM_REPORT_INTUOSPAD 12
drivers/hid/wacom_wac.h-47-#define WACOM_REPORT_INTUOS5PAD 3
]
|
| 66/2 |
2026/09/25 00:57 |
llm |
expert |
0m
Model:
Tokens:
input: 59245
output: 42
thoughts: 1000
Thoughts: **Analysis of a Wacom Driver NULL Pointer Dereference**
Okay, so here's what I've figured out. We've got a NULL pointer dereference in the Wacom driver, specifically within the `wacom_intuos_pad` function. It all hinges on this: if the device setup *doesn't* identify it as having pad functionality, the `pad_input` device gets freed and set to NULL. Then, later, when a report with ID 12 (`WACOM_REPORT_INTUOSPAD`) comes in, `wacom_intuos_pad` is called, and *it* tries to use that now-NULL `pad_input` without checking.
Specifically, `wacom_report_numbered_buttons` is called with `input` (which is `wacom->pad_input`) as an argument. Inside that function, `input_get_drvdata` is called with this NULL pointer, leading to the dereference and the crash. Essentially, the driver's state becomes inconsistent because the pad functionality is indicated to be present but the pad's `input_dev` is set to NULL.
The reproducer hinges on the following steps:
1. A UHID device mimicking a Wacom Cintiq 21UX is created, but with a custom HID descriptor *that doesn't* include any pad usages.
2. `wacom_setup_pad_input_capabilities` fails because the device isn't recognized as a pad.
3. `wacom_setup_inputs` cleans up, which means `wacom->pad_input` is NULL.
4. Then, a report with report ID 12 (`WACOM_REPORT_INTUOSPAD`) arrives.
5. `wacom_intuos_pad` uses this NULL `pad_input` without checking, crashing the kernel.
So, the critical mistake is `wacom_intuos_pad` blindly using `wacom->pad_input` without a NULL check *before* calling `wacom_report_numbered_buttons`. It reports the numbered buttons, reports the key presses from the pad, and does not validate the input.
The impact? It's a NULL pointer dereference, which *typically* means a kernel crash (Denial of Service). It would crash at `0x0000000000000360`. On modern systems with protections like `mmap_min_addr`, this is unlikely to be exploitable for code execution because we're just reading from a zeroed memory address. It can be triggered by providing a crafted HID report.
The accessibility: because the reproducer makes use of `/dev/uhid` this can be done via a physical USB device, which is an interesting vector. So, a malicious USB peripheral is a viable attack vector!
Now, can this be triggered by an unprivileged user? That depends on `/dev/uhid` access. Usually root is required, or membership of a relevant group. But since a physical USB device can be used, this means the attack can be done by a normal user.
Can it be done from a user namespace? That depends on whether `/dev/uhid` is bind-mounted. Physical USB access would still be a vector, though. I can't think of any other triggering mechanisms for this particular issueβeBPF, network, filesystemβ¦ they're not relevant here.
I'll double-check `wacom_intuos_pad` for that NULL check. Nope, it's not there: `struct input_dev *input = wacom->pad_input; ... wacom_report_numbered_buttons(input, nbuttons, buttons);` It uses `input` directly.
It's a straight-up DoS via a specially crafted HID report from a USB peripheral. The severity is there, and I need to see if a similar bug has been fixed in the past.
|
| 67/2 |
2026/09/25 00:57 |
tool |
git-log |
0m
Args: map[MessageRegexps:[wacom pad_input] PathPrefix:drivers/hid/wacom_wac.c]
Results: map[Output:d6b675687a4a HID: wacom: Don't register pad_input for touch switch
ed1fa736839e HID: wacom: generic: sync pad events only for actual packets
e7deb1570a52 HID: wacom: don't apply generic settings to old devices
b3c8e93f99a7 HID: wacom - return ENODEV for failed wacom_setup_pad_input_capabilities
]
|
| 68/2 |
2026/09/25 00:57 |
llm |
expert |
0m
Model:
Tokens:
input: 61263
output: 40
thoughts: 16
Thoughts: Okay, here's my attempt at summarizing the thought process, tailored for an expert audience, and written in the first person:
**Investigating a Potential NULL Pointer Dereference Fix**
Alright, I'm digging into this codebase, and I've got a hunch β a strong suspicion, really β that we're dealing with a nasty NULL pointer dereference. The symptoms are screaming it. So, before I start down the rabbit hole of debugging, let's take a strategic approach. My first move: check the commit history. I need to see if this specific issue, or something *very* similar, has already been identified and patched. A quick `git log -p` with some targeted keywords related to the suspected source of the dereference, or possibly related to the affected module or function, should give me a good starting point. I'm hoping to get lucky and find a "fix null pointer," or "handle null input" commit that's already in place. It would be great to see if this has already been handled and I don't need to reinvent the wheel!
|
| 69/2 |
2026/09/25 00:57 |
tool |
git-log |
0m
Args: map[MessageRegexps:[wacom null] PathPrefix:drivers/hid/wacom_wac.c]
Results: map[Output:20f3cf5f860f HID: wacom: Avoid using stale array indicies to read contact count
2ac97f0f6654 HID: wacom: Have wacom_tpc_irq guard against possible NULL dereference
a50aac7193f1 HID: wacom: leds: dynamically allocate LED groups
580549ef6b3e HID: wacom: fix Bamboo ONE oops
e2c7d8877e5c HID: wacom: check for wacom->shared before following the pointer
]
|
| 70/2 |
2026/09/25 00:57 |
llm |
expert |
0m
Model:
Tokens:
input: 61689
output: 42
thoughts: 43
Thoughts: Okay, here's my take on those thoughts, framed as an expert's internal monologue:
**Investigating a Suspected Kernel Bug**
Hmm, this issue is still popping up. I'm starting to think that either the fix itself isn't complete, or perhaps the error message we're seeing *doesn't* actually contain the string "null," which is throwing me off. I've seen that happen before. So, before I go down a rabbit hole, let's confirm the basics. My next step is clear: I need to quickly determine whether the `wacom_intuos_pad` driver *already* has a robust NULL pointer check implemented in the very latest kernel version. I need to get a definitive answer on that; only then can I continue my debugging process, I need to rule out this basic, but important, possibility.
|
| 71/2 |
2026/09/25 00:57 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/hid/wacom_wac.c Name:wacom_intuos_pad]
Results: map[SourceCode: 513: static int wacom_intuos_pad(struct wacom_wac *wacom)
514: {
515: struct wacom_features *features = &wacom->features;
516: unsigned char *data = wacom->data;
517: struct input_dev *input = wacom->pad_input;
518: int i;
519: int buttons = 0, nbuttons = features->numbered_buttons;
520: int keys = 0, nkeys = 0;
521: int ring1 = 0, ring2 = 0;
522: int strip1 = 0, strip2 = 0;
523: bool prox = false;
524: bool wrench = false, keyboard = false, mute_touch = false, menu = false,
525: info = false;
526:
527: /* pad packets. Works as a second tool and is always in prox */
528: if (!(data[0] == WACOM_REPORT_INTUOSPAD || data[0] == WACOM_REPORT_INTUOS5PAD ||
529: data[0] == WACOM_REPORT_CINTIQPAD))
530: return 0;
531:
532: if (features->type >= INTUOS4S && features->type <= INTUOS4L) {
533: buttons = (data[3] << 1) | (data[2] & 0x01);
534: ring1 = data[1];
535: } else if (features->type == DTK) {
536: buttons = data[6];
537: } else if (features->type == WACOM_13HD) {
538: buttons = (data[4] << 1) | (data[3] & 0x01);
539: } else if (features->type == WACOM_24HD) {
540: buttons = (data[8] << 8) | data[6];
541: ring1 = data[1];
542: ring2 = data[2];
543:
544: /*
545: * Three "buttons" are available on the 24HD which are
546: * physically implemented as a touchstrip. Each button
547: * is approximately 3 bits wide with a 2 bit spacing.
548: * The raw touchstrip bits are stored at:
549: * ((data[3] & 0x1f) << 8) | data[4])
550: */
551: nkeys = 3;
552: keys = ((data[3] & 0x1C) ? 1<<2 : 0) |
553: ((data[4] & 0xE0) ? 1<<1 : 0) |
554: ((data[4] & 0x07) ? 1<<0 : 0);
555: keyboard = !!(data[4] & 0xE0);
556: info = !!(data[3] & 0x1C);
557:
558: if (features->oPid) {
559: mute_touch = !!(data[4] & 0x07);
560: if (mute_touch)
561: wacom->shared->is_touch_on =
562: !wacom->shared->is_touch_on;
563: } else {
564: wrench = !!(data[4] & 0x07);
565: }
566: } else if (features->type == WACOM_27QHD) {
567: nkeys = 3;
568: keys = data[2] & 0x07;
569:
570: wrench = !!(data[2] & 0x01);
571: keyboard = !!(data[2] & 0x02);
572:
573: if (features->oPid) {
574: mute_touch = !!(data[2] & 0x04);
575: if (mute_touch)
576: wacom->shared->is_touch_on =
577: !wacom->shared->is_touch_on;
578: } else {
579: menu = !!(data[2] & 0x04);
580: }
581: input_report_abs(input, ABS_X, be16_to_cpup((__be16 *)&data[4]));
582: input_report_abs(input, ABS_Y, be16_to_cpup((__be16 *)&data[6]));
583: input_report_abs(input, ABS_Z, be16_to_cpup((__be16 *)&data[8]));
584: } else if (features->type == CINTIQ_HYBRID) {
585: /*
586: * Do not send hardware buttons under Android. They
587: * are already sent to the system through GPIO (and
588: * have different meaning).
589: *
590: * d-pad right -> data[4] & 0x10
591: * d-pad up -> data[4] & 0x20
592: * d-pad left -> data[4] & 0x40
593: * d-pad down -> data[4] & 0x80
594: * d-pad center -> data[3] & 0x01
595: */
596: buttons = (data[4] << 1) | (data[3] & 0x01);
597: } else if (features->type == CINTIQ_COMPANION_2) {
598: /* d-pad right -> data[2] & 0x10
599: * d-pad up -> data[2] & 0x20
600: * d-pad left -> data[2] & 0x40
601: * d-pad down -> data[2] & 0x80
602: * d-pad center -> data[1] & 0x01
603: */
604: buttons = ((data[2] >> 4) << 7) |
605: ((data[1] & 0x04) << 4) |
606: ((data[2] & 0x0F) << 2) |
607: (data[1] & 0x03);
608: } else if (features->type >= INTUOS5S && features->type <= INTUOSPL) {
609: /*
610: * ExpressKeys on Intuos5/Intuos Pro have a capacitive sensor in
611: * addition to the mechanical switch. Switch data is
612: * stored in data[4], capacitive data in data[5].
613: *
614: * Touch ring mode switch (data[3]) has no capacitive sensor
615: */
616: buttons = (data[4] << 1) | (data[3] & 0x01);
617: ring1 = data[2];
618: } else {
619: if (features->type == WACOM_21UX2 || features->type == WACOM_22HD) {
620: buttons = (data[8] << 10) | ((data[7] & 0x01) << 9) |
621: (data[6] << 1) | (data[5] & 0x01);
622:
623: if (features->type == WACOM_22HD) {
624: nkeys = 3;
625: keys = data[9] & 0x07;
626:
627: info = !!(data[9] & 0x01);
628: wrench = !!(data[9] & 0x02);
629: }
630: } else {
631: buttons = ((data[6] & 0x10) << 5) |
632: ((data[5] & 0x10) << 4) |
633: ((data[6] & 0x0F) << 4) |
634: (data[5] & 0x0F);
635: }
636: strip1 = ((data[1] & 0x1f) << 8) | data[2];
637: strip2 = ((data[3] & 0x1f) << 8) | data[4];
638: }
639:
640: prox = (buttons & ~(~0U << nbuttons)) | (keys & ~(~0U << nkeys)) |
641: (ring1 & 0x80) | (ring2 & 0x80) | strip1 | strip2;
642:
643: wacom_report_numbered_buttons(input, nbuttons, buttons);
644:
645: for (i = 0; i < nkeys; i++)
646: input_report_key(input, KEY_PROG1 + i, keys & (1 << i));
647:
648: input_report_key(input, KEY_BUTTONCONFIG, wrench);
649: input_report_key(input, KEY_ONSCREEN_KEYBOARD, keyboard);
650: input_report_key(input, KEY_CONTROLPANEL, menu);
651: input_report_key(input, KEY_INFO, info);
652:
653: if (wacom->shared && wacom->shared->touch_input) {
654: input_report_switch(wacom->shared->touch_input,
655: SW_MUTE_DEVICE,
656: !wacom->shared->is_touch_on);
657: input_sync(wacom->shared->touch_input);
658: }
659:
660: input_report_abs(input, ABS_RX, strip1);
661: input_report_abs(input, ABS_RY, strip2);
662:
663: input_report_abs(input, ABS_WHEEL, (ring1 & 0x80) ? (ring1 & 0x7f) : 0);
664: input_report_abs(input, ABS_THROTTLE, (ring2 & 0x80) ? (ring2 & 0x7f) : 0);
665:
666: input_report_key(input, wacom->tool[1], prox ? 1 : 0);
667: input_report_abs(input, ABS_MISC, prox ? PAD_DEVICE_ID : 0);
668:
669: input_event(input, EV_MSC, MSC_SERIAL, 0xffffffff);
670:
671: return 1;
672: }
SourceFile:drivers/hid/wacom_wac.c]
|
| 72/2 |
2026/09/25 00:57 |
llm |
expert |
0m
Model:
Tokens:
input: 65082
output: 66
thoughts: 1890
Thoughts: **Analysis of the Wacom Driver NULL Pointer Dereference**
Okay, so I'm looking at this bug, and first glance, it's a classic: a NULL pointer dereference. The trace indicates a read from a NULL pointer offset (0x360), a sure-fire kernel crash scenario. Exploitation potential seems limited; it's a read, not a write, so typically no code execution. Definitely a Denial of Service, though; a crash is a crash. The questions are, can an unprivileged process trigger it? No, `/dev/uhid` access or physical USB access is needed. User namespaces? Also no, `/dev/uhid` is restricted. No VM guest, host, network, or remote triggers either. The key is that it's a Peripheral Trigger, likely from a malicious USB device. Not a filesystem trigger, either.
I had to pause to consider any avenues for exploit, such as if `mmap_min_addr` was 0, but that's not the case on modern systems. Double-checking the crash address confirms it's a pure NULL dereference. I did a quick check on the `/dev/uhid` access permissions; itβs usually root-owned, not accessible to regular users.
So, the key vector here is a malicious USB device. It can present itself as a Wacom device, fool the driver to bind to it, and send a crafted HID descriptor and report.
Now, let's review the questions systematically: Exploitable is False (it's a NULL read), Denial of Service is True (kernel crash), Unprivileged is False, UserNamespace is False, VMGuestTrigger, VMHostTrigger, NetworkTrigger, RemoteTrigger, and FilesystemTrigger are all False. PeripheralTrigger is definitely True.
Then I considered if a Bluetooth device could trigger the issue, since Wacom devices can be Bluetooth. However, triggering would likely require user interaction or privilege, and it falls under "Peripheral Trigger".
I confirmed that `WACOM_21UX2` is a USB device using the driver match, but that it would be triggered by a crafted HID descriptor.
I needed to make sure about the NULL pointer condition. Could the `pad_input` be NULL if `wacom_setup_pad_input_capabilities` returned 0, but `wacom_allocate_inputs` failed? No, because `pad_input` is allocated in `wacom_allocate_inputs`, so it's guaranteed to be valid if the probe doesn't fail. The only way it would become NULL is by the driver explicitly freeing it. If `wacom_setup_pad_input_capabilities` returns an error, itβll call into `wacom_setup_inputs`, which frees the memory if an error occurs. In other words, if `WACOM_DEVICETYPE_PAD` isn't set, then `wacom_intuos_pad` could be NULL.
Then I looked at the device types that call `wacom_intuos_irq`. From `INTUOS3` up to `CINTIQ_COMPANION_2`, all those devices call `wacom_intuos_irq`, the IRQ handler. So, if a malicious device claims to be one of these, it can trigger the bug. If the HID descriptor is crafted to not set `WACOM_DEVICETYPE_PAD`, then the pad report triggers a NULL pointer dereference.
I checked if `wacom_setup_device_quirks` sets `WACOM_DEVICETYPE_PAD` to ensure there aren't any weird conditions that change the result, but found that it doesn't do so for `WACOM_21UX2`. Its range is from `INTUOS3S` to `WACOM_MO`, but that doesn't include `WACOM_21UX2`, so the driver relies entirely on the HID descriptor, so if it has pad usages, then the `pad_input` isn't NULL, and if it doesn't, then `wacom_intuos_pad` will be called with a NULL `pad_input`!
So, in summary, this bug is solid. The driver is triggered by a specially crafted HID report if `WACOM_DEVICETYPE_PAD` isn't set.
My final assessment: Exploitable: False, Denial of Service: True, Unprivileged: False, UserNamespace: False, VMGuestTrigger: False, VMHostTrigger: False, NetworkTrigger: False, RemoteTrigger: False, PeripheralTrigger: True, FilesystemTrigger: False. I'm going to set these results.
|
| 73/2 |
2026/09/25 00:57 |
tool |
set-results |
0m
Args: map[DenialOfService:true Exploitable:false FilesystemTrigger:false NetworkTrigger:false PeripheralTrigger:true RemoteTrigger:false Unprivileged:false UserNamespace:false VMGuestTrigger:false VMHostTrigger:false]
Results: map[DenialOfService:true Exploitable:false FilesystemTrigger:false NetworkTrigger:false PeripheralTrigger:true RemoteTrigger:false Unprivileged:false UserNamespace:false VMGuestTrigger:false VMHostTrigger:false]
|
| 74/2 |
2026/09/25 00:57 |
llm |
expert |
0m
Model:
Tokens:
input: 68094
output: 597
thoughts: 458
Thoughts: **My Analysis of the Wacom Driver Vulnerability**
Okay, so the investigation is complete, and I've got a clear picture of what's happening here. The core issue boils down to a NULL pointer dereference, specifically in the `wacom_report_numbered_buttons` function. This function is called from `wacom_intuos_pad`, and the root cause is that `wacom->pad_input` is becoming NULL unexpectedly.
Here's the breakdown: `wacom->pad_input` gets freed and subsequently set to NULL within the `wacom_setup_inputs` function. This happens when `wacom_setup_pad_input_capabilities` encounters an error, specifically `-ENODEV`. The conditions that lead to the `-ENODEV` error are important. It appears that `wacom_setup_pad_input_capabilities` checks for the presence of `WACOM_DEVICETYPE_PAD` within `features->device_type`. Now, for certain legacy devices, like the `WACOM_21UX2` (Cintiq 21UX), the `WACOM_DEVICETYPE_PAD` isn't set by default. The driver depends on the HID descriptor, looking for specific Wacom pad usages. These usages are mapped using `wacom_wac_pad_usage_mapping`.
This is where the vulnerability arises. If a malicious USB device pretends to be a `WACOM_21UX2` but provides a crafted HID descriptor that omits these essential pad usages, `wacom_setup_pad_input_capabilities` will fail, setting `wacom->pad_input` to NULL. The problem is that the interrupt handler `wacom_intuos_irq` *unconditionally* calls `wacom_intuos_pad` whenever it receives a pad report. This means that even with `wacom->pad_input` set to NULL, `wacom_intuos_pad` is still going to attempt to dereference it, leading to a kernel crash.
The good news is that, while it's a serious denial-of-service vulnerability, the read from the NULL pointer at offset 0x360 doesn't appear to be exploitable for privilege escalation or information leakage on modern systems. The `mmap_min_addr` protection should prevent that. Still, this is a reliable kernel panic, and therefore must be addressed promptly.
It's a peripheral trigger, meaning it requires physical access to connect a malicious USB device. It can't be triggered by unprivileged users or from user namespaces because it requires access to `/dev/uhid`, which is restricted.
|
| 75/1 |
2026/09/25 00:58 |
action |
format-explanation |
0m
Results: map[Explanation:**Bug Analysis**
The bug is a NULL pointer dereference in `wacom_report_numbered_buttons()` which
is called unconditionally by `wacom_intuos_pad()`.
**Root Cause:**
1. During device initialization, the Wacom driver allocates input devices for
the pen, touch, and pad interfaces.
2. It then parses the device's HID descriptor in `wacom_wac_pad_usage_mapping()`
to determine the device's capabilities. If specific Wacom pad usages are found,
it sets the `WACOM_DEVICETYPE_PAD` flag in `features->device_type`.
3. For certain device models like `WACOM_21UX2` (Wacom Cintiq 21UX), the driver
relies entirely on the HID descriptor to set this flag (it is not set by default
quirks).
4. If a crafted HID descriptor is provided that lacks any pad usages, the
`WACOM_DEVICETYPE_PAD` flag remains unset.
5. Consequently, `wacom_setup_pad_input_capabilities()` returns `-ENODEV`,
causing `wacom_setup_inputs()` to free the pad input device and set
`wacom_wac->pad_input = NULL`.
6. However, the interrupt handler `wacom_intuos_irq()` does not check if the pad
input device exists. If the device sends a pad report (e.g.,
`WACOM_REPORT_INTUOSPAD` / `0x0c`), the handler unconditionally calls
`wacom_intuos_pad()`.
7. `wacom_intuos_pad()` then passes the `NULL` `wacom->pad_input` pointer to
`wacom_report_numbered_buttons()`, which dereferences it at an offset (`0x360`),
causing a kernel oops.
**Security Impact:**
* **Exploitable:** False. The crash is caused by a read from a NULL pointer
offset (`0x360`). On modern systems with `mmap_min_addr` protections, mapping
the NULL page is prevented, making this bug unexploitable for privilege
escalation or memory corruption.
* **Denial of Service:** True. Triggering the bug results in a kernel panic,
crashing the system.
* **Peripheral Trigger:** True. An attacker with physical access can plug in a
malicious USB device (e.g., a Teensy or Raspberry Pi Pico) that spoofs the Wacom
Vendor/Product IDs and provides the crafted HID descriptor and reports to
trigger the crash.
* **Unprivileged / User Namespace:** False. The reproducer uses `/dev/uhid` to
emulate the USB device, but this character device is restricted to root or
specific privileged groups by default, and is not accessible within unprivileged
user namespaces.]
|