* 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
* Re: Display got wrong rotation after hid_sensor_accel_3d is loaded 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 0 siblings, 1 reply; 7+ messages in thread From: Bastien Nocera @ 2019-12-26 15:03 UTC (permalink / raw) To: AceLan Kao, Jiri Kosina, Jonathan Cameron, Srinivas Pandruvada, linux-input, linux-iio On Thu, 2019-12-26 at 17:22 +0800, AceLan Kao wrote: > 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. This needs to be done as a quirk, either by applying a quirk for the HID descriptors (which should have a definition of the scale, which would be negative for this device), or in user-space in systemd's hwdb database, which your user-space consumers need to take care of: https://github.com/systemd/systemd/blob/master/hwdb.d/60-sensor.hwdb Cheers ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Display got wrong rotation after hid_sensor_accel_3d is loaded 2019-12-26 15:03 ` Bastien Nocera @ 2019-12-27 2:30 ` AceLan Kao 2019-12-30 17:18 ` Srinivas Pandruvada 0 siblings, 1 reply; 7+ messages in thread From: AceLan Kao @ 2019-12-27 2:30 UTC (permalink / raw) To: Bastien Nocera Cc: Jiri Kosina, Jonathan Cameron, Srinivas Pandruvada, linux-input, linux-iio Hi Bastien, Thanks for your suggestion. I just tried to add the following line into /lib/udev/hwdb.d/60-sensor.hwdb and got the correct screen rotation. But the cursor is still un-rotated, the cursor is drawn upside down, and its coordinates are inverted. ######################################### # STMicro ######################################### sensor:modalias:platform:platform:HID-SENSOR-200073 ACCEL_MOUNT_MATRIX=-1, 0, 0; 0, -1, 0; 0, 0, 1 It looks like we should introduce a quirk into hid_sensor_accel_3d driver. There are 3 different scale variables in hid_sensor_accel_3d, but I don't see any of them would work the way I want. Do you mean to introduce new scale variables? drivers/iio/accel/hid-sensor-accel-3d.c:34: int scale_pre_decml; drivers/iio/accel/hid-sensor-accel-3d.c:35: int scale_post_decml; drivers/iio/accel/hid-sensor-accel-3d.c:36: int scale_precision; Bastien Nocera <hadess@hadess.net> 於 2019年12月26日 週四 下午11:03寫道: > > On Thu, 2019-12-26 at 17:22 +0800, AceLan Kao wrote: > > 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. > > This needs to be done as a quirk, either by applying a quirk for the > HID descriptors (which should have a definition of the scale, which > would be negative for this device), or in user-space in systemd's hwdb > database, which your user-space consumers need to take care of: > https://github.com/systemd/systemd/blob/master/hwdb.d/60-sensor.hwdb > > Cheers > ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Display got wrong rotation after hid_sensor_accel_3d is loaded 2019-12-27 2:30 ` AceLan Kao @ 2019-12-30 17:18 ` Srinivas Pandruvada 2020-01-02 2:46 ` AceLan Kao 0 siblings, 1 reply; 7+ messages in thread From: Srinivas Pandruvada @ 2019-12-30 17:18 UTC (permalink / raw) To: AceLan Kao, Bastien Nocera Cc: Jiri Kosina, Jonathan Cameron, linux-input, linux-iio Hi Kao, Is this device sold with Windows? Can you send full report descriptor (You can get from /sys/kernel/debug/hid)? Thanks, Srinivas On Fri, 2019-12-27 at 10:30 +0800, AceLan Kao wrote: > Hi Bastien, > > Thanks for your suggestion. > I just tried to add the following line into > /lib/udev/hwdb.d/60-sensor.hwdb and got the correct screen rotation. > But the cursor is still un-rotated, the cursor is drawn upside down, > and its coordinates are inverted. > > ######################################### > # STMicro > ######################################### > sensor:modalias:platform:platform:HID-SENSOR-200073 > ACCEL_MOUNT_MATRIX=-1, 0, 0; 0, -1, 0; 0, 0, 1 > > It looks like we should introduce a quirk into hid_sensor_accel_3d > driver. > There are 3 different scale variables in hid_sensor_accel_3d, but I > don't see any of them would work the way I want. > Do you mean to introduce new scale variables? > > drivers/iio/accel/hid-sensor-accel-3d.c:34: int > scale_pre_decml; > drivers/iio/accel/hid-sensor-accel-3d.c:35: int > scale_post_decml; > drivers/iio/accel/hid-sensor-accel-3d.c:36: int > scale_precision; > > Bastien Nocera <hadess@hadess.net> 於 2019年12月26日 週四 下午11:03寫道: > > > > On Thu, 2019-12-26 at 17:22 +0800, AceLan Kao wrote: > > > 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. > > > > This needs to be done as a quirk, either by applying a quirk for > > the > > HID descriptors (which should have a definition of the scale, which > > would be negative for this device), or in user-space in systemd's > > hwdb > > database, which your user-space consumers need to take care of: > > https://github.com/systemd/systemd/blob/master/hwdb.d/60-sensor.hwdb > > > > Cheers > > ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Display got wrong rotation after hid_sensor_accel_3d is loaded 2019-12-30 17:18 ` Srinivas Pandruvada @ 2020-01-02 2:46 ` AceLan Kao 2020-01-02 17:43 ` Srinivas Pandruvada 0 siblings, 1 reply; 7+ messages in thread From: AceLan Kao @ 2020-01-02 2:46 UTC (permalink / raw) To: Srinivas Pandruvada Cc: Bastien Nocera, Jiri Kosina, Jonathan Cameron, linux-input, linux-iio [-- Attachment #1: Type: text/plain, Size: 2860 bytes --] Yes, this machine will be sold with Windows, but currently we didn't hear any issues from Windows side. Here is the rdesc I found under /sys/kernel/debug/hid BTW, we're trying to push BIOS to provide some useful info about the orientation of the sensor, so that we don't have to list those machines in the driver. Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> 於 2019年12月31日 週二 上午1:18寫道: > > Hi Kao, > > Is this device sold with Windows? > Can you send full report descriptor (You can get from > /sys/kernel/debug/hid)? > > Thanks, > Srinivas > > On Fri, 2019-12-27 at 10:30 +0800, AceLan Kao wrote: > > Hi Bastien, > > > > Thanks for your suggestion. > > I just tried to add the following line into > > /lib/udev/hwdb.d/60-sensor.hwdb and got the correct screen rotation. > > But the cursor is still un-rotated, the cursor is drawn upside down, > > and its coordinates are inverted. > > > > ######################################### > > # STMicro > > ######################################### > > sensor:modalias:platform:platform:HID-SENSOR-200073 > > ACCEL_MOUNT_MATRIX=-1, 0, 0; 0, -1, 0; 0, 0, 1 > > > > It looks like we should introduce a quirk into hid_sensor_accel_3d > > driver. > > There are 3 different scale variables in hid_sensor_accel_3d, but I > > don't see any of them would work the way I want. > > Do you mean to introduce new scale variables? > > > > drivers/iio/accel/hid-sensor-accel-3d.c:34: int > > scale_pre_decml; > > drivers/iio/accel/hid-sensor-accel-3d.c:35: int > > scale_post_decml; > > drivers/iio/accel/hid-sensor-accel-3d.c:36: int > > scale_precision; > > > > Bastien Nocera <hadess@hadess.net> 於 2019年12月26日 週四 下午11:03寫道: > > > > > > On Thu, 2019-12-26 at 17:22 +0800, AceLan Kao wrote: > > > > 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. > > > > > > This needs to be done as a quirk, either by applying a quirk for > > > the > > > HID descriptors (which should have a definition of the scale, which > > > would be negative for this device), or in user-space in systemd's > > > hwdb > > > database, which your user-space consumers need to take care of: > > > > https://github.com/systemd/systemd/blob/master/hwdb.d/60-sensor.hwdb > > > > > > Cheers > > > > [-- Attachment #2: hid.tgz --] [-- Type: application/x-compressed-tar, Size: 9792 bytes --] ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Display got wrong rotation after hid_sensor_accel_3d is loaded 2020-01-02 2:46 ` AceLan Kao @ 2020-01-02 17:43 ` Srinivas Pandruvada 2020-01-06 1:53 ` AceLan Kao 0 siblings, 1 reply; 7+ messages in thread From: Srinivas Pandruvada @ 2020-01-02 17:43 UTC (permalink / raw) To: AceLan Kao Cc: Bastien Nocera, Jiri Kosina, Jonathan Cameron, linux-input, linux-iio On Thu, 2020-01-02 at 10:46 +0800, AceLan Kao wrote: > Yes, this machine will be sold with Windows, but currently we didn't > hear any issues from Windows side. There are custom sensors, which probably getting used by Windows instead of accel_3d. I didn't see any special fields in accel_3d. Thanks, Srinivas > Here is the rdesc I found under /sys/kernel/debug/hid > > BTW, we're trying to push BIOS to provide some useful info about the > orientation of the sensor, so that we don't have to list those > machines in the driver. > > Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> 於 > 2019年12月31日 週二 上午1:18寫道: > > Hi Kao, > > > > Is this device sold with Windows? > > Can you send full report descriptor (You can get from > > /sys/kernel/debug/hid)? > > > > Thanks, > > Srinivas > > > > On Fri, 2019-12-27 at 10:30 +0800, AceLan Kao wrote: > > > Hi Bastien, > > > > > > Thanks for your suggestion. > > > I just tried to add the following line into > > > /lib/udev/hwdb.d/60-sensor.hwdb and got the correct screen > > > rotation. > > > But the cursor is still un-rotated, the cursor is drawn upside > > > down, > > > and its coordinates are inverted. > > > > > > ######################################### > > > # STMicro > > > ######################################### > > > sensor:modalias:platform:platform:HID-SENSOR-200073 > > > ACCEL_MOUNT_MATRIX=-1, 0, 0; 0, -1, 0; 0, 0, 1 > > > > > > It looks like we should introduce a quirk into > > > hid_sensor_accel_3d > > > driver. > > > There are 3 different scale variables in hid_sensor_accel_3d, but > > > I > > > don't see any of them would work the way I want. > > > Do you mean to introduce new scale variables? > > > > > > drivers/iio/accel/hid-sensor-accel-3d.c:34: int > > > scale_pre_decml; > > > drivers/iio/accel/hid-sensor-accel-3d.c:35: int > > > scale_post_decml; > > > drivers/iio/accel/hid-sensor-accel-3d.c:36: int > > > scale_precision; > > > > > > Bastien Nocera <hadess@hadess.net> 於 2019年12月26日 週四 下午11:03寫道: > > > > On Thu, 2019-12-26 at 17:22 +0800, AceLan Kao wrote: > > > > > 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. > > > > > > > > This needs to be done as a quirk, either by applying a quirk > > > > for > > > > the > > > > HID descriptors (which should have a definition of the scale, > > > > which > > > > would be negative for this device), or in user-space in > > > > systemd's > > > > hwdb > > > > database, which your user-space consumers need to take care of: > > > > > > https://github.com/systemd/systemd/blob/master/hwdb.d/60-sensor.hwdb > > > > Cheers > > > > ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Display got wrong rotation after hid_sensor_accel_3d is loaded 2020-01-02 17:43 ` Srinivas Pandruvada @ 2020-01-06 1:53 ` AceLan Kao 0 siblings, 0 replies; 7+ messages in thread From: AceLan Kao @ 2020-01-06 1:53 UTC (permalink / raw) To: Srinivas Pandruvada Cc: Bastien Nocera, Jiri Kosina, Jonathan Cameron, linux-input, linux-iio Hi all, Quick update, ODM BIOS admits it's a BIOS issue, and they will fix this from BIOS side. Thanks all. Best regards, AceLan Kao. Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> 於 2020年1月3日 週五 上午1:43寫道: > > On Thu, 2020-01-02 at 10:46 +0800, AceLan Kao wrote: > > Yes, this machine will be sold with Windows, but currently we didn't > > hear any issues from Windows side. > There are custom sensors, which probably getting used by Windows > instead of accel_3d. I didn't see any special fields in accel_3d. > > Thanks, > Srinivas > > > Here is the rdesc I found under /sys/kernel/debug/hid > > > > BTW, we're trying to push BIOS to provide some useful info about the > > orientation of the sensor, so that we don't have to list those > > machines in the driver. > > > > Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> 於 > > 2019年12月31日 週二 上午1:18寫道: > > > Hi Kao, > > > > > > Is this device sold with Windows? > > > Can you send full report descriptor (You can get from > > > /sys/kernel/debug/hid)? > > > > > > Thanks, > > > Srinivas > > > > > > On Fri, 2019-12-27 at 10:30 +0800, AceLan Kao wrote: > > > > Hi Bastien, > > > > > > > > Thanks for your suggestion. > > > > I just tried to add the following line into > > > > /lib/udev/hwdb.d/60-sensor.hwdb and got the correct screen > > > > rotation. > > > > But the cursor is still un-rotated, the cursor is drawn upside > > > > down, > > > > and its coordinates are inverted. > > > > > > > > ######################################### > > > > # STMicro > > > > ######################################### > > > > sensor:modalias:platform:platform:HID-SENSOR-200073 > > > > ACCEL_MOUNT_MATRIX=-1, 0, 0; 0, -1, 0; 0, 0, 1 > > > > > > > > It looks like we should introduce a quirk into > > > > hid_sensor_accel_3d > > > > driver. > > > > There are 3 different scale variables in hid_sensor_accel_3d, but > > > > I > > > > don't see any of them would work the way I want. > > > > Do you mean to introduce new scale variables? > > > > > > > > drivers/iio/accel/hid-sensor-accel-3d.c:34: int > > > > scale_pre_decml; > > > > drivers/iio/accel/hid-sensor-accel-3d.c:35: int > > > > scale_post_decml; > > > > drivers/iio/accel/hid-sensor-accel-3d.c:36: int > > > > scale_precision; > > > > > > > > Bastien Nocera <hadess@hadess.net> 於 2019年12月26日 週四 下午11:03寫道: > > > > > On Thu, 2019-12-26 at 17:22 +0800, AceLan Kao wrote: > > > > > > 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. > > > > > > > > > > This needs to be done as a quirk, either by applying a quirk > > > > > for > > > > > the > > > > > HID descriptors (which should have a definition of the scale, > > > > > which > > > > > would be negative for this device), or in user-space in > > > > > systemd's > > > > > hwdb > > > > > database, which your user-space consumers need to take care of: > > > > > > > > https://github.com/systemd/systemd/blob/master/hwdb.d/60-sensor.hwdb > > > > > Cheers > > > > > > ^ permalink raw reply [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).