lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <da44f28f0f5b46fee9c8f1bdb8a71835157b8d60.camel@hadess.net>
Date: Sat, 04 Jan 2025 13:01:30 +0100
From: Bastien Nocera <hadess@...ess.net>
To: Christian Mayer <git@...er-bgk.de>, linux-input@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, Jiri Kosina <jikos@...nel.org>, Benjamin
 Tissoires <benjamin.tissoires@...hat.com>
Subject: Re: [PATCH 3/3] HID: steelseries: export model and manufacturer

On Wed, 2025-01-01 at 15:11 +0000, Christian Mayer wrote:
> Export model and manufacturer with the power supply properties.
> This helps identifing the device in the battery overview.
> In the case of the Arctis 9 headset, the manufacturer is prefixed
> twice in
> the device name.
> 
> Signed-off-by: Christian Mayer <git@...er-bgk.de>
> ---
>  drivers/hid/hid-steelseries.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/hid/hid-steelseries.c b/drivers/hid/hid-
> steelseries.c
> index d11296bc0e1e..32e559376be4 100644
> --- a/drivers/hid/hid-steelseries.c
> +++ b/drivers/hid/hid-steelseries.c
> @@ -447,6 +447,14 @@ static int
> steelseries_headset_battery_get_property(struct power_supply *psy,
>  	int ret = 0;
>  
>  	switch (psp) {
> +	case POWER_SUPPLY_PROP_MODEL_NAME:
> +		val->strval = sd->hdev->name;
> +		while (!strncmp(val->strval, "SteelSeries ", 12))
> +			val->strval += 12;

Please use constants instead of magic numbers:

#define STEELSERIES_PREFIX "SteelSeries "
#define STEELSERIES_PREFIX_LEN strlen(STEELSERIES_PREFIX)


> +		break;
> +	case POWER_SUPPLY_PROP_MANUFACTURER:
> +		val->strval = "SteelSeries";
> +		break;
>  	case POWER_SUPPLY_PROP_PRESENT:
>  		val->intval = 1;
>  		break;
> @@ -490,6 +498,8 @@ steelseries_headset_set_wireless_status(struct
> hid_device *hdev,
>  }
>  
>  static enum power_supply_property
> steelseries_headset_battery_props[] = {
> +	POWER_SUPPLY_PROP_MODEL_NAME,
> +	POWER_SUPPLY_PROP_MANUFACTURER,
>  	POWER_SUPPLY_PROP_PRESENT,
>  	POWER_SUPPLY_PROP_STATUS,
>  	POWER_SUPPLY_PROP_SCOPE,

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ