bta_hh_co.cc revision e34b0eb1110d47832a38180c1b1f8c08205aa0e2
1/******************************************************************************
2 *
3 *  Copyright (C) 2009-2012 Broadcom Corporation
4 *
5 *  Licensed under the Apache License, Version 2.0 (the "License");
6 *  you may not use this file except in compliance with the License.
7 *  You may obtain a copy of the License at:
8 *
9 *  http://www.apache.org/licenses/LICENSE-2.0
10 *
11 *  Unless required by applicable law or agreed to in writing, software
12 *  distributed under the License is distributed on an "AS IS" BASIS,
13 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 *  See the License for the specific language governing permissions and
15 *  limitations under the License.
16 *
17 ******************************************************************************/
18
19//#if (defined(BTA_HH_INCLUDED) && (BTA_HH_INCLUDED == TRUE))
20
21#include <ctype.h>
22#include <fcntl.h>
23#include <sys/poll.h>
24#include <pthread.h>
25#include <stdio.h>
26#include <string.h>
27#include <stdint.h>
28#include <errno.h>
29#include <unistd.h>
30#include <linux/uhid.h>
31#include <unistd.h>
32#include "osi/include/osi.h"
33#include "btif_hh.h"
34#include "bta_api.h"
35#include "bta_hh_api.h"
36#include "btif_util.h"
37#include "bta_hh_co.h"
38#include "btcore/include/bdaddr.h"
39
40const char *dev_path = "/dev/uhid";
41
42#if (BLE_INCLUDED == TRUE && BTA_HH_LE_INCLUDED == TRUE)
43#include "btif_config.h"
44#define BTA_HH_NV_LOAD_MAX       16
45static tBTA_HH_RPT_CACHE_ENTRY sReportCache[BTA_HH_NV_LOAD_MAX];
46#endif
47
48void uhid_set_non_blocking(int fd)
49{
50    int opts = fcntl(fd, F_GETFL);
51    if (opts < 0)
52        APPL_TRACE_ERROR("%s() Getting flags failed (%s)", __func__, strerror(errno));
53
54    opts |= O_NONBLOCK;
55
56    if (fcntl(fd, F_SETFL, opts) < 0)
57        APPL_TRACE_EVENT("%s() Setting non-blocking flag failed (%s)", __func__, strerror(errno));
58}
59
60/*Internal function to perform UHID write and error checking*/
61static int uhid_write(int fd, const struct uhid_event *ev)
62{
63    ssize_t ret;
64
65    OSI_NO_INTR(ret = write(fd, ev, sizeof(*ev)));
66    if (ret < 0){
67        int rtn = -errno;
68        APPL_TRACE_ERROR("%s: Cannot write to uhid:%s",
69                         __FUNCTION__, strerror(errno));
70        return rtn;
71    } else if (ret != (ssize_t)sizeof(*ev)) {
72        APPL_TRACE_ERROR("%s: Wrong size written to uhid: %zd != %zu",
73                         __FUNCTION__, ret, sizeof(*ev));
74        return -EFAULT;
75    }
76
77    return 0;
78}
79
80/* Internal function to parse the events received from UHID driver*/
81static int uhid_event(btif_hh_device_t *p_dev)
82{
83    struct uhid_event ev;
84    ssize_t ret;
85    memset(&ev, 0, sizeof(ev));
86    if(!p_dev)
87    {
88        APPL_TRACE_ERROR("%s: Device not found",__FUNCTION__)
89        return -1;
90    }
91    ret = read(p_dev->fd, &ev, sizeof(ev));
92    if (ret == 0) {
93        APPL_TRACE_ERROR("%s: Read HUP on uhid-cdev %s", __FUNCTION__,
94                                                 strerror(errno));
95        return -EFAULT;
96    } else if (ret < 0) {
97        APPL_TRACE_ERROR("%s: Cannot read uhid-cdev: %s", __FUNCTION__,
98                                                strerror(errno));
99        return -errno;
100    } else if ((ev.type == UHID_OUTPUT) || (ev.type==UHID_OUTPUT_EV)) {
101        // Only these two types havae payload,
102        // ensure we read full event descriptor
103        if (ret < (ssize_t)sizeof(ev)) {
104            APPL_TRACE_ERROR("%s: Invalid size read from uhid-dev: %ld != %lu",
105                         __FUNCTION__, ret, sizeof(ev.type));
106            return -EFAULT;
107        }
108    }
109
110    switch (ev.type) {
111    case UHID_START:
112        APPL_TRACE_DEBUG("UHID_START from uhid-dev\n");
113        p_dev->ready_for_data = TRUE;
114        break;
115    case UHID_STOP:
116        APPL_TRACE_DEBUG("UHID_STOP from uhid-dev\n");
117        p_dev->ready_for_data = FALSE;
118        break;
119    case UHID_OPEN:
120        APPL_TRACE_DEBUG("UHID_OPEN from uhid-dev\n");
121        p_dev->ready_for_data = TRUE;
122        break;
123    case UHID_CLOSE:
124        APPL_TRACE_DEBUG("UHID_CLOSE from uhid-dev\n");
125        p_dev->ready_for_data = FALSE;
126        break;
127    case UHID_OUTPUT:
128        if (ret < (ssize_t)(sizeof(ev.type) + sizeof(ev.u.output))) {
129            APPL_TRACE_ERROR("%s: Invalid size read from uhid-dev: %zd < %zu",
130                             __FUNCTION__, ret,
131                             sizeof(ev.type) + sizeof(ev.u.output));
132            return -EFAULT;
133        }
134
135        APPL_TRACE_DEBUG("UHID_OUTPUT: Report type = %d, report_size = %d"
136                            ,ev.u.output.rtype, ev.u.output.size);
137        //Send SET_REPORT with feature report if the report type in output event is FEATURE
138        if(ev.u.output.rtype == UHID_FEATURE_REPORT)
139            btif_hh_setreport(p_dev, BTHH_FEATURE_REPORT,
140                              ev.u.output.size, ev.u.output.data);
141        else if(ev.u.output.rtype == UHID_OUTPUT_REPORT)
142            btif_hh_setreport(p_dev, BTHH_OUTPUT_REPORT,
143                              ev.u.output.size, ev.u.output.data);
144        else
145            btif_hh_setreport(p_dev, BTHH_INPUT_REPORT,
146                              ev.u.output.size, ev.u.output.data);
147           break;
148    case UHID_OUTPUT_EV:
149        APPL_TRACE_DEBUG("UHID_OUTPUT_EV from uhid-dev\n");
150        break;
151    case UHID_FEATURE:
152        APPL_TRACE_DEBUG("UHID_FEATURE from uhid-dev\n");
153        break;
154    case UHID_FEATURE_ANSWER:
155        APPL_TRACE_DEBUG("UHID_FEATURE_ANSWER from uhid-dev\n");
156        break;
157
158    default:
159        APPL_TRACE_DEBUG("Invalid event from uhid-dev: %u\n", ev.type);
160    }
161
162    return 0;
163}
164
165/*******************************************************************************
166**
167** Function create_thread
168**
169** Description creat a select loop
170**
171** Returns pthread_t
172**
173*******************************************************************************/
174static inline pthread_t create_thread(void *(*start_routine)(void *), void * arg){
175    APPL_TRACE_DEBUG("create_thread: entered");
176    pthread_attr_t thread_attr;
177
178    pthread_attr_init(&thread_attr);
179    pthread_attr_setdetachstate(&thread_attr, PTHREAD_CREATE_JOINABLE);
180    pthread_t thread_id = -1;
181    if ( pthread_create(&thread_id, &thread_attr, start_routine, arg)!=0 )
182    {
183        APPL_TRACE_ERROR("pthread_create : %s", strerror(errno));
184        return -1;
185    }
186    APPL_TRACE_DEBUG("create_thread: thread created successfully");
187    return thread_id;
188}
189
190/*******************************************************************************
191**
192** Function btif_hh_poll_event_thread
193**
194** Description the polling thread which polls for event from UHID driver
195**
196** Returns void
197**
198*******************************************************************************/
199static void *btif_hh_poll_event_thread(void *arg)
200{
201    btif_hh_device_t *p_dev = (btif_hh_device_t*)arg;
202    APPL_TRACE_DEBUG("%s: Thread created fd = %d", __func__, p_dev->fd);
203    struct pollfd pfds[1];
204
205    pfds[0].fd = p_dev->fd;
206    pfds[0].events = POLLIN;
207
208    // Set the uhid fd as non-blocking to ensure we never block the BTU thread
209    uhid_set_non_blocking(p_dev->fd);
210
211    while(p_dev->hh_keep_polling){
212        int ret;
213        OSI_NO_INTR(ret = poll(pfds, 1, 50));
214        if (ret < 0) {
215            APPL_TRACE_ERROR("%s: Cannot poll for fds: %s\n", __func__, strerror(errno));
216            break;
217        }
218        if (pfds[0].revents & POLLIN) {
219            APPL_TRACE_DEBUG("%s: POLLIN", __func__);
220            ret = uhid_event(p_dev);
221            if (ret != -EINTR && ret != 0)
222                break;
223        }
224    }
225
226    p_dev->hh_poll_thread_id = -1;
227    return 0;
228}
229
230static inline void btif_hh_close_poll_thread(btif_hh_device_t *p_dev)
231{
232    APPL_TRACE_DEBUG("%s", __FUNCTION__);
233    p_dev->hh_keep_polling = 0;
234    if(p_dev->hh_poll_thread_id > 0)
235        pthread_join(p_dev->hh_poll_thread_id,NULL);
236
237    return;
238}
239
240void bta_hh_co_destroy(int fd)
241{
242    struct uhid_event ev;
243    memset(&ev, 0, sizeof(ev));
244    ev.type = UHID_DESTROY;
245    uhid_write(fd, &ev);
246    APPL_TRACE_DEBUG("%s: Closing fd=%d", __func__, fd);
247    close(fd);
248}
249
250int bta_hh_co_write(int fd, UINT8* rpt, UINT16 len)
251{
252    APPL_TRACE_DEBUG("%s: UHID write %d", __func__, len);
253
254    struct uhid_event ev;
255    memset(&ev, 0, sizeof(ev));
256    ev.type = UHID_INPUT;
257    ev.u.input.size = len;
258    if(len > sizeof(ev.u.input.data)){
259        APPL_TRACE_WARNING("%s: Report size greater than allowed size",
260                           __FUNCTION__);
261        return -1;
262    }
263    memcpy(ev.u.input.data, rpt, len);
264
265    return uhid_write(fd, &ev);
266
267}
268
269
270/*******************************************************************************
271**
272** Function      bta_hh_co_open
273**
274** Description   When connection is opened, this call-out function is executed
275**               by HH to do platform specific initialization.
276**
277** Returns       void.
278*******************************************************************************/
279void bta_hh_co_open(UINT8 dev_handle, UINT8 sub_class, tBTA_HH_ATTR_MASK attr_mask,
280                    UINT8 app_id)
281{
282    UINT32 i;
283    btif_hh_device_t *p_dev = NULL;
284
285    if (dev_handle == BTA_HH_INVALID_HANDLE) {
286        APPL_TRACE_WARNING("%s: Oops, dev_handle (%d) is invalid...",
287                           __FUNCTION__, dev_handle);
288        return;
289    }
290
291    for (i = 0; i < BTIF_HH_MAX_HID; i++) {
292        p_dev = &btif_hh_cb.devices[i];
293        if (p_dev->dev_status != BTHH_CONN_STATE_UNKNOWN &&
294            p_dev->dev_handle == dev_handle) {
295            // We found a device with the same handle. Must be a device reconnected.
296            APPL_TRACE_WARNING("%s: Found an existing device with the same handle "
297                                                                "dev_status = %d",__FUNCTION__,
298                                                                p_dev->dev_status);
299            APPL_TRACE_WARNING("%s:     bd_addr = [%02X:%02X:%02X:%02X:%02X:]", __FUNCTION__,
300                 p_dev->bd_addr.address[0], p_dev->bd_addr.address[1], p_dev->bd_addr.address[2],
301                 p_dev->bd_addr.address[3], p_dev->bd_addr.address[4]);
302                 APPL_TRACE_WARNING("%s:     attr_mask = 0x%04x, sub_class = 0x%02x, app_id = %d",
303                                  __FUNCTION__, p_dev->attr_mask, p_dev->sub_class, p_dev->app_id);
304
305            if(p_dev->fd<0) {
306                p_dev->fd = open(dev_path, O_RDWR | O_CLOEXEC);
307                if (p_dev->fd < 0){
308                    APPL_TRACE_ERROR("%s: Error: failed to open uhid, err:%s",
309                                                                    __FUNCTION__,strerror(errno));
310                    return;
311                }else
312                    APPL_TRACE_DEBUG("%s: uhid fd = %d", __FUNCTION__, p_dev->fd);
313            }
314
315            p_dev->hh_keep_polling = 1;
316            p_dev->hh_poll_thread_id = create_thread(btif_hh_poll_event_thread, p_dev);
317            break;
318        }
319        p_dev = NULL;
320    }
321
322    if (p_dev == NULL) {
323        // Did not find a device reconnection case. Find an empty slot now.
324        for (i = 0; i < BTIF_HH_MAX_HID; i++) {
325            if (btif_hh_cb.devices[i].dev_status == BTHH_CONN_STATE_UNKNOWN) {
326                p_dev = &btif_hh_cb.devices[i];
327                p_dev->dev_handle = dev_handle;
328                p_dev->attr_mask  = attr_mask;
329                p_dev->sub_class  = sub_class;
330                p_dev->app_id     = app_id;
331                p_dev->local_vup  = FALSE;
332
333                btif_hh_cb.device_num++;
334                // This is a new device,open the uhid driver now.
335                p_dev->fd = open(dev_path, O_RDWR | O_CLOEXEC);
336                if (p_dev->fd < 0){
337                    APPL_TRACE_ERROR("%s: Error: failed to open uhid, err:%s",
338                                                                    __FUNCTION__,strerror(errno));
339                    return;
340                }else{
341                    APPL_TRACE_DEBUG("%s: uhid fd = %d", __FUNCTION__, p_dev->fd);
342                    p_dev->hh_keep_polling = 1;
343                    p_dev->hh_poll_thread_id = create_thread(btif_hh_poll_event_thread, p_dev);
344                }
345
346
347                break;
348            }
349        }
350    }
351
352    if (p_dev == NULL) {
353        APPL_TRACE_ERROR("%s: Error: too many HID devices are connected", __FUNCTION__);
354        return;
355    }
356
357    p_dev->dev_status = BTHH_CONN_STATE_CONNECTED;
358    APPL_TRACE_DEBUG("%s: Return device status %d", __FUNCTION__, p_dev->dev_status);
359}
360
361
362/*******************************************************************************
363**
364** Function      bta_hh_co_close
365**
366** Description   When connection is closed, this call-out function is executed
367**               by HH to do platform specific finalization.
368**
369** Parameters    dev_handle  - device handle
370**                  app_id      - application id
371**
372** Returns          void.
373*******************************************************************************/
374void bta_hh_co_close(UINT8 dev_handle, UINT8 app_id)
375{
376    UINT32 i;
377    btif_hh_device_t *p_dev = NULL;
378
379    APPL_TRACE_WARNING("%s: dev_handle = %d, app_id = %d", __FUNCTION__, dev_handle, app_id);
380    if (dev_handle == BTA_HH_INVALID_HANDLE) {
381        APPL_TRACE_WARNING("%s: Oops, dev_handle (%d) is invalid...", __FUNCTION__, dev_handle);
382        return;
383    }
384
385    for (i = 0; i < BTIF_HH_MAX_HID; i++) {
386        p_dev = &btif_hh_cb.devices[i];
387        if (p_dev->dev_status != BTHH_CONN_STATE_UNKNOWN && p_dev->dev_handle == dev_handle) {
388            APPL_TRACE_WARNING("%s: Found an existing device with the same handle "
389                                                        "dev_status = %d, dev_handle =%d"
390                                                        ,__FUNCTION__,p_dev->dev_status
391                                                        ,p_dev->dev_handle);
392            btif_hh_close_poll_thread(p_dev);
393            break;
394        }
395     }
396}
397
398
399/*******************************************************************************
400**
401** Function         bta_hh_co_data
402**
403** Description      This function is executed by BTA when HID host receive a data
404**                  report.
405**
406** Parameters       dev_handle  - device handle
407**                  *p_rpt      - pointer to the report data
408**                  len         - length of report data
409**                  mode        - Hid host Protocol Mode
410**                  sub_clas    - Device Subclass
411**                  app_id      - application id
412**
413** Returns          void
414*******************************************************************************/
415void bta_hh_co_data(UINT8 dev_handle, UINT8 *p_rpt, UINT16 len, tBTA_HH_PROTO_MODE mode,
416                    UINT8 sub_class, UINT8 ctry_code, BD_ADDR peer_addr, UINT8 app_id)
417{
418    btif_hh_device_t *p_dev;
419    UNUSED(peer_addr);
420
421    APPL_TRACE_DEBUG("%s: dev_handle = %d, subclass = 0x%02X, mode = %d, "
422         "ctry_code = %d, app_id = %d",
423         __FUNCTION__, dev_handle, sub_class, mode, ctry_code, app_id);
424
425    p_dev = btif_hh_find_connected_dev_by_handle(dev_handle);
426    if (p_dev == NULL) {
427        APPL_TRACE_WARNING("%s: Error: unknown HID device handle %d", __FUNCTION__, dev_handle);
428        return;
429    }
430
431    // Wait a maximum of MAX_POLLING_ATTEMPTS x POLLING_SLEEP_DURATION in case
432    // device creation is pending.
433    if (p_dev->fd >= 0) {
434        UINT32 polling_attempts = 0;
435        while (!p_dev->ready_for_data && polling_attempts++ < BTIF_HH_MAX_POLLING_ATTEMPTS) {
436            usleep(BTIF_HH_POLLING_SLEEP_DURATION_US);
437        }
438    }
439
440    // Send the HID data to the kernel.
441    if ((p_dev->fd >= 0) && p_dev->ready_for_data) {
442        bta_hh_co_write(p_dev->fd, p_rpt, len);
443    }else {
444        APPL_TRACE_WARNING("%s: Error: fd = %d, ready %d, len = %d", __FUNCTION__, p_dev->fd,
445                            p_dev->ready_for_data, len);
446    }
447}
448
449
450/*******************************************************************************
451**
452** Function         bta_hh_co_send_hid_info
453**
454** Description      This function is called in btif_hh.c to process DSCP received.
455**
456** Parameters       dev_handle  - device handle
457**                  dscp_len    - report descriptor length
458**                  *p_dscp     - report descriptor
459**
460** Returns          void
461*******************************************************************************/
462void bta_hh_co_send_hid_info(btif_hh_device_t *p_dev, const char *dev_name, UINT16 vendor_id,
463                             UINT16 product_id, UINT16 version, UINT8 ctry_code,
464                             int dscp_len, UINT8 *p_dscp)
465{
466    int result;
467    struct uhid_event ev;
468
469    if (p_dev->fd < 0) {
470        APPL_TRACE_WARNING("%s: Error: fd = %d, dscp_len = %d", __FUNCTION__, p_dev->fd, dscp_len);
471        return;
472    }
473
474    APPL_TRACE_WARNING("%s: fd = %d, name = [%s], dscp_len = %d", __FUNCTION__,
475                                                                    p_dev->fd, dev_name, dscp_len);
476    APPL_TRACE_WARNING("%s: vendor_id = 0x%04x, product_id = 0x%04x, version= 0x%04x,"
477                                                                    "ctry_code=0x%02x",__FUNCTION__,
478                                                                    vendor_id, product_id,
479                                                                    version, ctry_code);
480
481    //Create and send hid descriptor to kernel
482    memset(&ev, 0, sizeof(ev));
483    ev.type = UHID_CREATE;
484    strncpy((char*)ev.u.create.name, dev_name, sizeof(ev.u.create.name) - 1);
485    snprintf((char*)ev.u.create.uniq, sizeof(ev.u.create.uniq),
486             "%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X",
487             p_dev->bd_addr.address[5], p_dev->bd_addr.address[4],
488             p_dev->bd_addr.address[3], p_dev->bd_addr.address[2],
489             p_dev->bd_addr.address[1], p_dev->bd_addr.address[0]);
490    ev.u.create.rd_size = dscp_len;
491    ev.u.create.rd_data = p_dscp;
492    ev.u.create.bus = BUS_BLUETOOTH;
493    ev.u.create.vendor = vendor_id;
494    ev.u.create.product = product_id;
495    ev.u.create.version = version;
496    ev.u.create.country = ctry_code;
497    result = uhid_write(p_dev->fd, &ev);
498
499    APPL_TRACE_WARNING("%s: wrote descriptor to fd = %d, dscp_len = %d, result = %d", __FUNCTION__,
500                                                                    p_dev->fd, dscp_len, result);
501
502    if (result) {
503        APPL_TRACE_WARNING("%s: Error: failed to send DSCP, result = %d", __FUNCTION__, result);
504
505        /* The HID report descriptor is corrupted. Close the driver. */
506        close(p_dev->fd);
507        p_dev->fd = -1;
508    }
509}
510
511#if (BLE_INCLUDED == TRUE && BTA_HH_LE_INCLUDED == TRUE)
512/*******************************************************************************
513**
514** Function         bta_hh_le_co_rpt_info
515**
516** Description      This callout function is to convey the report information on
517**                  a HOGP device to the application. Application can save this
518**                  information in NV if device is bonded and load it back when
519**                  stack reboot.
520**
521** Parameters       remote_bda  - remote device address
522**                  p_entry     - report entry pointer
523**                  app_id      - application id
524**
525** Returns          void.
526**
527*******************************************************************************/
528void bta_hh_le_co_rpt_info(BD_ADDR remote_bda, tBTA_HH_RPT_CACHE_ENTRY *p_entry, UINT8 app_id)
529{
530    UNUSED(app_id);
531
532    unsigned idx = 0;
533
534    bdstr_t bdstr;
535    sprintf(bdstr, "%02x:%02x:%02x:%02x:%02x:%02x",
536        remote_bda[0], remote_bda[1], remote_bda[2],
537        remote_bda[3], remote_bda[4], remote_bda[5]);
538
539    size_t len = btif_config_get_bin_length(bdstr, "HidReport");
540    if (len >= sizeof(tBTA_HH_RPT_CACHE_ENTRY) && len <= sizeof(sReportCache))
541    {
542        btif_config_get_bin(bdstr, "HidReport", (uint8_t *)sReportCache, &len);
543        idx = len / sizeof(tBTA_HH_RPT_CACHE_ENTRY);
544    }
545
546    if (idx < BTA_HH_NV_LOAD_MAX)
547    {
548        memcpy(&sReportCache[idx++], p_entry, sizeof(tBTA_HH_RPT_CACHE_ENTRY));
549        btif_config_set_bin(bdstr, "HidReport", (const uint8_t *)sReportCache,
550            idx * sizeof(tBTA_HH_RPT_CACHE_ENTRY));
551        BTIF_TRACE_DEBUG("%s() - Saving report; dev=%s, idx=%d", __FUNCTION__, bdstr, idx);
552    }
553}
554
555
556/*******************************************************************************
557**
558** Function         bta_hh_le_co_cache_load
559**
560** Description      This callout function is to request the application to load the
561**                  cached HOGP report if there is any. When cache reading is completed,
562**                  bta_hh_le_ci_cache_load() is called by the application.
563**
564** Parameters       remote_bda  - remote device address
565**                  p_num_rpt: number of cached report
566**                  app_id      - application id
567**
568** Returns          the acched report array
569**
570*******************************************************************************/
571tBTA_HH_RPT_CACHE_ENTRY * bta_hh_le_co_cache_load (BD_ADDR remote_bda,
572                                                   UINT8 *p_num_rpt, UINT8 app_id)
573{
574    UNUSED(app_id);
575
576    bdstr_t bdstr;
577    sprintf(bdstr, "%02x:%02x:%02x:%02x:%02x:%02x",
578        remote_bda[0], remote_bda[1], remote_bda[2],
579        remote_bda[3], remote_bda[4], remote_bda[5]);
580
581    size_t len = btif_config_get_bin_length(bdstr, "HidReport");
582    if (!p_num_rpt && len < sizeof(tBTA_HH_RPT_CACHE_ENTRY))
583        return NULL;
584
585    if (len > sizeof(sReportCache))
586        len = sizeof(sReportCache);
587    btif_config_get_bin(bdstr, "HidReport", (uint8_t *)sReportCache, &len);
588    *p_num_rpt = len / sizeof(tBTA_HH_RPT_CACHE_ENTRY);
589
590    BTIF_TRACE_DEBUG("%s() - Loaded %d reports; dev=%s", __FUNCTION__, *p_num_rpt, bdstr);
591
592    return sReportCache;
593}
594
595/*******************************************************************************
596**
597** Function         bta_hh_le_co_reset_rpt_cache
598**
599** Description      This callout function is to reset the HOGP device cache.
600**
601** Parameters       remote_bda  - remote device address
602**
603** Returns          none
604**
605*******************************************************************************/
606void bta_hh_le_co_reset_rpt_cache (BD_ADDR remote_bda, UINT8 app_id)
607{
608    UNUSED(app_id);
609
610    bdstr_t bdstr;
611    sprintf(bdstr, "%02x:%02x:%02x:%02x:%02x:%02x",
612        remote_bda[0], remote_bda[1], remote_bda[2],
613        remote_bda[3], remote_bda[4], remote_bda[5]);
614    btif_config_remove(bdstr, "HidReport");
615
616    BTIF_TRACE_DEBUG("%s() - Reset cache for bda %s", __FUNCTION__, bdstr);
617}
618
619#endif /* #if (BLE_INCLUDED == TRUE && BTA_HH_LE_INCLUDED == TRUE) */
620
621