Lines Matching defs:p_dev
58 static int uhid_event(btif_hh_device_t *p_dev)
63 if(!p_dev)
68 ret = read(p_dev->fd, &ev, sizeof(ev));
101 btif_hh_setreport(p_dev,BTHH_FEATURE_REPORT,ev.u.output.size,ev.u.output.data);
103 btif_hh_setreport(p_dev,BTHH_OUTPUT_REPORT,ev.u.output.size,ev.u.output.data);
105 btif_hh_setreport(p_dev,BTHH_INPUT_REPORT,ev.u.output.size,ev.u.output.data);
161 btif_hh_device_t *p_dev = arg;
162 APPL_TRACE_DEBUG2("%s: Thread created fd = %d", __FUNCTION__, p_dev->fd);
165 pfds[0].fd = p_dev->fd;
168 while(p_dev->hh_keep_polling){
176 ret = uhid_event(p_dev);
183 p_dev->hh_poll_thread_id = -1;
187 static inline void btif_hh_close_poll_thread(btif_hh_device_t *p_dev)
190 p_dev->hh_keep_polling = 0;
191 if(p_dev->hh_poll_thread_id > 0)
192 pthread_join(p_dev->hh_poll_thread_id,NULL);
236 btif_hh_device_t *p_dev = NULL;
244 p_dev = &btif_hh_cb.devices[i];
245 if (p_dev->dev_status != BTHH_CONN_STATE_UNKNOWN && p_dev->dev_handle == dev_handle) {
249 p_dev->dev_status);
251 p_dev->bd_addr.address[0], p_dev->bd_addr.address[1], p_dev->bd_addr.address[2],
252 p_dev->bd_addr.address[3], p_dev->bd_addr.address[4]);
254 __FUNCTION__, p_dev->attr_mask, p_dev->sub_class, p_dev->app_id);
256 if(p_dev->fd<0) {
257 p_dev->fd = open(dev_path, O_RDWR | O_CLOEXEC);
258 if (p_dev->fd < 0){
262 APPL_TRACE_DEBUG2("%s: uhid fd = %d", __FUNCTION__, p_dev->fd);
264 p_dev->hh_keep_polling = 1;
265 p_dev->hh_poll_thread_id = create_thread(btif_hh_poll_event_thread, p_dev);
268 p_dev = NULL;
271 if (p_dev == NULL) {
275 p_dev = &btif_hh_cb.devices[i];
276 p_dev->dev_handle = dev_handle;
277 p_dev->attr_mask = attr_mask;
278 p_dev->sub_class = sub_class;
279 p_dev->app_id = app_id;
283 p_dev->fd = open(dev_path, O_RDWR | O_CLOEXEC);
284 if (p_dev->fd < 0){
288 APPL_TRACE_DEBUG2("%s: uhid fd = %d", __FUNCTION__, p_dev->fd);
289 p_dev->hh_keep_polling = 1;
290 p_dev->hh_poll_thread_id = create_thread(btif_hh_poll_event_thread, p_dev);
299 if (p_dev == NULL) {
304 p_dev->dev_status = BTHH_CONN_STATE_CONNECTED;
305 APPL_TRACE_DEBUG2("%s: Return device status %d", __FUNCTION__, p_dev->dev_status);
324 btif_hh_device_t *p_dev = NULL;
333 p_dev = &btif_hh_cb.devices[i];
334 if (p_dev->dev_status != BTHH_CONN_STATE_UNKNOWN && p_dev->dev_handle == dev_handle) {
337 ,__FUNCTION__,p_dev->dev_status
338 ,p_dev->dev_handle);
339 btif_hh_close_poll_thread(p_dev);
366 btif_hh_device_t *p_dev;
372 p_dev = btif_hh_find_connected_dev_by_handle(dev_handle);
373 if (p_dev == NULL) {
378 if (p_dev->fd >= 0) {
379 bta_hh_co_write(p_dev->fd, p_rpt, len);
381 APPL_TRACE_WARNING3("%s: Error: fd = %d, len = %d", __FUNCTION__, p_dev->fd, len);
398 void bta_hh_co_send_hid_info(btif_hh_device_t *p_dev, char *dev_name, UINT16 vendor_id,
405 if (p_dev->fd < 0) {
406 APPL_TRACE_WARNING3("%s: Error: fd = %d, dscp_len = %d", __FUNCTION__, p_dev->fd, dscp_len);
411 p_dev->fd, dev_name, dscp_len);
428 result = uhid_write(p_dev->fd, &ev);
431 p_dev->fd, dscp_len, result);
437 close(p_dev->fd);
438 p_dev->fd = -1;