1
10
13
14
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
117
118
119
120
121
122
123
124
125
126
127
128
129
130
136
137
138
139
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
...
...
...
#define UX_SOURCE_CODE
#include "ux_api.h"
#include "ux_host_class_hid.h"
#include "ux_host_stack.h"
...
...
UINT _ux_host_class_hid_field_decompress(UX_HOST_CLASS_HID_FIELD *hid_field, UCHAR *report_buffer, UX_HOST_CLASS_HID_CLIENT_REPORT *client_report)
{
ULONG field_report_count;
ULONG field_report_size;
ULONG data_offset_byte;
ULONG data_offset_bit;
ULONG data_offset_bit_in_report;
ULONG field_value;
ULONG field_value_bit_shifting;
ULONG field_usage;
ULONG report_content;
data_offset_byte = (hid_field -> ux_host_class_hid_field_report_offset >> 3);
data_offset_bit = hid_field -> ux_host_class_hid_field_report_offset & 7;
/* ... */
for (field_report_count = 0; field_report_count < hid_field -> ux_host_class_hid_field_report_count; field_report_count++)
{
field_report_size = hid_field -> ux_host_class_hid_field_report_size;
data_offset_bit_in_report = data_offset_bit;
field_value = 0;
field_value_bit_shifting = 0;
while (field_report_size-- != 0)
{
/* ... */
report_content = (ULONG) *(report_buffer + data_offset_byte + (data_offset_bit_in_report >> 3));
field_value |= ((report_content >> (data_offset_bit_in_report & 7)) & 1) << field_value_bit_shifting;
data_offset_bit_in_report++;
field_value_bit_shifting++;
}while (field_report_size-- != 0) { ... }
if (hid_field -> ux_host_class_hid_field_value & UX_HOST_CLASS_HID_ITEM_VARIABLE)
{
field_usage = *(hid_field -> ux_host_class_hid_field_usages + field_report_count);
}if (hid_field -> ux_host_class_hid_field_value & UX_HOST_CLASS_HID_ITEM_VARIABLE) { ... }
else
{
/* ... */
field_usage = hid_field -> ux_host_class_hid_field_usage_min + (ULONG)((SLONG)field_value - hid_field -> ux_host_class_hid_field_logical_min);
field_usage |= (hid_field -> ux_host_class_hid_field_usage_page << 16);
}else { ... }
*(client_report -> ux_host_class_hid_client_report_buffer + client_report -> ux_host_class_hid_client_report_actual_length) = field_usage;
client_report -> ux_host_class_hid_client_report_actual_length++;
*(client_report -> ux_host_class_hid_client_report_buffer + client_report -> ux_host_class_hid_client_report_actual_length) = field_value;
client_report -> ux_host_class_hid_client_report_actual_length++;
data_offset_bit += hid_field -> ux_host_class_hid_field_report_size;
}for (field_report_count = 0; field_report_count < hid_field -> ux_host_class_hid_field_report_count; field_report_count++) { ... }
return(UX_SUCCESS);
}{ ... }