accel: Fix debug output in poll driver

Can you guess whether this was tested:
Accel read from IIO on '(null)': 0, 0, 0 (scale 1.0)

The NAME udev property was not available, so use the "name" sysfs
attribute instead, and don't use the readings struct before we've set
it.
This commit is contained in:
Bastien Nocera
2016-12-01 14:06:15 +01:00
parent 67a4b20d17
commit 93b80fb624

View File

@@ -61,7 +61,7 @@ poll_orientation (gpointer user_data)
readings.scale = data->scale;
g_debug ("Accel read from IIO on '%s': %d, %d, %d (scale %lf)", data->name,
readings.accel_x, readings.accel_y, readings.accel_z, readings.scale);
accel_x, accel_y, accel_z, readings.scale);
//FIXME report errors
readings.accel_x = accel_x;
@@ -113,7 +113,7 @@ iio_poll_accel_open (GUdevDevice *device,
drv_data = g_new0 (DrvData, 1);
drv_data->dev = g_object_ref (device);
drv_data->name = g_udev_device_get_property (device, "NAME");
drv_data->name = g_udev_device_get_sysfs_attr (device, "name");
mount_matrix = g_udev_device_get_property (device, "ACCEL_MOUNT_MATRIX");
if (!parse_mount_matrix (mount_matrix, &drv_data->mount_matrix)) {