It's an abnormal situation to have a sensor operating while its
associated character device couldn't be opened (the underlying
hardware may not be powered on). Reconciliate the HAL level state
with the underlying driver state in this case by reverting to
disabled state.
Issue: STPK-1429
Change-Id: I16ce2889b7be644a33a79fe04ddba9cf574bfde9
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
sprintf(device_name, DEV_FILE_PATH, dev_num);
dev_fd = open(device_name, O_RDONLY | O_NONBLOCK);
+ device_fd[dev_num] = dev_fd;
+
if (dev_fd == -1) {
ALOGE("Could not open fd on %s (%s)\n",
device_name, strerror(errno));
+ adjust_counters(s, 0);
return -1;
}
ALOGV("Opened %s: fd=%d\n", device_name, dev_fd);
-
- device_fd[dev_num] = dev_fd;
break;
default: