blob: 479f5d1e31848eb8784bab135b84a3a5fab1f5dc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
/// Detect HID drivers that initialize force-feedback after hid_hw_start()
/// when HID_CONNECT_HIDINPUT is used. This is a lifecycle violation as
/// the input device is already registered.
//
// Confidence: High
// Copyright: (C) 2026 Gemini. GPLv2.
virtual report
@r@
identifier probe_fn;
expression hdev, flags;
position p1, p2;
@@
probe_fn(struct hid_device *hdev, ...) {
<...
hid_hw_start@p1(hdev, flags)
...
\(input_ff_create\|input_ff_create_memless\)@p2(...)
...>
}
@script:python depends on report@
p1 << r.p1;
p2 << r.p2;
flags << r.flags;
@@
# Check if flags include HID_CONNECT_HIDINPUT (0x01) or HID_CONNECT_DEFAULT (0x0f)
# Note: HID_CONNECT_DEFAULT is 0x0f, HID_CONNECT_HIDINPUT is 0x01
if "HID_CONNECT_HIDINPUT" in flags or "HID_CONNECT_DEFAULT" in flags:
msg = "WARNING: force-feedback initialized after hid_hw_start() with HID_CONNECT_HIDINPUT. Input device is already registered at this point. Use .input_configured() instead."
coccilib.report.print_report(p2[0], msg)
|