Message ID | 1c4d7bee-9410-dd56-a74f-185b7de827a1@hanno.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | HID: hid-sony: Only allow four LED states | expand |
On Tue, 24 Jul 2018 13:54:56 +0200 Hanno Zulla <abos@hanno.de> wrote: > HID: hid-sony: Only allow four LED states to identify controller > > The PS3 and PS4 consoles only support four game controllers, while > Linux supports any number of game controller connected to it. The > kernel driver should mirror the original console's behaviour here > and leave the use of additional LED patterns/colours to user space. > Hi Hanno, JFYI the PS3 officially supports up to 7 controllers, quoting the PS3 Quick reference Guide[1]: You can connect up to 7 controllers at one time. The controller number is shown by the number above the port indicators. For numbers 5-7, add the numbers of the lit indicators. The 10 patterns in the linux driver were added following this "addition" rule, extrapolating it up to 10 by using all the 4 LEDs. Equivalent code was in the bluez sixaxis plugin[2] too but it was removed since the kernel started handling the controller numbering. If Sony developers really prefer this code removed I am not necessarily against it, they are the maintainers now after all, however I wanted to point out the history behind the code. I have no comments about the PS4 part. Ciao, Antonio [1] https://www.playstation.com/manual/pdf/CECHJ02_03-2.30_2.pdf See pag. 17 on this version of the guide. [2] https://git.kernel.org/pub/scm/bluetooth/bluez.git/commit/plugins/sixaxis.c?id=efe53dc46f0ebcfbe7d03f21fe52b5720f39ec59
Hi,
> JFYI the PS3 officially supports up to 7 controllers, quoting the PS3> Quick reference Guide[1]:
Oh wow, thanks for pointing it out.
I guess it should be Roderick making the call here. My original
assumption was based on his private feedback and I may have
misunderstood him there.
Kind regards,
Hanno
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
On Thu, 2018-07-26 at 10:43 +0200, Hanno Zulla wrote: > Hi, > > > JFYI the PS3 officially supports up to 7 controllers, quoting the > > PS3> Quick reference Guide[1]: > > Oh wow, thanks for pointing it out. > > I guess it should be Roderick making the call here. My original > assumption was based on his private feedback and I may have > misunderstood him there. He only mentioned the PS4 colour LEDs, not the PS3 controller indicators. -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Thu, Jul 26, 2018 at 3:56 AM, Bastien Nocera <hadess@hadess.net> wrote: > On Thu, 2018-07-26 at 10:43 +0200, Hanno Zulla wrote: >> Hi, >> >> > JFYI the PS3 officially supports up to 7 controllers, quoting the >> > PS3> Quick reference Guide[1]: >> >> Oh wow, thanks for pointing it out. >> >> I guess it should be Roderick making the call here. My original >> assumption was based on his private feedback and I may have >> misunderstood him there. > > He only mentioned the PS4 colour LEDs, not the PS3 controller > indicators. Correct I only meant PS4. Honestly had forgotten the PS3 supported 4 (not sure what LED codes it uses post 4). Thanks, Roderick -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Mon, 2018-07-30 at 15:08 -0700, Roderick Colenbrander wrote: > On Thu, Jul 26, 2018 at 3:56 AM, Bastien Nocera <hadess@hadess.net> > wrote: > > On Thu, 2018-07-26 at 10:43 +0200, Hanno Zulla wrote: > > > Hi, > > > > > > > JFYI the PS3 officially supports up to 7 controllers, quoting > > > > the > > > > PS3> Quick reference Guide[1]: > > > > > > Oh wow, thanks for pointing it out. > > > > > > I guess it should be Roderick making the call here. My original > > > assumption was based on his private feedback and I may have > > > misunderstood him there. > > > > He only mentioned the PS4 colour LEDs, not the PS3 controller > > indicators. > > Correct I only meant PS4. Honestly had forgotten the PS3 supported 4 > (not sure what LED codes it uses post 4). Past player 4, LED 4 is always on, with LEDs 1, 2 and 3 each used to represent player 5, 6 and 7 (so 4+1, 4+2 and 4+3). -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c index e475c5073c99..147750b8dea7 100644 --- a/drivers/hid/hid-sony.c +++ b/drivers/hid/hid-sony.c @@ -1798,17 +1798,11 @@ static int dualshock4_get_version_info(struct sony_sc *sc) static void sixaxis_set_leds_from_id(struct sony_sc *sc) { - static const u8 sixaxis_leds[10][4] = { + static const u8 sixaxis_leds[4][4] = { { 0x01, 0x00, 0x00, 0x00 }, { 0x00, 0x01, 0x00, 0x00 }, { 0x00, 0x00, 0x01, 0x00 }, - { 0x00, 0x00, 0x00, 0x01 }, - { 0x01, 0x00, 0x00, 0x01 }, - { 0x00, 0x01, 0x00, 0x01 }, - { 0x00, 0x00, 0x01, 0x01 }, - { 0x01, 0x00, 0x01, 0x01 }, - { 0x00, 0x01, 0x01, 0x01 }, - { 0x01, 0x01, 0x01, 0x01 } + { 0x00, 0x00, 0x00, 0x01 } }; int id = sc->device_id; @@ -1818,21 +1812,18 @@ static void sixaxis_set_leds_from_id(struct sony_sc *sc) if (id < 0) return; - id %= 10; + id %= 4; memcpy(sc->led_state, sixaxis_leds[id], sizeof(sixaxis_leds[id])); } static void dualshock4_set_leds_from_id(struct sony_sc *sc) { - /* The first 4 color/index entries match what the PS4 assigns */ - static const u8 color_code[7][3] = { + /* The 4 color/index entries match what the PS4 assigns */ + static const u8 color_code[4][3] = { /* Blue */ { 0x00, 0x00, 0x40 }, - /* Red */ { 0x40, 0x00, 0x00 }, + /* Red */ { 0x40, 0x00, 0x00 }, /* Green */ { 0x00, 0x40, 0x00 }, - /* Pink */ { 0x20, 0x00, 0x20 }, - /* Orange */ { 0x02, 0x01, 0x00 }, - /* Teal */ { 0x00, 0x01, 0x01 }, - /* White */ { 0x01, 0x01, 0x01 } + /* Pink */ { 0x20, 0x00, 0x20 } }; int id = sc->device_id; @@ -1842,7 +1833,7 @@ static void dualshock4_set_leds_from_id(struct sony_sc *sc) if (id < 0) return; - id %= 7; + id %= 4; memcpy(sc->led_state, color_code[id], sizeof(color_code[id])); }
HID: hid-sony: Only allow four LED states to identify controller The PS3 and PS4 consoles only support four game controllers, while Linux supports any number of game controller connected to it. The kernel driver should mirror the original console's behaviour here and leave the use of additional LED patterns/colours to user space. Signed-off-by: Hanno Zulla <kontakt@hanno.de> --- drivers/hid/hid-sony.c | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-)