Lines Matching refs:hid
383 struct bt_hid_device_s *hid = opaque; in bt_hid_control_sdu() local
385 bt_hid_control_transaction(hid, data, len); in bt_hid_control_sdu()
390 struct bt_hid_device_s *hid = opaque; in bt_hid_datain() local
395 if (hid->state == bt_state_suspend) { in bt_hid_datain()
396 hid->state = bt_state_ready; in bt_hid_datain()
399 if (bt_hid_in(hid) > 0) in bt_hid_datain()
402 bt_hid_send_data(hid->interrupt, BT_DATA_INPUT, in bt_hid_datain()
403 hid->datain.buffer, hid->datain.len); in bt_hid_datain()
408 struct bt_hid_device_s *hid = opaque; in bt_hid_interrupt_sdu() local
415 if (hid->intr_state) in bt_hid_interrupt_sdu()
418 hid->data_type = BT_DATA_OUTPUT; in bt_hid_interrupt_sdu()
419 hid->intrdataout.len = 0; in bt_hid_interrupt_sdu()
421 if (!hid->intr_state) in bt_hid_interrupt_sdu()
426 memcpy(hid->intrdataout.buffer + hid->intrdataout.len, data + 1, len - 1); in bt_hid_interrupt_sdu()
427 hid->intrdataout.len += len - 1; in bt_hid_interrupt_sdu()
428 hid->intr_state = (len == BT_HID_MTU); in bt_hid_interrupt_sdu()
429 if (!hid->intr_state) { in bt_hid_interrupt_sdu()
430 memcpy(hid->dataout.buffer, hid->intrdataout.buffer, in bt_hid_interrupt_sdu()
431 hid->dataout.len = hid->intrdataout.len); in bt_hid_interrupt_sdu()
432 bt_hid_out(hid); in bt_hid_interrupt_sdu()
442 static void bt_hid_connected_update(struct bt_hid_device_s *hid) in bt_hid_connected_update() argument
444 int prev = hid->connected; in bt_hid_connected_update()
446 hid->connected = hid->control && hid->interrupt; in bt_hid_connected_update()
449 hid->btdev.device.page_scan = !hid->connected; in bt_hid_connected_update()
450 hid->btdev.device.inquiry_scan = !hid->connected; in bt_hid_connected_update()
452 if (hid->connected && !prev) { in bt_hid_connected_update()
453 hid->usbdev->handle_reset(hid->usbdev); in bt_hid_connected_update()
454 hid->proto = BT_HID_PROTO_REPORT; in bt_hid_connected_update()
463 struct bt_hid_device_s *hid = opaque; in bt_hid_close_control() local
465 hid->control = NULL; in bt_hid_close_control()
466 bt_hid_connected_update(hid); in bt_hid_close_control()
471 struct bt_hid_device_s *hid = opaque; in bt_hid_close_interrupt() local
473 hid->interrupt = NULL; in bt_hid_close_interrupt()
474 bt_hid_connected_update(hid); in bt_hid_close_interrupt()
480 struct bt_hid_device_s *hid = (struct bt_hid_device_s *) dev; in bt_hid_new_control_ch() local
482 if (hid->control) in bt_hid_new_control_ch()
485 hid->control = params; in bt_hid_new_control_ch()
486 hid->control->opaque = hid; in bt_hid_new_control_ch()
487 hid->control->close = bt_hid_close_control; in bt_hid_new_control_ch()
488 hid->control->sdu_in = bt_hid_control_sdu; in bt_hid_new_control_ch()
490 bt_hid_connected_update(hid); in bt_hid_new_control_ch()
498 struct bt_hid_device_s *hid = (struct bt_hid_device_s *) dev; in bt_hid_new_interrupt_ch() local
500 if (hid->interrupt) in bt_hid_new_interrupt_ch()
503 hid->interrupt = params; in bt_hid_new_interrupt_ch()
504 hid->interrupt->opaque = hid; in bt_hid_new_interrupt_ch()
505 hid->interrupt->close = bt_hid_close_interrupt; in bt_hid_new_interrupt_ch()
506 hid->interrupt->sdu_in = bt_hid_interrupt_sdu; in bt_hid_new_interrupt_ch()
508 bt_hid_connected_update(hid); in bt_hid_new_interrupt_ch()
515 struct bt_hid_device_s *hid = (struct bt_hid_device_s *) dev; in bt_hid_destroy() local
517 if (hid->connected) in bt_hid_destroy()
518 bt_hid_send_control(hid, BT_HC_VIRTUAL_CABLE_UNPLUG); in bt_hid_destroy()
519 bt_l2cap_device_done(&hid->btdev); in bt_hid_destroy()
521 hid->usbdev->handle_destroy(hid->usbdev); in bt_hid_destroy()
523 qemu_free(hid); in bt_hid_destroy()