Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9889bcd5 authored by rbandi's avatar rbandi
Browse files

HID: qvr: Removing axis orientation



Driver reports sensor data without modifying the
orientation of axes.

Change-Id: I3e0d3d3efc848d7e72a1edda9f168721dbccb308
Signed-off-by: default avatarrbandi <rohitbandi@codeaurora.org>
parent dbd1a2d2
Loading
Loading
Loading
Loading
+19 −27
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
 * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -105,7 +105,6 @@ struct qvr_external_sensor {

static DECLARE_WAIT_QUEUE_HEAD(wq);
static struct qvr_external_sensor qvr_external_sensor;
static uint8_t DEBUG_ORIENTATION;

static int read_calibration_len(void)
{
@@ -255,10 +254,6 @@ static int qvr_send_package_wrap(u8 *message, int msize, struct hid_device *hid)
	memcpy((void *)&imuData, (void *)message,
		sizeof(struct external_imu_format));
	if (!sensor->ts_base) {
		if (imuData.gNumerator == 1 && imuData.aNumerator == 1)
			DEBUG_ORIENTATION = 1;
		else
			DEBUG_ORIENTATION = 0;
		pr_debug("qvr msize = %d reportID=%d padding=%d\n"
			"qvr version=%d numImu=%d nspip=%d pSize=%d\n"
			"qvr imuID=%d sampleID=%d temp=%d\n",
@@ -302,27 +297,24 @@ static int qvr_send_package_wrap(u8 *message, int msize, struct hid_device *hid)
		data->mts = data->ats;
	data->gts = data->ats;

	if (DEBUG_ORIENTATION == 1) {
		data->ax = -imuData.ax0;
	data->ax = imuData.ax0;
	data->ay = imuData.ay0;
		data->az = -imuData.az0;
		data->gx = -imuData.gx0;
	data->az = imuData.az0;
	data->gx = imuData.gx0;
	data->gy = imuData.gy0;
		data->gz = -imuData.gz0;
		data->mx = -imuData.my0;
		data->my = -imuData.mx0;
		data->mz = -imuData.mz0;
	} else {
		data->ax = -imuData.ay0;
		data->ay = -imuData.ax0;
		data->az = -imuData.az0;
		data->gx = -imuData.gy0;
		data->gy = -imuData.gx0;
		data->gz = -imuData.gz0;
		data->mx = -imuData.my0;
		data->my = -imuData.mx0;
		data->mz = -imuData.mz0;
	}
	data->gz = imuData.gz0;
	data->mx = imuData.my0;
	data->my = imuData.mx0;
	data->mz = imuData.mz0;
	data->ax = imuData.ax0;
	data->ay = imuData.ay0;
	data->az = imuData.az0;
	data->gx = imuData.gx0;
	data->gy = imuData.gy0;
	data->gz = imuData.gz0;
	data->mx = imuData.my0;
	data->my = imuData.mx0;
	data->mz = imuData.mz0;

	trace_qvr_recv_sensor("gyro", data->gts, data->gx, data->gy, data->gz);
	trace_qvr_recv_sensor("accel", data->ats, data->ax, data->ay, data->az);