Skip to contentSkip to conversation

HID: santroller: add driver for Santroller controllers

PATCH Superseded Sanjay Govind 3 participants 7 messages Oct 16 – Nov 4 HID

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 HID: santroller: add driver for Santroller controllers

Santroller is an open source firmware for DIY and modded game controllers and instruments: https://github.com/Santroller/Santroller

Santroller devices work like hubs: a user can connect several instruments and controllers to one device, and on USB each active profile appears as its own HID gamepad interface. On current firmware, each of these interfaces answers a vendor features report (usage 0xff00:0x2882) with the emulated controller type and a set of capability bits.

Inputs are left to the generic HID input layer, as the report descriptor already describes the buttons, axes and d-pad. Since users name each profile, and on USB the firmware puts that name in the interface string, the driver uses it to name the input device, so each connected instrument or controller can be told apart.

The driver also handles the outputs the device reports supporting:
rumble, player LEDs, an RGB indicator LED and the euphoria LED of DJ Hero turntables.

The controller type is exposed as a read-only "subtype" attribute on the HID device, documented in Documentation/ABI/testing/sysfs-driver-hid-santroller. Games that integrate with specific instruments can use it to tell them apart without needing access to the hidraw node.

The configuration interface, and devices running firmware without the features report, are started the same way hid-generic would start them.

Assisted-by LLM

---
Tested with 7.2.3, built as a module out of tree, over both USB and
Bluetooth: inputs with evtest, the input device named after each profile on USB, rumble, the player, RGB and euphoria LEDs through /sys/class/leds, and the subtype attribute. The configuration interface still works as a plain HID device.

 .../ABI/testing/sysfs-driver-hid-santroller   |  45 ++
 MAINTAINERS                                   |   7 +
 drivers/hid/Kconfig                           |  12 +
 drivers/hid/Makefile                          |   1 +
 drivers/hid/hid-ids.h                         |   4 +
 drivers/hid/hid-santroller.c                  | 624 ++++++++++++++++++
 6 files changed, 693 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-driver-hid-santroller
 create mode 100644 drivers/hid/hid-santroller.c
Documentation/ABI/testing/sysfs-driver-hid-santroller new file +45 -0
new file mode 100644
index 000000000000..78b87d850ad1
@@ -0,0 +1,45 @@
+What:		/sys/bus/hid/drivers/santroller/<dev>/subtype
+Date:		October 2026
+KernelVersion:	7.5
+Contact:	Sanjay Govind <[email protected]>
+Description:	(RO) The kind of controller the Santroller firmware is
+		emulating on this interface, as the decimal value the device
+		reports in its features report:
+
+		==  ==================================
+		1   Gamepad
+		2   Dance pad
+		3   Guitar Hero guitar
+		4   Rock Band guitar
+		5   Guitar Hero drum kit
+		6   Rock Band drum kit
+		7   Guitar Hero Live guitar
+		8   DJ Hero turntable
+		9   Rock Band stage kit
+		10  Disney Infinity base
+		11  Skylanders portal
+		12  Lego Dimensions toy pad
+		13  Project Diva controller
+		14  Guitar Freaks guitar
+		15  Wheel
+		16  Rock Band Pro keyboard
+		17  Rock Band Pro guitar (Mustang)
+		18  Rock Band Pro guitar (Squier)
+		20  Fight stick
+		21  Flight stick
+		22  Pop'n Music controller
+		23  DJMAX controller
+		24  Taiko drum
+		25  Power Gig drum kit
+		26  Power Gig guitar
+		27  Rock Revolution guitar
+		29  beatmania controller
+		30  DrumMania drum kit
+		31  KeyboardMania keyboard
+		==  ==================================
+
+		Values not listed here may be added by newer firmware and
+		should be treated as an unknown controller.
+
+		Only present on interfaces that respond to the features
+		report.
MAINTAINERS +7 -0
index 3a19da74d00c..cf9ffffb825b 100644
@@ -11640,6 +11640,13 @@ L:	[email protected]
 S:	Supported
 F:	drivers/hid/hid-playstation.c
 
+HID SANTROLLER DRIVER
+M:	Sanjay Govind <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	Documentation/ABI/testing/sysfs-driver-hid-santroller
+F:	drivers/hid/hid-santroller.c
+
 HID SENSOR HUB DRIVERS
 M:	Jiri Kosina <[email protected]>
 M:	Jonathan Cameron <[email protected]>
drivers/hid/Kconfig +12 -0
index aa7fa11a0197..29b7b1615158 100644
@@ -1132,6 +1132,18 @@ config HID_SAMSUNG
 	help
 	Support for Samsung InfraRed remote control or keyboards.
 
+config HID_SANTROLLER
+	tristate "Santroller game controller support"
+	depends on LEDS_CLASS_MULTICOLOR
+	select INPUT_FF_MEMLESS
+	help
+	  Support for game controllers and instruments running the Santroller
+	  firmware, including rumble, player LEDs, the RGB indicator LED and
+	  the DJ Hero turntable euphoria LED.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called hid-santroller.
+
 config HID_SEMITEK
 	tristate "Semitek USB keyboards"
 	help
drivers/hid/Makefile +1 -0
index 48a863b245ee..5a554bd8c41d 100644
@@ -130,6 +130,7 @@ obj-$(CONFIG_HID_ROCCAT)	+= hid-roccat.o hid-roccat-common.o \
 obj-$(CONFIG_HID_RMI)		+= hid-rmi.o
 obj-$(CONFIG_HID_SAITEK)	+= hid-saitek.o
 obj-$(CONFIG_HID_SAMSUNG)	+= hid-samsung.o
+obj-$(CONFIG_HID_SANTROLLER)	+= hid-santroller.o
 obj-$(CONFIG_HID_SEMITEK)	+= hid-semitek.o
 obj-$(CONFIG_HID_SIGMAMICRO)	+= hid-sigmamicro.o
 obj-$(CONFIG_HID_SMARTJOYPLUS)	+= hid-sjoy.o
drivers/hid/hid-ids.h +4 -0
index 341bf587863b..7863a4b9700a 100644
@@ -1199,6 +1199,10 @@
 #define USB_VENDOR_ID_PHILIPS		0x0471
 #define USB_DEVICE_ID_PHILIPS_IEEE802154_DONGLE 0x0617
 
+#define USB_VENDOR_ID_PID_CODES		0x1209
+#define USB_DEVICE_ID_SANTROLLER	0x2882
+#define USB_DEVICE_ID_SANTROLLER_V2	0x2883
+
 #define USB_VENDOR_ID_PI_ENGINEERING	0x05f3
 #define USB_DEVICE_ID_PI_ENGINEERING_VEC_USB_FOOTPEDAL	0xff
 
drivers/hid/hid-santroller.c new file +624 -0

624 lines not on this page · raw message

base-commit: cee9395acd8043be0644b25c34bfa86623f2b935

Signature · 1 line
2.55.0
#1 lore raw
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider: - [Medium] sysfs: subtype attribute is never created because drvdata is evaluated before probe - [Medium]…

Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [Medium] sysfs: subtype attribute is never created because drvdata is evaluated before probe
- [Medium] hid: santroller: TOCTOU race in santroller_player_led_set()
- [Low] cleanup: mixing goto-based error handling and scope-based guard in santroller_probe --

commit b57c720141928f4d7ed22cb8e37042ae56074ec7
Author: Sanjay Govind <[email protected]>

HID: santroller: add driver for Santroller controllers

This commit adds a new driver for game controllers and instruments running the open source Santroller firmware. It supports inputs, rumble, various device LEDs, and exposes the specific controller subtype to userspace via a sysfs attribute.

Quoted 5 lines
drivers/hid/hid-santroller.c new file +0 -0
new file mode 100644
index 0000000000000..00adeb741a886

[ ... ]

Quoted 8 lines
drivers/hid/hid-santroller.c new file +8 -0
+static void santroller_player_led_set(struct led_classdev *led,
+				      enum led_brightness value)
+{
+	struct hid_device *hdev = to_hid_device(led->dev->parent);
+	struct santroller *sc = hid_get_drvdata(hdev);
+	u8 player = SANTROLLER_PLAYER_LED_OFF;
+	int i;
+

drivers/hid/hid-santroller.c line 190

Quoted 10 lines
drivers/hid/hid-santroller.c new file +10 -0
+	for (i = 0; i < SANTROLLER_NUM_PLAYER_LEDS; i++) {
+		if (sc->player_leds[i].brightness) {
+			player = i;
+			break;
+		}
+	}
+
+	guard(spinlock_irqsave)(&sc->lock);
+
+	sc->player = player;

[Severity: Medium]
Is there a potential regression here? If multiple player LEDs' brightnesses are updated concurrently via sysfs, their respective callbacks could run in parallel.

Since the brightness array is read outside sc->lock, one thread might read a stale array, get preempted, and then overwrite the hardware state with an outdated player index after the other thread has updated the state. Moving the array read inside the lock would prevent this.

[ ... ]

drivers/hid/hid-santroller.c line 428

Quoted 8 lines
drivers/hid/hid-santroller.c new file +8 -0
+/* Interfaces left to the generic HID handling have no subtype */
+static umode_t santroller_attr_is_visible(struct kobject *kobj,
+					  struct attribute *attr, int n)
+{
+	struct device *dev = kobj_to_dev(kobj);
+
+	return hid_get_drvdata(to_hid_device(dev)) ? attr->mode : 0;
+}

[Severity: Medium]
Could this visibility check cause a regression where the attribute is never created?

In the driver core, dev_groups assigned to the driver structure are evaluated by device_add_groups() before the driver's probe() function is executed. Because hid_set_drvdata() is only called later inside santroller_probe(), drvdata is strictly NULL when this visibility check is performed. This causes it to return 0 and skip attribute creation.

[ ... ]

Quoted 3 lines
drivers/hid/hid-santroller.c new file +3 -0
+static int santroller_probe(struct hid_device *hdev,
+			    const struct hid_device_id *id)
+{

[ ... ]

drivers/hid/hid-santroller.c line 518

Quoted 10 lines
drivers/hid/hid-santroller.c new file +10 -0
+	hid_device_io_stop(hdev);
+
+	scoped_guard(spinlock_irqsave, &sc->lock)
+		sc->output_enabled = true;
+
+	ret = hid_connect(hdev, HID_CONNECT_DEFAULT);
+	if (ret) {
+		hid_err(hdev, "failed to connect HID device: %d\n", ret);
+		goto err_stop_output;
+	}

[Severity: Low]
Does this mix goto-based error handling with scope-based cleanup?

The kernel's cleanup subsystem guidelines explicitly state that a function must either convert all resources to scope-based cleanup or use goto exclusively. Mixing goto labels alongside scoped_guard can cause a regression by creating confusing ownership semantics.

[ ... ]

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
#2 lore raw
Quoted 7 lines · On Fri, 16 Oct 2026 03:06:58 +0000, [email protected] wrote:
Quoted 7 lines
drivers/hid/hid-santroller.c new file +7 -0
+	for (i = 0; i < SANTROLLER_NUM_PLAYER_LEDS; i++) {
+		if (sc->player_leds[i].brightness) {
+			player = i;
+			break;
+		}
+	}
+
Quoted 8 lines

drivers/hid/hid-santroller.c line 190

Quoted 3 lines
drivers/hid/hid-santroller.c new file +3 -0
+	guard(spinlock_irqsave)(&sc->lock);
+
+	sc->player = player;

Since the brightness array is read outside sc->lock, one thread might read a stale array, get preempted, and then overwrite the hardware state with an outdated player index after the other thread has updated the state. Moving the array read inside the lock would prevent this.

Agreed. The LED core only serialises writes to the same LED, so two player LEDs can be set at once. I'll move the scan under the lock in v2.

Quoted 5 lines

In the driver core, dev_groups assigned to the driver structure are evaluated by device_add_groups() before the driver's probe() function is executed. Because hid_set_drvdata() is only called later inside santroller_probe(), drvdata is strictly NULL when this visibility check is performed. This causes it to return 0 and skip attribute creation.

This one is a false positive. really_probe() adds drv->dev_groups after call_driver_probe() returns, so drvdata is already set when is_visible runs. In testing the attribute is present on the gamepad interfaces, and hidden on the configuration interface as intended.

Quoted 10 lines

drivers/hid/hid-santroller.c line 518

Quoted 8 lines
drivers/hid/hid-santroller.c new file +8 -0
+	scoped_guard(spinlock_irqsave, &sc->lock)
+		sc->output_enabled = true;
+
+	ret = hid_connect(hdev, HID_CONNECT_DEFAULT);
+	if (ret) {
+		hid_err(hdev, "failed to connect HID device: %d\n", ret);
+		goto err_stop_output;
+	}

Does this mix goto-based error handling with scope-based cleanup?

The guard can't be jumped across here, but I'll move it into a santroller_start_output() helper in v2 so probe only uses goto.

Thanks,
Sanjay

#3 lore raw

PATCH v2 1/1 HID: santroller: add driver for Santroller controllers

In reply to Sanjay Govind

Santroller is an open source firmware for DIY and modded game controllers and instruments: https://github.com/Santroller/Santroller

Santroller devices work like hubs: a user can connect several instruments and controllers to one device, and on USB each active profile appears as its own HID gamepad interface. On current firmware, each of these interfaces answers a vendor features report (usage 0xff00:0x2882) with the emulated controller type and a set of capability bits.

Inputs are left to the generic HID input layer, as the report descriptor already describes the buttons, axes and d-pad. Since users name each profile, and on USB the firmware puts that name in the interface string, the driver uses it to name the input device, so each connected instrument or controller can be told apart.

The driver also handles the outputs the device reports supporting:
rumble, player LEDs, an RGB indicator LED and the euphoria LED of DJ Hero turntables.

The configuration interface and devices whose report descriptor lacks the features report are left to hid-generic. Devices that advertise the report but fail to answer it are still connected as plain gamepads.

---
 MAINTAINERS                  |   6 +
 drivers/hid/Kconfig          |  12 +
 drivers/hid/Makefile         |   1 +
 drivers/hid/hid-ids.h        |   4 +
 drivers/hid/hid-santroller.c | 611 +++++++++++++++++++++++++++++++++++
 5 files changed, 634 insertions(+)
 create mode 100644 drivers/hid/hid-santroller.c

Changes since v1:
- Serialize concurrent player LED updates under the driver lock.
- Move output enabling into a helper to keep probe error handling consistently goto-based.
- Use a longer feature-report timeout over Bluetooth and still bind as a plain gamepad when a device advertises but does not answer the report.
- Drop the subtype sysfs attribute and its ABI documentation; SDL can identify the controller from USB descriptors already exposed through sysfs.
- Rebase onto the current hid/for-next.

AI assistance was used to review the v1 thread, prepare the rebase, and remove the subtype sysfs interface.

Testing:
- git diff --check
- Built hid-santroller.ko against the running 7.2.11-arch1-1 kernel.
- Bound both Santroller HID interfaces to the driver; verified live input events, tested the player LED and RGB indicator and restored their original states, and verified rumble with fftest.

MAINTAINERS +6 -0
index 4a69da715c58..028c8f7f40fa 100644
@@ -11703,6 +11703,12 @@ L:	[email protected]
 S:	Maintained
 F:	drivers/hid/hid-pulsar.c
 
+HID SANTROLLER DRIVER
+M:	Sanjay Govind <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	drivers/hid/hid-santroller.c
+
 HID SENSOR HUB DRIVERS
 M:	Jiri Kosina <[email protected]>
 M:	Jonathan Cameron <[email protected]>
drivers/hid/Kconfig +12 -0
index 2481bc01c435..2fab7003ce18 100644
@@ -1138,6 +1138,18 @@ config HID_SAMSUNG
 	help
 	Support for Samsung InfraRed remote control or keyboards.
 
+config HID_SANTROLLER
+	tristate "Santroller game controller support"
+	depends on LEDS_CLASS_MULTICOLOR
+	select INPUT_FF_MEMLESS
+	help
+	  Support for game controllers and instruments running the Santroller
+	  firmware, including rumble, player LEDs, the RGB indicator LED and
+	  the DJ Hero turntable euphoria LED.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called hid-santroller.
+
 config HID_SEMITEK
 	tristate "Semitek USB keyboards"
 	help
drivers/hid/Makefile +1 -0
index 43a8eb0f389b..afe88185289b 100644
@@ -131,6 +131,7 @@ obj-$(CONFIG_HID_ROCCAT)	+= hid-roccat.o hid-roccat-common.o \
 obj-$(CONFIG_HID_RMI)		+= hid-rmi.o
 obj-$(CONFIG_HID_SAITEK)	+= hid-saitek.o
 obj-$(CONFIG_HID_SAMSUNG)	+= hid-samsung.o
+obj-$(CONFIG_HID_SANTROLLER)	+= hid-santroller.o
 obj-$(CONFIG_HID_SEMITEK)	+= hid-semitek.o
 obj-$(CONFIG_HID_SIGMAMICRO)	+= hid-sigmamicro.o
 obj-$(CONFIG_HID_SMARTJOYPLUS)	+= hid-sjoy.o
drivers/hid/hid-ids.h +4 -0
index 91319aa6516d..ed3940cd36cd 100644
@@ -1216,6 +1216,10 @@
 #define USB_VENDOR_ID_PHILIPS		0x0471
 #define USB_DEVICE_ID_PHILIPS_IEEE802154_DONGLE 0x0617
 
+#define USB_VENDOR_ID_PID_CODES		0x1209
+#define USB_DEVICE_ID_SANTROLLER	0x2882
+#define USB_DEVICE_ID_SANTROLLER_V2	0x2883
+
 #define USB_VENDOR_ID_PI_ENGINEERING	0x05f3
 #define USB_DEVICE_ID_PI_ENGINEERING_VEC_USB_FOOTPEDAL	0xff
 
drivers/hid/hid-santroller.c new file +611 -0

611 lines not on this page · raw message

Signature · 1 line
2.56.0
#4 lore raw
Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider: - [Medium] HID: santroller: completion token consumed in santroller_get_features() - [Medium] HID…

Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider:
- [Medium] HID: santroller: completion token consumed in santroller_get_features()
- [Medium] HID: santroller: santroller_resume() clobbers dirty flag and skips input check
- [Medium] HID: santroller: unlocked color calculation in santroller_rgb_led_set()
- [Low] HID: santroller: missing USB_HID dependency for hid_is_usb()
--

commit 5d9a23d03a81b34363d47e701c2dd2ced730bac9
Author: Sanjay Govind <[email protected]>

HID: santroller: add driver for Santroller controllers

This commit adds a HID driver for game controllers and instruments running the open source Santroller firmware. It queries a vendor features report to configure force-feedback rumble, player LEDs, a multicolor RGB indicator LED, and the DJ Hero turntable euphoria LED.

drivers/hid/Kconfig config HID_SAMSUNG · line 1144

Quoted 12 lines
drivers/hid/Kconfig +4 -0
index 2481bc01c435b..2fab7003ce18f 100644
@@ -1138,6 +1138,18 @@ config HID_SAMSUNG
 	help
 	Support for Samsung InfraRed remote control or keyboards.
 
+config HID_SANTROLLER
+	tristate "Santroller game controller support"
+	depends on LEDS_CLASS_MULTICOLOR
+	select INPUT_FF_MEMLESS

[Severity: Low]
In drivers/hid/hid-santroller.c, santroller_profile_name() unconditionally calls hid_is_usb(hdev):

	if (!hid_is_usb(hdev))
		return NULL;

However, include/linux/hid.h declares hid_is_usb() as an extern symbol with no inline fallback when CONFIG_USB_HID is disabled, and its definition in drivers/hid/usbhid/hid-core.c is only built when CONFIG_USB_HID is enabled.

Can building with CONFIG_USB_HID=n (or CONFIG_USB_HID=m and CONFIG_HID_SANTROLLER=y) fail at link time with an undefined reference to hid_is_usb()? Should HID_SANTROLLER depend on USB_HID (or guard the USB helper with IS_ENABLED(CONFIG_USB_HID))?

Quoted 5 lines
drivers/hid/hid-santroller.c new file +0 -0
new file mode 100644
index 0000000000000..a2048e4ea3215

[ ... ]

Quoted 6 lines
drivers/hid/hid-santroller.c new file +6 -0
+static void santroller_rgb_led_set(struct led_classdev *led,
+				   enum led_brightness brightness)
+{
+	struct led_classdev_mc *mc = lcdev_to_mccdev(led);
+	struct santroller *sc = container_of(mc, struct santroller, rgb_led);
+	int i;

drivers/hid/hid-santroller.c line 212

Quoted 10 lines
drivers/hid/hid-santroller.c new file +10 -0
+
+	led_mc_calc_color_components(mc, brightness);
+
+	guard(spinlock_irqsave)(&sc->lock);
+
+	for (i = 0; i < ARRAY_SIZE(sc->rgb); i++)
+		sc->rgb[i] = mc->subled_info[i].brightness;
+	sc->rgb_dirty = true;
+	santroller_schedule_output(sc);
+}

[Severity: Medium]
Since santroller_rgb_led_set() is registered as the non-blocking led->brightness_set callback, it can be invoked concurrently from software blink timers, triggers, or sysfs writes without led_access held.

Because led_mc_calc_color_components(mc, brightness) updates mc->subled_info[i].brightness in place before sc->lock is acquired, can two concurrent calls to santroller_rgb_led_set() race on mc->subled_info[i].brightness and copy stale or mixed RGB values into sc->rgb[]? Should led_mc_calc_color_components() be called inside the sc->lock critical section?

[ ... ]

Quoted 35 lines
drivers/hid/hid-santroller.c new file +35 -0
+static int santroller_raw_event(struct hid_device *hdev,
+				struct hid_report *report, u8 *data, int size)
+{
+	struct santroller *sc = hid_get_drvdata(hdev);
+
+	if (sc && data[0] == SANTROLLER_REPORT_ID_FEATURES &&
+	    size >= SANTROLLER_FEATURES_REPORT_SIZE &&
+	    !completion_done(&sc->features_done)) {
+		sc->caps = data[2];
+		complete(&sc->features_done);
+	}
+
+	return 0;
+}
+
+/* The device answers the features command with an input report */
+static int santroller_get_features(struct santroller *sc)
+{
+	u8 *buf __free(kfree) = kzalloc(2, GFP_KERNEL);
+	unsigned long timeout = SANTROLLER_FEATURES_TIMEOUT;
+	int i, ret = -ETIMEDOUT;
+
+	if (!buf)
+		return -ENOMEM;
+
+	if (sc->hdev->bus == BUS_BLUETOOTH)
+		timeout = SANTROLLER_FEATURES_TIMEOUT_BT;
+
+	for (i = 0; i < SANTROLLER_FEATURES_RETRIES; i++) {
+		reinit_completion(&sc->features_done);
+
+		buf[0] = SANTROLLER_REPORT_ID_FEATURES;
+		buf[1] = 0;
+		ret = santroller_send_report(sc->hdev, buf, 2);
+		if (ret < 0)

drivers/hid/hid-santroller.c line 378

Quoted 10 lines
drivers/hid/hid-santroller.c new file +10 -0
+			continue;
+
+		if (wait_for_completion_timeout(&sc->features_done, timeout))
+			return 0;
+
+		ret = -ETIMEDOUT;
+	}
+
+	return ret;
+}

[Severity: Medium]
When santroller_raw_event() receives SANTROLLER_REPORT_ID_FEATURES, it calls complete(&sc->features_done), which increments sc->features_done.done from 0 to 1. When wait_for_completion_timeout(&sc->features_done, timeout) wakes up in santroller_get_features(), do_wait_for_common() consumes that token and decrements sc->features_done.done back to 0.

In santroller_probe(), complete(&sc->features_done) is only called when santroller_get_features() fails:

	ret = santroller_get_features(sc);
	if (ret == -ENOMEM)
		goto err_close;
	if (ret) {
		hid_warn(hdev, "failed to get device features: %d\n", ret);
		/* Ignore a late reply, the caps are settled from here on */
		complete(&sc->features_done);
	}

When santroller_get_features() succeeds, sc->features_done.done remains 0, so completion_done(&sc->features_done) in santroller_raw_event() continues to return false for the lifetime of the device. In addition, reinit_completion() in the retry loop can run concurrently with santroller_raw_event() if a reply to an earlier attempt arrives just as a timeout expires.

Can a delayed retry response or a later SANTROLLER_REPORT_ID_FEATURES report overwrite sc->caps in santroller_raw_event() without synchronization while santroller_probe() or santroller_resume() is reading sc->caps? Would complete_all() (or guarding sc->caps with a flag under sc->lock) avoid this?

[ ... ]

Quoted 7 lines
drivers/hid/hid-santroller.c new file +7 -0
+static int santroller_resume(struct hid_device *hdev)
+{
+	struct santroller *sc = hid_get_drvdata(hdev);
+
+	if (!sc)
+		return 0;
+

drivers/hid/hid-santroller.c line 586

Quoted 10 lines
drivers/hid/hid-santroller.c new file +10 -0
+	/* The device may have lost its LED state, so send it again */
+	guard(spinlock_irqsave)(&sc->lock);
+
+	sc->player_dirty = sc->caps & SANTROLLER_CAP_PLAYER_LEDS;
+	sc->rgb_dirty = sc->caps & SANTROLLER_CAP_RGB_LED;
+	sc->rumble_dirty = sc->caps & SANTROLLER_CAP_EUPHORIA_LED;
+	santroller_schedule_output(sc);
+
+	return 0;
+}

[Severity: Medium]
There appear to be two issues in santroller_resume():

First, sc->rumble_dirty is shared between FF_RUMBLE in santroller_play_effect() and the euphoria LED in santroller_euphoria_led_set(). Assigning sc->rumble_dirty with '=' instead of '|=' clears sc->rumble_dirty to false on controllers that support SANTROLLER_CAP_RUMBLE but not SANTROLLER_CAP_EUPHORIA_LED. If a rumble update was queued before santroller_output_work() ran, will santroller_resume() drop that pending rumble command?

Second, in santroller_probe(), if sc->input is NULL, the driver jumps to out without registering any LEDs or initializing sc->player (leaving sc->player at 0 rather than SANTROLLER_PLAYER_LED_OFF):

	/* The LEDs are named after the gamepad input device */
	if (!sc->input)
		goto out;

Because santroller_resume() does not check sc->input before marking the LEDs dirty, can resuming a device where sc->input is NULL send uninitialized LED state to the controller?

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
#5 lore raw
In reply to Sanjay Govind
kernel test robot noticed the following build errors:

Hi Sanjay,

kernel test robot noticed the following build errors:

[auto build test ERROR on hid/for-next]
[also build test ERROR on linus/master next-20261030] [cannot apply to v7.3]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Sanjay-Govind/HID-santroller-add-driver-for-Santroller-controllers/20261103-145335
base:   https://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git for-next
patch link:    https://lore.kernel.org/r/20261103015335.974344-1-sanjay.govind9%40gmail.com
patch subject: [PATCH v2] HID: santroller: add driver for Santroller controllers
config: xtensa-randconfig-1001-20261104 (https://download.01.org/0day-ci/archive/20261104/[email protected]/config)
compiler: xtensa-linux-gcc (GCC) 13.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261104/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>, old ones prefixed by <<):

WARNING: modpost: vmlinux: section mismatch in reference: trace_initcall_level+0x60 (section: .text.unlikely) -> initcall_level_names (section: .init.data)
WARNING: modpost: vmlinux: section mismatch in reference: trace_define_generic_fields+0x38c (section: .text.unlikely) -> initcall_level_names (section: .init.data)

>> ERROR: modpost: drivers/hid/hid-santroller.ko: symbol 'hid_is_usb' undefined!

Kconfig warnings: (for reference only)
WARNING: unmet direct dependencies detected for PM_GENERIC_DOMAINS_OF
Depends on [n]: PM_GENERIC_DOMAINS [=y] && OF [=n]
Selected by [m]:
- COMMON_CLK_MT8173_MFGTOP [=m] && COMMON_CLK [=y] && (ARCH_MEDIATEK || COMPILE_TEST [=y]) && COMMON_CLK_MT8173 [=m] && PM [=y]

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

#6 lore raw
In reply to Sanjay Govind
kernel test robot noticed the following build errors:

Hi Sanjay,

kernel test robot noticed the following build errors:

[auto build test ERROR on hid/for-next]
[also build test ERROR on linus/master next-20261030] [cannot apply to v7.3]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Sanjay-Govind/HID-santroller-add-driver-for-Santroller-controllers/20261103-145335
base:   https://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git for-next
patch link:    https://lore.kernel.org/r/20261103015335.974344-1-sanjay.govind9%40gmail.com
patch subject: [PATCH v2] HID: santroller: add driver for Santroller controllers
config: sparc64-randconfig-1000-20261104 (https://download.01.org/0day-ci/archive/20261104/[email protected]/config)
compiler: sparc64-linux-gcc (GCC) 8.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261104/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

sparc64-linux-ld: drivers/hid/hid-santroller.o: in function `santroller_probe.part.3':

>> hid-santroller.c:(.text+0x610): undefined reference to `hid_is_usb'

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki