GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: usbx_host_classes/src/ux_host_class_hid_mouse_deactivate.c Lines: 8 8 100.0 %
Date: 2026-03-06 18:57:10 Branches: 2 2 100.0 %

Line Branch Exec Source
1
/***************************************************************************
2
 * Copyright (c) 2024 Microsoft Corporation
3
 * Copyright (c) 2026-present Eclipse ThreadX contributors
4
 *
5
 * This program and the accompanying materials are made available under the
6
 * terms of the MIT License which is available at
7
 * https://opensource.org/licenses/MIT.
8
 *
9
 * SPDX-License-Identifier: MIT
10
 **************************************************************************/
11
12
13
/**************************************************************************/
14
/**************************************************************************/
15
/**                                                                       */
16
/** USBX Component                                                        */
17
/**                                                                       */
18
/**   HID Mouse Client Class                                              */
19
/**                                                                       */
20
/**************************************************************************/
21
/**************************************************************************/
22
23
24
/* Include necessary system files.  */
25
26
#define UX_SOURCE_CODE
27
28
#include "ux_api.h"
29
#include "ux_host_class_hid.h"
30
#include "ux_host_class_hid_mouse.h"
31
#include "ux_host_stack.h"
32
33
34
/**************************************************************************/
35
/*                                                                        */
36
/*  FUNCTION                                               RELEASE        */
37
/*                                                                        */
38
/*    _ux_host_class_hid_mouse_deactivate                 PORTABLE C      */
39
/*                                                           6.3.0        */
40
/*  AUTHOR                                                                */
41
/*                                                                        */
42
/*    Chaoqiong Xiao, Microsoft Corporation                               */
43
/*                                                                        */
44
/*  DESCRIPTION                                                           */
45
/*                                                                        */
46
/*    This function performs the deactivation of a HID mouse.             */
47
/*                                                                        */
48
/*  INPUT                                                                 */
49
/*                                                                        */
50
/*    command                               Pointer to command            */
51
/*                                                                        */
52
/*  OUTPUT                                                                */
53
/*                                                                        */
54
/*    Completion Status                                                   */
55
/*                                                                        */
56
/*  CALLS                                                                 */
57
/*                                                                        */
58
/*    _ux_host_class_hid_periodic_report_stop                             */
59
/*                                          Stop periodic report          */
60
/*    _ux_utility_memory_free               Free memory block             */
61
/*                                                                        */
62
/*  CALLED BY                                                             */
63
/*                                                                        */
64
/*    HID Mouse Class                                                     */
65
/*                                                                        */
66
/**************************************************************************/
67
34
UINT  _ux_host_class_hid_mouse_deactivate(UX_HOST_CLASS_HID_CLIENT_COMMAND  *command)
68
{
69
70
UX_HOST_CLASS_HID           *hid;
71
UX_HOST_CLASS_HID_CLIENT    *hid_client;
72
UINT                        status;
73
74
75
    /* Get the instance to the HID class.  */
76
34
    hid =  command -> ux_host_class_hid_client_command_instance;
77
78
    /* Stop the periodic report.  */
79
34
    status =  _ux_host_class_hid_periodic_report_stop(hid);
80
81
    /* Get the HID client pointer.  */
82
34
    hid_client =  hid -> ux_host_class_hid_client;
83
84
    /* If trace is enabled, insert this event into the trace buffer.  */
85
    UX_TRACE_IN_LINE_INSERT(UX_TRACE_HOST_CLASS_HID_MOUSE_DEACTIVATE, hid, hid_client -> ux_host_class_hid_client_local_instance, 0, 0, UX_TRACE_HOST_CLASS_EVENTS, 0, 0)
86
87
    /* We may need to inform the application
88
       if a function has been programmed in the system structure.  */
89
34
    if (_ux_system_host -> ux_system_host_change_function != UX_NULL)
90
    {
91
92
        /* Call system change function.  */
93
29
        _ux_system_host ->  ux_system_host_change_function(UX_HID_CLIENT_REMOVAL, hid -> ux_host_class_hid_class, (VOID *) hid_client);
94
    }
95
96
    /* Now free the instance memory.  */
97
34
    _ux_utility_memory_free(hid_client -> ux_host_class_hid_client_local_instance);
98
99
    /* Return completion status.  */
100
34
    return(status);
101
}
102