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

Commit 9beee168 authored by Chris Manton's avatar Chris Manton
Browse files

Streamline stack/hid/hidh_conn::hidh_l2cif_disconnect

Bug: 163134718
Test: cert
Tag: #refactor

Change-Id: I5ee1f8e3f3ec1c1783dab96bd27693721608fdf2
parent b865ddea
Loading
Loading
Loading
Loading
+6 −13
Original line number Diff line number Diff line
@@ -523,24 +523,17 @@ static void hidh_l2cif_disconnect_ind(uint16_t l2cap_cid, bool ack_needed) {
static void hidh_l2cif_disconnect(uint16_t l2cap_cid) {
  L2CA_DisconnectReq(l2cap_cid);

  uint8_t dhandle;
  tHID_CONN* p_hcon = NULL;

  /* Find CCB based on CID */
  dhandle = find_conn_by_cid(l2cap_cid);
  if (dhandle < HID_HOST_MAX_DEVICES) p_hcon = &hh_cb.devices[dhandle].conn;

  if (p_hcon == NULL) {
    HIDH_TRACE_WARNING("HID-Host Rcvd L2CAP disc cfm, unknown CID: 0x%x",
                       l2cap_cid);
  const uint8_t dhandle = find_conn_by_cid(l2cap_cid);
  if (dhandle == HID_HOST_MAX_DEVICES) {
    LOG_WARN("HID-Host Rcvd L2CAP disc cfm, unknown CID: 0x%x", l2cap_cid);
    return;
  }

  HIDH_TRACE_EVENT("HID-Host Rcvd L2CAP disc cfm, CID: 0x%x", l2cap_cid);

  if (l2cap_cid == p_hcon->ctrl_cid)
  tHID_CONN* p_hcon = &hh_cb.devices[dhandle].conn;
  if (l2cap_cid == p_hcon->ctrl_cid) {
    p_hcon->ctrl_cid = 0;
  else {
  } else {
    p_hcon->intr_cid = 0;
    if (p_hcon->ctrl_cid) {
      HIDH_TRACE_EVENT("HID-Host Initiating L2CAP Ctrl disconnection");