From 93b80fb624a5d732d12a72dc00eba2110ae5d79f Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Thu, 1 Dec 2016 14:06:15 +0100 Subject: [PATCH] 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. --- src/drv-iio-poll-accel.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/drv-iio-poll-accel.c b/src/drv-iio-poll-accel.c index 81572cf..4c043ac 100644 --- a/src/drv-iio-poll-accel.c +++ b/src/drv-iio-poll-accel.c @@ -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)) {