}
D("%s: fd=%d", __FUNCTION__, ctl->fd);
handle = native_handle_create(1, 0);
- handle->data[0] = ctl->fd;
+ handle->data[0] = dup(ctl->fd);
return handle;
}
char command[128];
int ret;
- D("%s: handle=%s (%d) enabled=%d", __FUNCTION__,
- _sensorIdToName(handle), handle, enabled);
+ D("%s: handle=%s (%d) fd=%d enabled=%d", __FUNCTION__,
+ _sensorIdToName(handle), handle, ctl->fd, enabled);
if (!ID_CHECK(handle)) {
E("%s: bad handle ID", __FUNCTION__);
}
ret = qemud_channel_send(ctl->fd, command, -1);
- if (ret < 0)
+ if (ret < 0) {
+ E("%s: when sending command errno=%d: %s", __FUNCTION__, errno, strerror(errno));
return -1;
-
+ }
ctl->active_sensors = new_sensors;
return 0;
data->timeOffset = 0;
data->events_fd = dup(handle->data[0]);
+ D("%s: dev=%p fd=%d (was %d)", __FUNCTION__, dev, data->events_fd, handle->data[0]);
native_handle_close(handle);
native_handle_delete(handle);
return 0;
int64_t event_time;
if (len < 0) {
- E("%s: len=%d", __FUNCTION__, len);
+ E("%s: len=%d, errno=%d: %s", __FUNCTION__, len, errno, strerror(errno));
return -errno;
}