Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1350412rwb; Thu, 6 Oct 2022 11:43:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4ksTLoIlBNTYfp4ULO5Ts1SZEtzl8HA4H3OX+4jVjBebj1Nsmrq/n4or24yGEIeM62j3dd X-Received: by 2002:a17:90b:4b41:b0:20a:fe8f:5a3 with SMTP id mi1-20020a17090b4b4100b0020afe8f05a3mr6923260pjb.120.1665081832362; Thu, 06 Oct 2022 11:43:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665081832; cv=none; d=google.com; s=arc-20160816; b=NGRP9r5tkdOOo5S6WJGitMsrdThR+DbA70oHp9zxmSwFah+lI3csdJaPwcvXQKsYSx 8s5R6O1kHnUMDuqUjHuZkKTqBumoqB7vzK1HKYpqpROdhUfDYmJYhoEUfZ5PD4RDnUxq 5o6fg9vaszzKBjceUggfozXqHJjOJzgxuCZ3Xu9paecvD5ke69WaG4IUV+a0xuFxQfBL 2lvNx6FgnhIyVpklfYU336EZwB6PrlB3UVIUqWOb39A3gsZhtXk5DdLk9iUyPQ6gQHP3 Lm2T/dBFGQKmZSJTQPa4SAF3qPJrrG5WAcF+bV0mWCKxWFYw7wsAcrU8nUXc0GbGKLs+ QEbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=KLSUG+i+YfUxCARVJTD1GslXbH0UKN+cZHn6UsaYzBg=; b=oRTDALMzg8mFoLVKQSC5Pu5doTao0Za2H2ux1fDIIzSFhd0Msc9feNSnb1rKi2lKex FG9AnWCYTwN2BcYRQXG24oMEG58y6xJoA1YjM/ns4zRjwDaowkfICxammf1V8McP1spB 3ZZH+WUf0EGPKvbPH5BV776iWInUMa/ZhgAlQLvMjOxcs/68al8Yh18ENoneOvx0MDNZ 7RA1D1LdidGwgs7Wk34Sd0WpHt9tE1LAQrcEnD6N1A40cgVBS7UnkwA0dkqwc8Y/8QND QG92dk6odIJEWYEdVtToPxGYzDB8FzidajS57CKbaM/JZF0dwC+kSLmIWsdI0FZdQ+36 AGGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=fZg6klCg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n2-20020a170902f60200b00170f6f728d4si19776997plg.543.2022.10.06.11.43.37; Thu, 06 Oct 2022 11:43:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=fZg6klCg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231783AbiJFSbk (ORCPT + 99 others); Thu, 6 Oct 2022 14:31:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231819AbiJFSbd (ORCPT ); Thu, 6 Oct 2022 14:31:33 -0400 Received: from mail-oi1-x22d.google.com (mail-oi1-x22d.google.com [IPv6:2607:f8b0:4864:20::22d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72396AA34D; Thu, 6 Oct 2022 11:31:32 -0700 (PDT) Received: by mail-oi1-x22d.google.com with SMTP id m81so3008838oia.1; Thu, 06 Oct 2022 11:31:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=KLSUG+i+YfUxCARVJTD1GslXbH0UKN+cZHn6UsaYzBg=; b=fZg6klCgbal5S5LyLap7E1l92Ytg2/ipGvE3NNsX+Yydh61Jga0Ys2YMOo05+LwPAf 8w24PXt5DIXI2SBkAa0tbMa82JRu3QhTrf/rECh2PP+q94awywDtvL1eUCfbHAQLM5cZ fnODJfbNZN+avjTlgrJhAhdbz2kLM/lPkA5gpZfHi1+uih0awjf+TDmeE9R4bTgnpgyv az5yKz/wp6qUVQq6CHa/dB6OsCbSvTz+wa0yfN31Teo/dt4SrTnZ0R2LtsaHJ1v1G3Fq x1z611IkW4QsoEg9uVd9B2nnR0YQ436LVBRgd558w9yeiYmNaqDeMuHQBm7/m5xPMuyv jMYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KLSUG+i+YfUxCARVJTD1GslXbH0UKN+cZHn6UsaYzBg=; b=NFNgg36lKUofLWVAOJrgOt0VY+a17kVfXo1OfHVG+5X5rhwC8mSiRUlt5kCzKRPk9b KEm3fXsh8ya88x6BeM5hNMxat5okYyIuVTSLO06ZzUwWHsM+D3rnUYKqJng5y/Tx1O/A TxxvVEtf5/17g2WDzOOg9iSGl2+u5rNANTh7qHFU+Jym4+VhjUSElyHie7ylIhLLKXum wY6JLBYUHOuSgd9hmkX95g8t4GB6oNkF9TIruh90n9tk/xS1ctG+0wHeipbhj94Snxc6 fJPcuPk/9M1ytRASakvy4OgFPk74N8dFb/pIW4HxoSiYmfPgBLd6/mzHt0HavVc1JWoo l4ag== X-Gm-Message-State: ACrzQf1D6xTUNwFl0qBFZpohdoeuX+zHnpAmANb7YB27ZpFGuAd4Y94Y J2nGQMxfLNUd8btXMR+aRLY= X-Received: by 2002:a05:6808:1448:b0:350:c8a5:3e7e with SMTP id x8-20020a056808144800b00350c8a53e7emr5767070oiv.234.1665081091752; Thu, 06 Oct 2022 11:31:31 -0700 (PDT) Received: from localhost.localdomain ([177.222.37.214]) by smtp.googlemail.com with ESMTPSA id 6-20020aca0506000000b003509cc4ad4esm6110429oif.39.2022.10.06.11.31.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Oct 2022 11:31:31 -0700 (PDT) From: Henry Castro To: thunderbird2k@gmail.com Cc: Henry Castro , Jiri Kosina , Benjamin Tissoires , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] drivers: hid: adjust gyro calibration data Date: Thu, 6 Oct 2022 14:31:05 -0400 Message-Id: <20221006183105.5416-1-hcvcastro@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org For some reason my DualShock 4 get the calibration data values equal: gyro_pitch_plus == gyro_pitch_minus Probably due to some defect in the DS4 hardware, and cause a CPU division exception to crash the linux kernel. At least with the patch, I can continue play Retroarch without using the Gyroscope :) Signed-off-by: Henry Castro --- > Are it only these which are equal or are there are other funky ones? > Are all constants in general the same? I'm just trying to figure out > if some of this device would even need calibration. More data logs: gyro_pitch_plus=8704 giro_pitch_minus=8704 gyro_yaw_plus=8704 giro_yaw_minus=-8704 gyro_roll_plus=-8704 giro_roll_minus=-8704 Yes, They are constants values :( I drivers/hid/hid-sony.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c index 87b538656f64..656caa07b25f 100644 --- a/drivers/hid/hid-sony.c +++ b/drivers/hid/hid-sony.c @@ -1823,6 +1823,15 @@ static int dualshock4_get_calibration_data(struct sony_sc *sc) acc_z_plus = get_unaligned_le16(&buf[31]); acc_z_minus = get_unaligned_le16(&buf[33]); + if (gyro_pitch_plus == gyro_pitch_minus) + gyro_pitch_minus *= -1; + + if (gyro_yaw_plus == gyro_yaw_minus) + gyro_yaw_minus *= -1; + + if (gyro_roll_plus == gyro_roll_minus) + gyro_roll_minus *= -1; + /* Set gyroscope calibration and normalization parameters. * Data values will be normalized to 1/DS4_GYRO_RES_PER_DEG_S degree/s. */ -- 2.20.1