1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
|
/*++
Copyright (c) Microsoft Corporation All Rights Reserved
Module Name:
bthhfpmictopo.cpp
Abstract:
Implementation of topology miniport for the mic (external: headphone).
--*/
#ifdef SYSVAD_BTH_BYPASS
#pragma warning (disable : 4127)
#include <sysvad.h>
#include "simple.h"
#include "mintopo.h"
#include "bthhfptopo.h"
#include "bthhfpmictopo.h"
#include "bthhfpmictoptable.h"
//=============================================================================
#pragma code_seg("PAGE")
NTSTATUS
PropertyHandler_BthHfpMicTopoFilter
(
_In_ PPCPROPERTY_REQUEST PropertyRequest
)
/*++
Routine Description:
Redirects property request to miniport object
Arguments:
PropertyRequest -
Return Value:
NT status code.
--*/
{
PAGED_CODE();
ASSERT(PropertyRequest);
DPF_ENTER(("[PropertyHandler_BthHfpMicTopoFilter]"));
// PropertryRequest structure is filled by portcls.
// MajorTarget is a pointer to miniport object for miniports.
//
NTSTATUS ntStatus = STATUS_INVALID_DEVICE_REQUEST;
if (IsEqualGUIDAligned(*PropertyRequest->PropertyItem->Set, KSPROPSETID_Jack))
{
switch(PropertyRequest->PropertyItem->Id)
{
case KSPROPERTY_JACK_DESCRIPTION:
ntStatus = PropertyHandler_BthHfpJackDescription(
PropertyRequest,
ARRAYSIZE(BthHfpMicJackDescriptions),
BthHfpMicJackDescriptions);
break;
case KSPROPERTY_JACK_DESCRIPTION2:
ntStatus = PropertyHandler_BthHfpJackDescription2(
PropertyRequest,
ARRAYSIZE(BthHfpMicJackDescriptions),
BthHfpMicJackDescriptions);
break;
case KSPROPERTY_JACK_CONTAINERID:
ntStatus = PropertyHandler_BthHfpJackContainerId(
PropertyRequest,
ARRAYSIZE(BthHfpMicJackDescriptions),
BthHfpMicJackDescriptions);
break;
}
}
else if (IsEqualGUIDAligned(*PropertyRequest->PropertyItem->Set, KSPROPSETID_BtAudio))
{
switch(PropertyRequest->PropertyItem->Id)
{
case KSPROPERTY_ONESHOT_RECONNECT:
ntStatus = PropertyHandler_BthHfpOneShotReconnect(PropertyRequest);
break;
case KSPROPERTY_ONESHOT_DISCONNECT:
ntStatus = PropertyHandler_BthHfpOneDisconnect(PropertyRequest);
break;
}
}
return ntStatus;
} // PropertyHandler_BthHfpMicTopoFilter
//=============================================================================
#pragma code_seg("PAGE")
NTSTATUS
PropertyHandler_BthHfpMicVolumeLevel
(
_In_ PPCPROPERTY_REQUEST PropertyRequest
)
/*++
Routine Description:
Handles ( KSPROPSETID_Audio, KSPROPERTY_AUDIO_VOLUMELEVEL )
Arguments:
PropertyRequest -
Return Value:
NT status code.
--*/
{
PAGED_CODE();
ASSERT(PropertyRequest);
DPF_ENTER(("[PropertyHandler_BthHfpMicVolumeLevel]"));
NTSTATUS ntStatus = STATUS_INVALID_DEVICE_REQUEST;
PCMiniportTopology miniport = (PCMiniportTopology)PropertyRequest->MajorTarget;
PSIDEBANDDEVICECOMMON bthHfpDevice = NULL;
ULONG channel = (ULONG)-1;
bthHfpDevice = miniport->GetSidebandDevice(); // weak ref.
ASSERT(bthHfpDevice != NULL);
if (bthHfpDevice->IsVolumeSupported(miniport->m_DeviceType) == FALSE)
{
ntStatus = miniport->PropertyHandlerGeneric(PropertyRequest);
}
else if (PropertyRequest->Verb & KSPROPERTY_TYPE_BASICSUPPORT)
{
ntStatus = PropertyHandler_BthHfpVolumeLevel_BasicSupport(PropertyRequest);
}
else if (PropertyRequest->InstanceSize >= sizeof(ULONG))
{
// Instance is the channel #, Bluetooth HFP supports mono streams.
channel = *(PULONG(PropertyRequest->Instance));
if (channel == 0)
{
ULONG cbNeeded = sizeof(LONG);
if (PropertyRequest->ValueSize == 0)
{
PropertyRequest->ValueSize = cbNeeded;
ntStatus = STATUS_BUFFER_OVERFLOW;
}
else if (PropertyRequest->ValueSize < cbNeeded)
{
ntStatus = STATUS_BUFFER_TOO_SMALL;
}
else
{
LONG* volume = (LONG*)PropertyRequest->Value;
if (PropertyRequest->Verb & KSPROPERTY_TYPE_GET)
{
ntStatus = bthHfpDevice->GetVolume(eBthHfpMicDevice, channel, volume);
}
else if (PropertyRequest->Verb & KSPROPERTY_TYPE_SET)
{
ntStatus = bthHfpDevice->SetVolume(eBthHfpMicDevice, *volume, channel);
}
}
}
}
return ntStatus;
}
//=============================================================================
#pragma code_seg("PAGE")
NTSTATUS
PropertyHandler_BthHfpMicTopoNode
(
_In_ PPCPROPERTY_REQUEST PropertyRequest
)
/*++
Routine Description:
Redirects property request to miniport object
Arguments:
PropertyRequest -
Return Value:
NT status code.
--*/
{
PAGED_CODE();
ASSERT(PropertyRequest);
DPF_ENTER(("[PropertyHandler_BthHfpMicTopoNode]"));
// PropertryRequest structure is filled by portcls.
// MajorTarget is a pointer to miniport object for miniports.
//
NTSTATUS ntStatus = STATUS_INVALID_DEVICE_REQUEST;
if (IsEqualGUIDAligned(*PropertyRequest->PropertyItem->Set, KSPROPSETID_Audio))
{
if (PropertyRequest->PropertyItem->Id == KSPROPERTY_AUDIO_VOLUMELEVEL)
{
ntStatus = PropertyHandler_BthHfpMicVolumeLevel(PropertyRequest);
}
}
return ntStatus;
} // PropertyHandler_BthHfpMicTopoFilter
//=============================================================================
#pragma code_seg()
NTSTATUS
PropertyHandler_BthHfpMicTopoNodeEvent
(
_In_ PPCEVENT_REQUEST EventRequest
)
{
ASSERT(EventRequest);
DPF_ENTER(("[PropertyHandler_BthHfpMicTopoNodeEvent]"));
// Validate the node.
if (EventRequest->Node != KSNODE_TOPO_VOLUME)
return STATUS_INVALID_PARAMETER;
return PropertyHandler_BthHfpTopoNodeEvent(EventRequest);
}
//=============================================================================
#pragma code_seg()
NTSTATUS
PropertyHandler_BthHfpMicTopoFilterEvent
(
_In_ PPCEVENT_REQUEST EventRequest
)
{
ASSERT(EventRequest);
DPF_ENTER(("[PropertyHandler_BthHfpMicTopoFilterEvent]"));
return PropertyHandler_BthHfpTopoNodeEvent(EventRequest);
}
#pragma code_seg()
#endif // SYSVAD_BTH_BYPASS
|