Lines Matching full:p_dev
80 static int uhid_read_event(btif_hh_device_t *p_dev)
82 assert(p_dev);
88 OSI_NO_INTR(ret = read(p_dev->fd, &ev, sizeof(ev)));
111 p_dev->ready_for_data = TRUE;
115 p_dev->ready_for_data = FALSE;
119 p_dev->ready_for_data = TRUE;
123 p_dev->ready_for_data = FALSE;
137 btif_hh_setreport(p_dev, BTHH_FEATURE_REPORT,
140 btif_hh_setreport(p_dev, BTHH_OUTPUT_REPORT,
143 btif_hh_setreport(p_dev, BTHH_INPUT_REPORT,
199 btif_hh_device_t *p_dev = arg;
200 APPL_TRACE_DEBUG("%s: Thread created fd = %d", __func__, p_dev->fd);
203 pfds[0].fd = p_dev->fd;
207 uhid_set_non_blocking(p_dev->fd);
209 while(p_dev->hh_keep_polling){
218 ret = uhid_read_event(p_dev);
224 p_dev->hh_poll_thread_id = -1;
228 static inline void btif_hh_close_poll_thread(btif_hh_device_t *p_dev)
231 p_dev->hh_keep_polling = 0;
232 if(p_dev->hh_poll_thread_id > 0)
233 pthread_join(p_dev->hh_poll_thread_id,NULL);
281 btif_hh_device_t *p_dev = NULL;
290 p_dev = &btif_hh_cb.devices[i];
291 if (p_dev->dev_status != BTHH_CONN_STATE_UNKNOWN &&
292 p_dev->dev_handle == dev_handle) {
296 p_dev->dev_status);
298 p_dev->bd_addr.address[0], p_dev->bd_addr.address[1], p_dev->bd_addr.address[2],
299 p_dev->bd_addr.address[3], p_dev->bd_addr.address[4]);
301 __FUNCTION__, p_dev->attr_mask, p_dev->sub_class, p_dev->app_id);
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);
313 p_dev->hh_keep_polling = 1;
314 p_dev->hh_poll_thread_id = create_thread(btif_hh_poll_event_thread, p_dev);
317 p_dev = NULL;
320 if (p_dev == NULL) {
324 p_dev = &btif_hh_cb.devices[i];
325 p_dev->dev_handle = dev_handle;
326 p_dev->attr_mask = attr_mask;
327 p_dev->sub_class = sub_class;
328 p_dev->app_id = app_id;
329 p_dev->local_vup = FALSE;
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);
340 p_dev->hh_keep_polling = 1;
341 p_dev->hh_poll_thread_id = create_thread(btif_hh_poll_event_thread, p_dev);
350 if (p_dev == NULL) {
355 p_dev->dev_status = BTHH_CONN_STATE_CONNECTED;
356 APPL_TRACE_DEBUG("%s: Return device status %d", __FUNCTION__, p_dev->dev_status);
375 btif_hh_device_t *p_dev = NULL;
384 p_dev = &btif_hh_cb.devices[i];
385 if (p_dev->dev_status != BTHH_CONN_STATE_UNKNOWN && p_dev->dev_handle == dev_handle) {
388 ,__FUNCTION__,p_dev->dev_status
389 ,p_dev->dev_handle);
390 btif_hh_close_poll_thread(p_dev);
416 btif_hh_device_t *p_dev;
423 p_dev = btif_hh_find_connected_dev_by_handle(dev_handle);
424 if (p_dev == NULL) {
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,
434 p_dev->ready_for_data, len);
451 void bta_hh_co_send_hid_info(btif_hh_device_t *p_dev, char *dev_name, UINT16 vendor_id,
458 if (p_dev->fd < 0) {
459 APPL_TRACE_WARNING("%s: Error: fd = %d, dscp_len = %d", __FUNCTION__, p_dev->fd, dscp_len);
464 p_dev->fd, dev_name, dscp_len);
476 p_dev->bd_addr.address[5], p_dev->bd_addr.address[4],
477 p_dev->bd_addr.address[3], p_dev->bd_addr.address[2],
478 p_dev->bd_addr.address[1], p_dev->bd_addr.address[0]);
486 result = uhid_write(p_dev->fd, &ev);
489 p_dev->fd, dscp_len, result);
495 close(p_dev->fd);
496 p_dev->fd = -1;