Subject: Bluetooth
To: Jun-ichiro itojun Hagino <itojun@itojun.org>
From: Dave Sainty <dave@dtsp.co.nz>
List: tech-kern
Date: 01/02/2004 02:54:40
Jun-ichiro itojun Hagino writes:

> > > > True, that'd be a nice round number.
> > >
> > > 	now, it looks that bluetooth device need a major number (bthci0).
> > > 	what should be the name for the device node?
> > > 	(i have no idea how to use bthci0...)
> > 
> > Shouldn't we figure out how bluetooth devices will work first?
> > 
> > I suspect that bluetooth will be more like usb, and there will be a
> > number of different things that will attach to a bluetooth bus.
> 
> 	i gess so, but i'm seeing cdevsw in bthci driver code (w/ read and
> 	write ops)

Yes...

I added the device support because it's functional and provides
complete access to the bluetooth device.  However it's all very
low-level (HCI), so it isn't really in a position to be used very
well.  I wanted to get it in the tree so that if others were also
trying to play with Bluetooth they would have a starting point.

Unfortunately I haven't had much time to work on this, so it has
stayed in this position.  I had hoped to have more time to devote to
it, but didn't manage to find as much of that as intended...

The device (if created) can be used fairly simply by the diagnostics
programs available from various Bluetooth stack efforts -
open("/dev/bthci0") is equivalent to an HCI-level socket (send/recv ->
write/read).

The FreeBSD stack uses a sockets-based interface, and reading the
Bluetooth specification you really get the idea that the protocol was
designed to map conveniently to sockets.  I've done some work on this,
but have committed none of it...

The FreeBSD stack author is looking at removing the Netgraph
dependency from their stack.  If that work was completed it would be a
much simpler port to NetBSD.

But with a sockets-style interface the /dev/bthci0 device would go.

Cheers,

Dave


Add a bthci major device to the tree

--- src/sys/arch/i386/conf/majors.i386.orig	Thu Dec 26 18:55:58 2002
+++ src/sys/arch/i386/conf/majors.i386	Sat Jan  4 19:07:24 2003
@@ -96,4 +96,5 @@
 device-major	rd		char 105 block 22	rd
 device-major	ct		char 106 block 23	ct
 device-major	mt		char 107 block 24	mt
+device-major	bthci		char 108		bthci
 
--- src/etc/MAKEDEV.tmpl.orig	Sat Jan  4 19:17:39 2003
+++ src/etc/MAKEDEV.tmpl	Sat Jan  4 19:18:35 2003
@@ -106,2 +106,3 @@
 #	bpf*	packet filter
+#	bthci*	Bluetooth
 #	cfs*	Coda file system device
@@ -1002,6 +1004,11 @@
 
 veriexec)
 	mkdev veriexec c %veriexec_chr% 0 644
 	;;
+
+bthci*)
+	unit=${i#bthci}
+	mkdev bthci$unit c %bthci_chr% $unit
+	;;
 
 ttyv*)
--- src/etc/etc.i386/MAKEDEV.conf.orig	Mon Oct 20 08:07:27 2003
+++ src/etc/etc.i386/MAKEDEV.conf	Sat Nov 15 22:51:17 2003
@@ -32,6 +32,7 @@
 	makedev scsibus0 scsibus1 scsibus2 scsibus3
 	makedev sysmon
 	makedev bktr
+	makedev bthci0
 	makedev ttyCZ0 ttyCY0
 	makedev agp0
 	makedev pci0 pci1 pci2 pci3 pci4 pci5 pci6 pci7