I have a MMA8563 accelerometer in an imx6ul board and am using the mma8452.c Linux IIO driver. I can access x, y, z raw values fine through /sys/bus/iio/devices/iio:device0.
However, I am unsure of how to use IIO events. I have configured motion detection in the accelerometer using the following commands:
# echo 15 > events/in_accel_mag_rising_value
# echo 1 > events/in_accel_mag_rising_period
# echo 1 > events/in_accel_x_mag_rising_en
I have placed debug print statements in the driver code and can see that the interrupt is being triggered when I move the device. I see that the driver then calls the iio_push_event() function. I can also see that the interrupt number in /proc/interrupts increments each time I move the device.
From user space, how can I get access to this interrupt or event? I would like to be able to tell when the device is in motion.
The driver creates a buffer and a char dev in /dev/iio:device0 but this seems to only populate when I enable either x, y, or z in the scan_elements directory.