Tech Support > Microsoft Windows > Drivers > kernel mode proxy driver
kernel mode proxy driver
Posted by Erik HG on May 11th, 2008


I need a kernel-mode proxy driver to control Bluetooth SCO (which only takes
internal kernel mode ioctl). Does anyone have an example that they can point
me towards? I would normally hack it out myself, but I only have a day
(until Monday) to figure it out.

Thanks,
-Erik

Posted by Windows Bluetooth Technology Team on May 12th, 2008


Bluetooth SCO was designed to be very similar to the Bluetooth L2CAP from
interface point of view. To receive a remote SCO connection, you first
register a 'server' with BRB_SCO_REGISTER_SERVER (to clear the registration
you call BRB_UNREGISTER_SERVER). You answer the remote connection with
BRB_SCO_OPEN_CHANNEL_RESPONSE. If you need to implement the client side of
SCO, you just need to use the BRB_SCO_OPEN_CHANNEL with the right parameters
for the connection you are making (voice settings, etc, please see Bluetooth
Spec for more info on this). At this point with the returned handle you can
start sending data via the BRB_SCO_TRANSFER. To understand if SCO is
supported in the system, I suggest using the BRB_SCO_GET_SYSTEM_INFO, which
also returns other useful information. Remember also to use the
BRB_SCO_FLUSH_CHANNEL to flush out any pending I/O packets before destroying
connections.

Remember to create a SCO connection after you already have a HCI (host
controller interface) link in place. The HCI link is created as a side
effect of creating a L2CAP communication link (control channel) between the
two devices (please see headset, hand-free profile for proper handshake).



"Erik HG" <ErikHG@discussions.microsoft.com> wrote in message
news:3F866AB6-9C9F-4071-9700-671C3B9FA7EC@microsoft.com...


Posted by Doron Holan [MSFT] on May 12th, 2008


6001.18000\src\bth\bthecho is an L2CAP sample. you can easily replace the
l2cap BRBs with SCO.

d

--
Please do not send e-mail directly to this alias. this alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.


"Erik HG" <ErikHG@discussions.microsoft.com> wrote in message
news:3F866AB6-9C9F-4071-9700-671C3B9FA7EC@microsoft.com...

Posted by Erik HG on May 12th, 2008


Yes, unfortunately that is what I figured out myself. I am 90% done with
porting bthecho at this point (two allnighters in a row). I am definately
going to have to do a codeguru article on this one.

Who came up with the terrible design spec of making the SCO/L2CAP support
only via kernel mode drivers? MS created a beautiful BT interface with
Vista, but really messed up on this part of it!

-Erik

"Doron Holan [MSFT]" wrote:


Posted by Windows Bluetooth Technology Team on May 12th, 2008


If you look at USB, you will see a lot of similarities. Initially this
L2CAP/SCO interface was not supposed to be public; originally the idea was
to provide all the necessary kernel plumbing and let developers further
enhance Bluetooth via the winsock interface. But for Vista developers
wanted more control and a way to write their own kernel Bluetooth drivers
(for example: audio drivers). Thus we simply exposed this interface to
everyone. I'm pretty sure the further direction is to expose this
functionality to user mode (much like WinUSB for USB), but this is a future
project which doesn't have a target date yet.





"Erik HG" <ErikHG@discussions.microsoft.com> wrote in message
news:37809E3C-428D-4384-B978-6567273CA252@microsoft.com...


Posted by Maxim S. Shatskih on May 12th, 2008


Is the Bluetooth bus driver a client of BT WinSock/TDI interface?

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com


Posted by Erik HG on May 13th, 2008



Now, of course, since I have my proxy driver written, I need to know what
some of the parameters for BRB_SCO_OPEN_CHANNEL.

1. Transmit Bandwidth?
2. Receive Bandwidth?
3. PacketType - SCO_HV1 or what?
4. Can ContentFormat be anything but SCO_VS_SETTING_DEFAULT? Of course I
want to crank it to the 16bit bandwidth.
5. Can the Callback Parameter be NULL?
6. What reference object? How are objects created in a kernel driver? I
see all sorts of routines for handling these objects, but no way of creating
them.

Thanks,
-Erik

Posted by Doron Holan [MSFT] on May 13th, 2008


not the bus itself. rfcomm.sys is a TDI provider.

d

--
Please do not send e-mail directly to this alias. this alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.


"Maxim S. Shatskih" <maxim@storagecraft.com> wrote in message
news:OM$b1tHtIHA.4912@TK2MSFTNGP03.phx.gbl...

Posted by Erik HG on May 13th, 2008



Arrgh! I just discovered that the proxy driver does TOO MUCH! It forces
the user to access the audio directly.

ALL I WANT IS A WAY TO CREATE A SCO CONNECTION WITH MY SPP CONNECTION!
Isn't there any way to do this? Widcomm SDK lets me do it easily,
unfortunately it doesn't support Vista.

I need to:
A. Connect via BT serial port. (easily done)
B. Connect on that channel via SCO and have it use the BthAudio driver like
a Headset or Audio Gateway. (so far not possible)

If I connect my device like a Headset or Audio Gateway, there is no way to
get the SPP data! The exact oppisite problem.

Anyone?

-Erik

Posted by Maxim S. Shatskih on May 13th, 2008


Am I correct that BT stack architecture is nearly the same as IrDA stack -
hardware driver the lowest as NDIS miniport using special NDIS family, protocol
logic driver above as NDIS protocol of this family and also TDI provider,
particular class drivers like serial as TDI clients?

Is the bus driver above rfcomm or below?

Can I write a user-mode-only code, using BT WinSock, to, say, send audio
stream to the BT stereo headphones?

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com

"Doron Holan [MSFT]" <doronh@online.microsoft.com> wrote in message
news:%23gaBR7KtIHA.5892@TK2MSFTNGP02.phx.gbl...

Posted by Doron Holan [MSFT] on May 13th, 2008


the bt stack is not much like irda. the only place that NDIS comes to play
is for the PAN profile. rfcomm is enumerated by the bthbus. you can write
user mode code using sockets to access RFCOMM connections only. no audio
(which is SCO) or raw L2CAP

d

--
Please do not send e-mail directly to this alias. this alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.


"Maxim S. Shatskih" <maxim@storagecraft.com> wrote in message
news:ukE1zNOtIHA.1772@TK2MSFTNGP03.phx.gbl...

Posted by Erik HG on May 13th, 2008



Maxim,

That is what started this thread. You cannot access SCO (Audio) without
doing so from a kernel mode driver.

-Erik

"Doron Holan [MSFT]" wrote:

Posted by RedOctober on May 16th, 2008


Btw, Could someone please tell me where to get bthecho? From the discussion
thread I know Erik HG had been gotten the one.

-RedOctober

"Erik HG" wrote:

Posted by RedOctober on May 16th, 2008


Please ignore the last post of mine, I've gotten wdk 6001 from connect
web-site.

-RedOctober

"RedOctober" wrote: