drivers:iio:stm:imu:st_asm330lhhx: correct scale available for temperature sensor
Temperature sensor scale cannot be expressed using the same string format of the other sensors since it has a non-zero integer part. Signed-off-by: Mario Tesi <mario.tesi@st.com> Change-Id: I3f05fb9182dad8fb2d04cd6f1f6377ba910cea3b Reviewed-on: https://gerrit.st.com/c/linuxandroidopen/stm-ldd-iio/+/305207 Tested-by: CITOOLS <MDG-smet-aci-reviews@list.st.com> Reviewed-by: Matteo DAMENO <matteo.dameno@st.com>
This commit is contained in:
parent
f21a642f04
commit
afcad3228e
@ -1488,9 +1488,20 @@ static ssize_t st_asm330lhhx_sysfs_scale_avail(struct device *dev,
|
||||
enum st_asm330lhhx_sensor_id id = sensor->id;
|
||||
int i, len = 0;
|
||||
|
||||
for (i = 0; i < st_asm330lhhx_fs_table[id].size; i++)
|
||||
len += scnprintf(buf + len, PAGE_SIZE - len, "0.%09u ",
|
||||
st_asm330lhhx_fs_table[id].fs_avl[i].gain);
|
||||
for (i = 0; i < st_asm330lhhx_fs_table[id].size; i++) {
|
||||
if (sensor->id != ST_ASM330LHHX_ID_TEMP) {
|
||||
len += scnprintf(buf + len, PAGE_SIZE - len, "0.%09u ",
|
||||
st_asm330lhhx_fs_table[id].fs_avl[i].gain);
|
||||
} else {
|
||||
int hi, low;
|
||||
|
||||
hi = (int)(st_asm330lhhx_fs_table[id].fs_avl[i].gain / 1000);
|
||||
low = (int)(st_asm330lhhx_fs_table[id].fs_avl[i].gain % 1000);
|
||||
len += scnprintf(buf + len, PAGE_SIZE - len, "%d.%d ",
|
||||
hi, low);
|
||||
}
|
||||
}
|
||||
|
||||
buf[len - 1] = '\n';
|
||||
|
||||
return len;
|
||||
|
Loading…
Reference in New Issue
Block a user