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