accel: Fix getting scale for sensors with IIO_SHARED_BY_ALL mask
Properties with the IIO_SHARED_BY_ALL mask don't have the sensor type prefix before the filename, causing some devices to not have a scale set from sysfs. Fix this by searching through sysfs for both properties name: scale and in_accel_scale. Tested on: Cyan (Acer Chromebook R11, with 2 accelerometers) Affects: All chromebooks with cros-ec sensors https://github.com/torvalds/linux/tree/master/drivers/iio/common/cros_ec_sensors
This commit is contained in:
24
src/accel-attributes.h
Normal file
24
src/accel-attributes.h
Normal file
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright (c) 2019 Luís Ferreira <luis@aurorafoss.org>
|
||||
* Copyright (c) 2019 Daniel Stuart <daniel.stuart@pucpr.edu.br>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 3 as published by
|
||||
* the Free Software Foundation.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <glib.h>
|
||||
#include <gudev/gudev.h>
|
||||
|
||||
typedef enum {
|
||||
ACCEL_LOCATION_DISPLAY,
|
||||
ACCEL_LOCATION_BASE,
|
||||
} AccelLocation;
|
||||
|
||||
AccelLocation setup_accel_location (GUdevDevice *device);
|
||||
|
||||
gboolean parse_accel_location (const char *location,
|
||||
AccelLocation *value);
|
||||
|
||||
gdouble get_accel_scale (GUdevDevice *device);
|
Reference in New Issue
Block a user