Display got wrong rotation after hid_sensor_accel_3d is loaded

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux