On Mon, 9 Sep 2019 13:51:13 +0200 Sean Nyekjaer <sean@xxxxxxxxxx> wrote: > On 09/09/2019 13.28, Sean Nyekjaer wrote: > > Report iio motion events to iio subsystem > > > > Signed-off-by: Sean Nyekjaer <sean@xxxxxxxxxx> > > --- > > Changes since v4: > > * Updated bitmask as pr Jonathans comments > > > > Changes since v5: > > * None > > > > drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h | 5 ++ > > drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 70 ++++++++++++++++++++ > > 2 files changed, 75 insertions(+) > > > [...] > > > > +void st_lsm6dsx_report_motion_event(struct st_lsm6dsx_hw *hw, int data) > > +{ > > + s64 timestamp = iio_get_time_ns(hw->iio_devs[ST_LSM6DSX_ID_ACC]); > > + > > + if (data & hw->settings->event_settings.wakeup_src_z_mask) > > + iio_push_event(hw->iio_devs[ST_LSM6DSX_ID_ACC], > > + IIO_MOD_EVENT_CODE(IIO_ACCEL, > > + 0, > > + IIO_MOD_Z, > > + IIO_EV_TYPE_THRESH, > > + IIO_EV_DIR_EITHER), > > + timestamp); > > + > > + if (data & hw->settings->event_settings.wakeup_src_x_mask) > > + iio_push_event(hw->iio_devs[ST_LSM6DSX_ID_ACC], > > + IIO_MOD_EVENT_CODE(IIO_ACCEL, > > + 0, > > + IIO_MOD_Y, > > + IIO_EV_TYPE_THRESH, > > + IIO_EV_DIR_EITHER), > > + timestamp); > > + > > + if (data & hw->settings->event_settings.wakeup_src_x_mask) > > + iio_push_event(hw->iio_devs[ST_LSM6DSX_ID_ACC], > > + IIO_MOD_EVENT_CODE(IIO_ACCEL, > > + 0, > > + IIO_MOD_X, > > + IIO_EV_TYPE_THRESH, > > + IIO_EV_DIR_EITHER), > > + timestamp); > > +} > > + > > I was looking at this again, and if the user enables events for channel > x, we continue to report events for y, z. > Is it okay or is it better to filter them out? Better to filter them out. It'll be a bit of a surprise for userspace otherwise. Thanks, Jonathan > > /Sean