[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <63eb7eda-7db5-4e2c-a976-2f2eb088bf44@wanadoo.fr>
Date: Sat, 4 Jan 2025 13:45:53 +0100
From: Christophe JAILLET <christophe.jaillet@...adoo.fr>
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>,
Bastien Nocera <hadess@...ess.net>
Subject: Re: [PATCH 1/3] HID: steelseries: add SteelSeries Arctis 9 support
Le 01/01/2025 à 16:11, Christian Mayer a écrit :
> Add support for the SteelSeries Arctis 9 headset. This driver
> will export the battery information like it already does for
> the Arcits 1 headset.
>
> Signed-off-by: Christian Mayer <git@...er-bgk.de>
...
> -static int steelseries_headset_arctis_1_fetch_battery(struct hid_device *hdev)
> +static int steelseries_headset_request_battery(struct hid_device *hdev,
> + const char *request, size_t len)
> {
> u8 *write_buf;
> int ret;
>
> /* Request battery information */
> - write_buf = kmemdup(arctis_1_battery_request, sizeof(arctis_1_battery_request), GFP_KERNEL);
> + write_buf = kmemdup(request, len, GFP_KERNEL);
> if (!write_buf)
> return -ENOMEM;
>
> - ret = hid_hw_raw_request(hdev, arctis_1_battery_request[0],
> - write_buf, sizeof(arctis_1_battery_request),
> + hid_dbg(hdev, "Sending battery request report");
> + ret = hid_hw_raw_request(hdev, request[0],
> + write_buf, len,
This could be on the same line.
> HID_OUTPUT_REPORT, HID_REQ_SET_REPORT);
> - if (ret < (int)sizeof(arctis_1_battery_request)) {
> + if (ret < (int)len) {
> hid_err(hdev, "hid_hw_raw_request() failed with %d\n", ret);
> ret = -ENODATA;
> }
...
> +static uint8_t steelseries_headset_map_capacity(uint8_t capacity, uint8_t min_in, uint8_t max_in)
> +{
> + if (capacity > max_in)
>= ?
> + return 100;
> + if (capacity < min_in)
<= ?
> + return 0;
> + return (capacity - min_in) * 100 / (max_in - min_in);
> +}
...
CJ
Powered by blists - more mailing lists