DISCONTINUED (October 2022): the maintenance for this repository has been discontinued. Please refer to https://github.com/STMicroelectronics/st-mems-android-linux-sensors-hal for the up-to-date HAL repository. This repository contains ST Android sensor Hardware Abstraction Layer (HAL) for MEMS Linux IIO drivers
Apache License 2.0
34
stars
21
forks
source link
ISM303DAC Magnetometer identified as accelerometer #2
Issue
The ISM303DAC Magnetometer is incorrectly identified as an accelerometer.
Why does it occur?
The st_hal_load_iio_devices_data function loops over the available iio devices. Within this loop a comparison between the iio device name and the driver name is executed.
In case of the ISM303DAC:
The iio device name for the accelerometer is: ism303dac_accel
The st sensor device name of the accelerometer : ism303dac
The iio device name for the magnetometer is: ism303dac_magn
The st sensor device name of the magnetometer: ism303dac_magn
The st sensor device name of the accelerometer comes before the magnetometer, this is normally not a problem however the maximum number of character to compare has been tied to the st sensor device name. So each time it searches for "ism303dac", which in turn returns the accelerometer because that is the first occurence.
_Introduced in commit 4e446d2312dadf171b5092a9c1353387a07845dd_
Issue The ISM303DAC Magnetometer is incorrectly identified as an accelerometer.
Why does it occur? The st_hal_load_iio_devices_data function loops over the available iio devices. Within this loop a comparison between the iio device name and the driver name is executed.
In case of the ISM303DAC: The iio device name for the accelerometer is: ism303dac_accel The st sensor device name of the accelerometer : ism303dac The iio device name for the magnetometer is: ism303dac_magn The st sensor device name of the magnetometer: ism303dac_magn
The st sensor device name of the accelerometer comes before the magnetometer, this is normally not a problem however the maximum number of character to compare has been tied to the st sensor device name. So each time it searches for "ism303dac", which in turn returns the accelerometer because that is the first occurence.
Solution I've traced the problem back to the supported sensor array (ST_sensors_supported). On line 200 a concat between "ST_SENSORS_LIST_44" and "ACCEL_NAME_SUFFIX_IIO" is missing.