Re: [PATCH 3/5] HID: hid-lenovo-go: record calibration completion state

From: Derek John Clark

Date: Tue Aug 25 2026 - 16:38:07 EST


On Fri, Aug 21, 2026 at 2:48 PM Aditya Dash <mradityadash@xxxxxxxxx> wrote:
>
> The firmware uses result value 0 for failure and 1 for success. The driver
> stores this value directly as a state index. Index 0 means unknown, so the
> driver reports a firmware failure as unknown.
This is false. Firmware reports 0x01 as success, 0x02 as failure. With
this change all calibration actions result in a success.

>From the documentation:

1. Start Joystick calibration.
2. The user needs to rotate the joystick along the edge for two full
circles and then return it to
the center position.
3. Upon successful calibration, the firmware will automatically exit
the calibration mode after 2
seconds and report a successful calibration status. If the joystick
calibration is not completed
within 10 seconds, the firmware will automatically exit the
calibration mode and report a
failed calibration status.

Thanks,
Derek
> Map the result value to the matching failure or success state.
>
> Fixes: 995887a10da1 ("HID: hid-lenovo-go: Add Calibration Settings")
> Assisted-by: Pi:gpt-5.6-sol
> Signed-off-by: Aditya Dash <mradityadash@xxxxxxxxx>
> ---
> A successful calibration completion was tested on hardware. No final
> failure completion was captured.
>
> drivers/hid/hid-lenovo-go.c | 14 ++++++++------
> 1 file changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/hid/hid-lenovo-go.c b/drivers/hid/hid-lenovo-go.c
> index a6e9a130ad41..d2d134873dd1 100644
> --- a/drivers/hid/hid-lenovo-go.c
> +++ b/drivers/hid/hid-lenovo-go.c
> @@ -577,17 +577,19 @@ static int hid_go_light_event(struct command_report *cmd_rep)
>
> static int hid_go_device_status_event(struct command_report *cmd_rep)
> {
> + u8 status = cmd_rep->data[1] ? CAL_STAT_SUCCESS : CAL_STAT_FAILURE;
> +
> switch (cmd_rep->device_type) {
> case LEFT_CONTROLLER:
> switch (cmd_rep->data[0]) {
> case CALDEV_GYROSCOPE:
> - drvdata.gp_left_gyro_cal_status = cmd_rep->data[1];
> + drvdata.gp_left_gyro_cal_status = status;
> return 0;
> case CALDEV_JOYSTICK:
> - drvdata.gp_left_joy_cal_status = cmd_rep->data[1];
> + drvdata.gp_left_joy_cal_status = status;
> return 0;
> case CALDEV_TRIGGER:
> - drvdata.gp_left_trigg_cal_status = cmd_rep->data[1];
> + drvdata.gp_left_trigg_cal_status = status;
> return 0;
> default:
> return -EINVAL;
> @@ -596,13 +598,13 @@ static int hid_go_device_status_event(struct command_report *cmd_rep)
> case RIGHT_CONTROLLER:
> switch (cmd_rep->data[0]) {
> case CALDEV_GYROSCOPE:
> - drvdata.gp_right_gyro_cal_status = cmd_rep->data[1];
> + drvdata.gp_right_gyro_cal_status = status;
> return 0;
> case CALDEV_JOYSTICK:
> - drvdata.gp_right_joy_cal_status = cmd_rep->data[1];
> + drvdata.gp_right_joy_cal_status = status;
> return 0;
> case CALDEV_TRIGGER:
> - drvdata.gp_right_trigg_cal_status = cmd_rep->data[1];
> + drvdata.gp_right_trigg_cal_status = status;
> return 0;
> default:
> return -EINVAL;
> --
> 2.55.0
>