Skip to content

Commit ba4b5eb

Browse files
authored
Merge pull request #234 from ayedm1/hid_device_class_cleanup
Device HID class clean-up
2 parents 1249abe + becc8d0 commit ba4b5eb

20 files changed

+298
-280
lines changed

common/usbx_device_classes/inc/ux_device_class_hid.h

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/***************************************************************************
2-
* Copyright (c) 2024 Microsoft Corporation
3-
*
2+
* Copyright (c) 2024 Microsoft Corporation
3+
*
44
* This program and the accompanying materials are made available under the
55
* terms of the MIT License which is available at
66
* https://opensource.org/licenses/MIT.
7-
*
7+
*
88
* SPDX-License-Identifier: MIT
99
**************************************************************************/
1010

@@ -14,7 +14,7 @@
1414
/** */
1515
/** USBX Component */
1616
/** */
17-
/** HID Class */
17+
/** Device HID Class */
1818
/** */
1919
/**************************************************************************/
2020
/**************************************************************************/
@@ -389,7 +389,7 @@ typedef struct UX_SLAVE_CLASS_HID_PARAMETER_STRUCT
389389

390390
/* Define HID Class function prototypes. */
391391
UINT _ux_device_class_hid_descriptor_send(UX_SLAVE_CLASS_HID *hid, ULONG descriptor_type,
392-
ULONG request_index, ULONG host_length);
392+
ULONG request_index, ULONG host_length);
393393
UINT _ux_device_class_hid_activate(UX_SLAVE_CLASS_COMMAND *command);
394394
UINT _ux_device_class_hid_deactivate(UX_SLAVE_CLASS_COMMAND *command);
395395
UINT _ux_device_class_hid_control_request(UX_SLAVE_CLASS_COMMAND *command);
@@ -398,35 +398,35 @@ VOID _ux_device_class_hid_interrupt_thread(ULONG hid_class);
398398
UINT _ux_device_class_hid_initialize(UX_SLAVE_CLASS_COMMAND *command);
399399
UINT _ux_device_class_hid_uninitialize(UX_SLAVE_CLASS_COMMAND *command);
400400
UINT _ux_device_class_hid_event_set(UX_SLAVE_CLASS_HID *hid,
401-
UX_SLAVE_CLASS_HID_EVENT *hid_event);
401+
UX_SLAVE_CLASS_HID_EVENT *hid_event);
402402
UINT _ux_device_class_hid_event_check(UX_SLAVE_CLASS_HID *hid,
403403
UX_DEVICE_CLASS_HID_EVENT **hid_event);
404404
VOID _ux_device_class_hid_event_free(UX_SLAVE_CLASS_HID *hid);
405405
UINT _ux_device_class_hid_event_get(UX_SLAVE_CLASS_HID *hid,
406-
UX_SLAVE_CLASS_HID_EVENT *hid_event);
406+
UX_SLAVE_CLASS_HID_EVENT *hid_event);
407407
UINT _ux_device_class_hid_report_set(UX_SLAVE_CLASS_HID *hid, ULONG descriptor_type,
408-
ULONG request_index, ULONG host_length);
408+
ULONG request_index, ULONG host_length);
409409
UINT _ux_device_class_hid_report_get(UX_SLAVE_CLASS_HID *hid, ULONG descriptor_type,
410-
ULONG request_index, ULONG host_length);
410+
ULONG request_index, ULONG host_length);
411411

412-
UINT _ux_device_class_hid_tasks_run(VOID *class_instance);
412+
UINT _ux_device_class_hid_tasks_run(VOID *hid_instance);
413413

414414
UINT _ux_device_class_hid_read(UX_SLAVE_CLASS_HID *hid,
415415
UCHAR *buffer, ULONG requested_length,
416416
ULONG *actual_length);
417417

418418
VOID _ux_device_class_hid_receiver_thread(ULONG hid_class);
419419
UINT _ux_device_class_hid_receiver_initialize(UX_SLAVE_CLASS_HID *hid,
420-
UX_SLAVE_CLASS_HID_PARAMETER *parameter,
421-
UX_DEVICE_CLASS_HID_RECEIVER **receiver);
420+
UX_SLAVE_CLASS_HID_PARAMETER *parameter,
421+
UX_DEVICE_CLASS_HID_RECEIVER **receiver);
422422
VOID _ux_device_class_hid_receiver_uninitialize(UX_DEVICE_CLASS_HID_RECEIVER *receiver);
423423
UINT _ux_device_class_hid_receiver_event_get(UX_SLAVE_CLASS_HID *hid,
424-
UX_DEVICE_CLASS_HID_RECEIVED_EVENT *event);
424+
UX_DEVICE_CLASS_HID_RECEIVED_EVENT *event);
425425
UINT _ux_device_class_hid_receiver_event_free(UX_SLAVE_CLASS_HID *hid);
426426

427427
UINT _ux_device_class_hid_read_run(UX_SLAVE_CLASS_HID *hid,
428-
UCHAR *buffer, ULONG requested_length,
429-
ULONG *actual_length);
428+
UCHAR *buffer, ULONG requested_length,
429+
ULONG *actual_length);
430430
UINT _ux_device_class_hid_receiver_tasks_run(UX_SLAVE_CLASS_HID *hid);
431431

432432

@@ -436,16 +436,16 @@ UINT _uxe_device_class_hid_event_set(UX_SLAVE_CLASS_HID *hid,
436436
UINT _uxe_device_class_hid_event_get(UX_SLAVE_CLASS_HID *hid,
437437
UX_SLAVE_CLASS_HID_EVENT *hid_event);
438438
UINT _uxe_device_class_hid_read(UX_SLAVE_CLASS_HID *hid,
439-
UCHAR *buffer, ULONG requested_length,
440-
ULONG *actual_length);
439+
UCHAR *buffer, ULONG requested_length,
440+
ULONG *actual_length);
441441
UINT _uxe_device_class_hid_read_run(UX_SLAVE_CLASS_HID *hid,
442-
UCHAR *buffer, ULONG requested_length,
443-
ULONG *actual_length);
442+
UCHAR *buffer, ULONG requested_length,
443+
ULONG *actual_length);
444444
UINT _uxe_device_class_hid_receiver_initialize(UX_SLAVE_CLASS_HID *hid,
445-
UX_SLAVE_CLASS_HID_PARAMETER *parameter,
446-
UX_DEVICE_CLASS_HID_RECEIVER **receiver);
445+
UX_SLAVE_CLASS_HID_PARAMETER *parameter,
446+
UX_DEVICE_CLASS_HID_RECEIVER **receiver);
447447
UINT _uxe_device_class_hid_receiver_event_get(UX_SLAVE_CLASS_HID *hid,
448-
UX_DEVICE_CLASS_HID_RECEIVED_EVENT *event);
448+
UX_DEVICE_CLASS_HID_RECEIVED_EVENT *event);
449449
UINT _uxe_device_class_hid_receiver_event_free(UX_SLAVE_CLASS_HID *hid);
450450

451451

@@ -493,4 +493,4 @@ UINT _uxe_device_class_hid_receiver_event_free(UX_SLAVE_CLASS_HID *hid);
493493
}
494494
#endif
495495

496-
#endif
496+
#endif /* UX_DEVICE_CLASS_HID_H */

common/usbx_device_classes/src/ux_device_class_hid_activate.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
/***************************************************************************
2-
* Copyright (c) 2024 Microsoft Corporation
3-
*
2+
* Copyright (c) 2024 Microsoft Corporation
3+
*
44
* This program and the accompanying materials are made available under the
55
* terms of the MIT License which is available at
66
* https://opensource.org/licenses/MIT.
7-
*
7+
*
88
* SPDX-License-Identifier: MIT
99
**************************************************************************/
1010

11+
12+
/**************************************************************************/
1113
/**************************************************************************/
1214
/** */
1315
/** USBX Component */

common/usbx_device_classes/src/ux_device_class_hid_control_request.c

Lines changed: 38 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
/***************************************************************************
2-
* Copyright (c) 2024 Microsoft Corporation
3-
*
2+
* Copyright (c) 2024 Microsoft Corporation
3+
*
44
* This program and the accompanying materials are made available under the
55
* terms of the MIT License which is available at
66
* https://opensource.org/licenses/MIT.
7-
*
7+
*
88
* SPDX-License-Identifier: MIT
99
**************************************************************************/
1010

11+
1112
/**************************************************************************/
1213
/**************************************************************************/
13-
/** */
14-
/** USBX Component */
14+
/** */
15+
/** USBX Component */
1516
/** */
1617
/** Device HID Class */
1718
/** */
@@ -28,44 +29,44 @@
2829
#include "ux_device_stack.h"
2930

3031

31-
/**************************************************************************/
32-
/* */
33-
/* FUNCTION RELEASE */
34-
/* */
35-
/* _ux_device_class_hid_control_request PORTABLE C */
32+
/**************************************************************************/
33+
/* */
34+
/* FUNCTION RELEASE */
35+
/* */
36+
/* _ux_device_class_hid_control_request PORTABLE C */
3637
/* 6.1.12 */
3738
/* AUTHOR */
3839
/* */
3940
/* Chaoqiong Xiao, Microsoft Corporation */
4041
/* */
4142
/* DESCRIPTION */
42-
/* */
43-
/* This function manages the based sent by the host on the control */
44-
/* endpoints with a CLASS or VENDOR SPECIFIC type. */
45-
/* */
46-
/* INPUT */
47-
/* */
48-
/* hid Pointer to hid class */
49-
/* */
50-
/* OUTPUT */
51-
/* */
52-
/* None */
53-
/* */
54-
/* CALLS */
55-
/* */
56-
/* _ux_device_stack_transfer_request Transfer request */
43+
/* */
44+
/* This function manages the based sent by the host on the control */
45+
/* endpoints with a CLASS or VENDOR SPECIFIC type. */
46+
/* */
47+
/* INPUT */
48+
/* */
49+
/* command Pointer to hid command */
50+
/* */
51+
/* OUTPUT */
52+
/* */
53+
/* None */
54+
/* */
55+
/* CALLS */
56+
/* */
57+
/* _ux_device_stack_transfer_request Transfer request */
5758
/* _ux_device_class_hid_report_get Process Get_Report request */
5859
/* _ux_device_class_hid_report_set Process Set_Report request */
5960
/* _ux_device_class_hid_descriptor_send Send requested descriptor */
60-
/* */
61-
/* CALLED BY */
62-
/* */
61+
/* */
62+
/* CALLED BY */
63+
/* */
6364
/* HID Class */
64-
/* */
65-
/* RELEASE HISTORY */
66-
/* */
67-
/* DATE NAME DESCRIPTION */
68-
/* */
65+
/* */
66+
/* RELEASE HISTORY */
67+
/* */
68+
/* DATE NAME DESCRIPTION */
69+
/* */
6970
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
7071
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
7172
/* prefixed UX to MS_TO_TICK, */
@@ -119,10 +120,10 @@ UX_SLAVE_CLASS_HID *hid;
119120

120121
/* Duration - upper byte of wValue. */
121122
duration = *(transfer_request -> ux_slave_transfer_request_setup + UX_SETUP_VALUE + 1);
122-
123+
123124
/* Get the class container. */
124125
class_ptr = command -> ux_slave_class_command_class_ptr;
125-
126+
126127
/* Get the storage instance from this class container. */
127128
hid = (UX_SLAVE_CLASS_HID *) class_ptr -> ux_slave_class_instance;
128129

@@ -149,8 +150,8 @@ UX_SLAVE_CLASS_HID *hid;
149150

150151
/* Send the requested descriptor to the host. */
151152
_ux_device_class_hid_descriptor_send(hid, request_value, request_index, request_length);
152-
break;
153-
153+
break;
154+
154155
case UX_DEVICE_CLASS_HID_COMMAND_GET_IDLE:
155156
case UX_DEVICE_CLASS_HID_COMMAND_SET_IDLE:
156157

common/usbx_device_classes/src/ux_device_class_hid_deactivate.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
* SPDX-License-Identifier: MIT
99
**************************************************************************/
1010

11+
1112
/**************************************************************************/
1213
/**************************************************************************/
1314
/** */

0 commit comments

Comments
 (0)