OSDN Git Service

libsensors: correct read() usage
authorAndy Ross <andy.ross@windriver.com>
Thu, 26 Sep 2013 19:31:26 +0000 (12:31 -0700)
committerMattias Pettersson <mattias.pettersson@intel.com>
Wed, 4 Dec 2013 14:13:12 +0000 (15:13 +0100)
commit17fd865ff6c4965cf37f0d7e76e0acc56f8061e9
tree3bc5e91a88e6409cee525d6125c116850f21ebd1
parent9814fad2dba56be8946f6f42736333742c2b9104
libsensors: correct read() usage

The readEvents() implementation would attempt to read buffer_len (two
by default) IIO events from the device, but would only ever process
one, leading to dropped events in the case of overflow.  It was also
not checking the return value from read and would push garbage data on
I/O errors (probably would not happen in regular usage, but IIO
devices are known to return -EBUSY or -EINVAL if there are other users
or if the sysfs parameters are set incorrectly).

Change-Id: I7f66f530c9fce0540f1596456b3ca191406bbd27
For: AXIA-3287
Signed-off-by: Andy Ross <andy.ross@windriver.com>
Reviewed-on: https://otc-android.intel.com/gerrit/22150
Reviewed-by: Daniel Leung <daniel.leung@intel.com>
Reviewed-by: Russell Webb <russell.webb@intel.com>
Tested-by: jenkins autobuilder
common/libsensors/SensorIIODev.cpp