We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 5493

Summary: (Patch) Hint SDL_HINT_SWITCH_HOME_LIT to let the user opt out of having Switch controllers' Home button lit when opened.
Product: SDL Reporter: jibb
Component: joystickAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: 2.0.15   
Hardware: x86_64   
OS: Windows 10   
Attachments: Patch with the proposed change

Description jibb 2021-01-22 09:30:30 UTC
Created attachment 4686 [details]
Patch with the proposed change

New hint SDL_HINT_SWITCH_HOME_LIT to let the user opt out of having Switch controllers' Home button lit when opened.

This is more consistent with the Switch itself (which doesn't light the button normally) and may be preferred by users who may disconnect their controller without letting the application close it.

I think this warrants a Switch-specific hint because the default behaviour is unusual (inconsistent with using a Switch controller on a Switch itself or with some other programs on PC), and because of that it's distinct from other lights (the player number on Switch controllers and the player colour on PlayStation controllers).
Comment 1 jibb 2021-01-22 09:43:42 UTC
Actually the biggest motivating factor for me was that while the player number LED and the PlayStation controller lights all turn off on their own after disconnect or after a little while without being pinged, respectively, the Switch Home button light stays on as long as the controller is charged, which bothers me as someone who will frequently disconnect controllers without closing an application.

In my own application I could of course turn the light off right away, but it makes sense to me that they shouldn't be initialised to ON in that case.
Comment 2 Sam Lantinga 2021-01-23 17:35:25 UTC
The PlayStation controller powers off, which is what is turning off the LED in that case. I wonder if we really need to have functionality to turn off the Switch controller after an idle timeout, to prevent the battery from running down?
Comment 3 jibb 2021-01-25 01:07:34 UTC
(In reply to Sam Lantinga from comment #2)
> The PlayStation controller powers off, which is what is turning off the LED
> in that case. I wonder if we really need to have functionality to turn off
> the Switch controller after an idle timeout, to prevent the battery from
> running down?

Oh interesting. I recall having to remind the DS4 to keep its light on, even while otherwise using the controller, but it's a long time since I tested that functionality in my library and I guess I'm misremembering (or have done it wrong).

But yeah, I agree that draining the battery after disconnect is a concern with leaving the light on indefinitely. A time-out is a good idea, but only works as long as the user doesn't disconnect their controller, right? I often disconnect / reconnect my controllers on the fly because my Bluetooth can't keep up with more than one at a time.

Whether it's a Switch-specific hint or a general one, as an application developer I'd certainly appreciate a way to turn off the Home LED or have it not turned on in the first place, and I can't find any way to set it at present.
Comment 4 Sam Lantinga 2021-01-26 04:39:39 UTC
I changed the name of the hint and added your change:
https://hg.libsdl.org/SDL/rev/b8180eae61c6
Comment 5 jibb 2021-01-27 01:14:31 UTC
(In reply to Sam Lantinga from comment #4)
> I changed the name of the hint and added your change:
> https://hg.libsdl.org/SDL/rev/b8180eae61c6

Thank you so much :)
Comment 6 Sam Lantinga 2021-01-27 02:00:19 UTC
You're welcome!