linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Display got wrong rotation after hid_sensor_accel_3d is loaded
@ 2019-12-26  9:22 AceLan Kao
  2019-12-26 15:03 ` Bastien Nocera
  0 siblings, 1 reply; 7+ messages in thread
From: AceLan Kao @ 2019-12-26  9:22 UTC (permalink / raw)
  To: Jiri Kosina, Jonathan Cameron, Srinivas Pandruvada, linux-input,
	linux-iio

Hi all,

I'm working on a new platform which comes with an accelerator meter.
It's a STMicroelectronics LSM6DS3US accelerator meter, it doesn't use
st_sensors driver, but hid_sensor_accel_3d.
After hid_sensor_accel_3d is loaded, the display becomes upside down,
so I tried to add some code to make it become normal.(ACCEL_X should
have the same modification)

I don't know how to fix this in a correct way, please give me some hints.
Thanks.

diff --git a/drivers/iio/accel/hid-sensor-accel-3d.c
b/drivers/iio/accel/hid-sensor-accel-3d.c
index 24573eb647a3..8ca6a222b773 100644
--- a/drivers/iio/accel/hid-sensor-accel-3d.c
+++ b/drivers/iio/accel/hid-sensor-accel-3d.c
@@ -270,6 +270,8 @@ static int accel_3d_capture_sample(struct
hid_sensor_hub_device *hsdev,
               accel_state->accel_val[CHANNEL_SCAN_INDEX_X + offset] =
                                               *(u32 *)raw_data;
+               if (usage_id == HID_USAGE_SENSOR_ACCEL_Y_AXIS)
+                       accel_state->accel_val[CHANNEL_SCAN_INDEX_Y] *= -1;

Best regards,
AceLan Kao.

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-01-06  1:53 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-26  9:22 Display got wrong rotation after hid_sensor_accel_3d is loaded AceLan Kao
2019-12-26 15:03 ` Bastien Nocera
2019-12-27  2:30   ` AceLan Kao
2019-12-30 17:18     ` Srinivas Pandruvada
2020-01-02  2:46       ` AceLan Kao
2020-01-02 17:43         ` Srinivas Pandruvada
2020-01-06  1:53           ` AceLan Kao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).