From: arun Date: Thu, 29 May 2014 21:29:51 +0000 (-0700) Subject: Do not update calibsense if prop read fails X-Git-Tag: android-x86-7.1-r1~71^2~1 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=96575ae85ba64e17a439ebc051bc4a006c1ddbac;p=android-x86%2Fhardware-intel-libsensors.git Do not update calibsense if prop read fails It was observed that in case the android prop read fails, we write a 0 value(typically happens in case the property variable not present)into the sysfs variable. This caused the resulting ALS output to be 0, added a check to filter that condition. Now in case the read from the android property fails, we just keep the default value for the calibsense variable. Issue:GMIN-671 Change-Id: Ifd65f0268dfa345ecf8cd6d40255c1a1fd52a03c Signed-off-by: suyyala --- diff --git a/enumeration.c b/enumeration.c index 5c2b9a9..227b691 100644 --- a/enumeration.c +++ b/enumeration.c @@ -88,8 +88,10 @@ static void add_sensor (int dev_num, int catalog_index, int use_polling) */ if (sensor_catalog[catalog_index].type == SENSOR_TYPE_LIGHT) { retval = sensor_get_illumincalib(s); - sprintf(sysfs_path, ILLUMINATION_CALIBPATH, dev_num); - sysfs_write_int(sysfs_path, retval); + if (retval > 0) { + sprintf(sysfs_path, ILLUMINATION_CALIBPATH, dev_num); + sysfs_write_int(sysfs_path, retval); + } } /* Read name attribute, if available */