Lines Matching defs:fd

47 void uhid_set_non_blocking(int fd)
49 int opts = fcntl(fd, F_GETFL);
55 if (fcntl(fd, F_SETFL, opts) < 0)
60 static int uhid_write(int fd, const struct uhid_event *ev)
63 OSI_NO_INTR(ret = write(fd, ev, sizeof(*ev)));
88 OSI_NO_INTR(ret = read(p_dev->fd, &ev, sizeof(ev)));
200 APPL_TRACE_DEBUG("%s: Thread created fd = %d", __func__, p_dev->fd);
203 pfds[0].fd = p_dev->fd;
206 // Set the uhid fd as non-blocking to ensure we never block the BTU thread
207 uhid_set_non_blocking(p_dev->fd);
238 void bta_hh_co_destroy(int fd)
243 uhid_write(fd, &ev);
244 APPL_TRACE_DEBUG("%s: Closing fd=%d", __func__, fd);
245 close(fd);
248 int bta_hh_co_write(int fd, UINT8* rpt, UINT16 len)
263 return uhid_write(fd, &ev);
303 if(p_dev->fd<0) {
304 p_dev->fd = open(dev_path, O_RDWR | O_CLOEXEC);
305 if (p_dev->fd < 0){
310 APPL_TRACE_DEBUG("%s: uhid fd = %d", __FUNCTION__, p_dev->fd);
333 p_dev->fd = open(dev_path, O_RDWR | O_CLOEXEC);
334 if (p_dev->fd < 0){
339 APPL_TRACE_DEBUG("%s: uhid fd = %d", __FUNCTION__, p_dev->fd);
430 if ((p_dev->fd >= 0) && p_dev->ready_for_data) {
431 bta_hh_co_write(p_dev->fd, p_rpt, len);
433 APPL_TRACE_WARNING("%s: Error: fd = %d, ready %d, len = %d", __FUNCTION__, p_dev->fd,
458 if (p_dev->fd < 0) {
459 APPL_TRACE_WARNING("%s: Error: fd = %d, dscp_len = %d", __FUNCTION__, p_dev->fd, dscp_len);
463 APPL_TRACE_WARNING("%s: fd = %d, name = [%s], dscp_len = %d", __FUNCTION__,
464 p_dev->fd, dev_name, dscp_len);
486 result = uhid_write(p_dev->fd, &ev);
488 APPL_TRACE_WARNING("%s: wrote descriptor to fd = %d, dscp_len = %d, result = %d", __FUNCTION__,
489 p_dev->fd, dscp_len, result);
495 close(p_dev->fd);
496 p_dev->fd = -1;