main: Workaround sysfs attributes naming quirk for compasses
In most IIO sensor types, _scale and _offset is added to the scan element base name, for example: in_accel has in_accel_scale and in_accel_offset For compasses, this is different. Instead of being named in_rot_from_north_magnetic_tilt_scale aand similar, the _scale and_offset attributes are named in_rot_scale and in_rot_offset. This commit adds a workaround to special-case the attribute naming for this type of sensor.
This commit is contained in:

committed by
Bastien Nocera

parent
b103c0d6cd
commit
42929a882a
@@ -244,6 +244,9 @@ build_channel_array (const char *device_dir,
|
||||
current->offset = 0;
|
||||
current->name = g_strndup (name, strlen(name) - strlen("_en"));
|
||||
current->generic_name = iioutils_break_up_name (current->name);
|
||||
if (g_strcmp0(current->generic_name, "in_rot_from_north_magnetic_tilt") == 0) {
|
||||
current->generic_name = "in_rot";
|
||||
}
|
||||
|
||||
index_name = g_strdup_printf ("%s_index", current->name);
|
||||
filename = g_build_filename (scan_el_dir, index_name, NULL);
|
||||
|
Reference in New Issue
Block a user