Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3b4385ce authored by Ying Hsu's avatar Ying Hsu Committed by Automerger Merge Worker
Browse files

Merge "floss: Support UHID_SET_REPORT" am: 3d58f869 am: fed2fe7b am: 736c7430

parents 999f448b 736c7430
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -171,7 +171,7 @@ static int uhid_read_event(btif_hh_device_t* p_dev) {
        APPL_TRACE_ERROR("%s: UHID_FEATURE: Invalid report type = %d", __func__,
                         ev.u.feature.rtype);
      break;
#ifdef OS_ANDROID  // Host kernel does not support UHID_SET_REPORT
#if ENABLE_UHID_SET_REPORT
    case UHID_SET_REPORT: {
      bool sent = true;

@@ -211,7 +211,7 @@ static int uhid_read_event(btif_hh_device_t* p_dev) {
      }
      break;
    }
#endif  // ifdef OS_ANDROID
#endif  // ENABLE_UHID_SET_REPORT
    default:
      APPL_TRACE_DEBUG("Invalid event from uhid-dev: %u\n", ev.type);
  }
@@ -418,10 +418,10 @@ void bta_hh_co_open(uint8_t dev_handle, uint8_t sub_class,
  p_dev->dev_status = BTHH_CONN_STATE_CONNECTED;
  p_dev->get_rpt_id_queue = fixed_queue_new(SIZE_MAX);
  CHECK(p_dev->get_rpt_id_queue);
#ifdef OS_ANDROID  // Host kernel does not support UHID_SET_REPORT
#if ENABLE_UHID_SET_REPORT
  p_dev->set_rpt_id_queue = fixed_queue_new(SIZE_MAX);
  CHECK(p_dev->set_rpt_id_queue);
#endif  // OS_ANDROID
#endif  // ENABLE_UHID_SET_REPORT

  APPL_TRACE_DEBUG("%s: Return device status %d", __func__, p_dev->dev_status);
}
@@ -455,11 +455,11 @@ void bta_hh_co_close(uint8_t dev_handle, uint8_t app_id) {
    fixed_queue_flush(p_dev->get_rpt_id_queue, osi_free);
    fixed_queue_free(p_dev->get_rpt_id_queue, NULL);
    p_dev->get_rpt_id_queue = NULL;
#ifdef OS_ANDROID  // Host kernel does not support UHID_SET_REPORT
#if ENABLE_UHID_SET_REPORT
    fixed_queue_flush(p_dev->set_rpt_id_queue, osi_free);
    fixed_queue_free(p_dev->set_rpt_id_queue, nullptr);
    p_dev->set_rpt_id_queue = nullptr;
#endif  // S_ANDROID
#endif  // ENABLE_UHID_SET_REPORT
    if (p_dev->dev_status != BTHH_CONN_STATE_UNKNOWN &&
        p_dev->dev_handle == dev_handle) {
      APPL_TRACE_WARNING(
@@ -607,7 +607,7 @@ void bta_hh_co_send_hid_info(btif_hh_device_t* p_dev, const char* dev_name,
 *
 ******************************************************************************/
void bta_hh_co_set_rpt_rsp(uint8_t dev_handle, uint8_t status) {
#ifdef OS_ANDROID  // Host kernel does not support UHID_SET_REPORT
#if ENABLE_UHID_SET_REPORT
  LOG_VERBOSE("dev_handle = %d", dev_handle);

  btif_hh_device_t* p_dev = btif_hh_find_connected_dev_by_handle(dev_handle);
@@ -639,7 +639,7 @@ void bta_hh_co_set_rpt_rsp(uint8_t dev_handle, uint8_t status) {
  }
#else
  LOG_ERROR("Error: UHID_SET_REPORT_REPLY not supported");
#endif  // OS_ANDROID
#endif  // ENABLE_UHID_SET_REPORT
}

/*******************************************************************************
+10 −2
Original line number Diff line number Diff line
@@ -45,6 +45,14 @@
#define BTIF_HH_MAX_POLLING_ATTEMPTS 10
#define BTIF_HH_POLLING_SLEEP_DURATION_US 5000

#ifndef ENABLE_UHID_SET_REPORT
#if defined(OS_ANDROID) || defined(TARGET_FLOSS)
#define ENABLE_UHID_SET_REPORT 1
#else
#define ENABLE_UHID_SET_REPORT 0
#endif
#endif

/*******************************************************************************
 *  Type definitions and return values
 ******************************************************************************/
@@ -94,9 +102,9 @@ typedef struct {
  uint8_t hh_keep_polling;
  alarm_t* vup_timer;
  fixed_queue_t* get_rpt_id_queue;
#ifdef OS_ANDROID
#if ENABLE_UHID_SET_REPORT
  fixed_queue_t* set_rpt_id_queue;
#endif  // OS_ANDROID
#endif  // ENSABLE_UHID_SET_REPORT
  uint8_t get_rpt_snt;
  bool local_vup;  // Indicated locally initiated VUP
} btif_hh_device_t;
+2 −2
Original line number Diff line number Diff line
@@ -918,7 +918,7 @@ static void btif_hh_upstreams_evt(uint16_t event, char* p_param) {
        HAL_CBACK(bt_hh_callbacks, handshake_cb, (RawAddress*)&(p_dev->bd_addr),
                  (bthh_status_t)p_data->hs_data.status);

#ifdef OS_ANDROID  // Host kernel does not support UHID_SET_REPORT
#if ENABLE_UHID_SET_REPORT
        if (p_dev->le_hid && p_dev->set_rpt_id_queue) {
          /* There is no handshake response for HOGP. Conclude the
           * UHID_SET_REPORT procedure here. */
@@ -928,7 +928,7 @@ static void btif_hh_upstreams_evt(uint16_t event, char* p_param) {
            bta_hh_co_set_rpt_rsp(p_dev->dev_handle, p_data->dev_status.status);
          }
        }
#endif
#endif  // ENABLE_UHID_SET_REPORT
      }
      break;