diff mbox

HID: hid-sony: Brighter RGB values for Orange/Teal/White.

Message ID b4115f24-95c6-6008-1eb0-3f2ee2330ef1@epublica.de (mailing list archive)
State New, archived
Headers show

Commit Message

Hanno Zulla June 4, 2018, 7:45 a.m. UTC
While blue/red/green/pink are bright, the RGB values for orange/teal/white
were rather dark in comparison. This increases the RGB brightness for
color values 4-6.

Signed-off-by: Hanno Zulla <kontakt@hanno.de>
---
 drivers/hid/hid-sony.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Jiri Kosina June 11, 2018, 1:03 p.m. UTC | #1
On Mon, 4 Jun 2018, Hanno Zulla wrote:

> While blue/red/green/pink are bright, the RGB values for orange/teal/white
> were rather dark in comparison. This increases the RGB brightness for
> color values 4-6.
> 
> Signed-off-by: Hanno Zulla <kontakt@hanno.de>
> ---
>  drivers/hid/hid-sony.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
> index e475c5073c99..65af382f7394 100644
> --- a/drivers/hid/hid-sony.c
> +++ b/drivers/hid/hid-sony.c
> @@ -1830,9 +1830,9 @@ static void dualshock4_set_leds_from_id(struct sony_sc *sc)
>  			/* Red	  */	{ 0x40, 0x00, 0x00 },
>  			/* Green  */	{ 0x00, 0x40, 0x00 },
>  			/* Pink   */	{ 0x20, 0x00, 0x20 },
> -			/* Orange */	{ 0x02, 0x01, 0x00 },
> -			/* Teal   */	{ 0x00, 0x01, 0x01 },
> -			/* White  */	{ 0x01, 0x01, 0x01 }
> +			/* Orange */	{ 0x40, 0x20, 0x00 },
> +			/* Teal   */	{ 0x00, 0x20, 0x20 },
> +			/* White  */	{ 0x20, 0x20, 0x20 }

Let's add Frank to CC (who came up with the original values). Frank, any 
word to this?

Thanks,
Frank Praznik June 13, 2018, 6:36 p.m. UTC | #2
> On Jun 11, 2018, at 09:03, Jiri Kosina <jikos@kernel.org> wrote:
> 
> On Mon, 4 Jun 2018, Hanno Zulla wrote:
> 
>> While blue/red/green/pink are bright, the RGB values for orange/teal/white
>> were rather dark in comparison. This increases the RGB brightness for
>> color values 4-6.
>> 
>> Signed-off-by: Hanno Zulla <kontakt@hanno.de>
>> ---
>> drivers/hid/hid-sony.c | 6 +++---
>> 1 file changed, 3 insertions(+), 3 deletions(-)
>> 
>> diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
>> index e475c5073c99..65af382f7394 100644
>> --- a/drivers/hid/hid-sony.c
>> +++ b/drivers/hid/hid-sony.c
>> @@ -1830,9 +1830,9 @@ static void dualshock4_set_leds_from_id(struct sony_sc *sc)
>> 			/* Red	  */	{ 0x40, 0x00, 0x00 },
>> 			/* Green  */	{ 0x00, 0x40, 0x00 },
>> 			/* Pink   */	{ 0x20, 0x00, 0x20 },
>> -			/* Orange */	{ 0x02, 0x01, 0x00 },
>> -			/* Teal   */	{ 0x00, 0x01, 0x01 },
>> -			/* White  */	{ 0x01, 0x01, 0x01 }
>> +			/* Orange */	{ 0x40, 0x20, 0x00 },
>> +			/* Teal   */	{ 0x00, 0x20, 0x20 },
>> +			/* White  */	{ 0x20, 0x20, 0x20 }
> 
> Let's add Frank to CC (who came up with the original values). Frank, any 
> word to this?
> 
> Thanks,
> 
> -- 
> Jiri Kosina
> SUSE Labs
> 

They were all darker at the beginning.  When Roderick Colenbrander at Sony was working on the driver he changed the first four values to be brighter, probably to match the values used on the Playstation 4.--
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
Jiri Kosina June 15, 2018, 1:14 p.m. UTC | #3
On Wed, 13 Jun 2018, Frank Praznik wrote:

> >> While blue/red/green/pink are bright, the RGB values for orange/teal/white
> >> were rather dark in comparison. This increases the RGB brightness for
> >> color values 4-6.
> >> 
> >> Signed-off-by: Hanno Zulla <kontakt@hanno.de>
> >> ---
> >> drivers/hid/hid-sony.c | 6 +++---
> >> 1 file changed, 3 insertions(+), 3 deletions(-)
> >> 
> >> diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
> >> index e475c5073c99..65af382f7394 100644
> >> --- a/drivers/hid/hid-sony.c
> >> +++ b/drivers/hid/hid-sony.c
> >> @@ -1830,9 +1830,9 @@ static void dualshock4_set_leds_from_id(struct sony_sc *sc)
> >> 			/* Red	  */	{ 0x40, 0x00, 0x00 },
> >> 			/* Green  */	{ 0x00, 0x40, 0x00 },
> >> 			/* Pink   */	{ 0x20, 0x00, 0x20 },
> >> -			/* Orange */	{ 0x02, 0x01, 0x00 },
> >> -			/* Teal   */	{ 0x00, 0x01, 0x01 },
> >> -			/* White  */	{ 0x01, 0x01, 0x01 }
> >> +			/* Orange */	{ 0x40, 0x20, 0x00 },
> >> +			/* Teal   */	{ 0x00, 0x20, 0x20 },
> >> +			/* White  */	{ 0x20, 0x20, 0x20 }
> > 
> > Let's add Frank to CC (who came up with the original values). Frank, any 
> > word to this?
> 
> They were all darker at the beginning.  When Roderick Colenbrander at 
> Sony was working on the driver he changed the first four values to be 
> brighter, probably to match the values used on the Playstation 4.

Alright, let's add Roderick as well :)
Hanno Zulla June 15, 2018, 1:39 p.m. UTC | #4
Am 15.06.2018 um 15:14 schrieb Jiri Kosina:
> Alright, let's add Roderick as well :)

fwiw, the brightness difference was discovered while working on

https://salsa.debian.org/debian/joystick/merge_requests/1

which is an attempt to show the joystick device number with
different gamepads. (Debian's current implementation only
supports PS3 gamepad.)

My patch here wants to send the brighter colors upstream back
to the hid-sony driver.

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
Bastien Nocera June 15, 2018, 4:48 p.m. UTC | #5
On Fri, 2018-06-15 at 15:39 +0200, Hanno Zulla wrote:
> Am 15.06.2018 um 15:14 schrieb Jiri Kosina:
> > Alright, let's add Roderick as well :)
> 
> fwiw, the brightness difference was discovered while working on
> 
> https://salsa.debian.org/debian/joystick/merge_requests/1
> 
> which is an attempt to show the joystick device number with
> different gamepads. (Debian's current implementation only
> supports PS3 gamepad.)
> 
> My patch here wants to send the brighter colors upstream back
> to the hid-sony driver.

This is neat. Do you have any plans to make this available in an
upstream package of some sorts, like systemd, so we can eventually
remove the dualshock4_set_leds_from_id()-type hacks in the kernel,
amongst other things?
--
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
Roderick Colenbrander June 16, 2018, 4:37 a.m. UTC | #6
On Fri, Jun 15, 2018 at 6:14 AM, Jiri Kosina <jikos@kernel.org> wrote:
> On Wed, 13 Jun 2018, Frank Praznik wrote:
>
>> >> While blue/red/green/pink are bright, the RGB values for orange/teal/white
>> >> were rather dark in comparison. This increases the RGB brightness for
>> >> color values 4-6.
>> >>
>> >> Signed-off-by: Hanno Zulla <kontakt@hanno.de>
>> >> ---
>> >> drivers/hid/hid-sony.c | 6 +++---
>> >> 1 file changed, 3 insertions(+), 3 deletions(-)
>> >>
>> >> diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
>> >> index e475c5073c99..65af382f7394 100644
>> >> --- a/drivers/hid/hid-sony.c
>> >> +++ b/drivers/hid/hid-sony.c
>> >> @@ -1830,9 +1830,9 @@ static void dualshock4_set_leds_from_id(struct sony_sc *sc)
>> >>                    /* Red    */    { 0x40, 0x00, 0x00 },
>> >>                    /* Green  */    { 0x00, 0x40, 0x00 },
>> >>                    /* Pink   */    { 0x20, 0x00, 0x20 },
>> >> -                  /* Orange */    { 0x02, 0x01, 0x00 },
>> >> -                  /* Teal   */    { 0x00, 0x01, 0x01 },
>> >> -                  /* White  */    { 0x01, 0x01, 0x01 }
>> >> +                  /* Orange */    { 0x40, 0x20, 0x00 },
>> >> +                  /* Teal   */    { 0x00, 0x20, 0x20 },
>> >> +                  /* White  */    { 0x20, 0x20, 0x20 }
>> >
>> > Let's add Frank to CC (who came up with the original values). Frank, any
>> > word to this?
>>
>> They were all darker at the beginning.  When Roderick Colenbrander at
>> Sony was working on the driver he changed the first four values to be
>> brighter, probably to match the values used on the Playstation 4.
>
> Alright, let's add Roderick as well :)
>

Correct, the 4 original colors (red, green, blue, purple) are the
values of the official platform, which we wanted to use. The official
platform supports 4 controllers, so there are no official colors
passed the official 4. Honestly more than 4 is a little academic.
Though if adding other colors, I'm not sure how bright to make them as
it affects battery life. For consistency reason I would probably have
the sum of other colors be ~0x40 to have similar battery life.

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
Hanno Zulla June 18, 2018, 8:57 a.m. UTC | #7
Hi,
>> fwiw, the brightness difference was discovered while working on
>>
>> https://salsa.debian.org/debian/joystick/merge_requests/1
>>
>> which is an attempt to show the joystick device number with
>> different gamepads. (Debian's current implementation only
>> supports PS3 gamepad.)
>>
>> My patch here wants to send the brighter colors upstream back
>> to the hid-sony driver.
> 
> This is neat. Do you have any plans to make this available in an
> upstream package of some sorts, like systemd, so we can eventually
> remove the dualshock4_set_leds_from_id()-type hacks in the kernel,
> amongst other things?

I'm not exactly sure where is the right place for this type of
gamepad enumeration display.

1) in the kernel

2) in systemd

3) in a distribution specific configuration add-on package

Right now, in Debian, it's 3), but yeah, that somehow feels wrong.

My gut feeling is that 2) is wrong, too, as the enumeration display
is driver specific, so I would try to add a number display api call
to game input drivers and do 1).

But I'm new to this, so please do tell me if that's the right
avenue to choose.

(First, let's get hid-bigbenff ready for acceptance.)

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
Bastien Nocera June 18, 2018, 9:53 a.m. UTC | #8
On Mon, 2018-06-18 at 10:57 +0200, Hanno Zulla wrote:
> Hi,
> > > fwiw, the brightness difference was discovered while working on
> > > 
> > > https://salsa.debian.org/debian/joystick/merge_requests/1
> > > 
> > > which is an attempt to show the joystick device number with
> > > different gamepads. (Debian's current implementation only
> > > supports PS3 gamepad.)
> > > 
> > > My patch here wants to send the brighter colors upstream back
> > > to the hid-sony driver.
> > 
> > This is neat. Do you have any plans to make this available in an
> > upstream package of some sorts, like systemd, so we can eventually
> > remove the dualshock4_set_leds_from_id()-type hacks in the kernel,
> > amongst other things?
> 
> I'm not exactly sure where is the right place for this type of
> gamepad enumeration display.
> 
> 1) in the kernel
> 
> 2) in systemd
> 
> 3) in a distribution specific configuration add-on package
> 
> Right now, in Debian, it's 3), but yeah, that somehow feels wrong.
> 
> My gut feeling is that 2) is wrong, too, as the enumeration display
> is driver specific, so I would try to add a number display api call
> to game input drivers and do 1).
> 
> But I'm new to this, so please do tell me if that's the right
> avenue to choose.
> 
> (First, let's get hid-bigbenff ready for acceptance.)

I'd say 2, as policy is better in user-space. But that might require
some changes in drivers to reduce the number of different methods to
set the player number.
--
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
Hanno Zulla June 18, 2018, 10:12 a.m. UTC | #9
Hi,

> I'd say 2, as policy is better in user-space. But that might require
> some changes in drivers to reduce the number of different methods to
> set the player number.

But it's already in 1, given the existing gamepad enumeration code in
hid-sony.c, xpad.c (and possibly elsewhere). Should it be removed from
the kernel and moved to systemd or not?

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
Bastien Nocera June 18, 2018, 10:35 a.m. UTC | #10
On Mon, 2018-06-18 at 12:12 +0200, Hanno Zulla wrote:
> Hi,
> 
> > I'd say 2, as policy is better in user-space. But that might
> > require
> > some changes in drivers to reduce the number of different methods
> > to
> > set the player number.
> 
> But it's already in 1, given the existing gamepad enumeration code in
> hid-sony.c, xpad.c (and possibly elsewhere). Should it be removed
> from
> the kernel and moved to systemd or not?

It exists in a way that doesn't have any knowledge of the other joypads
on the system. So a Wii pad and a PS3 pad won't be numbered properly,
but a PS3 and a PS4 pad would be, because they share a driver. That
feels wrong.
--
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
Roderick Colenbrander June 18, 2018, 4:08 p.m. UTC | #11
On Mon, Jun 18, 2018 at 3:12 AM, Hanno Zulla <abos@hanno.de> wrote:
> Hi,
>
>> I'd say 2, as policy is better in user-space. But that might require
>> some changes in drivers to reduce the number of different methods to
>> set the player number.
>
> But it's already in 1, given the existing gamepad enumeration code in
> hid-sony.c, xpad.c (and possibly elsewhere). Should it be removed from
> the kernel and moved to systemd or not?
>
> Kind regards,
>
> Hanno

From my perspective this kind of knowledge should not be in the kernel
(it is fine to have a default color for now). In my field we deal with
non-desktop devices (and no systemd) and the desired behaviour really
depends on the use case / platform. For this reason kernel logic is
not the best way. In the use cases I'm interested in, the application
may even adjust the color of the leds.

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
diff mbox

Patch

diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
index e475c5073c99..65af382f7394 100644
--- a/drivers/hid/hid-sony.c
+++ b/drivers/hid/hid-sony.c
@@ -1830,9 +1830,9 @@  static void dualshock4_set_leds_from_id(struct sony_sc *sc)
 			/* Red	  */	{ 0x40, 0x00, 0x00 },
 			/* Green  */	{ 0x00, 0x40, 0x00 },
 			/* Pink   */	{ 0x20, 0x00, 0x20 },
-			/* Orange */	{ 0x02, 0x01, 0x00 },
-			/* Teal   */	{ 0x00, 0x01, 0x01 },
-			/* White  */	{ 0x01, 0x01, 0x01 }
+			/* Orange */	{ 0x40, 0x20, 0x00 },
+			/* Teal   */	{ 0x00, 0x20, 0x20 },
+			/* White  */	{ 0x20, 0x20, 0x20 }
 	};
 
 	int id = sc->device_id;