Subject: Re: Bluetooth module on com(4)
To: KIYOHARA Takashi <kiyohara@kk.iij4u.or.jp>
From: Iain Hibbert <plunky@rya-online.net>
List: tech-kern
Date: 12/03/2006 18:45:20
On Mon, 4 Dec 2006, KIYOHARA Takashi wrote:

> Our gumstix (evbarm) has Bluetooth module on com(4).  I want this driver.
> However com(4) don't attach on itself.
> How should we attach it the driver of such a bluetooth module?  For
> instance, should I make it to the pseudo device driver?
>
>   (e.g.)
>   pseudo-device    btm	   1
>   bthub* at btm?
>
> And, the daemon (btuartd?) that reads and writes com(4) and btm is
> necessary.
>
> Is it best idea?

I think something like that - did you look at what FreeBSD does?  They use
a 'h4' line discipline and a hcseriald program that sets it up on a com
port with a netgraph node.

It should be possible to do similar but attach a pseudo device instance
when the line discipline is opened, and the data does not need to pass
through userland but can go directly through the line discipline to the
bluetooth stack (the btuartd is just a place holder). If the line
discipline is closed, the pseudo device is detached and all connections
through it are killed automatically.

I would adapt the line discipline code from FreeBSD (in
sys/netgraph/bluetooth/drivers/h4) and combine it with the bt3c_transmit
and bt3c_receive routines (which are basically serial access) to interface
with our stack.

iain

PS I think naming would be better 'pseudo-device btXXX' & 'btXXXd' whether
XXX is h4 or uart or something else (I think its Bluetooth H4 spec you
need to refer to)