OSDN Git Service

Remove unused funcs bta/hh::bta_hh_parse_
authorChris Manton <cmanton@google.com>
Sat, 8 May 2021 19:59:10 +0000 (12:59 -0700)
committerChris Manton <cmanton@google.com>
Wed, 12 May 2021 17:10:33 +0000 (10:10 -0700)
Bug: 163134718
Test: gd/cert/run
Tag: #refactor

Change-Id: I3804de80d85d564b64dd533c92c3c6289bda66e7

bta/hh/bta_hh_int.h
bta/hh/bta_hh_utils.cc

index 8d83d00..5ed6380 100644 (file)
@@ -309,10 +309,6 @@ extern void bta_hh_open_failure(tBTA_HH_DEV_CB* p_cb,
 /* utility functions */
 extern uint8_t bta_hh_find_cb(const RawAddress& bda);
 extern tBTA_HH_DEV_CB* bta_hh_get_cb(const RawAddress& bda);
-extern void bta_hh_parse_keybd_rpt(tBTA_HH_BOOT_RPT* p_kb_data,
-                                   uint8_t* p_report, uint16_t report_len);
-extern void bta_hh_parse_mice_rpt(tBTA_HH_BOOT_RPT* p_kb_data,
-                                  uint8_t* p_report, uint16_t report_len);
 extern bool bta_hh_tod_spt(tBTA_HH_DEV_CB* p_cb, uint8_t sub_class);
 extern void bta_hh_clean_up_kdev(tBTA_HH_DEV_CB* p_cb);
 
index 689f2e7..f7c8919 100644 (file)
 
 #define BTA_HH_MAX_RPT_CHARS 8
 
-static const uint8_t bta_hh_mod_key_mask[BTA_HH_MOD_MAX_KEY] = {
-    BTA_HH_KB_CTRL_MASK, BTA_HH_KB_SHIFT_MASK, BTA_HH_KB_ALT_MASK,
-    BTA_HH_KB_GUI_MASK};
-
 /*******************************************************************************
  *
  * Function         bta_hh_find_cb
@@ -232,140 +228,6 @@ bool bta_hh_tod_spt(tBTA_HH_DEV_CB* p_cb, uint8_t sub_class) {
   return false;
 }
 
-/*******************************************************************************
- *
- * Function         bta_hh_parse_keybd_rpt
- *
- * Description      This utility function parse a boot mode keyboard report.
- *
- * Returns          void
- *
- ******************************************************************************/
-void bta_hh_parse_keybd_rpt(tBTA_HH_BOOT_RPT* p_kb_data, uint8_t* p_report,
-                            uint16_t report_len) {
-  tBTA_HH_KB_CB* p_kb = &bta_hh_cb.kb_cb;
-  tBTA_HH_KEYBD_RPT* p_data = &p_kb_data->data_rpt.keybd_rpt;
-
-  uint8_t this_char, ctl_shift;
-  uint16_t xx, yy, key_idx = 0;
-  uint8_t this_report[BTA_HH_MAX_RPT_CHARS];
-
-#if (BTA_HH_DEBUG == TRUE)
-  APPL_TRACE_DEBUG("bta_hh_parse_keybd_rpt:  (report=%p, report_len=%d) called",
-                   p_report, report_len);
-#endif
-
-  if (report_len < 2) return;
-
-  ctl_shift = *p_report++;
-  report_len--;
-
-  if (report_len > BTA_HH_MAX_RPT_CHARS) report_len = BTA_HH_MAX_RPT_CHARS;
-
-  memset(this_report, 0, BTA_HH_MAX_RPT_CHARS);
-  memset(p_data, 0, sizeof(tBTA_HH_KEYBD_RPT));
-  memcpy(this_report, p_report, report_len);
-
-  /* Take care of shift, control, GUI and alt, modifier keys  */
-  for (xx = 0; xx < BTA_HH_MOD_MAX_KEY; xx++) {
-    if (ctl_shift & bta_hh_mod_key_mask[xx]) {
-      APPL_TRACE_DEBUG("Mod Key[%02x] pressed", bta_hh_mod_key_mask[xx]);
-      p_kb->mod_key[xx] = true;
-    } else if (p_kb->mod_key[xx]) {
-      p_kb->mod_key[xx] = false;
-    }
-    /* control key flag is set */
-    p_data->mod_key[xx] = p_kb->mod_key[xx];
-  }
-
-  /***************************************************************************/
-  /*  First step is to remove all characters we saw in the last report       */
-  /***************************************************************************/
-  for (xx = 0; xx < report_len; xx++) {
-    for (yy = 0; yy < BTA_HH_MAX_RPT_CHARS; yy++) {
-      if (this_report[xx] == p_kb->last_report[yy]) {
-        this_report[xx] = 0;
-      }
-    }
-  }
-  /***************************************************************************/
-  /*  Now, process all the characters in the report, up to 6 keycodes        */
-  /***************************************************************************/
-  for (xx = 0; xx < report_len; xx++) {
-#if (BTA_HH_DEBUG == TRUE)
-    APPL_TRACE_DEBUG("this_char = %02x", this_report[xx]);
-#endif
-    this_char = this_report[xx];
-    if (this_char == 0) continue;
-    /* take the key code as the report data */
-    if (this_report[xx] == BTA_HH_KB_CAPS_LOCK)
-      p_kb->caps_lock = p_kb->caps_lock ? false : true;
-    else if (this_report[xx] == BTA_HH_KB_NUM_LOCK)
-      p_kb->num_lock = p_kb->num_lock ? false : true;
-    else
-      p_data->this_char[key_idx++] = this_char;
-
-#if (BTA_HH_DEBUG == TRUE)
-    APPL_TRACE_DEBUG("found keycode %02x ", this_report[xx]);
-#endif
-    p_data->caps_lock = p_kb->caps_lock;
-    p_data->num_lock = p_kb->num_lock;
-  }
-
-  memset(p_kb->last_report, 0, BTA_HH_MAX_RPT_CHARS);
-  memcpy(p_kb->last_report, p_report, report_len);
-
-  return;
-}
-
-/*******************************************************************************
- *
- * Function         bta_hh_parse_mice_rpt
- *
- * Description      This utility function parse a boot mode mouse report.
- *
- * Returns          void
- *
- ******************************************************************************/
-void bta_hh_parse_mice_rpt(tBTA_HH_BOOT_RPT* p_mice_data, uint8_t* p_report,
-                           uint16_t report_len) {
-  tBTA_HH_MICE_RPT* p_data = &p_mice_data->data_rpt.mice_rpt;
-#if (BTA_HH_DEBUG == TRUE)
-  uint8_t xx;
-
-  APPL_TRACE_DEBUG(
-      "bta_hh_parse_mice_rpt:  bta_keybd_rpt_rcvd(report=%p, \
-                report_len=%d) called",
-      p_report, report_len);
-#endif
-
-  if (report_len < 3) return;
-
-  if (report_len > BTA_HH_MAX_RPT_CHARS) report_len = BTA_HH_MAX_RPT_CHARS;
-
-#if (BTA_HH_DEBUG == TRUE)
-  for (xx = 0; xx < report_len; xx++) {
-    APPL_TRACE_DEBUG("this_char = %02x", p_report[xx]);
-  }
-#endif
-
-  /* only first bytes lower 3 bits valid */
-  p_data->mouse_button = (p_report[0] & 0x07);
-
-  /* x displacement */
-  p_data->delta_x = p_report[1];
-
-  /* y displacement */
-  p_data->delta_y = p_report[2];
-
-#if (BTA_HH_DEBUG == TRUE)
-  APPL_TRACE_DEBUG("mice button: 0x%2x", p_data->mouse_button);
-  APPL_TRACE_DEBUG("mice move: x = %d y = %d", p_data->delta_x,
-                   p_data->delta_y);
-#endif
-
-  return;
-}
 
 /*******************************************************************************
  *