Home | History | Annotate | only in /src/sys/dev/bluetooth
History log of /src/sys/dev/bluetooth
RevisionDateAuthorComments
 1.7 10-Aug-2017  nat Add support for btuart h5 3-wire protocol.
 1.6 15-Apr-2008  plunky branches: 1.6.48; 1.6.68;
some changes to serial bluetooth host controller interfaces

btuartd(8) should be named btattach(8) for consistency
with other parts of NetBSD

make btattach(8) a single-use tool for less complexity

device specicific initialisation (from btuart(4)) is carried
out prior to activating the line discipline (in btattach(8)),
which simplifies the API somewhat and means that the user
tool and the kernel do not need to be kept in sync.

btuart(4) driver is much reduced; naming is made consistent
and all tsleep() and delay() are removed to userland
 1.5 30-Sep-2007  kiyohara branches: 1.5.18;
Add bcsp(4). However, it is debuging state.
 1.4 20-Feb-2007  briggs branches: 1.4.4; 1.4.16; 1.4.18; 1.4.20;
Install sys/dev/bluetooth/btuart.h.
Descend into and build/install usr.sbin/btuartd.
Install etc/rc.d/btuartd.
 1.3 10-Sep-2006  plunky branches: 1.3.6;
update to bluetooth device attachment:

remove pseudo-device btdev(4) and inherent limitations

add bthub(4) which autoconfigures at bluetooth controllers as they
are enabled. bluetooth devices now attach here.

btdevctl(8) and its cache is updated to handle new semantics

etc/rc.d/btdevctl is updated to configure devices from a list
in /etc/bluetooth/btdevctl.conf
 1.2 26-Jul-2006  tron branches: 1.2.2; 1.2.4; 1.2.6;
Bluetooth fixes by Iain Hibbert:
Remove bthset(4) device and add btsco(4) in its place. This is an
improved version which is not just for headsets, as it can receive
incoming connections (eg for Hands Free Profile). Update bthset(1)
control utlitiy to relate to new device.
 1.1 19-Jun-2006  gdamore branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8;
Initial import of bluetooth stack on behalf of Iain Hibbert. (plunky@,
NetBSD Foundation Membership still pending.) This stack was written by
Iain under sponsorship from Itronix Inc.

The stack includes support for rfcomm networking (networking via your
bluetooth enabled cell phone), hid devices (keyboards/mice), and headsets.

Drivers for both PCMCIA and USB bluetooth controllers are included.
 1.1.8.2 13-Jul-2006  gdamore Merge from HEAD.
 1.1.8.1 19-Jun-2006  gdamore file Makefile was added on branch gdamore-uart on 2006-07-13 17:49:22 +0000
 1.1.6.4 14-Sep-2006  yamt sync with head.
 1.1.6.3 11-Aug-2006  yamt sync with head
 1.1.6.2 26-Jun-2006  yamt sync with head.
 1.1.6.1 19-Jun-2006  yamt file Makefile was added on branch yamt-pdpolicy on 2006-06-26 12:50:37 +0000
 1.1.4.2 22-Jun-2006  chap Complete a sync sys/ with head.
 1.1.4.1 19-Jun-2006  chap file Makefile was added on branch chap-midi on 2006-06-22 03:39:48 +0000
 1.1.2.5 27-Oct-2007  yamt sync with head.
 1.1.2.4 26-Feb-2007  yamt sync with head.
 1.1.2.3 30-Dec-2006  yamt sync with head.
 1.1.2.2 21-Jun-2006  yamt sync with head.
 1.1.2.1 19-Jun-2006  yamt file Makefile was added on branch yamt-lazymbuf on 2006-06-21 15:02:45 +0000
 1.2.6.2 09-Sep-2006  rpaulo sync with head
 1.2.6.1 26-Jul-2006  rpaulo file Makefile was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:49:44 +0000
 1.2.4.1 18-Nov-2006  ad Sync with head.
 1.2.2.1 14-Sep-2006  riz Pull up following revision(s) (requested by plunky in ticket #161):
sys/dev/bluetooth/btdev.h: revision 1.4
distrib/sets/lists/comp/mi: revision 1.922
usr.sbin/postinstall/postinstall: revision 1.25
sys/netbt/hci_unit.c: revision 1.3
sys/netbt/hci_ioctl.c: revision 1.4
usr.sbin/sdpd/profile.c: revision 1.2
usr.sbin/btdevctl/btdevctl.c: revision 1.2
share/man/man4/Makefile: revision 1.405
distrib/sets/lists/man/mi: revision 1.930
distrib/sets/lists/etc/mi: revision 1.176
usr.sbin/sdpd/profile.c: revision 1.3
usr.sbin/btdevctl/btdevctl.c: revision 1.3
etc/MAKEDEV.tmpl: revision 1.62
distrib/sets/lists/base/mi: revision 1.650
usr.sbin/btdevctl/btdevctl.h: revision 1.2
usr.bin/sdpquery/sdpquery.1: revision 1.4
sys/netbt/rfcomm_session.c: revision 1.2
usr.sbin/btdevctl/btdevctl.8: revision 1.3
usr.bin/sdpquery/search.c: revision 1.2
usr.sbin/sdpd/Makefile: revision 1.2
sys/dev/bluetooth/Makefile: revision 1.3
usr.sbin/btdevctl/cfg.c: file removal
sys/netbt/files.netbt: revision 1.4
usr.sbin/btdevctl/sdp.c: revision 1.1
sys/dev/bluetooth/bthidev.c: revision 1.3
etc/bluetooth/Makefile: revision 1.3
sys/dev/pcmcia/files.pcmcia: revision 1.51
sys/dev/bluetooth/bthidev.c: revision 1.4
sys/dev/bluetooth/bthidev.h: revision 1.3
usr.sbin/btdevctl/dev.c: file removal
sys/dev/bluetooth/files.bluetooth: revision 1.10
sys/arch/i386/conf/GENERIC: revision 1.777
share/man/man4/ubt.4: revision 1.6
share/man/man4/bthub.4: revision 1.3
sys/netbt/hci.h: revision 1.5
sys/arch/i386/conf/GENERIC_LAPTOP: revision 1.202
lib/libsdp/sdp.h: revision 1.2
usr.sbin/btdevctl/print.c: revision 1.1
share/man/man4/bthidev.4: revision 1.5
share/man/man4/btdev.4: file removal
usr.sbin/btdevctl/print.c: revision 1.2
sys/arch/i386/conf/GENERIC_LAPTOP: revision 1.205
usr.sbin/btdevctl/Makefile: revision 1.2
sys/dev/usb/files.usb: revision 1.70
sys/netbt/l2cap_signal.c: revision 1.2
sys/netbt/hci_link.c: revision 1.4
sys/dev/bluetooth/bthub.c: revision 1.3
share/man/man4/btsco.4: revision 1.5
sys/netbt/hci_link.c: revision 1.5
share/man/man4/btdev.4: revision 1.4
sys/dev/bluetooth/btkbd.c: revision 1.3
sys/dev/bluetooth/btdev.c: file removal
sys/netbt/hci_event.c: revision 1.2
sys/dev/bluetooth/btsco.h: revision 1.2
etc/mtree/special: revision 1.101
sys/dev/bluetooth/btsco.c: revision 1.3
sys/conf/majors: revision 1.27
usr.sbin/sdpd/hf.c: revision 1.1
sys/dev/bluetooth/btsco.c: revision 1.4
share/man/man5/rc.conf.5: revision 1.107
sys/dev/bluetooth/btdev.c: revision 1.2
etc/rc.d/btdevctl: revision 1.2
usr.sbin/btdevctl/db.c: revision 1.1
etc/rc.d/btdevctl: revision 1.3
etc/bluetooth/btdevctl.conf: revision 1.1
usr.sbin/btdevctl/hid.c: file removal
sys/arch/i386/conf/GENERIC: revision 1.781
sys/dev/bluetooth/btdev.h: revision 1.3
Make btdev default count explicit
Fix typo in variable name
update to bluetooth device attachment:
remove pseudo-device btdev(4) and inherent limitations
add bthub(4) which autoconfigures at bluetooth controllers as they
are enabled. bluetooth devices now attach here.
btdevctl(8) and its cache is updated to handle new semantics
etc/rc.d/btdevctl is updated to configure devices from a list
in /etc/bluetooth/btdevctl.conf
also include service name in dictionary being sent to kernel.
(this is not used just yet, but it might be in the future and it will
be easier if we dont have to provide code to handle its absence)
clarify the CAVEAT section somewhat
Add service discovery support for the Handsfree profile
Replace static 'FreeBSD' string with operating system name gleaned
from uname(3)
Halt the callout on detach
btsco.c:
- sco_getopt(..., SO_SCO_MTU, ...) expects the address of a uint16_t,
not an int. So change sc_mtu's type to uint16_t.
- Try a little harder to ensure btsco_round_blocksize() does not
return zero. Prevents a subsequent panic in audio_init_ringbuffer().
from scw@
Endian issues:
hci_event.c:
- Convert memo->response.clock_offset to host-endian.
hci_ioctl.c:
- printf format tweak (size_t)
hci_link.c:
- Convert memo->response.clock_offset from host-endian.
- Tweak a DIAGNOSTIC message.
l2cap_signal.c:
- In l2cap_recv_config_req(), rp->scid is little-endian so make sure
we convert from host-endian.
from scw@
hci_link.c:
- In hci_link_free(), do not unlink items from a LIST queue within
a LIST_FOREACH() iterator.
rfcomm_session.c:
- In rfcomm_session_recv_mcc_nsc(), do not unlink items from a LIST
queue within a LIST_FOREACH() iterator.
from scw@
guard against a possible situation where the list of l2cap channels is changed
when the bluetooth code is not expecting it to be. During a disconnect, we can
detach the channel that is being disconnected, but its not really safe to detach
any others.
Print explicit 64-bit types using the format macros from int_fmtio.h.
Unbreaks the build for our LP64 ports, where "long long" typically is
not 64 bits.
 1.3.6.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.4.20.1 06-Oct-2007  yamt sync with head.
 1.4.18.1 06-Nov-2007  matt sync with HEAD
 1.4.16.1 02-Oct-2007  joerg Sync with HEAD.
 1.4.4.1 09-Oct-2007  ad Sync with head.
 1.5.18.1 02-Jun-2008  mjf Sync with HEAD.
 1.6.68.1 28-Aug-2017  skrll Sync with HEAD
 1.6.48.1 03-Dec-2017  jdolecek update from HEAD
 1.34 05-Jul-2024  rin sys: Drop redundant NULL check before m_freem(9)

m_freem(9) safely has accepted NULL argument at least since 4.2BSD:
https://www.tuhs.org/cgi-bin/utree.pl?file=4.2BSD/usr/src/sys/sys/uipc_mbuf.c

Compile-tested on amd64/ALL.

Suggested by knakahara@
 1.33 26-Oct-2022  riastradh branches: 1.33.8;
bcsp(4): Convert to ttylock/ttyunlock.
 1.32 28-Jun-2022  plunky remove KASSERT() checking for t_oproc at open since assigning this line
discipline to a pty may not have that set. Instead do a runtime check to
ensure that the function exists before calling it, as ttstart() handles it.

Same code in btuart.c, bcsp.c and bth5.c

Reported-by: syzbot+766981eef92a3cd0352a@syzkaller.appspotmail.com
 1.31 24-Jan-2019  knakahara Add comments about D_MPSAFE to functions called as struct linesw.l_ioctl.
 1.30 15-Aug-2016  maxv branches: 1.30.6; 1.30.14; 1.30.16;
Curious typo, found by mootja
 1.29 20-Aug-2015  christos include "ioconf.h" to get the 'void <driver>attach(int count);' prototype.
 1.28 08-May-2015  christos goto out for negative lengths too. Really this test should either be removed
or turned into a KASSERT(). From max.
 1.27 30-Apr-2015  christos Fix more memory leaks by changing the transmit routines to always free the
mbuf to send.
 1.26 27-Apr-2015  christos free mbuf on failure (Brainy)
 1.25 16-Nov-2014  ozaki-r branches: 1.25.2;
Replace callout_stop with callout_halt

In order to call callout_destroy for a callout safely, we have to ensure
the function of the callout is not running and pending. To do so, we should
use callout_halt, not callout_stop.

Discussed with martin@ and riastradh@.
 1.24 20-May-2014  rmind branches: 1.24.2;
netbt: rename some attach/detach functions to have _pcb suffix, so
we could use standard attach/detach naming for pr_usrreq functions.
No functional change.
 1.23 25-Feb-2014  pooka branches: 1.23.2;
Ensure that the top level sysctl nodes (kern, vfs, net, ...) exist before
the sysctl link sets are processed, and remove redundancy.

Shaves >13kB off of an amd64 GENERIC, not to mention >1k duplicate
lines of code.
 1.22 17-Oct-2013  christos add __USE for debugging variables
 1.21 02-Jun-2012  dsl branches: 1.21.2; 1.21.4;
Add some pre-processor magic to verify that the type of the data item
passed to sysctl_createv() actually matches the declared type for
the item itself.
In the places where the caller specifies a function and a structure
address (typically the 'softc') an explicit (void *) cast is now needed.
Fixes bugs in sys/dev/acpi/asus_acpi.c sys/dev/bluetooth/bcsp.c
sys/kern/vfs_bio.c sys/miscfs/syncfs/sync_subr.c and setting
AcpiGbl_EnableAmlDebugObject.
(mostly passing the address of a uint64_t when typed as CTLTYPE_INT).
I've test built quite a few kernels, but there may be some unfixed MD
fallout. Most likely passing &char[] to char *.
Also add CTLFLAG_UNSIGNED for unsiged decimals - not set yet.
 1.20 31-Jul-2011  uebayasi branches: 1.20.2; 1.20.8;
Put back #include "ioconf.h" per popular demand.
 1.19 25-May-2011  uebayasi Declare cfdrivers using extern rather than including ioconf.h.
 1.18 12-May-2009  cegger branches: 1.18.4; 1.18.6;
struct cfdata * -> cfdata_t, no functional changes intended.
 1.17 07-May-2009  elad Introduce actions/requests to handle authorization for ppp(4), sl(4),
strip(4), btuart(4) and bcsp(4) network interfaces and devices.

Mailing list reference:

http://mail-index.netbsd.org/tech-kern/2009/04/27/msg004955.html
 1.16 26-Apr-2009  elad Authorizing actions from the generic scope using a device scope wrapper
is a big no-no.

As painful as it is, use kauth_authorize_generic() for now.
 1.15 15-Mar-2009  cegger ansify function definitions
 1.14 11-Jan-2009  christos branches: 1.14.2;
merge christos-time_t
 1.13 12-Jun-2008  cegger branches: 1.13.4; 1.13.10;
use device_lookup_private to get softc
 1.12 22-Mar-2008  plunky branches: 1.12.2; 1.12.4; 1.12.6; 1.12.8;
remove unnecessary include file
 1.11 03-Dec-2007  plunky branches: 1.11.14;
initialize loop variable as loop is not necessarily undertaken
 1.10 28-Nov-2007  plunky Clean up the way that bluetooth drivers attach to the bluetooth stack,
to remove the frobbing that drivers must do in the hci_unit structure.

- driver provides a static const interface descriptor
- hci_unit is allocated by hci_attach() rather than part of softc
- statistics are compiled by driver and provided on request
- driver provides output methods and is responsible for output queue
- stack provides input methods and is responsible for input queue
- mutex is used to arbitrate device queue access
 1.9 28-Nov-2007  kiyohara + Use device_t.
+ Increment rptr if send the ESCAPE char.
+ Use m_pkthdr.len for pktlen.
 1.8 11-Nov-2007  plunky convert device printf() usages to aprint_xxxx()
 1.7 11-Nov-2007  plunky bluetooth stack now keeps a device_t and passes it to device callbacks,
update bcsp to new reality
 1.6 10-Nov-2007  ad Call ttyflush() with tty_lock held.
 1.5 03-Nov-2007  plunky branches: 1.5.2; 1.5.4;
'struct callout' => callout_t
don't use callout_reset()
do use callout_destroy()
 1.4 03-Nov-2007  plunky switch devices to using CFATTACH_DECL_NEW()
softc no longer contains 'struct device' by default
use 'device_t' instead of 'struct device *'
use device_xxx() accessor functions
remove casting of 'xxx_softc *' & 'struct device *'
use aprint_xxx_dev() routines
 1.3 14-Oct-2007  kiyohara branches: 1.3.2; 1.3.4;
+ Add #ifdef DPRINTF{,N} before #undef.
+ Initialize m_pkthdr.len, and increment if not escape charactor.
+ Call bcsp_start() if there is no transmitted packet.
+ Call m_adj() after debug print.
+ Reset the values of the Sequencing layer if link reset it.
 1.2 04-Oct-2007  kiyohara branches: 1.2.2; 1.2.4;
Fix some bugs.
* Cast to integer the 2nd args of m_adj().
* Move test/set flag BTF_XMIT to bcsp_start().
* The initialization of the array was clarified.
 1.1 30-Sep-2007  kiyohara branches: 1.1.2;
Add bcsp(4). However, it is debuging state.
 1.1.2.7 03-Dec-2007  joerg Sync with HEAD.
 1.1.2.6 11-Nov-2007  joerg Sync with HEAD.
 1.1.2.5 04-Nov-2007  jmcneill Sync with HEAD.
 1.1.2.4 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.1.2.3 04-Oct-2007  joerg Sync with HEAD.
 1.1.2.2 02-Oct-2007  joerg Sync with HEAD.
 1.1.2.1 30-Sep-2007  joerg file bcsp.c was added on branch jmcneill-pm on 2007-10-02 18:28:20 +0000
 1.2.4.3 23-Oct-2007  ad Sync with head.
 1.2.4.2 09-Oct-2007  ad Sync with head.
 1.2.4.1 04-Oct-2007  ad file bcsp.c was added on branch vmlocking on 2007-10-09 13:41:16 +0000
 1.2.2.3 18-Oct-2007  yamt sync with head.
 1.2.2.2 06-Oct-2007  yamt sync with head.
 1.2.2.1 04-Oct-2007  yamt file bcsp.c was added on branch yamt-x86pmap on 2007-10-06 15:31:06 +0000
 1.3.4.5 24-Mar-2008  yamt sync with head.
 1.3.4.4 07-Dec-2007  yamt sync with head
 1.3.4.3 15-Nov-2007  yamt sync with head.
 1.3.4.2 27-Oct-2007  yamt sync with head.
 1.3.4.1 14-Oct-2007  yamt file bcsp.c was added on branch yamt-lazymbuf on 2007-10-27 11:30:06 +0000
 1.3.2.1 13-Nov-2007  bouyer Sync with HEAD
 1.5.4.3 09-Jan-2008  matt sync with HEAD
 1.5.4.2 06-Nov-2007  matt sync with HEAD
 1.5.4.1 03-Nov-2007  matt file bcsp.c was added on branch matt-armv6 on 2007-11-06 23:25:44 +0000
 1.5.2.2 08-Dec-2007  mjf Sync with HEAD.
 1.5.2.1 19-Nov-2007  mjf Sync with HEAD.
 1.11.14.3 17-Jan-2009  mjf Sync with HEAD.
 1.11.14.2 29-Jun-2008  mjf Sync with HEAD.
 1.11.14.1 03-Apr-2008  mjf Sync with HEAD.
 1.12.8.1 18-Jun-2008  simonb Sync with head.
 1.12.6.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.12.4.2 16-May-2009  yamt sync with head
 1.12.4.1 04-May-2009  yamt sync with head.
 1.12.2.1 17-Jun-2008  yamt sync with head.
 1.13.10.2 30-Dec-2008  christos fix dev_t format
 1.13.10.1 12-Jun-2008  christos file bcsp.c was added on branch christos-time_t on 2008-12-30 19:32:51 +0000
 1.13.4.2 28-Apr-2009  skrll Sync with HEAD.
 1.13.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.14.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.18.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.18.4.1 31-May-2011  rmind sync with head
 1.20.8.2 07-Dec-2014  martin Pull up following revision(s) (requested by ozaki-r in ticket #1201):
sys/kern/kern_ktrace.c: revision 1.166
sys/dev/isa/aps.c: revision 1.16
sys/dev/sysmon/sysmonvar.h: revision 1.45
sys/dev/ir/irframe_tty.c: revision 1.60
sys/dev/sysmon/sysmon_envsys_events.c: revision 1.111-1.112 (patch)
sys/dev/pci/pccbb.c: revision 1.207
sys/dev/wscons/wskbd.c: revision 1.135
sys/dev/usb/ohci.c: revision 1.254
sys/net/if_ecosubr.c: revision 1.41
sys/dev/pcmcia/btbc.c: revision 1.17
sys/arch/x86/x86/via_padlock.c: revision 1.23
sys/dev/sdmmc/sdmmc.c: revision 1.23 (patch)
sys/dev/bluetooth/btkbd.c: revision 1.17
sys/dev/bluetooth/bcsp.c: revision 1.25
sys/arch/x86/pci/fwhrng.c: revision 1.8
sys/dev/ic/nslm7x.c: revision 1.61
share/man/man9/callout.9: revision 1.28 (patch)

Replace callout_stop with callout_halt and ensure the callout
is not running before destroying it.
 1.20.8.1 12-Jun-2012  riz Pull up following revision(s) (requested by dsl in ticket #306):
sys/kern/vfs_bio.c: revision 1.238
sys/dev/bluetooth/bcsp.c: revision 1.21
sys/dev/acpi/asus_acpi.c: revision 1.24
sys/miscfs/syncfs/sync_subr.c: revision 1.48
Some calls to sysctl_createv() have mismatches betwwen the data type
and the CTLTYPE_xxx flags.
Fixes bugs in sys/dev/acpi/asus_acpi.c sys/dev/bluetooth/bcsp.c
sys/kern/vfs_bio.c sys/miscfs/syncfs/sync_subr.c
(mostly passing the address of a uint64_t when typed as CTLTYPE_INT).
The vm.bufmem_lowater (etc) sysctls needs to be processed with a
64bit temporary value on 64bit systems.
Fixes PR kern/46536.
 1.20.2.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.20.2.1 30-Oct-2012  yamt sync with head
 1.21.4.1 18-May-2014  rmind sync with head
 1.21.2.2 03-Dec-2017  jdolecek update from HEAD
 1.21.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.23.2.1 10-Aug-2014  tls Rebase.
 1.24.2.1 01-Dec-2014  martin Pull up following revision(s) (requested by ozaki-r in ticket #279):
sys/kern/kern_ktrace.c: revision 1.166
sys/dev/isa/aps.c: revision 1.16
sys/dev/sysmon/sysmonvar.h: revision 1.45
sys/dev/ir/irframe_tty.c: revision 1.60
sys/dev/sysmon/sysmon_envsys_events.c: revision 1.111
sys/dev/sysmon/sysmon_envsys_events.c: revision 1.112
sys/dev/pci/pccbb.c: revision 1.207
sys/dev/wscons/wskbd.c: revision 1.135
sys/dev/usb/ohci.c: revision 1.254
sys/net/if_ecosubr.c: revision 1.41
sys/dev/pcmcia/btbc.c: revision 1.17
sys/arch/x86/x86/via_padlock.c: revision 1.23
sys/dev/sdmmc/sdmmc.c: revision 1.23
sys/dev/bluetooth/btkbd.c: revision 1.17
sys/dev/bluetooth/bcsp.c: revision 1.25
sys/arch/x86/pci/fwhrng.c: revision 1.8
sys/dev/ic/nslm7x.c: revision 1.61
share/man/man9/callout.9: revision 1.28
Replace callout_stop with callout_halt
In order to call callout_destroy for a callout safely, we have to ensure
the function of the callout is not running and pending. To do so, we should
use callout_halt, not callout_stop.
Discussed with martin@ and riastradh@.
Make it clear that we should use not callout_stop but callout_halt
before callout_destroy
Replace callout_stop with callout_halt
In order to call callout_destroy for a callout safely, we have to ensure
the function of the callout is not running and pending. To do so, we should
use callout_halt, not callout_stop.
In this case, we need to pass an interlock to callout_halt to wait for
the callout complete.
Reviewed by riastradh@.
Kill sme_callout_mtx and use sme_mtx instead
We can use sme_mtx for the callout as well. Actually we should do so
because sme_events_list and some other data that are touched in the
callout should be protected by sme_mtx, not sme_callout_mtx.
Discussed with riastradh@ in
http://mail-index.netbsd.org/tech-kern/2014/11/11/msg017956.html
Replace callout_stop with callout_halt
In order to call callout_destroy for a callout safely, we have to ensure
the function of the callout is not running and pending. To do so, we should
use callout_halt, not callout_stop.
In this case, we need to pass an interlock to callout_halt to wait for
the callout complete. And also we make sure that SME_CALLOUT_INITIALIZED
is unset before calling callout_halt to prevent the callout from calling
callout_schedule. This is the same as what we did in sys/netinet6/mld6.c@1.61.
Reviewed by riastradh@.
 1.25.2.3 05-Oct-2016  skrll Sync with HEAD
 1.25.2.2 22-Sep-2015  skrll Sync with HEAD
 1.25.2.1 06-Jun-2015  skrll Sync with HEAD
 1.30.16.1 10-Jun-2019  christos Sync with HEAD
 1.30.14.1 26-Jan-2019  pgoyette Sync with HEAD
 1.30.6.1 17-May-2017  pgoyette At suggestion of chuq@, modify config_attach_pseudo() to return with a
reference held on the device.

Adapt callers to expect the reference to exist, and to ensure that the
reference is released.
 1.33.8.1 02-Aug-2025  perseant Sync with HEAD
 1.2 02-Oct-2007  junyoung branches: 1.2.2; 1.2.4; 1.2.6; 1.2.10; 1.2.14;
Use __packed rather than __attribute__ ((__packed__)).
 1.1 30-Sep-2007  kiyohara Add bcsp(4). However, it is debuging state.
 1.2.14.2 06-Nov-2007  matt sync with HEAD
 1.2.14.1 02-Oct-2007  matt file bcsp.h was added on branch matt-armv6 on 2007-11-06 23:25:44 +0000
 1.2.10.2 27-Oct-2007  yamt sync with head.
 1.2.10.1 02-Oct-2007  yamt file bcsp.h was added on branch yamt-lazymbuf on 2007-10-27 11:30:07 +0000
 1.2.6.2 09-Oct-2007  ad Sync with head.
 1.2.6.1 02-Oct-2007  ad file bcsp.h was added on branch vmlocking on 2007-10-09 13:41:16 +0000
 1.2.4.2 06-Oct-2007  yamt sync with head.
 1.2.4.1 02-Oct-2007  yamt file bcsp.h was added on branch yamt-x86pmap on 2007-10-06 15:31:07 +0000
 1.2.2.2 02-Oct-2007  joerg Sync with HEAD.
 1.2.2.1 02-Oct-2007  joerg file bcsp.h was added on branch jmcneill-pm on 2007-10-02 18:28:20 +0000
 1.5 19-Jun-2006  gdamore Initial import of bluetooth stack on behalf of Iain Hibbert. (plunky@,
NetBSD Foundation Membership still pending.) This stack was written by
Iain under sponsorship from Itronix Inc.

The stack includes support for rfcomm networking (networking via your
bluetooth enabled cell phone), hid devices (keyboards/mice), and headsets.

Drivers for both PCMCIA and USB bluetooth controllers are included.
 1.4 11-Dec-2005  christos branches: 1.4.4; 1.4.8; 1.4.16;
merge ktrace-lwp.
 1.3 14-Jul-2003  lukem branches: 1.3.16;
add missing __KERNEL_RCSID()
 1.2 01-Jan-2003  thorpej branches: 1.2.2;
Use aprint_normal() in cfprint routines.
 1.1 24-Aug-2002  augustss branches: 1.1.2; 1.1.4; 1.1.6;
Add some placeholders for Bluetooth code.
 1.1.6.3 03-Jan-2003  thorpej Sync with HEAD.
 1.1.6.2 18-Oct-2002  nathanw New files in merge.
 1.1.6.1 24-Aug-2002  nathanw file bluetooth.c was added on branch nathanw_sa on 2002-10-18 03:20:33 +0000
 1.1.4.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.1.4.1 24-Aug-2002  jdolecek file bluetooth.c was added on branch kqueue on 2002-09-06 08:43:58 +0000
 1.1.2.2 29-Aug-2002  gehenna catch up with -current.
 1.1.2.1 24-Aug-2002  gehenna file bluetooth.c was added on branch gehenna-devsw on 2002-08-29 05:22:22 +0000
 1.2.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.2.1 03-Aug-2004  skrll Sync with HEAD
 1.3.16.1 21-Jun-2006  yamt sync with head.
 1.4.16.1 13-Jul-2006  gdamore Merge from HEAD.
 1.4.8.1 26-Jun-2006  yamt sync with head.
 1.4.4.1 09-Sep-2006  rpaulo sync with head
 1.7 19-Jun-2006  gdamore Initial import of bluetooth stack on behalf of Iain Hibbert. (plunky@,
NetBSD Foundation Membership still pending.) This stack was written by
Iain under sponsorship from Itronix Inc.

The stack includes support for rfcomm networking (networking via your
bluetooth enabled cell phone), hid devices (keyboards/mice), and headsets.

Drivers for both PCMCIA and USB bluetooth controllers are included.
 1.6 11-Dec-2005  christos branches: 1.6.4; 1.6.8; 1.6.16;
merge ktrace-lwp.
 1.5 04-Jan-2004  dsainty branches: 1.5.16;
Kill the flow control interface. Bluetooth devices are not equipped to deal
with flow control being applied. It is simpler and no more problematic to
accept the data and drop it if we hit a resource limit than to expect the
Bluetooth device to do anything about it (which it won't).
 1.4 08-Jul-2003  itojun function prototype must not have variable name
 1.3 11-Jan-2003  dsainty branches: 1.3.2;
Changed the interface for passing output data between the bthci driver
and the back end Bluetooth device driver. The device driver now
allocates a suitable buffer on behalf of the bthci driver, and bthci
fills the buffer before despatch.

This saves an ugly temporary allocation (in bthci) and memory copy (in
the USB driver) per write, and also works better with the
sockets-based interface I'm experimenting with.
 1.2 05-Jan-2003  dsainty Make the bthci driver functional. This is an experimental, incomplete, but
actually functional driver. It provides user access through a character
device to a Bluetooth HCI capable driver.

The device interface is the same (open/read/write) as the RAW HCI socket
(socket/recv/send) interface provided by the Linux and FreeBSD netgraph
Bluetooth stacks. This allows a (very small) number of diagnostic programs to
be trivially ported and actually work.
 1.1 24-Aug-2002  augustss branches: 1.1.2; 1.1.4; 1.1.6;
Add some placeholders for Bluetooth code.
 1.1.6.4 15-Jan-2003  thorpej Sync with HEAD.
 1.1.6.3 07-Jan-2003  thorpej Sync with HEAD.
 1.1.6.2 18-Oct-2002  nathanw New files in merge.
 1.1.6.1 24-Aug-2002  nathanw file bluetooth.h was added on branch nathanw_sa on 2002-10-18 03:20:33 +0000
 1.1.4.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.1.4.1 24-Aug-2002  jdolecek file bluetooth.h was added on branch kqueue on 2002-09-06 08:43:58 +0000
 1.1.2.2 29-Aug-2002  gehenna catch up with -current.
 1.1.2.1 24-Aug-2002  gehenna file bluetooth.h was added on branch gehenna-devsw on 2002-08-29 05:22:22 +0000
 1.3.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.3.2.1 03-Aug-2004  skrll Sync with HEAD
 1.5.16.1 21-Jun-2006  yamt sync with head.
 1.6.16.1 13-Jul-2006  gdamore Merge from HEAD.
 1.6.8.1 26-Jun-2006  yamt sync with head.
 1.6.4.1 09-Sep-2006  rpaulo sync with head
 1.2 10-Aug-2017  nat Add support for btuart h5 3-wire protocol.
 1.1 20-Jul-2011  jakllsch branches: 1.1.12; 1.1.30;
Add config(5) fragment for MI bluetooth(4) drivers.
 1.1.30.1 28-Aug-2017  skrll Sync with HEAD
 1.1.12.1 03-Dec-2017  jdolecek update from HEAD
 1.2 19-Jun-2006  gdamore Initial import of bluetooth stack on behalf of Iain Hibbert. (plunky@,
NetBSD Foundation Membership still pending.) This stack was written by
Iain under sponsorship from Itronix Inc.

The stack includes support for rfcomm networking (networking via your
bluetooth enabled cell phone), hid devices (keyboards/mice), and headsets.

Drivers for both PCMCIA and USB bluetooth controllers are included.
 1.1 11-Jan-2003  dsainty branches: 1.1.2; 1.1.20; 1.1.34; 1.1.38; 1.1.46;
Bluetooth HCI protocol constants
 1.1.46.1 13-Jul-2006  gdamore Merge from HEAD.
 1.1.38.1 26-Jun-2006  yamt sync with head.
 1.1.34.1 09-Sep-2006  rpaulo sync with head
 1.1.20.1 21-Jun-2006  yamt sync with head.
 1.1.2.2 15-Jan-2003  thorpej Sync with HEAD.
 1.1.2.1 11-Jan-2003  thorpej file bt_hci.h was added on branch nathanw_sa on 2003-01-15 18:44:15 +0000
 1.4 10-Sep-2006  plunky update to bluetooth device attachment:

remove pseudo-device btdev(4) and inherent limitations

add bthub(4) which autoconfigures at bluetooth controllers as they
are enabled. bluetooth devices now attach here.

btdevctl(8) and its cache is updated to handle new semantics

etc/rc.d/btdevctl is updated to configure devices from a list
in /etc/bluetooth/btdevctl.conf
 1.3 28-Aug-2006  christos branches: 1.3.2; 1.3.4;
add missing initializer.
 1.2 20-Aug-2006  plunky Make btdev default count explicit
 1.1 26-Jul-2006  tron branches: 1.1.2; 1.1.4;
Bluetooth fixes by Iain Hibbert:
Change the way in which bluetooth devices attach to system. The
new way is for devices to attach directly to a btdevN device via
its own control file /dev/btdevN.
- bthub(4) is replaced by btdev(4).
- /dev/bthubctl is replaced by /dev/btdevN.
- configuration now uses proplib(3) property lists.
- btcontrol(8) updated to use new API, and now uses private
- XML config file /var/db/btdev.xml.
 1.1.4.4 14-Sep-2006  yamt sync with head.
 1.1.4.3 03-Sep-2006  yamt sync with head.
 1.1.4.2 11-Aug-2006  yamt sync with head
 1.1.4.1 26-Jul-2006  yamt file btdev.c was added on branch yamt-pdpolicy on 2006-08-11 15:43:59 +0000
 1.1.2.1 14-Sep-2006  riz Pull up following revision(s) (requested by plunky in ticket #161):
sys/dev/bluetooth/btdev.h: revision 1.4
distrib/sets/lists/comp/mi: revision 1.922
usr.sbin/postinstall/postinstall: revision 1.25
sys/netbt/hci_unit.c: revision 1.3
sys/netbt/hci_ioctl.c: revision 1.4
usr.sbin/sdpd/profile.c: revision 1.2
usr.sbin/btdevctl/btdevctl.c: revision 1.2
share/man/man4/Makefile: revision 1.405
distrib/sets/lists/man/mi: revision 1.930
distrib/sets/lists/etc/mi: revision 1.176
usr.sbin/sdpd/profile.c: revision 1.3
usr.sbin/btdevctl/btdevctl.c: revision 1.3
etc/MAKEDEV.tmpl: revision 1.62
distrib/sets/lists/base/mi: revision 1.650
usr.sbin/btdevctl/btdevctl.h: revision 1.2
usr.bin/sdpquery/sdpquery.1: revision 1.4
sys/netbt/rfcomm_session.c: revision 1.2
usr.sbin/btdevctl/btdevctl.8: revision 1.3
usr.bin/sdpquery/search.c: revision 1.2
usr.sbin/sdpd/Makefile: revision 1.2
sys/dev/bluetooth/Makefile: revision 1.3
usr.sbin/btdevctl/cfg.c: file removal
sys/netbt/files.netbt: revision 1.4
usr.sbin/btdevctl/sdp.c: revision 1.1
sys/dev/bluetooth/bthidev.c: revision 1.3
etc/bluetooth/Makefile: revision 1.3
sys/dev/pcmcia/files.pcmcia: revision 1.51
sys/dev/bluetooth/bthidev.c: revision 1.4
sys/dev/bluetooth/bthidev.h: revision 1.3
usr.sbin/btdevctl/dev.c: file removal
sys/dev/bluetooth/files.bluetooth: revision 1.10
sys/arch/i386/conf/GENERIC: revision 1.777
share/man/man4/ubt.4: revision 1.6
share/man/man4/bthub.4: revision 1.3
sys/netbt/hci.h: revision 1.5
sys/arch/i386/conf/GENERIC_LAPTOP: revision 1.202
lib/libsdp/sdp.h: revision 1.2
usr.sbin/btdevctl/print.c: revision 1.1
share/man/man4/bthidev.4: revision 1.5
share/man/man4/btdev.4: file removal
usr.sbin/btdevctl/print.c: revision 1.2
sys/arch/i386/conf/GENERIC_LAPTOP: revision 1.205
usr.sbin/btdevctl/Makefile: revision 1.2
sys/dev/usb/files.usb: revision 1.70
sys/netbt/l2cap_signal.c: revision 1.2
sys/netbt/hci_link.c: revision 1.4
sys/dev/bluetooth/bthub.c: revision 1.3
share/man/man4/btsco.4: revision 1.5
sys/netbt/hci_link.c: revision 1.5
share/man/man4/btdev.4: revision 1.4
sys/dev/bluetooth/btkbd.c: revision 1.3
sys/dev/bluetooth/btdev.c: file removal
sys/netbt/hci_event.c: revision 1.2
sys/dev/bluetooth/btsco.h: revision 1.2
etc/mtree/special: revision 1.101
sys/dev/bluetooth/btsco.c: revision 1.3
sys/conf/majors: revision 1.27
usr.sbin/sdpd/hf.c: revision 1.1
sys/dev/bluetooth/btsco.c: revision 1.4
share/man/man5/rc.conf.5: revision 1.107
sys/dev/bluetooth/btdev.c: revision 1.2
etc/rc.d/btdevctl: revision 1.2
usr.sbin/btdevctl/db.c: revision 1.1
etc/rc.d/btdevctl: revision 1.3
etc/bluetooth/btdevctl.conf: revision 1.1
usr.sbin/btdevctl/hid.c: file removal
sys/arch/i386/conf/GENERIC: revision 1.781
sys/dev/bluetooth/btdev.h: revision 1.3
Make btdev default count explicit
Fix typo in variable name
update to bluetooth device attachment:
remove pseudo-device btdev(4) and inherent limitations
add bthub(4) which autoconfigures at bluetooth controllers as they
are enabled. bluetooth devices now attach here.
btdevctl(8) and its cache is updated to handle new semantics
etc/rc.d/btdevctl is updated to configure devices from a list
in /etc/bluetooth/btdevctl.conf
also include service name in dictionary being sent to kernel.
(this is not used just yet, but it might be in the future and it will
be easier if we dont have to provide code to handle its absence)
clarify the CAVEAT section somewhat
Add service discovery support for the Handsfree profile
Replace static 'FreeBSD' string with operating system name gleaned
from uname(3)
Halt the callout on detach
btsco.c:
- sco_getopt(..., SO_SCO_MTU, ...) expects the address of a uint16_t,
not an int. So change sc_mtu's type to uint16_t.
- Try a little harder to ensure btsco_round_blocksize() does not
return zero. Prevents a subsequent panic in audio_init_ringbuffer().
from scw@
Endian issues:
hci_event.c:
- Convert memo->response.clock_offset to host-endian.
hci_ioctl.c:
- printf format tweak (size_t)
hci_link.c:
- Convert memo->response.clock_offset from host-endian.
- Tweak a DIAGNOSTIC message.
l2cap_signal.c:
- In l2cap_recv_config_req(), rp->scid is little-endian so make sure
we convert from host-endian.
from scw@
hci_link.c:
- In hci_link_free(), do not unlink items from a LIST queue within
a LIST_FOREACH() iterator.
rfcomm_session.c:
- In rfcomm_session_recv_mcc_nsc(), do not unlink items from a LIST
queue within a LIST_FOREACH() iterator.
from scw@
guard against a possible situation where the list of l2cap channels is changed
when the bluetooth code is not expecting it to be. During a disconnect, we can
detach the channel that is being disconnected, but its not really safe to detach
any others.
Print explicit 64-bit types using the format macros from int_fmtio.h.
Unbreaks the build for our LP64 ports, where "long long" typically is
not 64 bits.
 1.3.4.2 09-Sep-2006  rpaulo sync with head
 1.3.4.1 28-Aug-2006  rpaulo file btdev.c was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:49:44 +0000
 1.3.2.1 18-Nov-2006  ad Sync with head.
 1.10 06-Sep-2015  dholland More on PR 41200: headers that declare ioctls should include sys/ioccom.h.
This covers (I think) all the MI headers outside of external/ (and dist/).
 1.9 28-Apr-2010  plunky branches: 1.9.18; 1.9.36;
allow for vendor-id and product-id properties, passing them
through to child devices
 1.8 28-Mar-2008  plunky branches: 1.8.4; 1.8.14; 1.8.24; 1.8.26;
Use deviter API to search for child devices.

As all identifying information is stored in the device
properties, this removes the need for child devices to
have a reserved area (struct btdev) in the softc, and
bthub(4) does no longer need to have a softc at all.
 1.7 03-Nov-2007  plunky branches: 1.7.16;
switch devices to using CFATTACH_DECL_NEW()
softc no longer contains 'struct device' by default
use 'device_t' instead of 'struct device *'
use device_xxx() accessor functions
remove casting of 'xxx_softc *' & 'struct device *'
use aprint_xxx_dev() routines
 1.6 21-Apr-2007  plunky branches: 1.6.6; 1.6.8; 1.6.12;
Add 'service level' security for L2CAP and RFCOMM connections, following
the Linux (BlueZ) API.

- L2CAP or RFCOMM connections can require the baseband radio link
mode be any of:
authenticated (devices are paired)
encrypted (implies authentication)
secured (encryption, plus generate new link key)

- for sockets, the mode is set using setsockopt(2) and the socket
connection will be aborted if the mode change fails.

- mode settings will be applied during connection establishment, and
for safety, we enter a wait state and will only proceed when the mode
settings are successfuly set.

- It is possible to change the mode on already open connections, but
not possible to guarantee that data already queued (from either end)
will not be delivered. (this is a feature, not a bug)

- bthidev(4) and rfcomm_sppd(1) support "auth", "encrypt" and
"secure" options

- btdevctl(8) by default enables "auth" for HIDs, and "encrypt" for
keyboards (which are required to support it)
 1.5 04-Oct-2006  plunky branches: 1.5.2; 1.5.4; 1.5.8; 1.5.10; 1.5.16;
Internally, use the service name as the identifier for matching
 1.4 11-Sep-2006  plunky branches: 1.4.2;
also include service name in dictionary being sent to kernel.

(this is not used just yet, but it might be in the future and it will
be easier if we dont have to provide code to handle its absence)
 1.3 10-Sep-2006  plunky update to bluetooth device attachment:

remove pseudo-device btdev(4) and inherent limitations

add bthub(4) which autoconfigures at bluetooth controllers as they
are enabled. bluetooth devices now attach here.

btdevctl(8) and its cache is updated to handle new semantics

etc/rc.d/btdevctl is updated to configure devices from a list
in /etc/bluetooth/btdevctl.conf
 1.2 26-Jul-2006  tron branches: 1.2.2; 1.2.4; 1.2.6;
Bluetooth fixes by Iain Hibbert:
Change the way in which bluetooth devices attach to system. The
new way is for devices to attach directly to a btdevN device via
its own control file /dev/btdevN.
- bthub(4) is replaced by btdev(4).
- /dev/bthubctl is replaced by /dev/btdevN.
- configuration now uses proplib(3) property lists.
- btcontrol(8) updated to use new API, and now uses private
- XML config file /var/db/btdev.xml.
 1.1 19-Jun-2006  gdamore branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8;
Initial import of bluetooth stack on behalf of Iain Hibbert. (plunky@,
NetBSD Foundation Membership still pending.) This stack was written by
Iain under sponsorship from Itronix Inc.

The stack includes support for rfcomm networking (networking via your
bluetooth enabled cell phone), hid devices (keyboards/mice), and headsets.

Drivers for both PCMCIA and USB bluetooth controllers are included.
 1.1.8.2 13-Jul-2006  gdamore Merge from HEAD.
 1.1.8.1 19-Jun-2006  gdamore file btdev.h was added on branch gdamore-uart on 2006-07-13 17:49:22 +0000
 1.1.6.4 14-Sep-2006  yamt sync with head.
 1.1.6.3 11-Aug-2006  yamt sync with head
 1.1.6.2 26-Jun-2006  yamt sync with head.
 1.1.6.1 19-Jun-2006  yamt file btdev.h was added on branch yamt-pdpolicy on 2006-06-26 12:50:37 +0000
 1.1.4.2 22-Jun-2006  chap Complete a sync sys/ with head.
 1.1.4.1 19-Jun-2006  chap file btdev.h was added on branch chap-midi on 2006-06-22 03:39:48 +0000
 1.1.2.5 15-Nov-2007  yamt sync with head.
 1.1.2.4 03-Sep-2007  yamt sync with head.
 1.1.2.3 30-Dec-2006  yamt sync with head.
 1.1.2.2 21-Jun-2006  yamt sync with head.
 1.1.2.1 19-Jun-2006  yamt file btdev.h was added on branch yamt-lazymbuf on 2006-06-21 15:02:45 +0000
 1.2.6.2 09-Sep-2006  rpaulo sync with head
 1.2.6.1 26-Jul-2006  rpaulo file btdev.h was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:49:44 +0000
 1.2.4.1 18-Nov-2006  ad Sync with head.
 1.2.2.1 14-Sep-2006  riz Pull up following revision(s) (requested by plunky in ticket #161):
sys/dev/bluetooth/btdev.h: revision 1.4
distrib/sets/lists/comp/mi: revision 1.922
usr.sbin/postinstall/postinstall: revision 1.25
sys/netbt/hci_unit.c: revision 1.3
sys/netbt/hci_ioctl.c: revision 1.4
usr.sbin/sdpd/profile.c: revision 1.2
usr.sbin/btdevctl/btdevctl.c: revision 1.2
share/man/man4/Makefile: revision 1.405
distrib/sets/lists/man/mi: revision 1.930
distrib/sets/lists/etc/mi: revision 1.176
usr.sbin/sdpd/profile.c: revision 1.3
usr.sbin/btdevctl/btdevctl.c: revision 1.3
etc/MAKEDEV.tmpl: revision 1.62
distrib/sets/lists/base/mi: revision 1.650
usr.sbin/btdevctl/btdevctl.h: revision 1.2
usr.bin/sdpquery/sdpquery.1: revision 1.4
sys/netbt/rfcomm_session.c: revision 1.2
usr.sbin/btdevctl/btdevctl.8: revision 1.3
usr.bin/sdpquery/search.c: revision 1.2
usr.sbin/sdpd/Makefile: revision 1.2
sys/dev/bluetooth/Makefile: revision 1.3
usr.sbin/btdevctl/cfg.c: file removal
sys/netbt/files.netbt: revision 1.4
usr.sbin/btdevctl/sdp.c: revision 1.1
sys/dev/bluetooth/bthidev.c: revision 1.3
etc/bluetooth/Makefile: revision 1.3
sys/dev/pcmcia/files.pcmcia: revision 1.51
sys/dev/bluetooth/bthidev.c: revision 1.4
sys/dev/bluetooth/bthidev.h: revision 1.3
usr.sbin/btdevctl/dev.c: file removal
sys/dev/bluetooth/files.bluetooth: revision 1.10
sys/arch/i386/conf/GENERIC: revision 1.777
share/man/man4/ubt.4: revision 1.6
share/man/man4/bthub.4: revision 1.3
sys/netbt/hci.h: revision 1.5
sys/arch/i386/conf/GENERIC_LAPTOP: revision 1.202
lib/libsdp/sdp.h: revision 1.2
usr.sbin/btdevctl/print.c: revision 1.1
share/man/man4/bthidev.4: revision 1.5
share/man/man4/btdev.4: file removal
usr.sbin/btdevctl/print.c: revision 1.2
sys/arch/i386/conf/GENERIC_LAPTOP: revision 1.205
usr.sbin/btdevctl/Makefile: revision 1.2
sys/dev/usb/files.usb: revision 1.70
sys/netbt/l2cap_signal.c: revision 1.2
sys/netbt/hci_link.c: revision 1.4
sys/dev/bluetooth/bthub.c: revision 1.3
share/man/man4/btsco.4: revision 1.5
sys/netbt/hci_link.c: revision 1.5
share/man/man4/btdev.4: revision 1.4
sys/dev/bluetooth/btkbd.c: revision 1.3
sys/dev/bluetooth/btdev.c: file removal
sys/netbt/hci_event.c: revision 1.2
sys/dev/bluetooth/btsco.h: revision 1.2
etc/mtree/special: revision 1.101
sys/dev/bluetooth/btsco.c: revision 1.3
sys/conf/majors: revision 1.27
usr.sbin/sdpd/hf.c: revision 1.1
sys/dev/bluetooth/btsco.c: revision 1.4
share/man/man5/rc.conf.5: revision 1.107
sys/dev/bluetooth/btdev.c: revision 1.2
etc/rc.d/btdevctl: revision 1.2
usr.sbin/btdevctl/db.c: revision 1.1
etc/rc.d/btdevctl: revision 1.3
etc/bluetooth/btdevctl.conf: revision 1.1
usr.sbin/btdevctl/hid.c: file removal
sys/arch/i386/conf/GENERIC: revision 1.781
sys/dev/bluetooth/btdev.h: revision 1.3
Make btdev default count explicit
Fix typo in variable name
update to bluetooth device attachment:
remove pseudo-device btdev(4) and inherent limitations
add bthub(4) which autoconfigures at bluetooth controllers as they
are enabled. bluetooth devices now attach here.
btdevctl(8) and its cache is updated to handle new semantics
etc/rc.d/btdevctl is updated to configure devices from a list
in /etc/bluetooth/btdevctl.conf
also include service name in dictionary being sent to kernel.
(this is not used just yet, but it might be in the future and it will
be easier if we dont have to provide code to handle its absence)
clarify the CAVEAT section somewhat
Add service discovery support for the Handsfree profile
Replace static 'FreeBSD' string with operating system name gleaned
from uname(3)
Halt the callout on detach
btsco.c:
- sco_getopt(..., SO_SCO_MTU, ...) expects the address of a uint16_t,
not an int. So change sc_mtu's type to uint16_t.
- Try a little harder to ensure btsco_round_blocksize() does not
return zero. Prevents a subsequent panic in audio_init_ringbuffer().
from scw@
Endian issues:
hci_event.c:
- Convert memo->response.clock_offset to host-endian.
hci_ioctl.c:
- printf format tweak (size_t)
hci_link.c:
- Convert memo->response.clock_offset from host-endian.
- Tweak a DIAGNOSTIC message.
l2cap_signal.c:
- In l2cap_recv_config_req(), rp->scid is little-endian so make sure
we convert from host-endian.
from scw@
hci_link.c:
- In hci_link_free(), do not unlink items from a LIST queue within
a LIST_FOREACH() iterator.
rfcomm_session.c:
- In rfcomm_session_recv_mcc_nsc(), do not unlink items from a LIST
queue within a LIST_FOREACH() iterator.
from scw@
guard against a possible situation where the list of l2cap channels is changed
when the bluetooth code is not expecting it to be. During a disconnect, we can
detach the channel that is being disconnected, but its not really safe to detach
any others.
Print explicit 64-bit types using the format macros from int_fmtio.h.
Unbreaks the build for our LP64 ports, where "long long" typically is
not 64 bits.
 1.4.2.1 22-Oct-2006  yamt sync with head
 1.5.16.1 03-Sep-2007  wrstuden Sync w/ NetBSD-4-RC_1
 1.5.10.1 11-Jul-2007  mjf Sync with head.
 1.5.8.1 27-May-2007  ad Sync with head.
 1.5.4.1 07-May-2007  yamt sync with head.
 1.5.2.1 19-Jul-2007  liamjfoy Pull up following revision(s) (requested by plunky in ticket #744):
sys/netbt/l2cap_lower.c: revision 1.6
sys/dev/bluetooth/btdev.h: revision 1.6
sys/netbt/sco_socket.c: revision 1.9
sys/netbt/rfcomm_upper.c: revision 1.3
sys/netbt/l2cap_socket.c: revision 1.7
sys/netbt/rfcomm_upper.c: revision 1.5
lib/libusbhid/usbhid.h: revision 1.5
sys/netbt/rfcomm_upper.c: revision 1.6
usr.sbin/btdevctl/btdevctl.c: revision 1.4
usr.sbin/btdevctl/btdevctl.h: revision 1.3
usr.sbin/btdevctl/btdevctl.8: revision 1.4
sys/netbt/rfcomm_session.c: revision 1.5
sys/netbt/hci.h: revision 1.10
usr.bin/rfcomm_sppd/rfcomm_sppd.c: revision 1.6
sys/netbt/hci_link.c: revision 1.11
usr.bin/rfcomm_sppd/rfcomm_sppd.c: revision 1.7
usr.bin/rfcomm_sppd/rfcomm_sppd.c: revision 1.8
sys/dev/bluetooth/btsco.c: revision 1.14
sys/netbt/rfcomm_session.c: revision 1.9
usr.sbin/btdevctl/sdp.c: revision 1.2
share/man/man9/bluetooth.9: revision 1.2
usr.sbin/btdevctl/sdp.c: revision 1.3
sys/dev/bluetooth/bthidev.c: revision 1.8
sys/netbt/l2cap.h: revision 1.4
sys/netbt/rfcomm.h: revision 1.3
sys/netbt/l2cap.h: revision 1.5
sys/netbt/l2cap_misc.c: revision 1.3
share/man/man4/bluetooth.4: revision 1.5
lib/libusbhid/usbhid.3: revision 1.11
sys/netbt/bluetooth.h: revision 1.5
share/man/man4/bthidev.4: revision 1.8
sys/netbt/rfcomm_dlc.c: revision 1.3
usr.sbin/btdevctl/print.c: revision 1.8
sys/netbt/rfcomm_socket.c: revision 1.7
sys/netbt/l2cap_signal.c: revision 1.4
sys/netbt/l2cap_signal.c: revision 1.5
sys/netbt/l2cap_signal.c: revision 1.7
sys/netbt/hci_event.c: revision 1.6
usr.bin/rfcomm_sppd/rfcomm_sppd.1: revision 1.5
sys/netbt/l2cap_upper.c: revision 1.3
sys/netbt/l2cap_lower.c: revision 1.2
usr.sbin/btdevctl/db.c: revision 1.3
sys/netbt/l2cap_upper.c: revision 1.6
lib/libusbhid/descr.c: revision 1.5
sys/netbt/l2cap_upper.c: revision 1.7
sys/netbt/l2cap_lower.c: revision 1.4
Add 'service level' security for L2CAP and RFCOMM connections, following
the Linux (BlueZ) API.
- L2CAP or RFCOMM connections can require the baseband radio link
mode be any of:
authenticated (devices are paired)
encrypted (implies authentication)
secured (encryption, plus generate new link key)
- for sockets, the mode is set using setsockopt(2) and the socket
connection will be aborted if the mode change fails.
- mode settings will be applied during connection establishment, and
for safety, we enter a wait state and will only proceed when the mode
settings are successfuly set.
- It is possible to change the mode on already open connections, but
not possible to guarantee that data already queued (from either end)
will not be delivered. (this is a feature, not a bug)
- bthidev(4) and rfcomm_sppd(1) support "auth", "encrypt" and
"secure" options
- btdevctl(8) by default enables "auth" for HIDs, and "encrypt" for
keyboards (which are required to support it)
- ALSO INCLUDES OTHER MINOR FIXES
 1.6.12.1 13-Nov-2007  bouyer Sync with HEAD
 1.6.8.1 06-Nov-2007  matt sync with HEAD
 1.6.6.1 04-Nov-2007  jmcneill Sync with HEAD.
 1.7.16.1 03-Apr-2008  mjf Sync with HEAD.
 1.8.26.1 30-May-2010  rmind sync with head
 1.8.24.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.8.14.1 21-Nov-2010  riz Pull up following revision(s) (requested by plunky in ticket #1407):
sys/dev/bluetooth/btdev.h: revision 1.9
sys/arch/iyonix/conf/GENERIC: revision 1.60
sys/arch/sparc64/conf/GENERIC: revision 1.129
sys/dev/usb/hid.c: revision 1.30
sys/dev/usb/hid.h: revision 1.13
sys/arch/i386/conf/GENERIC: revision 1.983
usr.sbin/btdevctl/print.c: revision 1.10
sys/arch/evbarm/conf/MPCSA_GENERIC: revision 1.16
sys/arch/alpha/conf/GENERIC: revision 1.337
sys/dev/bluetooth/files.bluetooth: revision 1.14
sys/arch/evbarm/conf/GUMSTIX: revision 1.49
sys/dev/usb/usbdevs: revision 1.550
sys/arch/evbppc/conf/OPENBLOCKS266_OPT: revision 1.14
sys/arch/hpcsh/conf/GENERIC: revision 1.91
sys/dev/bluetooth/btmagic.c: revision 1.1
distrib/sets/lists/man/mi: revision 1.1210
sys/arch/amd64/conf/GENERIC: revision 1.279
sys/arch/i386/conf/ALL: revision 1.258
sys/arch/amd64/conf/XEN3_DOM0: revision 1.54
sys/arch/hpcarm/conf/JORNADA720: revision 1.78
sys/dev/usb/hid.c: revision 1.29
share/man/man4/btmagic.4: revision 1.1
hid_get_data() does not work if the size of data is less than
a byte and crosses a byte boundary, and it always returns a
sign-extended value.
fix this by using the algorithm from libusbhid to read bytes,
and provide a hid_get_udata() function to return unsigned data
values.
while here, const args
update DPRINTF to reflect actual function name
add Apple Magic Mouse product-id
regen for Magic Mouse id
allow for vendor-id and product-id properties, passing them
through to child devices
add Magic Mouse driver and manpage btmagic(4)
additionally query the "PnP Information" service record to discover
any USB Forum vendor-id and product-id values and store them in the
property list if found.
add btmagic(4) where other Bluetooth drivers are listed
 1.8.4.1 11-Aug-2010  yamt sync with head.
 1.9.36.1 22-Sep-2015  skrll Sync with HEAD
 1.9.18.1 03-Dec-2017  jdolecek update from HEAD
 1.9 05-Jul-2024  rin sys: Drop redundant NULL check before m_freem(9)

m_freem(9) safely has accepted NULL argument at least since 4.2BSD:
https://www.tuhs.org/cgi-bin/utree.pl?file=4.2BSD/usr/src/sys/sys/uipc_mbuf.c

Compile-tested on amd64/ALL.

Suggested by knakahara@
 1.8 26-Oct-2022  riastradh branches: 1.8.8;
bth5(4): Convert to ttylock/ttyunlock.
 1.7 28-Jun-2022  plunky remove KASSERT() checking for t_oproc at open since assigning this line
discipline to a pty may not have that set. Instead do a runtime check to
ensure that the function exists before calling it, as ttstart() handles it.

Same code in btuart.c, bcsp.c and bth5.c

Reported-by: syzbot+766981eef92a3cd0352a@syzkaller.appspotmail.com
 1.6 16-Nov-2019  mlelstv Don't wait in interrupt context.
 1.5 03-Sep-2017  nat branches: 1.5.2; 1.5.6;
Remove references to BlueCore.
Enable XON/XOFF flowcontrol in SLIP layer depending on config response.
Send an acknowlegment packet on timeout/retry.
Compute tx{ack,seq} and rx{ack,seq} according to the specification.
 1.4 14-Aug-2017  nat branches: 1.4.2;
Apply the sequence number mask to txack.
 1.3 14-Aug-2017  nat Conform to the spec. with regards to acknowlegment packets. This prevents
the host controller from freezing.

Inmprove communication from inactive to active state.
 1.2 11-Aug-2017  nat Ensure the XMIT flag is cleared before calling bth5_start.

This avoids a panic due to a diagnostic assertion.
 1.1 10-Aug-2017  nat Add support for btuart h5 3-wire protocol.
 1.4.2.2 28-Aug-2017  skrll Sync with HEAD
 1.4.2.1 14-Aug-2017  skrll file bth5.c was added on branch nick-nhusb on 2017-08-28 17:52:01 +0000
 1.5.6.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.5.2.2 03-Dec-2017  jdolecek update from HEAD
 1.5.2.1 03-Sep-2017  jdolecek file bth5.c was added on branch tls-maxphys on 2017-12-03 11:36:59 +0000
 1.8.8.1 02-Aug-2025  perseant Sync with HEAD
 1.2 03-Sep-2017  nat branches: 1.2.2;
Remove references to BlueCore.
Enable XON/XOFF flowcontrol in SLIP layer depending on config response.
Send an acknowlegment packet on timeout/retry.
Compute tx{ack,seq} and rx{ack,seq} according to the specification.
 1.1 10-Aug-2017  nat branches: 1.1.2;
Add support for btuart h5 3-wire protocol.
 1.1.2.2 28-Aug-2017  skrll Sync with HEAD
 1.1.2.1 10-Aug-2017  skrll file bth5.h was added on branch nick-nhusb on 2017-08-28 17:52:01 +0000
 1.2.2.2 03-Dec-2017  jdolecek update from HEAD
 1.2.2.1 03-Sep-2017  jdolecek file bth5.h was added on branch tls-maxphys on 2017-12-03 11:36:59 +0000
 1.21 19-Jun-2006  gdamore Initial import of bluetooth stack on behalf of Iain Hibbert. (plunky@,
NetBSD Foundation Membership still pending.) This stack was written by
Iain under sponsorship from Itronix Inc.

The stack includes support for rfcomm networking (networking via your
bluetooth enabled cell phone), hid devices (keyboards/mice), and headsets.

Drivers for both PCMCIA and USB bluetooth controllers are included.
 1.20 28-Mar-2006  thorpej branches: 1.20.4;
Use device_unit().
 1.19 20-Feb-2006  thorpej branches: 1.19.2; 1.19.4; 1.19.6;
Use device_is_active() rather than testing dv_flags for DVF_ACTIVE
directly.
 1.18 17-Dec-2005  xtraeme branches: 1.18.2; 1.18.4; 1.18.6;
Make this build again (ktrace-lwp branch changes).
 1.17 11-Dec-2005  christos merge ktrace-lwp.
 1.16 02-Jul-2005  dsainty branches: 1.16.2;
bthcipoll must not return <sys/errno.h> error codes, return POLLERR/POLLHUP
instead. Fixes a small part of PR/30566.

Also check for a set 'dying' flag here, and include it in the POLLHUP
case.
 1.15 04-Jan-2004  dsainty Don't (ab)use the device driver flow control interface to prevent incoming
data. We should be prepared to buffer that data here (though we currently
don't do that either).
 1.14 24-Jul-2003  nathanw A little printf-casting to make the DIAGNOSTIC sections of this
compile on LP64.
 1.13 14-Jul-2003  lukem add missing __KERNEL_RCSID()
 1.12 11-Jan-2003  dsainty branches: 1.12.2;
Changed the interface for passing output data between the bthci driver
and the back end Bluetooth device driver. The device driver now
allocates a suitable buffer on behalf of the bthci driver, and bthci
fills the buffer before despatch.

This saves an ugly temporary allocation (in bthci) and memory copy (in
the USB driver) per write, and also works better with the
sockets-based interface I'm experimenting with.
 1.11 05-Jan-2003  dsainty Make the bthci driver functional. This is an experimental, incomplete, but
actually functional driver. It provides user access through a character
device to a Bluetooth HCI capable driver.

The device interface is the same (open/read/write) as the RAW HCI socket
(socket/recv/send) interface provided by the Linux and FreeBSD netgraph
Bluetooth stacks. This allows a (very small) number of diagnostic programs to
be trivially ported and actually work.
 1.10 24-Oct-2002  augustss g/c IRDA ioctls (was within #if 0 anyway)
Fix kqueue pasto.
 1.9 23-Oct-2002  jdolecek merge kqueue branch into -current

kqueue provides a stateful and efficient event notification framework
currently supported events include socket, file, directory, fifo,
pipe, tty and device changes, and monitoring of processes and signals

kqueue is supported by all writable filesystems in NetBSD tree
(with exception of Coda) and all device drivers supporting poll(2)

based on work done by Jonathan Lemon for FreeBSD
initial NetBSD port done by Luke Mewburn and Jason Thorpe
 1.8 02-Oct-2002  thorpej branches: 1.8.2;
Add trailing ; to CFATTACH_DECL.
 1.7 01-Oct-2002  thorpej Remove unnecessary extern decl of bthci_ca.
 1.6 30-Sep-2002  thorpej Use CFATTACH_DECL().
 1.5 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.4 27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.3 12-Sep-2002  augustss Make it compile. Rename a macro.
 1.2 06-Sep-2002  gehenna Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.1 24-Aug-2002  augustss branches: 1.1.2; 1.1.4;
Add some placeholders for Bluetooth code.
 1.1.4.4 11-Oct-2002  jdolecek add some kqfilter hooks
 1.1.4.3 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.1.4.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.1.4.1 24-Aug-2002  jdolecek file bthci.c was added on branch kqueue on 2002-09-06 08:43:59 +0000
 1.1.2.3 29-Aug-2002  gehenna Add character device switch.
 1.1.2.2 29-Aug-2002  gehenna catch up with -current.
 1.1.2.1 24-Aug-2002  gehenna file bthci.c was added on branch gehenna-devsw on 2002-08-29 05:22:22 +0000
 1.8.2.5 15-Jan-2003  thorpej Sync with HEAD.
 1.8.2.4 07-Jan-2003  thorpej Sync with HEAD.
 1.8.2.3 11-Nov-2002  nathanw Catch up to -current
 1.8.2.2 18-Oct-2002  nathanw New files in merge.
 1.8.2.1 02-Oct-2002  nathanw file bthci.c was added on branch nathanw_sa on 2002-10-18 03:20:33 +0000
 1.12.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.12.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.12.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.12.2.1 03-Aug-2004  skrll Sync with HEAD
 1.16.2.1 21-Jun-2006  yamt sync with head.
 1.18.6.1 22-Apr-2006  simonb Sync with head.
 1.18.4.1 09-Sep-2006  rpaulo sync with head
 1.18.2.1 01-Mar-2006  yamt sync with head.
 1.19.6.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.19.4.1 19-Apr-2006  elad sync with head.
 1.19.2.2 26-Jun-2006  yamt sync with head.
 1.19.2.1 01-Apr-2006  yamt sync with head.
 1.20.4.1 13-Jul-2006  gdamore Merge from HEAD.
 1.2 19-Jun-2006  gdamore Initial import of bluetooth stack on behalf of Iain Hibbert. (plunky@,
NetBSD Foundation Membership still pending.) This stack was written by
Iain under sponsorship from Itronix Inc.

The stack includes support for rfcomm networking (networking via your
bluetooth enabled cell phone), hid devices (keyboards/mice), and headsets.

Drivers for both PCMCIA and USB bluetooth controllers are included.
 1.1 11-Jan-2003  dsainty branches: 1.1.2; 1.1.20; 1.1.34; 1.1.38; 1.1.46;
Utilities for use with Bluetooth drivers
 1.1.46.1 13-Jul-2006  gdamore Merge from HEAD.
 1.1.38.1 26-Jun-2006  yamt sync with head.
 1.1.34.1 09-Sep-2006  rpaulo sync with head
 1.1.20.1 21-Jun-2006  yamt sync with head.
 1.1.2.2 15-Jan-2003  thorpej Sync with HEAD.
 1.1.2.1 11-Jan-2003  thorpej file bthci_util.c was added on branch nathanw_sa on 2003-01-15 18:44:15 +0000
 1.2 19-Jun-2006  gdamore Initial import of bluetooth stack on behalf of Iain Hibbert. (plunky@,
NetBSD Foundation Membership still pending.) This stack was written by
Iain under sponsorship from Itronix Inc.

The stack includes support for rfcomm networking (networking via your
bluetooth enabled cell phone), hid devices (keyboards/mice), and headsets.

Drivers for both PCMCIA and USB bluetooth controllers are included.
 1.1 11-Jan-2003  dsainty branches: 1.1.2; 1.1.20; 1.1.34; 1.1.38; 1.1.46;
Utilities for use with Bluetooth drivers
 1.1.46.1 13-Jul-2006  gdamore Merge from HEAD.
 1.1.38.1 26-Jun-2006  yamt sync with head.
 1.1.34.1 09-Sep-2006  rpaulo sync with head
 1.1.20.1 21-Jun-2006  yamt sync with head.
 1.1.2.2 15-Jan-2003  thorpej Sync with HEAD.
 1.1.2.1 11-Jan-2003  thorpej file bthci_util.h was added on branch nathanw_sa on 2003-01-15 18:44:15 +0000
 1.5 19-Jun-2006  gdamore Initial import of bluetooth stack on behalf of Iain Hibbert. (plunky@,
NetBSD Foundation Membership still pending.) This stack was written by
Iain under sponsorship from Itronix Inc.

The stack includes support for rfcomm networking (networking via your
bluetooth enabled cell phone), hid devices (keyboards/mice), and headsets.

Drivers for both PCMCIA and USB bluetooth controllers are included.
 1.4 17-Dec-2005  xtraeme branches: 1.4.4; 1.4.8; 1.4.16;
Make this build again (ktrace-lwp branch changes).
 1.3 05-Jan-2003  dsainty branches: 1.3.18;
Make the bthci driver functional. This is an experimental, incomplete, but
actually functional driver. It provides user access through a character
device to a Bluetooth HCI capable driver.

The device interface is the same (open/read/write) as the RAW HCI socket
(socket/recv/send) interface provided by the Linux and FreeBSD netgraph
Bluetooth stacks. This allows a (very small) number of diagnostic programs to
be trivially ported and actually work.
 1.2 23-Oct-2002  jdolecek merge kqueue branch into -current

kqueue provides a stateful and efficient event notification framework
currently supported events include socket, file, directory, fifo,
pipe, tty and device changes, and monitoring of processes and signals

kqueue is supported by all writable filesystems in NetBSD tree
(with exception of Coda) and all device drivers supporting poll(2)

based on work done by Jonathan Lemon for FreeBSD
initial NetBSD port done by Luke Mewburn and Jason Thorpe
 1.1 24-Aug-2002  augustss branches: 1.1.2; 1.1.4; 1.1.6;
Add some placeholders for Bluetooth code.
 1.1.6.4 07-Jan-2003  thorpej Sync with HEAD.
 1.1.6.3 11-Nov-2002  nathanw Catch up to -current
 1.1.6.2 18-Oct-2002  nathanw New files in merge.
 1.1.6.1 24-Aug-2002  nathanw file bthcivar.h was added on branch nathanw_sa on 2002-10-18 03:20:33 +0000
 1.1.4.3 11-Oct-2002  jdolecek add some kqfilter hooks
 1.1.4.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.1.4.1 24-Aug-2002  jdolecek file bthcivar.h was added on branch kqueue on 2002-09-06 08:43:59 +0000
 1.1.2.2 29-Aug-2002  gehenna catch up with -current.
 1.1.2.1 24-Aug-2002  gehenna file bthcivar.h was added on branch gehenna-devsw on 2002-08-29 05:22:22 +0000
 1.3.18.1 21-Jun-2006  yamt sync with head.
 1.4.16.1 13-Jul-2006  gdamore Merge from HEAD.
 1.4.8.1 26-Jun-2006  yamt sync with head.
 1.4.4.1 09-Sep-2006  rpaulo sync with head
 1.1 19-Jun-2006  gdamore branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8; 1.1.14;
Initial import of bluetooth stack on behalf of Iain Hibbert. (plunky@,
NetBSD Foundation Membership still pending.) This stack was written by
Iain under sponsorship from Itronix Inc.

The stack includes support for rfcomm networking (networking via your
bluetooth enabled cell phone), hid devices (keyboards/mice), and headsets.

Drivers for both PCMCIA and USB bluetooth controllers are included.
 1.1.14.2 09-Sep-2006  rpaulo sync with head
 1.1.14.1 19-Jun-2006  rpaulo file bthid.h was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:49:44 +0000
 1.1.8.2 13-Jul-2006  gdamore Merge from HEAD.
 1.1.8.1 19-Jun-2006  gdamore file bthid.h was added on branch gdamore-uart on 2006-07-13 17:49:22 +0000
 1.1.6.2 26-Jun-2006  yamt sync with head.
 1.1.6.1 19-Jun-2006  yamt file bthid.h was added on branch yamt-pdpolicy on 2006-06-26 12:50:37 +0000
 1.1.4.2 22-Jun-2006  chap Complete a sync sys/ with head.
 1.1.4.1 19-Jun-2006  chap file bthid.h was added on branch chap-midi on 2006-06-22 03:39:48 +0000
 1.1.2.2 21-Jun-2006  yamt sync with head.
 1.1.2.1 19-Jun-2006  yamt file bthid.h was added on branch yamt-lazymbuf on 2006-06-21 15:02:45 +0000
 1.34 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.33 24-Apr-2021  thorpej branches: 1.33.8;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.32 11-Jun-2020  thorpej branches: 1.32.4;
Update for proplib(3) API changes.
 1.31 15-Nov-2018  jakllsch Correctly handle signed/unsigned quantities in kernel HID parser.

Should fix PR kern/53605.
 1.30 10-Dec-2017  bouyer branches: 1.30.2; 1.30.4;
Factor out bus-independant HID code so that it can be shared by USB, bluetooth
and i2c.
dev/usb/ukbdmap.c is renamed to dev/hid/hidkbdmap.c
dev/usb/hid.[ch] moved to dev/hid/
usage pages moved from dev/usb/usbhid.h moved to dev/hid/hid.h,
and updated with OpenBSD entries.
bus-independant code moved from dev/usb/ums.c to dev/hid/hidms.c
(the same should be done for keyboard and touchpad drivers)

Needed for the upcoming HID over I2C support, proposed on tech-kern@
on Dec, 1.
 1.29 05-Aug-2014  rtr split PRU_SEND function out of pr_generic() usrreq switches and put into
separate functions

xxx_send(struct socket *, struct mbuf *, struct mbuf *,
struct mbuf *, struct lwp *)

- always KASSERT(solocked(so)) even if not implemented

- replace calls to pr_generic() with req = PRU_SEND with calls to
pr_send()

rename existing functions that operate on PCB for consistency (and to
free up their names for xxx_send() PRUs

- l2cap_send() -> l2cap_send_pcb()
- sco_send() -> sco_send_pcb()
- rfcomm_send() -> rfcomm_send_pcb()

patch reviewed by rmind
 1.28 31-Jul-2014  rtr split PRU_DISCONNECT, PRU_SHUTDOWN and PRU_ABORT function out of
pr_generic() usrreq switches and put into separate functions

xxx_disconnect(struct socket *)
xxx_shutdown(struct socket *)
xxx_abort(struct socket *)

- always KASSERT(solocked(so)) even if not implemented
- replace calls to pr_generic() with req =
PRU_{DISCONNECT,SHUTDOWN,ABORT}
with calls to pr_{disconnect,shutdown,abort}() respectively

rename existing internal functions used to implement above functionality
to permit use of the names for xxx_{disconnect,shutdown,abort}().

- {l2cap,sco,rfcomm}_disconnect() ->
{l2cap,sco,rfcomm}_disconnect_pcb()
- {unp,rip,tcp}_disconnect() -> {unp,rip,tcp}_disconnect1()
- unp_shutdown() -> unp_shutdown1()

patch reviewed by rmind
 1.27 30-Jul-2014  rtr split PRU_CONNECT function out of pr_generic() usrreq switches and put
into seaparate functions

xxx_listen(struct socket *, struct mbuf *)

- always KASSERT(solocked(so)) and KASSERT(nam != NULL)
- replace calls to pr_generic() with req = PRU_CONNECT with
pr_connect()
- rename existin {l2cap,sco,rfcomm}_connect() to
{l2cap,sco,rfcomm}_connect_pcb() respectively to permit
naming consistency with other protocols functions.
- drop struct lwp * parameter from unp_connect() and at_pcbconnect()
and use curlwp instead where appropriate.

patch reviewed by rmind
 1.26 24-Jul-2014  rtr split PRU_BIND and PRU_LISTEN function out of pr_generic() usrreq
switches and put into separate functions
xxx_bind(struct socket *, struct mbuf *)
xxx_listen(struct socket *)

- always KASSERT(solocked(so)) even if not implemented

- replace calls to pr_generic() with req = PRU_BIND with call to
pr_bind()

- replace calls to pr_generic() with req = PRU_LISTEN with call to
pr_listen()

- drop struct lwp * parameter from at_pcbsetaddr(), in_pcbbind() and
unp_bind() and always use curlwp.

rename existing functions that operate on PCB for consistency (and to
free up their names for xxx_{bind,listen}() PRUs

- l2cap_{bind,listen}() -> l2cap_{bind,listen}_pcb()
- sco_{bind,listen}() -> sco_{bind,listen}_pcb()
- rfcomm_{bind,listen}() -> rfcomm_{bind,listen}_pcb()

patch reviewed by rmind

welcome to netbsd 6.99.48
 1.25 20-May-2014  rmind netbt: rename some attach/detach functions to have _pcb suffix, so
we could use standard attach/detach naming for pr_usrreq functions.
No functional change.
 1.24 20-Dec-2012  plunky branches: 1.24.10;
increase some diagnostics
 1.23 20-Dec-2012  plunky when no link-mode is specified, explicitly set a mode of (int)0
otherwise l2cap_setmode() will fail during connection setup

for bthidev.c, this fixes a problem with Microsoft Wedge Touch
mouse (which may not be able to authenticate)

for btmagic.c, include this fix in case somebody tries that

related to PR/47286
 1.22 03-Apr-2012  plunky branches: 1.22.2;

register/deregister pmf(9) NULL handlers for bthub(4) and
bluetooth devices which attach there, to fix PR/39006
 1.21 11-Jan-2012  plunky branches: 1.21.2;
offset processing of input reports to a kernel thread, to avoid
locking issues when a child device needs to call back into the
Bluetooth stack (eg when caps-lock is pressed, and wskbd wants
to change a LED)

(as discussed with Radoslaw Kujawa)
 1.20 31-Dec-2011  rkujawa Fix panic triggered by pressing the caps lock key:
http://c0ff33.net/drop/bt_caps_panic.jpg

OK'd mrg.
 1.19 28-Apr-2010  plunky branches: 1.19.8; 1.19.12;
allow for vendor-id and product-id properties, passing them
through to child devices
 1.18 21-Aug-2009  plunky branches: 1.18.2; 1.18.4;
I had a complaint that it was difficult to reconnect a device after
system crashes and reboots and I wonder if the reason was that we
were rejecting the connection for some reason. So, notify the console
if that happens.
 1.17 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.16 06-Aug-2008  plunky branches: 1.16.4; 1.16.8;
Convert socket options code to use a sockopt structure
instead of laying everything into an mbuf.

approved by core
 1.15 24-Apr-2008  ad branches: 1.15.2; 1.15.4; 1.15.8;
Merge the socket locking patch:

- Socket layer becomes MP safe.
- Unix protocols become MP safe.
- Allows protocol processing interrupts to safely block on locks.
- Fixes a number of race conditions.

With much feedback from matt@ and plunky@.
 1.14 28-Mar-2008  plunky branches: 1.14.2;
Use deviter API to search for child devices.

As all identifying information is stored in the device
properties, this removes the need for child devices to
have a reserved area (struct btdev) in the softc, and
bthub(4) does no longer need to have a softc at all.
 1.13 12-Nov-2007  plunky branches: 1.13.14;
improve visibility of [dis]connected messages
 1.12 11-Nov-2007  plunky convert device printf() usages to aprint_xxxx()
 1.11 03-Nov-2007  plunky branches: 1.11.2;
'struct callout' => callout_t
don't use callout_reset()
do use callout_destroy()
 1.10 03-Nov-2007  plunky switch devices to using CFATTACH_DECL_NEW()
softc no longer contains 'struct device' by default
use 'device_t' instead of 'struct device *'
use device_xxx() accessor functions
remove casting of 'xxx_softc *' & 'struct device *'
use aprint_xxx_dev() routines
 1.9 09-Jul-2007  ad branches: 1.9.6; 1.9.8; 1.9.12;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
 1.8 21-Apr-2007  plunky Add 'service level' security for L2CAP and RFCOMM connections, following
the Linux (BlueZ) API.

- L2CAP or RFCOMM connections can require the baseband radio link
mode be any of:
authenticated (devices are paired)
encrypted (implies authentication)
secured (encryption, plus generate new link key)

- for sockets, the mode is set using setsockopt(2) and the socket
connection will be aborted if the mode change fails.

- mode settings will be applied during connection establishment, and
for safety, we enter a wait state and will only proceed when the mode
settings are successfuly set.

- It is possible to change the mode on already open connections, but
not possible to guarantee that data already queued (from either end)
will not be delivered. (this is a feature, not a bug)

- bthidev(4) and rfcomm_sppd(1) support "auth", "encrypt" and
"secure" options

- btdevctl(8) by default enables "auth" for HIDs, and "encrypt" for
keyboards (which are required to support it)
 1.7 16-Nov-2006  christos branches: 1.7.2; 1.7.4; 1.7.8; 1.7.10; 1.7.16;
__unused removal on arguments; approved by core.
 1.6 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.5 04-Oct-2006  plunky Internally, use the service name as the identifier for matching
 1.4 12-Sep-2006  plunky branches: 1.4.2;
guard against a possible situation where the list of l2cap channels is changed
when the bluetooth code is not expecting it to be. During a disconnect, we can
detach the channel that is being disconnected, but its not really safe to detach
any others.
 1.3 10-Sep-2006  plunky update to bluetooth device attachment:

remove pseudo-device btdev(4) and inherent limitations

add bthub(4) which autoconfigures at bluetooth controllers as they
are enabled. bluetooth devices now attach here.

btdevctl(8) and its cache is updated to handle new semantics

etc/rc.d/btdevctl is updated to configure devices from a list
in /etc/bluetooth/btdevctl.conf
 1.2 26-Jul-2006  tron branches: 1.2.2; 1.2.4; 1.2.6;
Bluetooth fixes by Iain Hibbert:
- Update bthidev(4) to use property lists for configuration.
 1.1 19-Jun-2006  gdamore branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8;
Initial import of bluetooth stack on behalf of Iain Hibbert. (plunky@,
NetBSD Foundation Membership still pending.) This stack was written by
Iain under sponsorship from Itronix Inc.

The stack includes support for rfcomm networking (networking via your
bluetooth enabled cell phone), hid devices (keyboards/mice), and headsets.

Drivers for both PCMCIA and USB bluetooth controllers are included.
 1.1.8.2 13-Jul-2006  gdamore Merge from HEAD.
 1.1.8.1 19-Jun-2006  gdamore file bthidev.c was added on branch gdamore-uart on 2006-07-13 17:49:22 +0000
 1.1.6.4 14-Sep-2006  yamt sync with head.
 1.1.6.3 11-Aug-2006  yamt sync with head
 1.1.6.2 26-Jun-2006  yamt sync with head.
 1.1.6.1 19-Jun-2006  yamt file bthidev.c was added on branch yamt-pdpolicy on 2006-06-26 12:50:37 +0000
 1.1.4.2 22-Jun-2006  chap Complete a sync sys/ with head.
 1.1.4.1 19-Jun-2006  chap file bthidev.c was added on branch chap-midi on 2006-06-22 03:39:48 +0000
 1.1.2.5 15-Nov-2007  yamt sync with head.
 1.1.2.4 03-Sep-2007  yamt sync with head.
 1.1.2.3 30-Dec-2006  yamt sync with head.
 1.1.2.2 21-Jun-2006  yamt sync with head.
 1.1.2.1 19-Jun-2006  yamt file bthidev.c was added on branch yamt-lazymbuf on 2006-06-21 15:02:45 +0000
 1.2.6.2 09-Sep-2006  rpaulo sync with head
 1.2.6.1 26-Jul-2006  rpaulo file bthidev.c was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:49:44 +0000
 1.2.4.1 18-Nov-2006  ad Sync with head.
 1.2.2.1 14-Sep-2006  riz Pull up following revision(s) (requested by plunky in ticket #161):
sys/dev/bluetooth/btdev.h: revision 1.4
distrib/sets/lists/comp/mi: revision 1.922
usr.sbin/postinstall/postinstall: revision 1.25
sys/netbt/hci_unit.c: revision 1.3
sys/netbt/hci_ioctl.c: revision 1.4
usr.sbin/sdpd/profile.c: revision 1.2
usr.sbin/btdevctl/btdevctl.c: revision 1.2
share/man/man4/Makefile: revision 1.405
distrib/sets/lists/man/mi: revision 1.930
distrib/sets/lists/etc/mi: revision 1.176
usr.sbin/sdpd/profile.c: revision 1.3
usr.sbin/btdevctl/btdevctl.c: revision 1.3
etc/MAKEDEV.tmpl: revision 1.62
distrib/sets/lists/base/mi: revision 1.650
usr.sbin/btdevctl/btdevctl.h: revision 1.2
usr.bin/sdpquery/sdpquery.1: revision 1.4
sys/netbt/rfcomm_session.c: revision 1.2
usr.sbin/btdevctl/btdevctl.8: revision 1.3
usr.bin/sdpquery/search.c: revision 1.2
usr.sbin/sdpd/Makefile: revision 1.2
sys/dev/bluetooth/Makefile: revision 1.3
usr.sbin/btdevctl/cfg.c: file removal
sys/netbt/files.netbt: revision 1.4
usr.sbin/btdevctl/sdp.c: revision 1.1
sys/dev/bluetooth/bthidev.c: revision 1.3
etc/bluetooth/Makefile: revision 1.3
sys/dev/pcmcia/files.pcmcia: revision 1.51
sys/dev/bluetooth/bthidev.c: revision 1.4
sys/dev/bluetooth/bthidev.h: revision 1.3
usr.sbin/btdevctl/dev.c: file removal
sys/dev/bluetooth/files.bluetooth: revision 1.10
sys/arch/i386/conf/GENERIC: revision 1.777
share/man/man4/ubt.4: revision 1.6
share/man/man4/bthub.4: revision 1.3
sys/netbt/hci.h: revision 1.5
sys/arch/i386/conf/GENERIC_LAPTOP: revision 1.202
lib/libsdp/sdp.h: revision 1.2
usr.sbin/btdevctl/print.c: revision 1.1
share/man/man4/bthidev.4: revision 1.5
share/man/man4/btdev.4: file removal
usr.sbin/btdevctl/print.c: revision 1.2
sys/arch/i386/conf/GENERIC_LAPTOP: revision 1.205
usr.sbin/btdevctl/Makefile: revision 1.2
sys/dev/usb/files.usb: revision 1.70
sys/netbt/l2cap_signal.c: revision 1.2
sys/netbt/hci_link.c: revision 1.4
sys/dev/bluetooth/bthub.c: revision 1.3
share/man/man4/btsco.4: revision 1.5
sys/netbt/hci_link.c: revision 1.5
share/man/man4/btdev.4: revision 1.4
sys/dev/bluetooth/btkbd.c: revision 1.3
sys/dev/bluetooth/btdev.c: file removal
sys/netbt/hci_event.c: revision 1.2
sys/dev/bluetooth/btsco.h: revision 1.2
etc/mtree/special: revision 1.101
sys/dev/bluetooth/btsco.c: revision 1.3
sys/conf/majors: revision 1.27
usr.sbin/sdpd/hf.c: revision 1.1
sys/dev/bluetooth/btsco.c: revision 1.4
share/man/man5/rc.conf.5: revision 1.107
sys/dev/bluetooth/btdev.c: revision 1.2
etc/rc.d/btdevctl: revision 1.2
usr.sbin/btdevctl/db.c: revision 1.1
etc/rc.d/btdevctl: revision 1.3
etc/bluetooth/btdevctl.conf: revision 1.1
usr.sbin/btdevctl/hid.c: file removal
sys/arch/i386/conf/GENERIC: revision 1.781
sys/dev/bluetooth/btdev.h: revision 1.3
Make btdev default count explicit
Fix typo in variable name
update to bluetooth device attachment:
remove pseudo-device btdev(4) and inherent limitations
add bthub(4) which autoconfigures at bluetooth controllers as they
are enabled. bluetooth devices now attach here.
btdevctl(8) and its cache is updated to handle new semantics
etc/rc.d/btdevctl is updated to configure devices from a list
in /etc/bluetooth/btdevctl.conf
also include service name in dictionary being sent to kernel.
(this is not used just yet, but it might be in the future and it will
be easier if we dont have to provide code to handle its absence)
clarify the CAVEAT section somewhat
Add service discovery support for the Handsfree profile
Replace static 'FreeBSD' string with operating system name gleaned
from uname(3)
Halt the callout on detach
btsco.c:
- sco_getopt(..., SO_SCO_MTU, ...) expects the address of a uint16_t,
not an int. So change sc_mtu's type to uint16_t.
- Try a little harder to ensure btsco_round_blocksize() does not
return zero. Prevents a subsequent panic in audio_init_ringbuffer().
from scw@
Endian issues:
hci_event.c:
- Convert memo->response.clock_offset to host-endian.
hci_ioctl.c:
- printf format tweak (size_t)
hci_link.c:
- Convert memo->response.clock_offset from host-endian.
- Tweak a DIAGNOSTIC message.
l2cap_signal.c:
- In l2cap_recv_config_req(), rp->scid is little-endian so make sure
we convert from host-endian.
from scw@
hci_link.c:
- In hci_link_free(), do not unlink items from a LIST queue within
a LIST_FOREACH() iterator.
rfcomm_session.c:
- In rfcomm_session_recv_mcc_nsc(), do not unlink items from a LIST
queue within a LIST_FOREACH() iterator.
from scw@
guard against a possible situation where the list of l2cap channels is changed
when the bluetooth code is not expecting it to be. During a disconnect, we can
detach the channel that is being disconnected, but its not really safe to detach
any others.
Print explicit 64-bit types using the format macros from int_fmtio.h.
Unbreaks the build for our LP64 ports, where "long long" typically is
not 64 bits.
 1.4.2.2 10-Dec-2006  yamt sync with head.
 1.4.2.1 22-Oct-2006  yamt sync with head
 1.7.16.1 03-Sep-2007  wrstuden Sync w/ NetBSD-4-RC_1
 1.7.10.1 11-Jul-2007  mjf Sync with head.
 1.7.8.2 01-Jul-2007  ad Adapt to callout API change.
 1.7.8.1 27-May-2007  ad Sync with head.
 1.7.4.1 07-May-2007  yamt sync with head.
 1.7.2.1 19-Jul-2007  liamjfoy Pull up following revision(s) (requested by plunky in ticket #744):
sys/netbt/l2cap_lower.c: revision 1.6
sys/dev/bluetooth/btdev.h: revision 1.6
sys/netbt/sco_socket.c: revision 1.9
sys/netbt/rfcomm_upper.c: revision 1.3
sys/netbt/l2cap_socket.c: revision 1.7
sys/netbt/rfcomm_upper.c: revision 1.5
lib/libusbhid/usbhid.h: revision 1.5
sys/netbt/rfcomm_upper.c: revision 1.6
usr.sbin/btdevctl/btdevctl.c: revision 1.4
usr.sbin/btdevctl/btdevctl.h: revision 1.3
usr.sbin/btdevctl/btdevctl.8: revision 1.4
sys/netbt/rfcomm_session.c: revision 1.5
sys/netbt/hci.h: revision 1.10
usr.bin/rfcomm_sppd/rfcomm_sppd.c: revision 1.6
sys/netbt/hci_link.c: revision 1.11
usr.bin/rfcomm_sppd/rfcomm_sppd.c: revision 1.7
usr.bin/rfcomm_sppd/rfcomm_sppd.c: revision 1.8
sys/dev/bluetooth/btsco.c: revision 1.14
sys/netbt/rfcomm_session.c: revision 1.9
usr.sbin/btdevctl/sdp.c: revision 1.2
share/man/man9/bluetooth.9: revision 1.2
usr.sbin/btdevctl/sdp.c: revision 1.3
sys/dev/bluetooth/bthidev.c: revision 1.8
sys/netbt/l2cap.h: revision 1.4
sys/netbt/rfcomm.h: revision 1.3
sys/netbt/l2cap.h: revision 1.5
sys/netbt/l2cap_misc.c: revision 1.3
share/man/man4/bluetooth.4: revision 1.5
lib/libusbhid/usbhid.3: revision 1.11
sys/netbt/bluetooth.h: revision 1.5
share/man/man4/bthidev.4: revision 1.8
sys/netbt/rfcomm_dlc.c: revision 1.3
usr.sbin/btdevctl/print.c: revision 1.8
sys/netbt/rfcomm_socket.c: revision 1.7
sys/netbt/l2cap_signal.c: revision 1.4
sys/netbt/l2cap_signal.c: revision 1.5
sys/netbt/l2cap_signal.c: revision 1.7
sys/netbt/hci_event.c: revision 1.6
usr.bin/rfcomm_sppd/rfcomm_sppd.1: revision 1.5
sys/netbt/l2cap_upper.c: revision 1.3
sys/netbt/l2cap_lower.c: revision 1.2
usr.sbin/btdevctl/db.c: revision 1.3
sys/netbt/l2cap_upper.c: revision 1.6
lib/libusbhid/descr.c: revision 1.5
sys/netbt/l2cap_upper.c: revision 1.7
sys/netbt/l2cap_lower.c: revision 1.4
Add 'service level' security for L2CAP and RFCOMM connections, following
the Linux (BlueZ) API.
- L2CAP or RFCOMM connections can require the baseband radio link
mode be any of:
authenticated (devices are paired)
encrypted (implies authentication)
secured (encryption, plus generate new link key)
- for sockets, the mode is set using setsockopt(2) and the socket
connection will be aborted if the mode change fails.
- mode settings will be applied during connection establishment, and
for safety, we enter a wait state and will only proceed when the mode
settings are successfuly set.
- It is possible to change the mode on already open connections, but
not possible to guarantee that data already queued (from either end)
will not be delivered. (this is a feature, not a bug)
- bthidev(4) and rfcomm_sppd(1) support "auth", "encrypt" and
"secure" options
- btdevctl(8) by default enables "auth" for HIDs, and "encrypt" for
keyboards (which are required to support it)
- ALSO INCLUDES OTHER MINOR FIXES
 1.9.12.1 13-Nov-2007  bouyer Sync with HEAD
 1.9.8.2 09-Jan-2008  matt sync with HEAD
 1.9.8.1 06-Nov-2007  matt sync with HEAD
 1.9.6.3 14-Nov-2007  joerg Sync with HEAD.
 1.9.6.2 11-Nov-2007  joerg Sync with HEAD.
 1.9.6.1 04-Nov-2007  jmcneill Sync with HEAD.
 1.11.2.1 19-Nov-2007  mjf Sync with HEAD.
 1.13.14.3 28-Sep-2008  mjf Sync with HEAD.
 1.13.14.2 02-Jun-2008  mjf Sync with HEAD.
 1.13.14.1 03-Apr-2008  mjf Sync with HEAD.
 1.14.2.1 18-May-2008  yamt sync with head.
 1.15.8.1 19-Oct-2008  haad Sync with HEAD.
 1.15.4.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.15.2.4 11-Aug-2010  yamt sync with head.
 1.15.2.3 16-Sep-2009  yamt sync with head
 1.15.2.2 16-May-2009  yamt sync with head
 1.15.2.1 04-May-2009  yamt sync with head.
 1.16.8.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.16.4.1 20-Jan-2013  bouyer Pull up following revision(s) (requested by plunky in ticket #1835):
sys/dev/bluetooth/bthidev.c: revision 1.23 via patch
sys/dev/bluetooth/bthidev.c: revision 1.24 via patch
usr.sbin/btdevctl/btdevctl.8: revision 1.8 via patch
sys/dev/bluetooth/btmagic.c: revision 1.4 via patch
sys/dev/bluetooth/btmagic.c: revision 1.5 via patch
when no link-mode is specified, explicitly set a mode of (int)0
otherwise l2cap_setmode() will fail during connection setup
for bthidev.c, this fixes a problem with Microsoft Wedge Touch
mouse (which may not be able to authenticate)
for btmagic.c, include this fix in case somebody tries that
related to PR/47286
increase some diagnostics
add a comment pointing out that the link-mode may need to be
changed manually, for devices which cannot authenticate
for PR/47286
 1.18.4.1 30-May-2010  rmind sync with head
 1.18.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.19.12.2 05-Apr-2012  mrg sync to latest -current.
 1.19.12.1 18-Feb-2012  mrg merge to -current.
 1.19.8.2 23-Jan-2013  yamt sync with head
 1.19.8.1 17-Apr-2012  yamt sync with head
 1.21.2.2 07-Jan-2013  riz Pull up following revision(s) (requested by plunky in ticket #769):
sys/dev/bluetooth/bthidev.c: revision 1.23
sys/dev/bluetooth/bthidev.c: revision 1.24
usr.sbin/btdevctl/btdevctl.8: revision 1.8
sys/dev/bluetooth/btmagic.c: revision 1.4
sys/dev/bluetooth/btmagic.c: revision 1.5
when no link-mode is specified, explicitly set a mode of (int)0
otherwise l2cap_setmode() will fail during connection setup
for bthidev.c, this fixes a problem with Microsoft Wedge Touch
mouse (which may not be able to authenticate)
for btmagic.c, include this fix in case somebody tries that
related to PR/47286
increase some diagnostics
add a comment pointing out that the link-mode may need to be
changed manually, for devices which cannot authenticate
for PR/47286
 1.21.2.1 03-Apr-2012  riz Pull up following revision(s) (requested by plunky in ticket #159):
sys/dev/bluetooth/btsco.c: revision 1.28
sys/dev/bluetooth/bthidev.c: revision 1.22
sys/dev/bluetooth/bthub.c: revision 1.18
sys/dev/bluetooth/btkbd.c: revision 1.14
sys/dev/bluetooth/btms.c: revision 1.10
sys/dev/bluetooth/btmagic.c: revision 1.2
register/deregister pmf(9) NULL handlers for bthub(4) and
bluetooth devices which attach there, to fix PR/39006
 1.22.2.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.22.2.1 25-Feb-2013  tls resync with head
 1.24.10.1 10-Aug-2014  tls Rebase.
 1.30.4.1 10-Jun-2019  christos Sync with HEAD
 1.30.2.1 26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.32.4.1 22-Mar-2021  thorpej Mechanical conversion of config_found_sm_loc() -> config_found().
CFARG_IATTR usage needs to be audited.
 1.33.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.5 28-Apr-2010  plunky allow for vendor-id and product-id properties, passing them
through to child devices
 1.4 03-Nov-2007  plunky branches: 1.4.20; 1.4.40; 1.4.42;
switch devices to using CFATTACH_DECL_NEW()
softc no longer contains 'struct device' by default
use 'device_t' instead of 'struct device *'
use device_xxx() accessor functions
remove casting of 'xxx_softc *' & 'struct device *'
use aprint_xxx_dev() routines
 1.3 10-Sep-2006  plunky branches: 1.3.24; 1.3.26; 1.3.30;
update to bluetooth device attachment:

remove pseudo-device btdev(4) and inherent limitations

add bthub(4) which autoconfigures at bluetooth controllers as they
are enabled. bluetooth devices now attach here.

btdevctl(8) and its cache is updated to handle new semantics

etc/rc.d/btdevctl is updated to configure devices from a list
in /etc/bluetooth/btdevctl.conf
 1.2 26-Jul-2006  tron branches: 1.2.2; 1.2.4; 1.2.6;
Bluetooth fixes by Iain Hibbert:
- Update bthidev(4) to use property lists for configuration.
 1.1 19-Jun-2006  gdamore branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8;
Initial import of bluetooth stack on behalf of Iain Hibbert. (plunky@,
NetBSD Foundation Membership still pending.) This stack was written by
Iain under sponsorship from Itronix Inc.

The stack includes support for rfcomm networking (networking via your
bluetooth enabled cell phone), hid devices (keyboards/mice), and headsets.

Drivers for both PCMCIA and USB bluetooth controllers are included.
 1.1.8.2 13-Jul-2006  gdamore Merge from HEAD.
 1.1.8.1 19-Jun-2006  gdamore file bthidev.h was added on branch gdamore-uart on 2006-07-13 17:49:22 +0000
 1.1.6.4 14-Sep-2006  yamt sync with head.
 1.1.6.3 11-Aug-2006  yamt sync with head
 1.1.6.2 26-Jun-2006  yamt sync with head.
 1.1.6.1 19-Jun-2006  yamt file bthidev.h was added on branch yamt-pdpolicy on 2006-06-26 12:50:37 +0000
 1.1.4.2 22-Jun-2006  chap Complete a sync sys/ with head.
 1.1.4.1 19-Jun-2006  chap file bthidev.h was added on branch chap-midi on 2006-06-22 03:39:48 +0000
 1.1.2.4 15-Nov-2007  yamt sync with head.
 1.1.2.3 30-Dec-2006  yamt sync with head.
 1.1.2.2 21-Jun-2006  yamt sync with head.
 1.1.2.1 19-Jun-2006  yamt file bthidev.h was added on branch yamt-lazymbuf on 2006-06-21 15:02:45 +0000
 1.2.6.2 09-Sep-2006  rpaulo sync with head
 1.2.6.1 26-Jul-2006  rpaulo file bthidev.h was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:49:44 +0000
 1.2.4.1 18-Nov-2006  ad Sync with head.
 1.2.2.1 14-Sep-2006  riz Pull up following revision(s) (requested by plunky in ticket #161):
sys/dev/bluetooth/btdev.h: revision 1.4
distrib/sets/lists/comp/mi: revision 1.922
usr.sbin/postinstall/postinstall: revision 1.25
sys/netbt/hci_unit.c: revision 1.3
sys/netbt/hci_ioctl.c: revision 1.4
usr.sbin/sdpd/profile.c: revision 1.2
usr.sbin/btdevctl/btdevctl.c: revision 1.2
share/man/man4/Makefile: revision 1.405
distrib/sets/lists/man/mi: revision 1.930
distrib/sets/lists/etc/mi: revision 1.176
usr.sbin/sdpd/profile.c: revision 1.3
usr.sbin/btdevctl/btdevctl.c: revision 1.3
etc/MAKEDEV.tmpl: revision 1.62
distrib/sets/lists/base/mi: revision 1.650
usr.sbin/btdevctl/btdevctl.h: revision 1.2
usr.bin/sdpquery/sdpquery.1: revision 1.4
sys/netbt/rfcomm_session.c: revision 1.2
usr.sbin/btdevctl/btdevctl.8: revision 1.3
usr.bin/sdpquery/search.c: revision 1.2
usr.sbin/sdpd/Makefile: revision 1.2
sys/dev/bluetooth/Makefile: revision 1.3
usr.sbin/btdevctl/cfg.c: file removal
sys/netbt/files.netbt: revision 1.4
usr.sbin/btdevctl/sdp.c: revision 1.1
sys/dev/bluetooth/bthidev.c: revision 1.3
etc/bluetooth/Makefile: revision 1.3
sys/dev/pcmcia/files.pcmcia: revision 1.51
sys/dev/bluetooth/bthidev.c: revision 1.4
sys/dev/bluetooth/bthidev.h: revision 1.3
usr.sbin/btdevctl/dev.c: file removal
sys/dev/bluetooth/files.bluetooth: revision 1.10
sys/arch/i386/conf/GENERIC: revision 1.777
share/man/man4/ubt.4: revision 1.6
share/man/man4/bthub.4: revision 1.3
sys/netbt/hci.h: revision 1.5
sys/arch/i386/conf/GENERIC_LAPTOP: revision 1.202
lib/libsdp/sdp.h: revision 1.2
usr.sbin/btdevctl/print.c: revision 1.1
share/man/man4/bthidev.4: revision 1.5
share/man/man4/btdev.4: file removal
usr.sbin/btdevctl/print.c: revision 1.2
sys/arch/i386/conf/GENERIC_LAPTOP: revision 1.205
usr.sbin/btdevctl/Makefile: revision 1.2
sys/dev/usb/files.usb: revision 1.70
sys/netbt/l2cap_signal.c: revision 1.2
sys/netbt/hci_link.c: revision 1.4
sys/dev/bluetooth/bthub.c: revision 1.3
share/man/man4/btsco.4: revision 1.5
sys/netbt/hci_link.c: revision 1.5
share/man/man4/btdev.4: revision 1.4
sys/dev/bluetooth/btkbd.c: revision 1.3
sys/dev/bluetooth/btdev.c: file removal
sys/netbt/hci_event.c: revision 1.2
sys/dev/bluetooth/btsco.h: revision 1.2
etc/mtree/special: revision 1.101
sys/dev/bluetooth/btsco.c: revision 1.3
sys/conf/majors: revision 1.27
usr.sbin/sdpd/hf.c: revision 1.1
sys/dev/bluetooth/btsco.c: revision 1.4
share/man/man5/rc.conf.5: revision 1.107
sys/dev/bluetooth/btdev.c: revision 1.2
etc/rc.d/btdevctl: revision 1.2
usr.sbin/btdevctl/db.c: revision 1.1
etc/rc.d/btdevctl: revision 1.3
etc/bluetooth/btdevctl.conf: revision 1.1
usr.sbin/btdevctl/hid.c: file removal
sys/arch/i386/conf/GENERIC: revision 1.781
sys/dev/bluetooth/btdev.h: revision 1.3
Make btdev default count explicit
Fix typo in variable name
update to bluetooth device attachment:
remove pseudo-device btdev(4) and inherent limitations
add bthub(4) which autoconfigures at bluetooth controllers as they
are enabled. bluetooth devices now attach here.
btdevctl(8) and its cache is updated to handle new semantics
etc/rc.d/btdevctl is updated to configure devices from a list
in /etc/bluetooth/btdevctl.conf
also include service name in dictionary being sent to kernel.
(this is not used just yet, but it might be in the future and it will
be easier if we dont have to provide code to handle its absence)
clarify the CAVEAT section somewhat
Add service discovery support for the Handsfree profile
Replace static 'FreeBSD' string with operating system name gleaned
from uname(3)
Halt the callout on detach
btsco.c:
- sco_getopt(..., SO_SCO_MTU, ...) expects the address of a uint16_t,
not an int. So change sc_mtu's type to uint16_t.
- Try a little harder to ensure btsco_round_blocksize() does not
return zero. Prevents a subsequent panic in audio_init_ringbuffer().
from scw@
Endian issues:
hci_event.c:
- Convert memo->response.clock_offset to host-endian.
hci_ioctl.c:
- printf format tweak (size_t)
hci_link.c:
- Convert memo->response.clock_offset from host-endian.
- Tweak a DIAGNOSTIC message.
l2cap_signal.c:
- In l2cap_recv_config_req(), rp->scid is little-endian so make sure
we convert from host-endian.
from scw@
hci_link.c:
- In hci_link_free(), do not unlink items from a LIST queue within
a LIST_FOREACH() iterator.
rfcomm_session.c:
- In rfcomm_session_recv_mcc_nsc(), do not unlink items from a LIST
queue within a LIST_FOREACH() iterator.
from scw@
guard against a possible situation where the list of l2cap channels is changed
when the bluetooth code is not expecting it to be. During a disconnect, we can
detach the channel that is being disconnected, but its not really safe to detach
any others.
Print explicit 64-bit types using the format macros from int_fmtio.h.
Unbreaks the build for our LP64 ports, where "long long" typically is
not 64 bits.
 1.3.30.1 13-Nov-2007  bouyer Sync with HEAD
 1.3.26.1 06-Nov-2007  matt sync with HEAD
 1.3.24.1 04-Nov-2007  jmcneill Sync with HEAD.
 1.4.42.1 30-May-2010  rmind sync with head
 1.4.40.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.4.20.1 11-Aug-2010  yamt sync with head.
 1.2 26-Jul-2006  tron Bluetooth fixes by Iain Hibbert:
Remove bthset(4) device and add btsco(4) in its place. This is an
improved version which is not just for headsets, as it can receive
incoming connections (eg for Hands Free Profile). Update bthset(1)
control utlitiy to relate to new device.
 1.1 19-Jun-2006  gdamore branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8;
Initial import of bluetooth stack on behalf of Iain Hibbert. (plunky@,
NetBSD Foundation Membership still pending.) This stack was written by
Iain under sponsorship from Itronix Inc.

The stack includes support for rfcomm networking (networking via your
bluetooth enabled cell phone), hid devices (keyboards/mice), and headsets.

Drivers for both PCMCIA and USB bluetooth controllers are included.
 1.1.8.2 13-Jul-2006  gdamore Merge from HEAD.
 1.1.8.1 19-Jun-2006  gdamore file bthset.c was added on branch gdamore-uart on 2006-07-13 17:49:22 +0000
 1.1.6.3 11-Aug-2006  yamt sync with head
 1.1.6.2 26-Jun-2006  yamt sync with head.
 1.1.6.1 19-Jun-2006  yamt file bthset.c was added on branch yamt-pdpolicy on 2006-06-26 12:50:37 +0000
 1.1.4.2 22-Jun-2006  chap Complete a sync sys/ with head.
 1.1.4.1 19-Jun-2006  chap file bthset.c was added on branch chap-midi on 2006-06-22 03:39:48 +0000
 1.1.2.3 30-Dec-2006  yamt sync with head.
 1.1.2.2 21-Jun-2006  yamt sync with head.
 1.1.2.1 19-Jun-2006  yamt file bthset.c was added on branch yamt-lazymbuf on 2006-06-21 15:02:45 +0000
 1.2 26-Jul-2006  tron Bluetooth fixes by Iain Hibbert:
Remove bthset(4) device and add btsco(4) in its place. This is an
improved version which is not just for headsets, as it can receive
incoming connections (eg for Hands Free Profile). Update bthset(1)
control utlitiy to relate to new device.
 1.1 19-Jun-2006  gdamore branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8;
Initial import of bluetooth stack on behalf of Iain Hibbert. (plunky@,
NetBSD Foundation Membership still pending.) This stack was written by
Iain under sponsorship from Itronix Inc.

The stack includes support for rfcomm networking (networking via your
bluetooth enabled cell phone), hid devices (keyboards/mice), and headsets.

Drivers for both PCMCIA and USB bluetooth controllers are included.
 1.1.8.2 13-Jul-2006  gdamore Merge from HEAD.
 1.1.8.1 19-Jun-2006  gdamore file bthset.h was added on branch gdamore-uart on 2006-07-13 17:49:22 +0000
 1.1.6.3 11-Aug-2006  yamt sync with head
 1.1.6.2 26-Jun-2006  yamt sync with head.
 1.1.6.1 19-Jun-2006  yamt file bthset.h was added on branch yamt-pdpolicy on 2006-06-26 12:50:37 +0000
 1.1.4.2 22-Jun-2006  chap Complete a sync sys/ with head.
 1.1.4.1 19-Jun-2006  chap file bthset.h was added on branch chap-midi on 2006-06-22 03:39:48 +0000
 1.1.2.3 30-Dec-2006  yamt sync with head.
 1.1.2.2 21-Jun-2006  yamt sync with head.
 1.1.2.1 19-Jun-2006  yamt file bthset.h was added on branch yamt-lazymbuf on 2006-06-21 15:02:45 +0000
 1.26 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.25 24-Apr-2021  thorpej branches: 1.25.8;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.24 11-Jun-2020  thorpej branches: 1.24.4;
Update for proplib(3) API changes.
 1.23 08-Jun-2020  thorpej Update for proplib(3) API changes.
 1.22 09-May-2015  dholland use standard idiom - thanks riastradh@
 1.21 09-May-2015  dholland Coverity CID 975184: don't ignore pmf_device_register failure.
(XXX: unfortunately all we can do for the moment is print a warning)
 1.20 25-Jul-2014  dholland branches: 1.20.4;
Add d_discard to all struct cdevsw instances I could find.

All have been set to "nodiscard"; some should get a real implementation.
 1.19 16-Mar-2014  dholland branches: 1.19.2;
Change (mostly mechanically) every cdevsw/bdevsw I can find to use
designated initializers.

I have not built every extant kernel so I have probably broken at
least one build; however I've also found and fixed some wrong
cdevsw/bdevsw entries so even if so I think we come out ahead.
 1.18 03-Apr-2012  plunky branches: 1.18.2; 1.18.4;

register/deregister pmf(9) NULL handlers for bthub(4) and
bluetooth devices which attach there, to fix PR/39006
 1.17 31-Jul-2011  uebayasi branches: 1.17.2; 1.17.6; 1.17.8;
Put back #include "ioconf.h" per popular demand.
 1.16 25-May-2011  uebayasi Declare cfdrivers using extern rather than including ioconf.h.
 1.15 12-May-2009  cegger branches: 1.15.4; 1.15.6;
struct cfdata * -> cfdata_t, no functional changes intended.
 1.14 12-Jun-2008  cegger branches: 1.14.10;
use device_lookup_private to get softc
 1.13 28-Mar-2008  plunky branches: 1.13.2; 1.13.4; 1.13.6; 1.13.8;
Use deviter API to search for child devices.

As all identifying information is stored in the device
properties, this removes the need for child devices to
have a reserved area (struct btdev) in the softc, and
bthub(4) does no longer need to have a softc at all.
 1.12 03-Nov-2007  plunky branches: 1.12.16;
switch devices to using CFATTACH_DECL_NEW()
softc no longer contains 'struct device' by default
use 'device_t' instead of 'struct device *'
use device_xxx() accessor functions
remove casting of 'xxx_softc *' & 'struct device *'
use aprint_xxx_dev() routines
 1.11 28-Oct-2007  plunky remove unnecessary cast (shortens long line)
 1.10 13-Mar-2007  plunky branches: 1.10.10; 1.10.12; 1.10.16;
remove extraneous whitespace
 1.9 04-Mar-2007  christos branches: 1.9.2; 1.9.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.8 16-Nov-2006  christos branches: 1.8.4;
__unused removal on arguments; approved by core.
 1.7 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.6 04-Oct-2006  plunky Internally, use the service name as the identifier for matching
 1.5 04-Oct-2006  christos fix incomplete initializer
 1.4 22-Sep-2006  thorpej Alter the protocol impemented by prop_kern to allow for bi-directional
plist-based messages and to eliminate looping previously required to
receive a plist from the kernel:

- prop_dictionary_copyin_ioctl() and prop_dictionary_copyout_ioctl()
now take the cmd argument rather than the file open flag. The
read-ness or write-ness of an ioctl command is checked by these
routines to ensure that information is being passed to/from the
userland component properly.

- prop_dictionary_copyout_ioctl() now allocates the memory for the
XML plist on behalf of the userland component by way of uvm_mmap().
The XML plist is copied out to the newly-mapped anonymous region,
and the pointer returned via the plistref.

- prop_dictionary_recv_ioctl() is responsible for munmap()'ing the
region after parsing the XML plist into internal represenatation.

- A new prop_dictionary_sendrecv_ioctl() is added, allowing user space
code to send a dictionary to the kernel and receive one back as a
reply.


Update users of prop_kern for the API changes (Bluetooth).

This constitutes an ABI / protocol change -- but this will also be put
into NetBSD 4.0 so that the first proplib release will implement the new
scheme.
 1.3 10-Sep-2006  plunky branches: 1.3.2;
update to bluetooth device attachment:

remove pseudo-device btdev(4) and inherent limitations

add bthub(4) which autoconfigures at bluetooth controllers as they
are enabled. bluetooth devices now attach here.

btdevctl(8) and its cache is updated to handle new semantics

etc/rc.d/btdevctl is updated to configure devices from a list
in /etc/bluetooth/btdevctl.conf
 1.2 13-Aug-2006  plunky branches: 1.2.2;
Remove obsolete file from repository
 1.1 19-Jun-2006  gdamore branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8; 1.1.10;
Initial import of bluetooth stack on behalf of Iain Hibbert. (plunky@,
NetBSD Foundation Membership still pending.) This stack was written by
Iain under sponsorship from Itronix Inc.

The stack includes support for rfcomm networking (networking via your
bluetooth enabled cell phone), hid devices (keyboards/mice), and headsets.

Drivers for both PCMCIA and USB bluetooth controllers are included.
 1.1.10.2 14-Sep-2006  riz Pull up following revision(s) (requested by plunky in ticket #161):
sys/dev/bluetooth/btdev.h: revision 1.4
distrib/sets/lists/comp/mi: revision 1.922
usr.sbin/postinstall/postinstall: revision 1.25
sys/netbt/hci_unit.c: revision 1.3
sys/netbt/hci_ioctl.c: revision 1.4
usr.sbin/sdpd/profile.c: revision 1.2
usr.sbin/btdevctl/btdevctl.c: revision 1.2
share/man/man4/Makefile: revision 1.405
distrib/sets/lists/man/mi: revision 1.930
distrib/sets/lists/etc/mi: revision 1.176
usr.sbin/sdpd/profile.c: revision 1.3
usr.sbin/btdevctl/btdevctl.c: revision 1.3
etc/MAKEDEV.tmpl: revision 1.62
distrib/sets/lists/base/mi: revision 1.650
usr.sbin/btdevctl/btdevctl.h: revision 1.2
usr.bin/sdpquery/sdpquery.1: revision 1.4
sys/netbt/rfcomm_session.c: revision 1.2
usr.sbin/btdevctl/btdevctl.8: revision 1.3
usr.bin/sdpquery/search.c: revision 1.2
usr.sbin/sdpd/Makefile: revision 1.2
sys/dev/bluetooth/Makefile: revision 1.3
usr.sbin/btdevctl/cfg.c: file removal
sys/netbt/files.netbt: revision 1.4
usr.sbin/btdevctl/sdp.c: revision 1.1
sys/dev/bluetooth/bthidev.c: revision 1.3
etc/bluetooth/Makefile: revision 1.3
sys/dev/pcmcia/files.pcmcia: revision 1.51
sys/dev/bluetooth/bthidev.c: revision 1.4
sys/dev/bluetooth/bthidev.h: revision 1.3
usr.sbin/btdevctl/dev.c: file removal
sys/dev/bluetooth/files.bluetooth: revision 1.10
sys/arch/i386/conf/GENERIC: revision 1.777
share/man/man4/ubt.4: revision 1.6
share/man/man4/bthub.4: revision 1.3
sys/netbt/hci.h: revision 1.5
sys/arch/i386/conf/GENERIC_LAPTOP: revision 1.202
lib/libsdp/sdp.h: revision 1.2
usr.sbin/btdevctl/print.c: revision 1.1
share/man/man4/bthidev.4: revision 1.5
share/man/man4/btdev.4: file removal
usr.sbin/btdevctl/print.c: revision 1.2
sys/arch/i386/conf/GENERIC_LAPTOP: revision 1.205
usr.sbin/btdevctl/Makefile: revision 1.2
sys/dev/usb/files.usb: revision 1.70
sys/netbt/l2cap_signal.c: revision 1.2
sys/netbt/hci_link.c: revision 1.4
sys/dev/bluetooth/bthub.c: revision 1.3
share/man/man4/btsco.4: revision 1.5
sys/netbt/hci_link.c: revision 1.5
share/man/man4/btdev.4: revision 1.4
sys/dev/bluetooth/btkbd.c: revision 1.3
sys/dev/bluetooth/btdev.c: file removal
sys/netbt/hci_event.c: revision 1.2
sys/dev/bluetooth/btsco.h: revision 1.2
etc/mtree/special: revision 1.101
sys/dev/bluetooth/btsco.c: revision 1.3
sys/conf/majors: revision 1.27
usr.sbin/sdpd/hf.c: revision 1.1
sys/dev/bluetooth/btsco.c: revision 1.4
share/man/man5/rc.conf.5: revision 1.107
sys/dev/bluetooth/btdev.c: revision 1.2
etc/rc.d/btdevctl: revision 1.2
usr.sbin/btdevctl/db.c: revision 1.1
etc/rc.d/btdevctl: revision 1.3
etc/bluetooth/btdevctl.conf: revision 1.1
usr.sbin/btdevctl/hid.c: file removal
sys/arch/i386/conf/GENERIC: revision 1.781
sys/dev/bluetooth/btdev.h: revision 1.3
Make btdev default count explicit
Fix typo in variable name
update to bluetooth device attachment:
remove pseudo-device btdev(4) and inherent limitations
add bthub(4) which autoconfigures at bluetooth controllers as they
are enabled. bluetooth devices now attach here.
btdevctl(8) and its cache is updated to handle new semantics
etc/rc.d/btdevctl is updated to configure devices from a list
in /etc/bluetooth/btdevctl.conf
also include service name in dictionary being sent to kernel.
(this is not used just yet, but it might be in the future and it will
be easier if we dont have to provide code to handle its absence)
clarify the CAVEAT section somewhat
Add service discovery support for the Handsfree profile
Replace static 'FreeBSD' string with operating system name gleaned
from uname(3)
Halt the callout on detach
btsco.c:
- sco_getopt(..., SO_SCO_MTU, ...) expects the address of a uint16_t,
not an int. So change sc_mtu's type to uint16_t.
- Try a little harder to ensure btsco_round_blocksize() does not
return zero. Prevents a subsequent panic in audio_init_ringbuffer().
from scw@
Endian issues:
hci_event.c:
- Convert memo->response.clock_offset to host-endian.
hci_ioctl.c:
- printf format tweak (size_t)
hci_link.c:
- Convert memo->response.clock_offset from host-endian.
- Tweak a DIAGNOSTIC message.
l2cap_signal.c:
- In l2cap_recv_config_req(), rp->scid is little-endian so make sure
we convert from host-endian.
from scw@
hci_link.c:
- In hci_link_free(), do not unlink items from a LIST queue within
a LIST_FOREACH() iterator.
rfcomm_session.c:
- In rfcomm_session_recv_mcc_nsc(), do not unlink items from a LIST
queue within a LIST_FOREACH() iterator.
from scw@
guard against a possible situation where the list of l2cap channels is changed
when the bluetooth code is not expecting it to be. During a disconnect, we can
detach the channel that is being disconnected, but its not really safe to detach
any others.
Print explicit 64-bit types using the format macros from int_fmtio.h.
Unbreaks the build for our LP64 ports, where "long long" typically is
not 64 bits.
 1.1.10.1 16-Aug-2006  tron Pull up following revision(s) (requested by plunky in ticket #26):
sys/dev/bluetooth/bthub.c: file removal
Remove obsolete file from repository
 1.1.8.2 13-Jul-2006  gdamore Merge from HEAD.
 1.1.8.1 19-Jun-2006  gdamore file bthub.c was added on branch gdamore-uart on 2006-07-13 17:49:22 +0000
 1.1.6.4 14-Sep-2006  yamt sync with head.
 1.1.6.3 03-Sep-2006  yamt sync with head.
 1.1.6.2 26-Jun-2006  yamt sync with head.
 1.1.6.1 19-Jun-2006  yamt file bthub.c was added on branch yamt-pdpolicy on 2006-06-26 12:50:37 +0000
 1.1.4.2 22-Jun-2006  chap Complete a sync sys/ with head.
 1.1.4.1 19-Jun-2006  chap file bthub.c was added on branch chap-midi on 2006-06-22 03:39:48 +0000
 1.1.2.5 15-Nov-2007  yamt sync with head.
 1.1.2.4 03-Sep-2007  yamt sync with head.
 1.1.2.3 30-Dec-2006  yamt sync with head.
 1.1.2.2 21-Jun-2006  yamt sync with head.
 1.1.2.1 19-Jun-2006  yamt file bthub.c was added on branch yamt-lazymbuf on 2006-06-21 15:02:45 +0000
 1.2.2.1 18-Nov-2006  ad Sync with head.
 1.3.2.2 10-Dec-2006  yamt sync with head.
 1.3.2.1 22-Oct-2006  yamt sync with head
 1.8.4.2 24-Mar-2007  yamt sync with head.
 1.8.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.9.4.1 11-Jul-2007  mjf Sync with head.
 1.9.2.1 10-Apr-2007  ad Sync with head.
 1.10.16.1 13-Nov-2007  bouyer Sync with HEAD
 1.10.12.1 06-Nov-2007  matt sync with HEAD
 1.10.10.2 04-Nov-2007  jmcneill Sync with HEAD.
 1.10.10.1 29-Oct-2007  joerg Sync with HEAD.
 1.12.16.4 29-Jun-2008  mjf Sync with HEAD.
 1.12.16.3 06-Apr-2008  mjf - after some discussion with agc@ i agreed it would be a good idea to move
device_unregister_* to device_deregister_* to be more like the pmf(9)
functions, especially since a lot of the time the function calls are next
to each other.

- add device_register_name() support for dk(4).
 1.12.16.2 05-Apr-2008  mjf - add "file-system DEVFS" and "pseudo-device devfsctl" to conf/std seeing
as these are always needed.

- convert many, many drivers over to the New Devfs World Order. For a
list of device drivers yet to be converted see,
http://www.netbsd.org/~mjf/devfs-todo.html.

- add a new device_unregister_all(device_t) function to remove all device
names associated with a device_t, which saves us having to construct
device names when the driver is detached.

- add a DEV_AUDIO type for devices.
 1.12.16.1 03-Apr-2008  mjf Sync with HEAD.
 1.13.8.1 18-Jun-2008  simonb Sync with head.
 1.13.6.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.13.4.2 16-May-2009  yamt sync with head
 1.13.4.1 04-May-2009  yamt sync with head.
 1.13.2.1 17-Jun-2008  yamt sync with head.
 1.14.10.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.15.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.15.4.1 31-May-2011  rmind sync with head
 1.17.8.1 03-Apr-2012  riz Pull up following revision(s) (requested by plunky in ticket #159):
sys/dev/bluetooth/btsco.c: revision 1.28
sys/dev/bluetooth/bthidev.c: revision 1.22
sys/dev/bluetooth/bthub.c: revision 1.18
sys/dev/bluetooth/btkbd.c: revision 1.14
sys/dev/bluetooth/btms.c: revision 1.10
sys/dev/bluetooth/btmagic.c: revision 1.2
register/deregister pmf(9) NULL handlers for bthub(4) and
bluetooth devices which attach there, to fix PR/39006
 1.17.6.1 05-Apr-2012  mrg sync to latest -current.
 1.17.2.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.17.2.1 17-Apr-2012  yamt sync with head
 1.18.4.1 18-May-2014  rmind sync with head
 1.18.2.2 03-Dec-2017  jdolecek update from HEAD
 1.18.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.19.2.1 10-Aug-2014  tls Rebase.
 1.20.4.1 06-Jun-2015  skrll Sync with HEAD
 1.24.4.1 21-Mar-2021  thorpej Give config_found() the same variadic arguments treatment as
config_search(). This commit only adds the CFARG_EOL sentinel
to the existing config_found() calls. Conversion of config_found_sm_loc()
and config_found_ia() call sites will be in subsequent commits.
 1.25.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.21 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.20 24-Apr-2021  thorpej branches: 1.20.8;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.19 14-Mar-2020  maxv branches: 1.19.6;
fix memory leaks
 1.18 10-Dec-2017  bouyer branches: 1.18.4;
Factor out bus-independant HID code so that it can be shared by USB, bluetooth
and i2c.
dev/usb/ukbdmap.c is renamed to dev/hid/hidkbdmap.c
dev/usb/hid.[ch] moved to dev/hid/
usage pages moved from dev/usb/usbhid.h moved to dev/hid/hid.h,
and updated with OpenBSD entries.
bus-independant code moved from dev/usb/ums.c to dev/hid/hidms.c
(the same should be done for keyboard and touchpad drivers)

Needed for the upcoming HID over I2C support, proposed on tech-kern@
on Dec, 1.
 1.17 16-Nov-2014  ozaki-r Replace callout_stop with callout_halt

In order to call callout_destroy for a callout safely, we have to ensure
the function of the callout is not running and pending. To do so, we should
use callout_halt, not callout_stop.

Discussed with martin@ and riastradh@.
 1.16 12-Sep-2013  martin branches: 1.16.4;
#ifdef the "npress" variable, so it is only defined (and initialized) when
it is also used.
 1.15 27-Oct-2012  chs branches: 1.15.2;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.14 03-Apr-2012  plunky branches: 1.14.2;

register/deregister pmf(9) NULL handlers for bthub(4) and
bluetooth devices which attach there, to fix PR/39006
 1.13 11-Jan-2012  plunky branches: 1.13.2;
offset processing of input reports to a kernel thread, to avoid
locking issues when a child device needs to call back into the
Bluetooth stack (eg when caps-lock is pressed, and wskbd wants
to change a LED)

(as discussed with Radoslaw Kujawa)
 1.12 31-Dec-2011  rkujawa Fix panic triggered by pressing the caps lock key:
http://c0ff33.net/drop/bt_caps_panic.jpg

OK'd mrg.
 1.11 12-May-2009  cegger branches: 1.11.12; 1.11.16;
struct cfdata * -> cfdata_t, no functional changes intended.
 1.10 09-Sep-2008  cube branches: 1.10.8;
Redde Caesari quae sunt Caesaris. Or rather, in this particular case,
those that are Lennart's.

Eventually there should only be one set of HID drivers.
 1.9 03-Nov-2007  plunky branches: 1.9.16; 1.9.20; 1.9.22; 1.9.26;
'struct callout' => callout_t
don't use callout_reset()
do use callout_destroy()
 1.8 03-Nov-2007  plunky switch devices to using CFATTACH_DECL_NEW()
softc no longer contains 'struct device' by default
use 'device_t' instead of 'struct device *'
use device_xxx() accessor functions
remove casting of 'xxx_softc *' & 'struct device *'
use aprint_xxx_dev() routines
 1.7 09-Jul-2007  ad branches: 1.7.6; 1.7.8; 1.7.12;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
 1.6 04-Mar-2007  christos branches: 1.6.2; 1.6.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.5 16-Nov-2006  christos branches: 1.5.4;
__unused removal on arguments; approved by core.
 1.4 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.3 05-Sep-2006  plunky branches: 1.3.2; 1.3.4; 1.3.6;
Halt the callout on detach
 1.2 26-Jul-2006  tron branches: 1.2.2;
Bluetooth fixes by Iain Hibbert:
- Update bthidev(4) to use property lists for configuration.
 1.1 19-Jun-2006  gdamore branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8;
Initial import of bluetooth stack on behalf of Iain Hibbert. (plunky@,
NetBSD Foundation Membership still pending.) This stack was written by
Iain under sponsorship from Itronix Inc.

The stack includes support for rfcomm networking (networking via your
bluetooth enabled cell phone), hid devices (keyboards/mice), and headsets.

Drivers for both PCMCIA and USB bluetooth controllers are included.
 1.1.8.2 13-Jul-2006  gdamore Merge from HEAD.
 1.1.8.1 19-Jun-2006  gdamore file btkbd.c was added on branch gdamore-uart on 2006-07-13 17:49:22 +0000
 1.1.6.4 14-Sep-2006  yamt sync with head.
 1.1.6.3 11-Aug-2006  yamt sync with head
 1.1.6.2 26-Jun-2006  yamt sync with head.
 1.1.6.1 19-Jun-2006  yamt file btkbd.c was added on branch yamt-pdpolicy on 2006-06-26 12:50:37 +0000
 1.1.4.2 22-Jun-2006  chap Complete a sync sys/ with head.
 1.1.4.1 19-Jun-2006  chap file btkbd.c was added on branch chap-midi on 2006-06-22 03:39:48 +0000
 1.1.2.5 15-Nov-2007  yamt sync with head.
 1.1.2.4 03-Sep-2007  yamt sync with head.
 1.1.2.3 30-Dec-2006  yamt sync with head.
 1.1.2.2 21-Jun-2006  yamt sync with head.
 1.1.2.1 19-Jun-2006  yamt file btkbd.c was added on branch yamt-lazymbuf on 2006-06-21 15:02:45 +0000
 1.2.2.1 14-Sep-2006  riz Pull up following revision(s) (requested by plunky in ticket #161):
sys/dev/bluetooth/btdev.h: revision 1.4
distrib/sets/lists/comp/mi: revision 1.922
usr.sbin/postinstall/postinstall: revision 1.25
sys/netbt/hci_unit.c: revision 1.3
sys/netbt/hci_ioctl.c: revision 1.4
usr.sbin/sdpd/profile.c: revision 1.2
usr.sbin/btdevctl/btdevctl.c: revision 1.2
share/man/man4/Makefile: revision 1.405
distrib/sets/lists/man/mi: revision 1.930
distrib/sets/lists/etc/mi: revision 1.176
usr.sbin/sdpd/profile.c: revision 1.3
usr.sbin/btdevctl/btdevctl.c: revision 1.3
etc/MAKEDEV.tmpl: revision 1.62
distrib/sets/lists/base/mi: revision 1.650
usr.sbin/btdevctl/btdevctl.h: revision 1.2
usr.bin/sdpquery/sdpquery.1: revision 1.4
sys/netbt/rfcomm_session.c: revision 1.2
usr.sbin/btdevctl/btdevctl.8: revision 1.3
usr.bin/sdpquery/search.c: revision 1.2
usr.sbin/sdpd/Makefile: revision 1.2
sys/dev/bluetooth/Makefile: revision 1.3
usr.sbin/btdevctl/cfg.c: file removal
sys/netbt/files.netbt: revision 1.4
usr.sbin/btdevctl/sdp.c: revision 1.1
sys/dev/bluetooth/bthidev.c: revision 1.3
etc/bluetooth/Makefile: revision 1.3
sys/dev/pcmcia/files.pcmcia: revision 1.51
sys/dev/bluetooth/bthidev.c: revision 1.4
sys/dev/bluetooth/bthidev.h: revision 1.3
usr.sbin/btdevctl/dev.c: file removal
sys/dev/bluetooth/files.bluetooth: revision 1.10
sys/arch/i386/conf/GENERIC: revision 1.777
share/man/man4/ubt.4: revision 1.6
share/man/man4/bthub.4: revision 1.3
sys/netbt/hci.h: revision 1.5
sys/arch/i386/conf/GENERIC_LAPTOP: revision 1.202
lib/libsdp/sdp.h: revision 1.2
usr.sbin/btdevctl/print.c: revision 1.1
share/man/man4/bthidev.4: revision 1.5
share/man/man4/btdev.4: file removal
usr.sbin/btdevctl/print.c: revision 1.2
sys/arch/i386/conf/GENERIC_LAPTOP: revision 1.205
usr.sbin/btdevctl/Makefile: revision 1.2
sys/dev/usb/files.usb: revision 1.70
sys/netbt/l2cap_signal.c: revision 1.2
sys/netbt/hci_link.c: revision 1.4
sys/dev/bluetooth/bthub.c: revision 1.3
share/man/man4/btsco.4: revision 1.5
sys/netbt/hci_link.c: revision 1.5
share/man/man4/btdev.4: revision 1.4
sys/dev/bluetooth/btkbd.c: revision 1.3
sys/dev/bluetooth/btdev.c: file removal
sys/netbt/hci_event.c: revision 1.2
sys/dev/bluetooth/btsco.h: revision 1.2
etc/mtree/special: revision 1.101
sys/dev/bluetooth/btsco.c: revision 1.3
sys/conf/majors: revision 1.27
usr.sbin/sdpd/hf.c: revision 1.1
sys/dev/bluetooth/btsco.c: revision 1.4
share/man/man5/rc.conf.5: revision 1.107
sys/dev/bluetooth/btdev.c: revision 1.2
etc/rc.d/btdevctl: revision 1.2
usr.sbin/btdevctl/db.c: revision 1.1
etc/rc.d/btdevctl: revision 1.3
etc/bluetooth/btdevctl.conf: revision 1.1
usr.sbin/btdevctl/hid.c: file removal
sys/arch/i386/conf/GENERIC: revision 1.781
sys/dev/bluetooth/btdev.h: revision 1.3
Make btdev default count explicit
Fix typo in variable name
update to bluetooth device attachment:
remove pseudo-device btdev(4) and inherent limitations
add bthub(4) which autoconfigures at bluetooth controllers as they
are enabled. bluetooth devices now attach here.
btdevctl(8) and its cache is updated to handle new semantics
etc/rc.d/btdevctl is updated to configure devices from a list
in /etc/bluetooth/btdevctl.conf
also include service name in dictionary being sent to kernel.
(this is not used just yet, but it might be in the future and it will
be easier if we dont have to provide code to handle its absence)
clarify the CAVEAT section somewhat
Add service discovery support for the Handsfree profile
Replace static 'FreeBSD' string with operating system name gleaned
from uname(3)
Halt the callout on detach
btsco.c:
- sco_getopt(..., SO_SCO_MTU, ...) expects the address of a uint16_t,
not an int. So change sc_mtu's type to uint16_t.
- Try a little harder to ensure btsco_round_blocksize() does not
return zero. Prevents a subsequent panic in audio_init_ringbuffer().
from scw@
Endian issues:
hci_event.c:
- Convert memo->response.clock_offset to host-endian.
hci_ioctl.c:
- printf format tweak (size_t)
hci_link.c:
- Convert memo->response.clock_offset from host-endian.
- Tweak a DIAGNOSTIC message.
l2cap_signal.c:
- In l2cap_recv_config_req(), rp->scid is little-endian so make sure
we convert from host-endian.
from scw@
hci_link.c:
- In hci_link_free(), do not unlink items from a LIST queue within
a LIST_FOREACH() iterator.
rfcomm_session.c:
- In rfcomm_session_recv_mcc_nsc(), do not unlink items from a LIST
queue within a LIST_FOREACH() iterator.
from scw@
guard against a possible situation where the list of l2cap channels is changed
when the bluetooth code is not expecting it to be. During a disconnect, we can
detach the channel that is being disconnected, but its not really safe to detach
any others.
Print explicit 64-bit types using the format macros from int_fmtio.h.
Unbreaks the build for our LP64 ports, where "long long" typically is
not 64 bits.
 1.3.6.2 10-Dec-2006  yamt sync with head.
 1.3.6.1 22-Oct-2006  yamt sync with head
 1.3.4.2 09-Sep-2006  rpaulo sync with head
 1.3.4.1 05-Sep-2006  rpaulo file btkbd.c was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:49:44 +0000
 1.3.2.1 18-Nov-2006  ad Sync with head.
 1.5.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.6.4.1 11-Jul-2007  mjf Sync with head.
 1.6.2.1 01-Jul-2007  ad Adapt to callout API change.
 1.7.12.1 13-Nov-2007  bouyer Sync with HEAD
 1.7.8.1 06-Nov-2007  matt sync with HEAD
 1.7.6.1 04-Nov-2007  jmcneill Sync with HEAD.
 1.9.26.1 19-Oct-2008  haad Sync with HEAD.
 1.9.22.1 24-Sep-2008  wrstuden Merge in changes between wrstuden-revivesa-base-2 and
wrstuden-revivesa-base-3.
 1.9.20.2 16-May-2009  yamt sync with head
 1.9.20.1 04-May-2009  yamt sync with head.
 1.9.16.1 28-Sep-2008  mjf Sync with HEAD.
 1.10.8.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.11.16.2 05-Apr-2012  mrg sync to latest -current.
 1.11.16.1 18-Feb-2012  mrg merge to -current.
 1.11.12.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.11.12.2 30-Oct-2012  yamt sync with head
 1.11.12.1 17-Apr-2012  yamt sync with head
 1.13.2.2 07-Dec-2014  martin Pull up following revision(s) (requested by ozaki-r in ticket #1201):
sys/kern/kern_ktrace.c: revision 1.166
sys/dev/isa/aps.c: revision 1.16
sys/dev/sysmon/sysmonvar.h: revision 1.45
sys/dev/ir/irframe_tty.c: revision 1.60
sys/dev/sysmon/sysmon_envsys_events.c: revision 1.111-1.112 (patch)
sys/dev/pci/pccbb.c: revision 1.207
sys/dev/wscons/wskbd.c: revision 1.135
sys/dev/usb/ohci.c: revision 1.254
sys/net/if_ecosubr.c: revision 1.41
sys/dev/pcmcia/btbc.c: revision 1.17
sys/arch/x86/x86/via_padlock.c: revision 1.23
sys/dev/sdmmc/sdmmc.c: revision 1.23 (patch)
sys/dev/bluetooth/btkbd.c: revision 1.17
sys/dev/bluetooth/bcsp.c: revision 1.25
sys/arch/x86/pci/fwhrng.c: revision 1.8
sys/dev/ic/nslm7x.c: revision 1.61
share/man/man9/callout.9: revision 1.28 (patch)

Replace callout_stop with callout_halt and ensure the callout
is not running before destroying it.
 1.13.2.1 03-Apr-2012  riz Pull up following revision(s) (requested by plunky in ticket #159):
sys/dev/bluetooth/btsco.c: revision 1.28
sys/dev/bluetooth/bthidev.c: revision 1.22
sys/dev/bluetooth/bthub.c: revision 1.18
sys/dev/bluetooth/btkbd.c: revision 1.14
sys/dev/bluetooth/btms.c: revision 1.10
sys/dev/bluetooth/btmagic.c: revision 1.2
register/deregister pmf(9) NULL handlers for bthub(4) and
bluetooth devices which attach there, to fix PR/39006
 1.14.2.3 03-Dec-2017  jdolecek update from HEAD
 1.14.2.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.14.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.15.2.1 18-May-2014  rmind sync with head
 1.16.4.1 01-Dec-2014  martin Pull up following revision(s) (requested by ozaki-r in ticket #279):
sys/kern/kern_ktrace.c: revision 1.166
sys/dev/isa/aps.c: revision 1.16
sys/dev/sysmon/sysmonvar.h: revision 1.45
sys/dev/ir/irframe_tty.c: revision 1.60
sys/dev/sysmon/sysmon_envsys_events.c: revision 1.111
sys/dev/sysmon/sysmon_envsys_events.c: revision 1.112
sys/dev/pci/pccbb.c: revision 1.207
sys/dev/wscons/wskbd.c: revision 1.135
sys/dev/usb/ohci.c: revision 1.254
sys/net/if_ecosubr.c: revision 1.41
sys/dev/pcmcia/btbc.c: revision 1.17
sys/arch/x86/x86/via_padlock.c: revision 1.23
sys/dev/sdmmc/sdmmc.c: revision 1.23
sys/dev/bluetooth/btkbd.c: revision 1.17
sys/dev/bluetooth/bcsp.c: revision 1.25
sys/arch/x86/pci/fwhrng.c: revision 1.8
sys/dev/ic/nslm7x.c: revision 1.61
share/man/man9/callout.9: revision 1.28
Replace callout_stop with callout_halt
In order to call callout_destroy for a callout safely, we have to ensure
the function of the callout is not running and pending. To do so, we should
use callout_halt, not callout_stop.
Discussed with martin@ and riastradh@.
Make it clear that we should use not callout_stop but callout_halt
before callout_destroy
Replace callout_stop with callout_halt
In order to call callout_destroy for a callout safely, we have to ensure
the function of the callout is not running and pending. To do so, we should
use callout_halt, not callout_stop.
In this case, we need to pass an interlock to callout_halt to wait for
the callout complete.
Reviewed by riastradh@.
Kill sme_callout_mtx and use sme_mtx instead
We can use sme_mtx for the callout as well. Actually we should do so
because sme_events_list and some other data that are touched in the
callout should be protected by sme_mtx, not sme_callout_mtx.
Discussed with riastradh@ in
http://mail-index.netbsd.org/tech-kern/2014/11/11/msg017956.html
Replace callout_stop with callout_halt
In order to call callout_destroy for a callout safely, we have to ensure
the function of the callout is not running and pending. To do so, we should
use callout_halt, not callout_stop.
In this case, we need to pass an interlock to callout_halt to wait for
the callout complete. And also we make sure that SME_CALLOUT_INITIALIZED
is unset before calling callout_halt to prevent the callout from calling
callout_schedule. This is the same as what we did in sys/netinet6/mld6.c@1.61.
Reviewed by riastradh@.
 1.18.4.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.19.6.1 21-Mar-2021  thorpej Give config_found() the same variadic arguments treatment as
config_search(). This commit only adds the CFARG_EOL sentinel
to the existing config_found() calls. Conversion of config_found_sm_loc()
and config_found_ia() call sites will be in subsequent commits.
 1.20.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.21 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.20 24-Apr-2021  thorpej branches: 1.20.8;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.19 11-Jun-2020  thorpej branches: 1.19.4;
Update for proplib(3) API changes.
 1.18 03-Sep-2018  riastradh Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)
 1.17 10-Dec-2017  bouyer branches: 1.17.2; 1.17.4;
Factor out bus-independant HID code so that it can be shared by USB, bluetooth
and i2c.
dev/usb/ukbdmap.c is renamed to dev/hid/hidkbdmap.c
dev/usb/hid.[ch] moved to dev/hid/
usage pages moved from dev/usb/usbhid.h moved to dev/hid/hid.h,
and updated with OpenBSD entries.
bus-independant code moved from dev/usb/ums.c to dev/hid/hidms.c
(the same should be done for keyboard and touchpad drivers)

Needed for the upcoming HID over I2C support, proposed on tech-kern@
on Dec, 1.
 1.16 07-Jul-2016  msaitoh KNF. Remove extra spaces. No functional change.
 1.15 13-Dec-2015  plunky STRENGHT -> STRENGTH and misc spelling/whitespace. no functional change
 1.14 03-Jul-2015  bouyer Add basic support for tap detection, emulating a left-click.
 1.13 16-Apr-2015  christos CID 1293640/1 memory corruption/overrun
 1.12 06-Apr-2015  bouyer Add support for Apple Magic Trackpad.
3 button emulation by detecting in which area of the bottom of
the device the trackpad's button is pressed.
Pointer move support with 1 finger touch, X/Y scroll with 2-finger touch.
TODO:
- detect tap to emulate button press and drag/n/drop.
- Detect and support zoom, if wsmouse allows to report this
 1.11 05-Aug-2014  rtr branches: 1.11.2; 1.11.4;
split PRU_SEND function out of pr_generic() usrreq switches and put into
separate functions

xxx_send(struct socket *, struct mbuf *, struct mbuf *,
struct mbuf *, struct lwp *)

- always KASSERT(solocked(so)) even if not implemented

- replace calls to pr_generic() with req = PRU_SEND with calls to
pr_send()

rename existing functions that operate on PCB for consistency (and to
free up their names for xxx_send() PRUs

- l2cap_send() -> l2cap_send_pcb()
- sco_send() -> sco_send_pcb()
- rfcomm_send() -> rfcomm_send_pcb()

patch reviewed by rmind
 1.10 31-Jul-2014  rtr split PRU_DISCONNECT, PRU_SHUTDOWN and PRU_ABORT function out of
pr_generic() usrreq switches and put into separate functions

xxx_disconnect(struct socket *)
xxx_shutdown(struct socket *)
xxx_abort(struct socket *)

- always KASSERT(solocked(so)) even if not implemented
- replace calls to pr_generic() with req =
PRU_{DISCONNECT,SHUTDOWN,ABORT}
with calls to pr_{disconnect,shutdown,abort}() respectively

rename existing internal functions used to implement above functionality
to permit use of the names for xxx_{disconnect,shutdown,abort}().

- {l2cap,sco,rfcomm}_disconnect() ->
{l2cap,sco,rfcomm}_disconnect_pcb()
- {unp,rip,tcp}_disconnect() -> {unp,rip,tcp}_disconnect1()
- unp_shutdown() -> unp_shutdown1()

patch reviewed by rmind
 1.9 30-Jul-2014  rtr split PRU_CONNECT function out of pr_generic() usrreq switches and put
into seaparate functions

xxx_listen(struct socket *, struct mbuf *)

- always KASSERT(solocked(so)) and KASSERT(nam != NULL)
- replace calls to pr_generic() with req = PRU_CONNECT with
pr_connect()
- rename existin {l2cap,sco,rfcomm}_connect() to
{l2cap,sco,rfcomm}_connect_pcb() respectively to permit
naming consistency with other protocols functions.
- drop struct lwp * parameter from unp_connect() and at_pcbconnect()
and use curlwp instead where appropriate.

patch reviewed by rmind
 1.8 24-Jul-2014  rtr split PRU_BIND and PRU_LISTEN function out of pr_generic() usrreq
switches and put into separate functions
xxx_bind(struct socket *, struct mbuf *)
xxx_listen(struct socket *)

- always KASSERT(solocked(so)) even if not implemented

- replace calls to pr_generic() with req = PRU_BIND with call to
pr_bind()

- replace calls to pr_generic() with req = PRU_LISTEN with call to
pr_listen()

- drop struct lwp * parameter from at_pcbsetaddr(), in_pcbbind() and
unp_bind() and always use curlwp.

rename existing functions that operate on PCB for consistency (and to
free up their names for xxx_{bind,listen}() PRUs

- l2cap_{bind,listen}() -> l2cap_{bind,listen}_pcb()
- sco_{bind,listen}() -> sco_{bind,listen}_pcb()
- rfcomm_{bind,listen}() -> rfcomm_{bind,listen}_pcb()

patch reviewed by rmind

welcome to netbsd 6.99.48
 1.7 20-May-2014  rmind netbt: rename some attach/detach functions to have _pcb suffix, so
we could use standard attach/detach naming for pr_usrreq functions.
No functional change.
 1.6 25-Feb-2014  pooka branches: 1.6.2;
Ensure that the top level sysctl nodes (kern, vfs, net, ...) exist before
the sysctl link sets are processed, and remove redundancy.

Shaves >13kB off of an amd64 GENERIC, not to mention >1k duplicate
lines of code.
 1.5 20-Dec-2012  plunky branches: 1.5.2;
increase some diagnostics
 1.4 20-Dec-2012  plunky when no link-mode is specified, explicitly set a mode of (int)0
otherwise l2cap_setmode() will fail during connection setup

for bthidev.c, this fixes a problem with Microsoft Wedge Touch
mouse (which may not be able to authenticate)

for btmagic.c, include this fix in case somebody tries that

related to PR/47286
 1.3 02-Jun-2012  dsl branches: 1.3.2;
Add some pre-processor magic to verify that the type of the data item
passed to sysctl_createv() actually matches the declared type for
the item itself.
In the places where the caller specifies a function and a structure
address (typically the 'softc') an explicit (void *) cast is now needed.
Fixes bugs in sys/dev/acpi/asus_acpi.c sys/dev/bluetooth/bcsp.c
sys/kern/vfs_bio.c sys/miscfs/syncfs/sync_subr.c and setting
AcpiGbl_EnableAmlDebugObject.
(mostly passing the address of a uint64_t when typed as CTLTYPE_INT).
I've test built quite a few kernels, but there may be some unfixed MD
fallout. Most likely passing &char[] to char *.
Also add CTLFLAG_UNSIGNED for unsiged decimals - not set yet.
 1.2 03-Apr-2012  plunky register/deregister pmf(9) NULL handlers for bthub(4) and
bluetooth devices which attach there, to fix PR/39006
 1.1 22-May-2010  plunky branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8; 1.1.16; 1.1.20; 1.1.22;
add Magic Mouse driver and manpage btmagic(4)
 1.1.22.2 07-Jan-2013  riz Pull up following revision(s) (requested by plunky in ticket #769):
sys/dev/bluetooth/bthidev.c: revision 1.23
sys/dev/bluetooth/bthidev.c: revision 1.24
usr.sbin/btdevctl/btdevctl.8: revision 1.8
sys/dev/bluetooth/btmagic.c: revision 1.4
sys/dev/bluetooth/btmagic.c: revision 1.5
when no link-mode is specified, explicitly set a mode of (int)0
otherwise l2cap_setmode() will fail during connection setup
for bthidev.c, this fixes a problem with Microsoft Wedge Touch
mouse (which may not be able to authenticate)
for btmagic.c, include this fix in case somebody tries that
related to PR/47286
increase some diagnostics
add a comment pointing out that the link-mode may need to be
changed manually, for devices which cannot authenticate
for PR/47286
 1.1.22.1 03-Apr-2012  riz Pull up following revision(s) (requested by plunky in ticket #159):
sys/dev/bluetooth/btsco.c: revision 1.28
sys/dev/bluetooth/bthidev.c: revision 1.22
sys/dev/bluetooth/bthub.c: revision 1.18
sys/dev/bluetooth/btkbd.c: revision 1.14
sys/dev/bluetooth/btms.c: revision 1.10
sys/dev/bluetooth/btmagic.c: revision 1.2
register/deregister pmf(9) NULL handlers for bthub(4) and
bluetooth devices which attach there, to fix PR/39006
 1.1.20.1 05-Apr-2012  mrg sync to latest -current.
 1.1.16.4 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.1.16.3 23-Jan-2013  yamt sync with head
 1.1.16.2 30-Oct-2012  yamt sync with head
 1.1.16.1 17-Apr-2012  yamt sync with head
 1.1.8.3 20-Jan-2013  bouyer Pull up following revision(s) (requested by plunky in ticket #1835):
sys/dev/bluetooth/bthidev.c: revision 1.23 via patch
sys/dev/bluetooth/bthidev.c: revision 1.24 via patch
usr.sbin/btdevctl/btdevctl.8: revision 1.8 via patch
sys/dev/bluetooth/btmagic.c: revision 1.4 via patch
sys/dev/bluetooth/btmagic.c: revision 1.5 via patch
when no link-mode is specified, explicitly set a mode of (int)0
otherwise l2cap_setmode() will fail during connection setup
for bthidev.c, this fixes a problem with Microsoft Wedge Touch
mouse (which may not be able to authenticate)
for btmagic.c, include this fix in case somebody tries that
related to PR/47286
increase some diagnostics
add a comment pointing out that the link-mode may need to be
changed manually, for devices which cannot authenticate
for PR/47286
 1.1.8.2 21-Nov-2010  riz Pull up following revision(s) (requested by plunky in ticket #1407):
sys/dev/bluetooth/btdev.h: revision 1.9
sys/arch/iyonix/conf/GENERIC: revision 1.60
sys/arch/sparc64/conf/GENERIC: revision 1.129
sys/dev/usb/hid.c: revision 1.30
sys/dev/usb/hid.h: revision 1.13
sys/arch/i386/conf/GENERIC: revision 1.983
usr.sbin/btdevctl/print.c: revision 1.10
sys/arch/evbarm/conf/MPCSA_GENERIC: revision 1.16
sys/arch/alpha/conf/GENERIC: revision 1.337
sys/dev/bluetooth/files.bluetooth: revision 1.14
sys/arch/evbarm/conf/GUMSTIX: revision 1.49
sys/dev/usb/usbdevs: revision 1.550
sys/arch/evbppc/conf/OPENBLOCKS266_OPT: revision 1.14
sys/arch/hpcsh/conf/GENERIC: revision 1.91
sys/dev/bluetooth/btmagic.c: revision 1.1
distrib/sets/lists/man/mi: revision 1.1210
sys/arch/amd64/conf/GENERIC: revision 1.279
sys/arch/i386/conf/ALL: revision 1.258
sys/arch/amd64/conf/XEN3_DOM0: revision 1.54
sys/arch/hpcarm/conf/JORNADA720: revision 1.78
sys/dev/usb/hid.c: revision 1.29
share/man/man4/btmagic.4: revision 1.1
hid_get_data() does not work if the size of data is less than
a byte and crosses a byte boundary, and it always returns a
sign-extended value.
fix this by using the algorithm from libusbhid to read bytes,
and provide a hid_get_udata() function to return unsigned data
values.
while here, const args
update DPRINTF to reflect actual function name
add Apple Magic Mouse product-id
regen for Magic Mouse id
allow for vendor-id and product-id properties, passing them
through to child devices
add Magic Mouse driver and manpage btmagic(4)
additionally query the "PnP Information" service record to discover
any USB Forum vendor-id and product-id values and store them in the
property list if found.
add btmagic(4) where other Bluetooth drivers are listed
 1.1.8.1 22-May-2010  riz file btmagic.c was added on branch netbsd-5 on 2010-11-21 03:05:03 +0000
 1.1.6.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.1.6.1 22-May-2010  uebayasi file btmagic.c was added on branch uebayasi-xip on 2010-08-17 06:46:04 +0000
 1.1.4.2 11-Aug-2010  yamt sync with head.
 1.1.4.1 22-May-2010  yamt file btmagic.c was added on branch yamt-nfs-mp on 2010-08-11 22:53:19 +0000
 1.1.2.2 30-May-2010  rmind sync with head
 1.1.2.1 22-May-2010  rmind file btmagic.c was added on branch rmind-uvmplock on 2010-05-30 05:17:18 +0000
 1.3.2.3 03-Dec-2017  jdolecek update from HEAD
 1.3.2.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.3.2.1 25-Feb-2013  tls resync with head
 1.5.2.1 18-May-2014  rmind sync with head
 1.6.2.1 10-Aug-2014  tls Rebase.
 1.11.4.4 09-Jul-2016  skrll Sync with HEAD
 1.11.4.3 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.11.4.2 22-Sep-2015  skrll Sync with HEAD
 1.11.4.1 06-Jun-2015  skrll Sync with HEAD
 1.11.2.1 15-Oct-2015  snj Pull up following revision(s) (requested by bouyer in ticket #869):
share/man/man4/btmagic.4: revisions 1.3-1.6
sys/dev/bluetooth/btmagic.c: revisions 1.12, 1.14
Add support for Apple Magic Trackpad.
3 button emulation by detecting in which area of the bottom of
the device the trackpad's button is pressed.
Pointer move support with 1 finger touch, X/Y scroll with 2-finger touch.
TODO:
- detect tap to emulate button press and drag/n/drop.
- Detect and support zoom, if wsmouse allows to report this
--
Mention magic trackpad support
--
Grammar, whitespace; make AUTHORS section from HISTORY since it mostly cites
people.
--
Add basic support for tap detection, emulating a left-click.
--
New sentence, new line.
 1.17.4.1 10-Jun-2019  christos Sync with HEAD
 1.17.2.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.19.4.1 21-Mar-2021  thorpej Give config_found() the same variadic arguments treatment as
config_search(). This commit only adds the CFARG_EOL sentinel
to the existing config_found() calls. Conversion of config_found_sm_loc()
and config_found_ia() call sites will be in subsequent commits.
 1.20.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.15 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.14 24-Apr-2021  thorpej branches: 1.14.8;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.13 10-Dec-2017  bouyer branches: 1.13.20;
Factor out bus-independant HID code so that it can be shared by USB, bluetooth
and i2c.
dev/usb/ukbdmap.c is renamed to dev/hid/hidkbdmap.c
dev/usb/hid.[ch] moved to dev/hid/
usage pages moved from dev/usb/usbhid.h moved to dev/hid/hid.h,
and updated with OpenBSD entries.
bus-independant code moved from dev/usb/ums.c to dev/hid/hidms.c
(the same should be done for keyboard and touchpad drivers)

Needed for the upcoming HID over I2C support, proposed on tech-kern@
on Dec, 1.
 1.12 13-Dec-2014  nonaka Added quirk for ELECOM M-XG2BB.
 1.11 27-Oct-2012  chs branches: 1.11.12; 1.11.14;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.10 03-Apr-2012  plunky branches: 1.10.2;

register/deregister pmf(9) NULL handlers for bthub(4) and
bluetooth devices which attach there, to fix PR/39006
 1.9 12-May-2009  cegger branches: 1.9.12; 1.9.16; 1.9.18;
struct cfdata * -> cfdata_t, no functional changes intended.
 1.8 09-Sep-2008  cube branches: 1.8.8;
Redde Caesari quae sunt Caesaris. Or rather, in this particular case,
those that are Lennart's.

Eventually there should only be one set of HID drivers.
 1.7 03-Nov-2007  plunky branches: 1.7.16; 1.7.20; 1.7.22; 1.7.26;
switch devices to using CFATTACH_DECL_NEW()
softc no longer contains 'struct device' by default
use 'device_t' instead of 'struct device *'
use device_xxx() accessor functions
remove casting of 'xxx_softc *' & 'struct device *'
use aprint_xxx_dev() routines
 1.6 04-Mar-2007  christos branches: 1.6.14; 1.6.16; 1.6.20;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.5 16-Nov-2006  christos branches: 1.5.4;
__unused removal on arguments; approved by core.
 1.4 12-Nov-2006  plunky Tidy away wsmouse_input() abstractions and update
documentation to include the W direction.
 1.3 31-Oct-2006  plunky enable 'Application Control Pan' in Consumer usage group as an equivalent
to the Z direction since some mice (Apple Mighty Mouse) provide horizontal
scrolling direction with that report.
 1.2 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.1 19-Jun-2006  gdamore branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8; 1.1.12; 1.1.14; 1.1.16;
Initial import of bluetooth stack on behalf of Iain Hibbert. (plunky@,
NetBSD Foundation Membership still pending.) This stack was written by
Iain under sponsorship from Itronix Inc.

The stack includes support for rfcomm networking (networking via your
bluetooth enabled cell phone), hid devices (keyboards/mice), and headsets.

Drivers for both PCMCIA and USB bluetooth controllers are included.
 1.1.16.2 10-Dec-2006  yamt sync with head.
 1.1.16.1 22-Oct-2006  yamt sync with head
 1.1.14.2 09-Sep-2006  rpaulo sync with head
 1.1.14.1 19-Jun-2006  rpaulo file btms.c was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:49:44 +0000
 1.1.12.1 18-Nov-2006  ad Sync with head.
 1.1.8.2 13-Jul-2006  gdamore Merge from HEAD.
 1.1.8.1 19-Jun-2006  gdamore file btms.c was added on branch gdamore-uart on 2006-07-13 17:49:22 +0000
 1.1.6.2 26-Jun-2006  yamt sync with head.
 1.1.6.1 19-Jun-2006  yamt file btms.c was added on branch yamt-pdpolicy on 2006-06-26 12:50:37 +0000
 1.1.4.2 22-Jun-2006  chap Complete a sync sys/ with head.
 1.1.4.1 19-Jun-2006  chap file btms.c was added on branch chap-midi on 2006-06-22 03:39:48 +0000
 1.1.2.5 15-Nov-2007  yamt sync with head.
 1.1.2.4 03-Sep-2007  yamt sync with head.
 1.1.2.3 30-Dec-2006  yamt sync with head.
 1.1.2.2 21-Jun-2006  yamt sync with head.
 1.1.2.1 19-Jun-2006  yamt file btms.c was added on branch yamt-lazymbuf on 2006-06-21 15:02:45 +0000
 1.5.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.6.20.1 13-Nov-2007  bouyer Sync with HEAD
 1.6.16.1 06-Nov-2007  matt sync with HEAD
 1.6.14.1 04-Nov-2007  jmcneill Sync with HEAD.
 1.7.26.1 19-Oct-2008  haad Sync with HEAD.
 1.7.22.1 24-Sep-2008  wrstuden Merge in changes between wrstuden-revivesa-base-2 and
wrstuden-revivesa-base-3.
 1.7.20.2 16-May-2009  yamt sync with head
 1.7.20.1 04-May-2009  yamt sync with head.
 1.7.16.1 28-Sep-2008  mjf Sync with HEAD.
 1.8.8.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.9.18.1 03-Apr-2012  riz Pull up following revision(s) (requested by plunky in ticket #159):
sys/dev/bluetooth/btsco.c: revision 1.28
sys/dev/bluetooth/bthidev.c: revision 1.22
sys/dev/bluetooth/bthub.c: revision 1.18
sys/dev/bluetooth/btkbd.c: revision 1.14
sys/dev/bluetooth/btms.c: revision 1.10
sys/dev/bluetooth/btmagic.c: revision 1.2
register/deregister pmf(9) NULL handlers for bthub(4) and
bluetooth devices which attach there, to fix PR/39006
 1.9.16.1 05-Apr-2012  mrg sync to latest -current.
 1.9.12.2 30-Oct-2012  yamt sync with head
 1.9.12.1 17-Apr-2012  yamt sync with head
 1.10.2.2 03-Dec-2017  jdolecek update from HEAD
 1.10.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.11.14.1 06-Apr-2015  skrll Sync with HEAD
 1.11.12.1 16-Dec-2014  msaitoh Pull up following revision(s) (requested by nonaka in ticket #330):
sys/dev/bluetooth/btms.c: revision 1.12
Added quirk for ELECOM M-XG2BB.
 1.13.20.1 21-Mar-2021  thorpej Give config_found() the same variadic arguments treatment as
config_search(). This commit only adds the CFARG_EOL sentinel
to the existing config_found() calls. Conversion of config_found_sm_loc()
and config_found_ia() call sites will be in subsequent commits.
 1.14.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.43 05-Jul-2024  rin sys: Drop redundant NULL check before m_freem(9)

m_freem(9) safely has accepted NULL argument at least since 4.2BSD:
https://www.tuhs.org/cgi-bin/utree.pl?file=4.2BSD/usr/src/sys/sys/uipc_mbuf.c

Compile-tested on amd64/ALL.

Suggested by knakahara@
 1.42 11-Jun-2020  thorpej branches: 1.42.26;
Update for proplib(3) API changes.
 1.41 08-Jun-2019  isaki Clean get_props().
- Make get_props() return AUDIO_PROP_{PLAYBACK,CAPTURE} properly.
This eliminates need for audio.c to take care of such (old)
drivers which don't return both of PLAYBACK and CAPTURE.
- All get_props() doesn't need to return AUDIO_PROP_MMAP.
It is handled in the audio layer now.
 1.40 25-May-2019  isaki Make it compilable even with debug option.
 1.39 08-May-2019  isaki Merge isaki-audio2 branch, the overhaul of audio subsystem.
- Interrupt-oriented system rather than thread-oriented.
- Improve stability, quality and performance.
- Split playback and record cleanly. Improve halfduplex support.
- Many bugs are fixed including deadlocks, resource leaks, abuses, etc.
- Simplify audio filter mechanism. The encoding/channels/frequency
conversions are completely handled in the upper layer. So the hard-
ware driver only converts its hardware encoding (if necessary).
- audio_hw_if changes:
- Obsoletes query_encoding and add query_format instead.
- Obsoletes set_params and add set_format instead.
- Remove drain, setfd, mappage.
- The call sequences are changed.
- ioctl AUDIO_GETFD/SETFD, AUDIO_GETCHAN/SETCHAN are obsoleted.
- ioctl AUDIO_{QUERY,GET,SET}FORMAT are introduced.
- cleanup config attributes: au*conv and mulaw.
- All hardware drivers should follow it (I've done as much as possible).

Some file paths are changed:
- dev/audio.c -> dev/audio/audio.c (rewritten)
- dev/audiovar.h -> dev/audio/audiovar.h
- dev/audio_dai.h -> dev/audio/audio_dai.h
- dev/audio_if.h -> dev/audio/audio_if.h
- dev/audiobell.c -> dev/audio/audiobell.c
- dev/audiobellvar.h -> dev/audio/audiobellvar.h
- dev/mulaw.[ch] -> dev/audio/mulaw.[ch] + dev/audio/alaw.c
 1.38 16-Mar-2019  isaki branches: 1.38.2;
Use C99 style struct initializer to audio_hw_if.
 1.37 03-Feb-2019  mrg - add or adjust /* FALLTHROUGH */ where appropriate
- add __unreachable() after functions that can return but won't in
this case, and thus can't be marked __dead easily
 1.36 01-Jun-2017  chs branches: 1.36.10;
remove checks for failure after memory allocation calls that cannot fail:

kmem_alloc() with KM_SLEEP
kmem_zalloc() with KM_SLEEP
percpu_alloc()
pserialize_create()
psref_class_create()

all of these paths include an assertion that the allocation has not failed,
so callers should not assert that again.
 1.35 28-May-2017  nat bt_lock is now used as the audio interrupt lock. This is more appropriate
as the interrupt lock deals with the hardware.

btsco audio works again with the new audio changes.
 1.34 10-Jul-2015  nat Wrap up calls to softint_schedule in kpeempt_[dis/en]able.

Addresses PR kern/48459.

This commit was approved by christos@
 1.33 05-Aug-2014  rtr branches: 1.33.4;
split PRU_SEND function out of pr_generic() usrreq switches and put into
separate functions

xxx_send(struct socket *, struct mbuf *, struct mbuf *,
struct mbuf *, struct lwp *)

- always KASSERT(solocked(so)) even if not implemented

- replace calls to pr_generic() with req = PRU_SEND with calls to
pr_send()

rename existing functions that operate on PCB for consistency (and to
free up their names for xxx_send() PRUs

- l2cap_send() -> l2cap_send_pcb()
- sco_send() -> sco_send_pcb()
- rfcomm_send() -> rfcomm_send_pcb()

patch reviewed by rmind
 1.32 31-Jul-2014  rtr split PRU_DISCONNECT, PRU_SHUTDOWN and PRU_ABORT function out of
pr_generic() usrreq switches and put into separate functions

xxx_disconnect(struct socket *)
xxx_shutdown(struct socket *)
xxx_abort(struct socket *)

- always KASSERT(solocked(so)) even if not implemented
- replace calls to pr_generic() with req =
PRU_{DISCONNECT,SHUTDOWN,ABORT}
with calls to pr_{disconnect,shutdown,abort}() respectively

rename existing internal functions used to implement above functionality
to permit use of the names for xxx_{disconnect,shutdown,abort}().

- {l2cap,sco,rfcomm}_disconnect() ->
{l2cap,sco,rfcomm}_disconnect_pcb()
- {unp,rip,tcp}_disconnect() -> {unp,rip,tcp}_disconnect1()
- unp_shutdown() -> unp_shutdown1()

patch reviewed by rmind
 1.31 30-Jul-2014  rtr split PRU_CONNECT function out of pr_generic() usrreq switches and put
into seaparate functions

xxx_listen(struct socket *, struct mbuf *)

- always KASSERT(solocked(so)) and KASSERT(nam != NULL)
- replace calls to pr_generic() with req = PRU_CONNECT with
pr_connect()
- rename existin {l2cap,sco,rfcomm}_connect() to
{l2cap,sco,rfcomm}_connect_pcb() respectively to permit
naming consistency with other protocols functions.
- drop struct lwp * parameter from unp_connect() and at_pcbconnect()
and use curlwp instead where appropriate.

patch reviewed by rmind
 1.30 24-Jul-2014  rtr split PRU_BIND and PRU_LISTEN function out of pr_generic() usrreq
switches and put into separate functions
xxx_bind(struct socket *, struct mbuf *)
xxx_listen(struct socket *)

- always KASSERT(solocked(so)) even if not implemented

- replace calls to pr_generic() with req = PRU_BIND with call to
pr_bind()

- replace calls to pr_generic() with req = PRU_LISTEN with call to
pr_listen()

- drop struct lwp * parameter from at_pcbsetaddr(), in_pcbbind() and
unp_bind() and always use curlwp.

rename existing functions that operate on PCB for consistency (and to
free up their names for xxx_{bind,listen}() PRUs

- l2cap_{bind,listen}() -> l2cap_{bind,listen}_pcb()
- sco_{bind,listen}() -> sco_{bind,listen}_pcb()
- rfcomm_{bind,listen}() -> rfcomm_{bind,listen}_pcb()

patch reviewed by rmind

welcome to netbsd 6.99.48
 1.29 20-May-2014  rmind netbt: rename some attach/detach functions to have _pcb suffix, so
we could use standard attach/detach naming for pr_usrreq functions.
No functional change.
 1.28 03-Apr-2012  plunky branches: 1.28.2; 1.28.12;

register/deregister pmf(9) NULL handlers for bthub(4) and
bluetooth devices which attach there, to fix PR/39006
 1.27 26-Mar-2012  mrg don't use mutex_spin*() on an IPL_NONE mutex. fixes PR#46120.
 1.26 10-Dec-2011  jmcneill branches: 1.26.2;
no need to acquire thread lock in btsco_open / btsco_close, as they are
already held by MI audio when these methods are called
 1.25 23-Nov-2011  jmcneill branches: 1.25.2;
Merge jmcneill-audiomp3 branch, which is derived from ad-audiomp2. From
the original ad-audiomp branch notes:

Add MP locking to the audio drivers.

Making the audio drivers MP safe is necessary before efforts
can be made to make the VM system MP safe.

The are two locks per device instance, an ISR lock and
a character device lock. The ISR lock replaces calls to
splaudio()/splx(), and will be held across calls to device
methods which were called at splaudio() before (e.g.
trigger_output). The character device lock is held across
calls to nearly all of the methods, excluding some only
used for initialization, e.g. get_locks.

Welcome to 5.99.57.
 1.24 16-Mar-2011  plunky branches: 1.24.4; 1.24.6;
use C99 style for variadic macro arguments
 1.23 12-May-2009  cegger branches: 1.23.4; 1.23.6;
struct cfdata * -> cfdata_t, no functional changes intended.
 1.22 06-Aug-2008  plunky branches: 1.22.6; 1.22.8;
Convert socket options code to use a sockopt structure
instead of laying everything into an mbuf.

approved by core
 1.21 23-Jun-2008  plunky branches: 1.21.2;
hold bt_lock when sending data via sco_send()
 1.20 24-Apr-2008  ad branches: 1.20.2; 1.20.4; 1.20.6;
Merge the socket locking patch:

- Socket layer becomes MP safe.
- Unix protocols become MP safe.
- Allows protocol processing interrupts to safely block on locks.
- Fixes a number of race conditions.

With much feedback from matt@ and plunky@.
 1.19 28-Mar-2008  plunky branches: 1.19.2;
Use deviter API to search for child devices.

As all identifying information is stored in the device
properties, this removes the need for child devices to
have a reserved area (struct btdev) in the softc, and
bthub(4) does no longer need to have a softc at all.
 1.18 11-Nov-2007  plunky branches: 1.18.14;
convert device printf() usages to aprint_xxxx()
 1.17 07-Nov-2007  ad Merge from vmlocking:

- pool_cache changes.
- Debugger/procfs locking fixes.
- Other minor changes.
 1.16 03-Nov-2007  plunky branches: 1.16.2;
switch devices to using CFATTACH_DECL_NEW()
softc no longer contains 'struct device' by default
use 'device_t' instead of 'struct device *'
use device_xxx() accessor functions
remove casting of 'xxx_softc *' & 'struct device *'
use aprint_xxx_dev() routines
 1.15 08-Oct-2007  ad branches: 1.15.2;
Use the softint API.
 1.14 21-Apr-2007  plunky branches: 1.14.6; 1.14.8; 1.14.10;
Add 'service level' security for L2CAP and RFCOMM connections, following
the Linux (BlueZ) API.

- L2CAP or RFCOMM connections can require the baseband radio link
mode be any of:
authenticated (devices are paired)
encrypted (implies authentication)
secured (encryption, plus generate new link key)

- for sockets, the mode is set using setsockopt(2) and the socket
connection will be aborted if the mode change fails.

- mode settings will be applied during connection establishment, and
for safety, we enter a wait state and will only proceed when the mode
settings are successfuly set.

- It is possible to change the mode on already open connections, but
not possible to guarantee that data already queued (from either end)
will not be delivered. (this is a feature, not a bug)

- bthidev(4) and rfcomm_sppd(1) support "auth", "encrypt" and
"secure" options

- btdevctl(8) by default enables "auth" for HIDs, and "encrypt" for
keyboards (which are required to support it)
 1.13 13-Mar-2007  plunky remove extraneous whitespace
 1.12 04-Mar-2007  christos branches: 1.12.2; 1.12.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.11 16-Nov-2006  christos branches: 1.11.2; 1.11.4; 1.11.6; 1.11.8; 1.11.10;
__unused removal on arguments; approved by core.
 1.10 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.9 04-Oct-2006  plunky Internally, use the service name as the identifier for matching
 1.8 24-Sep-2006  plunky utilise auconv_set_converter() to handle the filter setup, so that its
done properly.
 1.7 24-Sep-2006  plunky adjust indentation
 1.6 23-Sep-2006  plunky guard against possible race conditions when detaching SCO pcb's
 1.5 23-Sep-2006  plunky return ENOTCONN when not connected, rather than EINVAL
 1.4 11-Sep-2006  plunky branches: 1.4.2;
btsco.c:
- sco_getopt(..., SO_SCO_MTU, ...) expects the address of a uint16_t,
not an int. So change sc_mtu's type to uint16_t.
- Try a little harder to ensure btsco_round_blocksize() does not
return zero. Prevents a subsequent panic in audio_init_ringbuffer().

from scw@
 1.3 10-Sep-2006  plunky update to bluetooth device attachment:

remove pseudo-device btdev(4) and inherent limitations

add bthub(4) which autoconfigures at bluetooth controllers as they
are enabled. bluetooth devices now attach here.

btdevctl(8) and its cache is updated to handle new semantics

etc/rc.d/btdevctl is updated to configure devices from a list
in /etc/bluetooth/btdevctl.conf
 1.2 27-Aug-2006  plunky branches: 1.2.2; 1.2.4;
BluetootH SCO Audio update.

Provide an ioctl to set the SCO mtu value in the controller and
place limits in the SCO code such that only packets of this size
may be sent.

Move the mtu option from btsco(4) and btdevctl(8), to the
btconfig(8) program.

Remove temporary BLUETOOTH_SCO kernel option, and enable SCO
socket access.

Fix incoming connection handling for btsco(4) and SCO sockets.

Fix documentation to reflect the new world order.
 1.1 26-Jul-2006  tron branches: 1.1.2; 1.1.4;
Bluetooth fixes by Iain Hibbert:
Remove bthset(4) device and add btsco(4) in its place. This is an
improved version which is not just for headsets, as it can receive
incoming connections (eg for Hands Free Profile). Update bthset(1)
control utlitiy to relate to new device.
 1.1.4.4 14-Sep-2006  yamt sync with head.
 1.1.4.3 03-Sep-2006  yamt sync with head.
 1.1.4.2 11-Aug-2006  yamt sync with head
 1.1.4.1 26-Jul-2006  yamt file btsco.c was added on branch yamt-pdpolicy on 2006-08-11 15:43:59 +0000
 1.1.2.2 14-Sep-2006  riz Pull up following revision(s) (requested by plunky in ticket #161):
sys/dev/bluetooth/btdev.h: revision 1.4
distrib/sets/lists/comp/mi: revision 1.922
usr.sbin/postinstall/postinstall: revision 1.25
sys/netbt/hci_unit.c: revision 1.3
sys/netbt/hci_ioctl.c: revision 1.4
usr.sbin/sdpd/profile.c: revision 1.2
usr.sbin/btdevctl/btdevctl.c: revision 1.2
share/man/man4/Makefile: revision 1.405
distrib/sets/lists/man/mi: revision 1.930
distrib/sets/lists/etc/mi: revision 1.176
usr.sbin/sdpd/profile.c: revision 1.3
usr.sbin/btdevctl/btdevctl.c: revision 1.3
etc/MAKEDEV.tmpl: revision 1.62
distrib/sets/lists/base/mi: revision 1.650
usr.sbin/btdevctl/btdevctl.h: revision 1.2
usr.bin/sdpquery/sdpquery.1: revision 1.4
sys/netbt/rfcomm_session.c: revision 1.2
usr.sbin/btdevctl/btdevctl.8: revision 1.3
usr.bin/sdpquery/search.c: revision 1.2
usr.sbin/sdpd/Makefile: revision 1.2
sys/dev/bluetooth/Makefile: revision 1.3
usr.sbin/btdevctl/cfg.c: file removal
sys/netbt/files.netbt: revision 1.4
usr.sbin/btdevctl/sdp.c: revision 1.1
sys/dev/bluetooth/bthidev.c: revision 1.3
etc/bluetooth/Makefile: revision 1.3
sys/dev/pcmcia/files.pcmcia: revision 1.51
sys/dev/bluetooth/bthidev.c: revision 1.4
sys/dev/bluetooth/bthidev.h: revision 1.3
usr.sbin/btdevctl/dev.c: file removal
sys/dev/bluetooth/files.bluetooth: revision 1.10
sys/arch/i386/conf/GENERIC: revision 1.777
share/man/man4/ubt.4: revision 1.6
share/man/man4/bthub.4: revision 1.3
sys/netbt/hci.h: revision 1.5
sys/arch/i386/conf/GENERIC_LAPTOP: revision 1.202
lib/libsdp/sdp.h: revision 1.2
usr.sbin/btdevctl/print.c: revision 1.1
share/man/man4/bthidev.4: revision 1.5
share/man/man4/btdev.4: file removal
usr.sbin/btdevctl/print.c: revision 1.2
sys/arch/i386/conf/GENERIC_LAPTOP: revision 1.205
usr.sbin/btdevctl/Makefile: revision 1.2
sys/dev/usb/files.usb: revision 1.70
sys/netbt/l2cap_signal.c: revision 1.2
sys/netbt/hci_link.c: revision 1.4
sys/dev/bluetooth/bthub.c: revision 1.3
share/man/man4/btsco.4: revision 1.5
sys/netbt/hci_link.c: revision 1.5
share/man/man4/btdev.4: revision 1.4
sys/dev/bluetooth/btkbd.c: revision 1.3
sys/dev/bluetooth/btdev.c: file removal
sys/netbt/hci_event.c: revision 1.2
sys/dev/bluetooth/btsco.h: revision 1.2
etc/mtree/special: revision 1.101
sys/dev/bluetooth/btsco.c: revision 1.3
sys/conf/majors: revision 1.27
usr.sbin/sdpd/hf.c: revision 1.1
sys/dev/bluetooth/btsco.c: revision 1.4
share/man/man5/rc.conf.5: revision 1.107
sys/dev/bluetooth/btdev.c: revision 1.2
etc/rc.d/btdevctl: revision 1.2
usr.sbin/btdevctl/db.c: revision 1.1
etc/rc.d/btdevctl: revision 1.3
etc/bluetooth/btdevctl.conf: revision 1.1
usr.sbin/btdevctl/hid.c: file removal
sys/arch/i386/conf/GENERIC: revision 1.781
sys/dev/bluetooth/btdev.h: revision 1.3
Make btdev default count explicit
Fix typo in variable name
update to bluetooth device attachment:
remove pseudo-device btdev(4) and inherent limitations
add bthub(4) which autoconfigures at bluetooth controllers as they
are enabled. bluetooth devices now attach here.
btdevctl(8) and its cache is updated to handle new semantics
etc/rc.d/btdevctl is updated to configure devices from a list
in /etc/bluetooth/btdevctl.conf
also include service name in dictionary being sent to kernel.
(this is not used just yet, but it might be in the future and it will
be easier if we dont have to provide code to handle its absence)
clarify the CAVEAT section somewhat
Add service discovery support for the Handsfree profile
Replace static 'FreeBSD' string with operating system name gleaned
from uname(3)
Halt the callout on detach
btsco.c:
- sco_getopt(..., SO_SCO_MTU, ...) expects the address of a uint16_t,
not an int. So change sc_mtu's type to uint16_t.
- Try a little harder to ensure btsco_round_blocksize() does not
return zero. Prevents a subsequent panic in audio_init_ringbuffer().
from scw@
Endian issues:
hci_event.c:
- Convert memo->response.clock_offset to host-endian.
hci_ioctl.c:
- printf format tweak (size_t)
hci_link.c:
- Convert memo->response.clock_offset from host-endian.
- Tweak a DIAGNOSTIC message.
l2cap_signal.c:
- In l2cap_recv_config_req(), rp->scid is little-endian so make sure
we convert from host-endian.
from scw@
hci_link.c:
- In hci_link_free(), do not unlink items from a LIST queue within
a LIST_FOREACH() iterator.
rfcomm_session.c:
- In rfcomm_session_recv_mcc_nsc(), do not unlink items from a LIST
queue within a LIST_FOREACH() iterator.
from scw@
guard against a possible situation where the list of l2cap channels is changed
when the bluetooth code is not expecting it to be. During a disconnect, we can
detach the channel that is being disconnected, but its not really safe to detach
any others.
Print explicit 64-bit types using the format macros from int_fmtio.h.
Unbreaks the build for our LP64 ports, where "long long" typically is
not 64 bits.
 1.1.2.1 07-Sep-2006  tron Pull up following revision(s) (requested by plunky in ticket #81):
sys/netbt/sco_upper.c: revision 1.2
usr.sbin/btconfig/btconfig.c: revision 1.3
sys/netbt/hci_ioctl.c: revision 1.3
usr.sbin/btconfig/btconfig.8: revision 1.4
usr.sbin/btdevctl/btdevctl.8: revision 1.2
sys/netbt/files.netbt: revision 1.3
sys/netbt/bt_proto.c: revision 1.2
share/man/man4/ubt.4: revision 1.4
usr.sbin/btdevctl/cfg.c: revision 1.3
sys/netbt/hci.h: revision 1.4
share/man/man4/bluetooth.4: revision 1.2
share/man/man4/btsco.4: revision 1.4
sys/dev/bluetooth/btsco.c: revision 1.2
sys/netbt/bt_sysctl.c: revision 1.2
BluetootH SCO Audio update.
Provide an ioctl to set the SCO mtu value in the controller and
place limits in the SCO code such that only packets of this size
may be sent.
Move the mtu option from btsco(4) and btdevctl(8), to the
btconfig(8) program.
Remove temporary BLUETOOTH_SCO kernel option, and enable SCO
socket access.
Fix incoming connection handling for btsco(4) and SCO sockets.
Fix documentation to reflect the new world order.
 1.2.4.2 09-Sep-2006  rpaulo sync with head
 1.2.4.1 27-Aug-2006  rpaulo file btsco.c was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:49:44 +0000
 1.2.2.1 18-Nov-2006  ad Sync with head.
 1.4.2.2 10-Dec-2006  yamt sync with head.
 1.4.2.1 22-Oct-2006  yamt sync with head
 1.11.10.1 03-Sep-2007  wrstuden Sync w/ NetBSD-4-RC_1
 1.11.8.1 27-Feb-2007  ad Add MP locking for audio drivers.
 1.11.6.3 07-May-2007  yamt sync with head.
 1.11.6.2 24-Mar-2007  yamt sync with head.
 1.11.6.1 12-Mar-2007  rmind Sync with HEAD.
 1.11.4.5 15-Nov-2007  yamt sync with head.
 1.11.4.4 27-Oct-2007  yamt sync with head.
 1.11.4.3 03-Sep-2007  yamt sync with head.
 1.11.4.2 30-Dec-2006  yamt sync with head.
 1.11.4.1 16-Nov-2006  yamt file btsco.c was added on branch yamt-lazymbuf on 2006-12-30 20:47:57 +0000
 1.11.2.1 19-Jul-2007  liamjfoy Pull up following revision(s) (requested by plunky in ticket #744):
sys/netbt/l2cap_lower.c: revision 1.6
sys/dev/bluetooth/btdev.h: revision 1.6
sys/netbt/sco_socket.c: revision 1.9
sys/netbt/rfcomm_upper.c: revision 1.3
sys/netbt/l2cap_socket.c: revision 1.7
sys/netbt/rfcomm_upper.c: revision 1.5
lib/libusbhid/usbhid.h: revision 1.5
sys/netbt/rfcomm_upper.c: revision 1.6
usr.sbin/btdevctl/btdevctl.c: revision 1.4
usr.sbin/btdevctl/btdevctl.h: revision 1.3
usr.sbin/btdevctl/btdevctl.8: revision 1.4
sys/netbt/rfcomm_session.c: revision 1.5
sys/netbt/hci.h: revision 1.10
usr.bin/rfcomm_sppd/rfcomm_sppd.c: revision 1.6
sys/netbt/hci_link.c: revision 1.11
usr.bin/rfcomm_sppd/rfcomm_sppd.c: revision 1.7
usr.bin/rfcomm_sppd/rfcomm_sppd.c: revision 1.8
sys/dev/bluetooth/btsco.c: revision 1.14
sys/netbt/rfcomm_session.c: revision 1.9
usr.sbin/btdevctl/sdp.c: revision 1.2
share/man/man9/bluetooth.9: revision 1.2
usr.sbin/btdevctl/sdp.c: revision 1.3
sys/dev/bluetooth/bthidev.c: revision 1.8
sys/netbt/l2cap.h: revision 1.4
sys/netbt/rfcomm.h: revision 1.3
sys/netbt/l2cap.h: revision 1.5
sys/netbt/l2cap_misc.c: revision 1.3
share/man/man4/bluetooth.4: revision 1.5
lib/libusbhid/usbhid.3: revision 1.11
sys/netbt/bluetooth.h: revision 1.5
share/man/man4/bthidev.4: revision 1.8
sys/netbt/rfcomm_dlc.c: revision 1.3
usr.sbin/btdevctl/print.c: revision 1.8
sys/netbt/rfcomm_socket.c: revision 1.7
sys/netbt/l2cap_signal.c: revision 1.4
sys/netbt/l2cap_signal.c: revision 1.5
sys/netbt/l2cap_signal.c: revision 1.7
sys/netbt/hci_event.c: revision 1.6
usr.bin/rfcomm_sppd/rfcomm_sppd.1: revision 1.5
sys/netbt/l2cap_upper.c: revision 1.3
sys/netbt/l2cap_lower.c: revision 1.2
usr.sbin/btdevctl/db.c: revision 1.3
sys/netbt/l2cap_upper.c: revision 1.6
lib/libusbhid/descr.c: revision 1.5
sys/netbt/l2cap_upper.c: revision 1.7
sys/netbt/l2cap_lower.c: revision 1.4
Add 'service level' security for L2CAP and RFCOMM connections, following
the Linux (BlueZ) API.
- L2CAP or RFCOMM connections can require the baseband radio link
mode be any of:
authenticated (devices are paired)
encrypted (implies authentication)
secured (encryption, plus generate new link key)
- for sockets, the mode is set using setsockopt(2) and the socket
connection will be aborted if the mode change fails.
- mode settings will be applied during connection establishment, and
for safety, we enter a wait state and will only proceed when the mode
settings are successfuly set.
- It is possible to change the mode on already open connections, but
not possible to guarantee that data already queued (from either end)
will not be delivered. (this is a feature, not a bug)
- bthidev(4) and rfcomm_sppd(1) support "auth", "encrypt" and
"secure" options
- btdevctl(8) by default enables "auth" for HIDs, and "encrypt" for
keyboards (which are required to support it)
- ALSO INCLUDES OTHER MINOR FIXES
 1.12.4.1 11-Jul-2007  mjf Sync with head.
 1.12.2.4 01-Sep-2007  ad Update for pool_cache API changes.
 1.12.2.3 17-Jun-2007  ad - Increase the number of thread priorities from 128 to 256. How the space
is set up is to be revisited.
- Implement soft interrupts as kernel threads. A generic implementation
is provided, with hooks for fast-path MD code that can run the interrupt
threads over the top of other threads executing in the kernel.
- Split vnode::v_flag into three fields, depending on how the flag is
locked (by the interlock, by the vnode lock, by the file system).
- Miscellaneous locking fixes and improvements.
 1.12.2.2 27-May-2007  ad Sync with head.
 1.12.2.1 10-Apr-2007  ad Sync with head.
 1.14.10.1 14-Oct-2007  yamt sync with head.
 1.14.8.3 09-Jan-2008  matt sync with HEAD
 1.14.8.2 08-Nov-2007  matt sync with -HEAD
 1.14.8.1 06-Nov-2007  matt sync with HEAD
 1.14.6.3 11-Nov-2007  joerg Sync with HEAD.
 1.14.6.2 04-Nov-2007  jmcneill Sync with HEAD.
 1.14.6.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.15.2.1 13-Nov-2007  bouyer Sync with HEAD
 1.16.2.1 19-Nov-2007  mjf Sync with HEAD.
 1.18.14.4 28-Sep-2008  mjf Sync with HEAD.
 1.18.14.3 29-Jun-2008  mjf Sync with HEAD.
 1.18.14.2 02-Jun-2008  mjf Sync with HEAD.
 1.18.14.1 03-Apr-2008  mjf Sync with HEAD.
 1.19.2.1 18-May-2008  yamt sync with head.
 1.20.6.1 27-Jun-2008  simonb Sync with head.
 1.20.4.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.20.2.2 16-May-2009  yamt sync with head
 1.20.2.1 04-May-2009  yamt sync with head.
 1.21.2.1 19-Oct-2008  haad Sync with HEAD.
 1.22.8.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.22.6.3 12-Dec-2008  ad Checkpoint work in progress.
 1.22.6.2 07-Dec-2008  ad No need for sc_intr_lock to be a spinlock any more, since we don't have
a hardware interrupt.
 1.22.6.1 07-Dec-2008  ad Ressurect the ad-audiomp branch at request of matt@.

With this commit:

- core audio subsystem made MPSAFE
- eap, btsco drivers made MPSAFE

TODO:

- midi
- convert remaining drivers
 1.23.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.23.4.1 21-Apr-2011  rmind sync with head
 1.24.6.2 22-Nov-2011  jmcneill get rid of unused 'powerstate' callback in audio_hw_if
 1.24.6.1 19-Nov-2011  jmcneill port ad-audiomp2 branch changes to 5.99.56
todo:
- port ad-audiomp2 pcppi changes
- these drivers need to be fixed:
- emuxki
- gcscaudio
- hdafg
- uaudio
- umidi
- MD audio drivers
 1.24.4.1 17-Apr-2012  yamt sync with head
 1.25.2.2 05-Apr-2012  mrg sync to latest -current.
 1.25.2.1 18-Feb-2012  mrg merge to -current.
 1.26.2.2 09-Apr-2012  riz Pull up following revision(s) (requested by mrg in ticket #165):
sys/dev/bluetooth/btsco.c: revision 1.27
don't use mutex_spin*() on an IPL_NONE mutex. fixes PR#46120.
 1.26.2.1 03-Apr-2012  riz Pull up following revision(s) (requested by plunky in ticket #159):
sys/dev/bluetooth/btsco.c: revision 1.28
sys/dev/bluetooth/bthidev.c: revision 1.22
sys/dev/bluetooth/bthub.c: revision 1.18
sys/dev/bluetooth/btkbd.c: revision 1.14
sys/dev/bluetooth/btms.c: revision 1.10
sys/dev/bluetooth/btmagic.c: revision 1.2
register/deregister pmf(9) NULL handlers for bthub(4) and
bluetooth devices which attach there, to fix PR/39006
 1.28.12.1 10-Aug-2014  tls Rebase.
 1.28.2.2 03-Dec-2017  jdolecek update from HEAD
 1.28.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.33.4.2 28-Aug-2017  skrll Sync with HEAD
 1.33.4.1 22-Sep-2015  skrll Sync with HEAD
 1.36.10.1 10-Jun-2019  christos Sync with HEAD
 1.38.2.4 04-May-2019  isaki Move dev/audio_if.h -> dev/audio/audio_if.h
 1.38.2.3 04-May-2019  isaki Remove obsoleted methods in audio_hw_if.
- drain: is handled in audio upper layer now.
- mappage: is handled in audio upper layer now.
- setfd: no one uses and it's meaningless now.
 1.38.2.2 24-Apr-2019  isaki Adapt to audio2.
 1.38.2.1 21-Apr-2019  isaki Use C99 style struct initializer to audio_format.
 1.42.26.1 02-Aug-2025  perseant Sync with HEAD
 1.3 06-Sep-2015  dholland More on PR 41200: headers that declare ioctls should include sys/ioccom.h.
This covers (I think) all the MI headers outside of external/ (and dist/).
 1.2 10-Sep-2006  plunky branches: 1.2.6; 1.2.102; 1.2.122;
update to bluetooth device attachment:

remove pseudo-device btdev(4) and inherent limitations

add bthub(4) which autoconfigures at bluetooth controllers as they
are enabled. bluetooth devices now attach here.

btdevctl(8) and its cache is updated to handle new semantics

etc/rc.d/btdevctl is updated to configure devices from a list
in /etc/bluetooth/btdevctl.conf
 1.1 26-Jul-2006  tron branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8;
Bluetooth fixes by Iain Hibbert:
Remove bthset(4) device and add btsco(4) in its place. This is an
improved version which is not just for headsets, as it can receive
incoming connections (eg for Hands Free Profile). Update bthset(1)
control utlitiy to relate to new device.
 1.1.8.2 09-Sep-2006  rpaulo sync with head
 1.1.8.1 26-Jul-2006  rpaulo file btsco.h was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:49:44 +0000
 1.1.6.1 18-Nov-2006  ad Sync with head.
 1.1.4.3 14-Sep-2006  yamt sync with head.
 1.1.4.2 11-Aug-2006  yamt sync with head
 1.1.4.1 26-Jul-2006  yamt file btsco.h was added on branch yamt-pdpolicy on 2006-08-11 15:43:59 +0000
 1.1.2.1 14-Sep-2006  riz Pull up following revision(s) (requested by plunky in ticket #161):
sys/dev/bluetooth/btdev.h: revision 1.4
distrib/sets/lists/comp/mi: revision 1.922
usr.sbin/postinstall/postinstall: revision 1.25
sys/netbt/hci_unit.c: revision 1.3
sys/netbt/hci_ioctl.c: revision 1.4
usr.sbin/sdpd/profile.c: revision 1.2
usr.sbin/btdevctl/btdevctl.c: revision 1.2
share/man/man4/Makefile: revision 1.405
distrib/sets/lists/man/mi: revision 1.930
distrib/sets/lists/etc/mi: revision 1.176
usr.sbin/sdpd/profile.c: revision 1.3
usr.sbin/btdevctl/btdevctl.c: revision 1.3
etc/MAKEDEV.tmpl: revision 1.62
distrib/sets/lists/base/mi: revision 1.650
usr.sbin/btdevctl/btdevctl.h: revision 1.2
usr.bin/sdpquery/sdpquery.1: revision 1.4
sys/netbt/rfcomm_session.c: revision 1.2
usr.sbin/btdevctl/btdevctl.8: revision 1.3
usr.bin/sdpquery/search.c: revision 1.2
usr.sbin/sdpd/Makefile: revision 1.2
sys/dev/bluetooth/Makefile: revision 1.3
usr.sbin/btdevctl/cfg.c: file removal
sys/netbt/files.netbt: revision 1.4
usr.sbin/btdevctl/sdp.c: revision 1.1
sys/dev/bluetooth/bthidev.c: revision 1.3
etc/bluetooth/Makefile: revision 1.3
sys/dev/pcmcia/files.pcmcia: revision 1.51
sys/dev/bluetooth/bthidev.c: revision 1.4
sys/dev/bluetooth/bthidev.h: revision 1.3
usr.sbin/btdevctl/dev.c: file removal
sys/dev/bluetooth/files.bluetooth: revision 1.10
sys/arch/i386/conf/GENERIC: revision 1.777
share/man/man4/ubt.4: revision 1.6
share/man/man4/bthub.4: revision 1.3
sys/netbt/hci.h: revision 1.5
sys/arch/i386/conf/GENERIC_LAPTOP: revision 1.202
lib/libsdp/sdp.h: revision 1.2
usr.sbin/btdevctl/print.c: revision 1.1
share/man/man4/bthidev.4: revision 1.5
share/man/man4/btdev.4: file removal
usr.sbin/btdevctl/print.c: revision 1.2
sys/arch/i386/conf/GENERIC_LAPTOP: revision 1.205
usr.sbin/btdevctl/Makefile: revision 1.2
sys/dev/usb/files.usb: revision 1.70
sys/netbt/l2cap_signal.c: revision 1.2
sys/netbt/hci_link.c: revision 1.4
sys/dev/bluetooth/bthub.c: revision 1.3
share/man/man4/btsco.4: revision 1.5
sys/netbt/hci_link.c: revision 1.5
share/man/man4/btdev.4: revision 1.4
sys/dev/bluetooth/btkbd.c: revision 1.3
sys/dev/bluetooth/btdev.c: file removal
sys/netbt/hci_event.c: revision 1.2
sys/dev/bluetooth/btsco.h: revision 1.2
etc/mtree/special: revision 1.101
sys/dev/bluetooth/btsco.c: revision 1.3
sys/conf/majors: revision 1.27
usr.sbin/sdpd/hf.c: revision 1.1
sys/dev/bluetooth/btsco.c: revision 1.4
share/man/man5/rc.conf.5: revision 1.107
sys/dev/bluetooth/btdev.c: revision 1.2
etc/rc.d/btdevctl: revision 1.2
usr.sbin/btdevctl/db.c: revision 1.1
etc/rc.d/btdevctl: revision 1.3
etc/bluetooth/btdevctl.conf: revision 1.1
usr.sbin/btdevctl/hid.c: file removal
sys/arch/i386/conf/GENERIC: revision 1.781
sys/dev/bluetooth/btdev.h: revision 1.3
Make btdev default count explicit
Fix typo in variable name
update to bluetooth device attachment:
remove pseudo-device btdev(4) and inherent limitations
add bthub(4) which autoconfigures at bluetooth controllers as they
are enabled. bluetooth devices now attach here.
btdevctl(8) and its cache is updated to handle new semantics
etc/rc.d/btdevctl is updated to configure devices from a list
in /etc/bluetooth/btdevctl.conf
also include service name in dictionary being sent to kernel.
(this is not used just yet, but it might be in the future and it will
be easier if we dont have to provide code to handle its absence)
clarify the CAVEAT section somewhat
Add service discovery support for the Handsfree profile
Replace static 'FreeBSD' string with operating system name gleaned
from uname(3)
Halt the callout on detach
btsco.c:
- sco_getopt(..., SO_SCO_MTU, ...) expects the address of a uint16_t,
not an int. So change sc_mtu's type to uint16_t.
- Try a little harder to ensure btsco_round_blocksize() does not
return zero. Prevents a subsequent panic in audio_init_ringbuffer().
from scw@
Endian issues:
hci_event.c:
- Convert memo->response.clock_offset to host-endian.
hci_ioctl.c:
- printf format tweak (size_t)
hci_link.c:
- Convert memo->response.clock_offset from host-endian.
- Tweak a DIAGNOSTIC message.
l2cap_signal.c:
- In l2cap_recv_config_req(), rp->scid is little-endian so make sure
we convert from host-endian.
from scw@
hci_link.c:
- In hci_link_free(), do not unlink items from a LIST queue within
a LIST_FOREACH() iterator.
rfcomm_session.c:
- In rfcomm_session_recv_mcc_nsc(), do not unlink items from a LIST
queue within a LIST_FOREACH() iterator.
from scw@
guard against a possible situation where the list of l2cap channels is changed
when the bluetooth code is not expecting it to be. During a disconnect, we can
detach the channel that is being disconnected, but its not really safe to detach
any others.
Print explicit 64-bit types using the format macros from int_fmtio.h.
Unbreaks the build for our LP64 ports, where "long long" typically is
not 64 bits.
 1.2.122.1 22-Sep-2015  skrll Sync with HEAD
 1.2.102.1 03-Dec-2017  jdolecek update from HEAD
 1.2.6.2 30-Dec-2006  yamt sync with head.
 1.2.6.1 10-Sep-2006  yamt file btsco.h was added on branch yamt-lazymbuf on 2006-12-30 20:47:57 +0000
 1.32 05-Jul-2024  rin sys: Drop redundant NULL check before m_freem(9)

m_freem(9) safely has accepted NULL argument at least since 4.2BSD:
https://www.tuhs.org/cgi-bin/utree.pl?file=4.2BSD/usr/src/sys/sys/uipc_mbuf.c

Compile-tested on amd64/ALL.

Suggested by knakahara@
 1.31 26-Oct-2022  riastradh branches: 1.31.8;
btuart(4): Convert to ttylock/ttyunlock.
 1.30 28-Jun-2022  plunky remove KASSERT() checking for t_oproc at open since assigning this line
discipline to a pty may not have that set. Instead do a runtime check to
ensure that the function exists before calling it, as ttstart() handles it.

Same code in btuart.c, bcsp.c and bth5.c

Reported-by: syzbot+766981eef92a3cd0352a@syzkaller.appspotmail.com
 1.29 24-Jan-2019  knakahara Add comments about D_MPSAFE to functions called as struct linesw.l_ioctl.
 1.28 20-Aug-2015  christos branches: 1.28.8; 1.28.16; 1.28.18;
include "ioconf.h" to get the 'void <driver>attach(int count);' prototype.
 1.27 20-May-2014  rmind branches: 1.27.4;
netbt: rename some attach/detach functions to have _pcb suffix, so
we could use standard attach/detach naming for pr_usrreq functions.
No functional change.
 1.26 31-Jul-2011  uebayasi branches: 1.26.12; 1.26.26;
Put back #include "ioconf.h" per popular demand.
 1.25 25-May-2011  uebayasi Declare cfdrivers using extern rather than including ioconf.h.
 1.24 18-Feb-2010  kiyohara branches: 1.24.2; 1.24.4;
Remove unnecessary line-feed.
 1.23 12-May-2009  cegger branches: 1.23.2;
struct cfdata * -> cfdata_t, no functional changes intended.
 1.22 07-May-2009  elad Introduce actions/requests to handle authorization for ppp(4), sl(4),
strip(4), btuart(4) and bcsp(4) network interfaces and devices.

Mailing list reference:

http://mail-index.netbsd.org/tech-kern/2009/04/27/msg004955.html
 1.21 26-Apr-2009  elad Authorizing actions from the generic scope using a device scope wrapper
is a big no-no.

As painful as it is, use kauth_authorize_generic() for now.
 1.20 11-Jan-2009  christos branches: 1.20.2;
merge christos-time_t
 1.19 12-Jun-2008  cegger branches: 1.19.4; 1.19.10;
use device_lookup_private to get softc
 1.18 15-Apr-2008  plunky branches: 1.18.2; 1.18.4; 1.18.6; 1.18.8;
some changes to serial bluetooth host controller interfaces

btuartd(8) should be named btattach(8) for consistency
with other parts of NetBSD

make btattach(8) a single-use tool for less complexity

device specicific initialisation (from btuart(4)) is carried
out prior to activating the line discipline (in btattach(8)),
which simplifies the API somewhat and means that the user
tool and the kernel do not need to be kept in sync.

btuart(4) driver is much reduced; naming is made consistent
and all tsleep() and delay() are removed to userland
 1.17 15-Dec-2007  perry branches: 1.17.6;
__FUNCTION__ -> __func__
 1.16 02-Dec-2007  kiyohara branches: 1.16.2; 1.16.6;
Print name of firmware on fail for firmware_open().
 1.15 02-Dec-2007  kiyohara Add support bgb2xx. (not test X-)
Add configuration rate with ericsson.
Change initialization at stlc2500.
Obsolate BTUART_HCITYPE_BT2000C.
 1.14 28-Nov-2007  plunky Clean up the way that bluetooth drivers attach to the bluetooth stack,
to remove the frobbing that drivers must do in the hci_unit structure.

- driver provides a static const interface descriptor
- hci_unit is allocated by hci_attach() rather than part of softc
- statistics are compiled by driver and provided on request
- driver provides output methods and is responsible for output queue
- stack provides input methods and is responsible for input queue
- mutex is used to arbitrate device queue access
 1.13 11-Nov-2007  plunky convert device printf() usages to aprint_xxxx()
 1.12 10-Nov-2007  plunky use more device_t and device_xxx() accessors

make bluetooth stack keep device_t instead of softc pointer as
device is not necessarily part of softc, and pass device_t to
driver callbacks. hci_devname is no longer required.
 1.11 10-Nov-2007  ad Call ttyflush() with tty_lock held.
 1.10 03-Nov-2007  plunky branches: 1.10.2;
switch devices to using CFATTACH_DECL_NEW()
softc no longer contains 'struct device' by default
use 'device_t' instead of 'struct device *'
use device_xxx() accessor functions
remove casting of 'xxx_softc *' & 'struct device *'
use aprint_xxx_dev() routines
 1.9 19-Oct-2007  ad machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.8 03-Sep-2007  kiyohara branches: 1.8.4;
No need to check the NULL, m_gethdr() calls always with M_WAIT.
 1.7 15-Aug-2007  kiyohara branches: 1.7.2;
Remove BTUART_DEBUG.
 1.6 23-Jul-2007  kiyohara branches: 1.6.4; 1.6.6;
Remove printf for debugging.
 1.5 13-Mar-2007  plunky branches: 1.5.6;
remove extraneous whitespace
 1.4 12-Mar-2007  kiyohara branches: 1.4.2;
Not KAUTH_DEVICE_TTY_OPEN but KAUTH_GENERIC_ISSUSER is used.
 1.3 06-Mar-2007  plunky branches: 1.3.2;
fix typo
 1.2 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.1 20-Feb-2007  kiyohara branches: 1.1.2; 1.1.6;
Supprot Bluetooth HCI UART (H4) driver and daemon.
 1.1.6.4 24-Mar-2007  yamt sync with head.
 1.1.6.3 12-Mar-2007  rmind Sync with HEAD.
 1.1.6.2 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.1.6.1 20-Feb-2007  yamt file btuart.c was added on branch yamt-idlelwp on 2007-02-27 16:53:51 +0000
 1.1.2.7 21-Jan-2008  yamt sync with head
 1.1.2.6 07-Dec-2007  yamt sync with head
 1.1.2.5 15-Nov-2007  yamt sync with head.
 1.1.2.4 27-Oct-2007  yamt sync with head.
 1.1.2.3 03-Sep-2007  yamt sync with head.
 1.1.2.2 26-Feb-2007  yamt sync with head.
 1.1.2.1 20-Feb-2007  yamt file btuart.c was added on branch yamt-lazymbuf on 2007-02-26 09:10:00 +0000
 1.3.2.5 23-Oct-2007  ad Sync with head.
 1.3.2.4 09-Oct-2007  ad Sync with head.
 1.3.2.3 20-Aug-2007  ad Sync with HEAD.
 1.3.2.2 10-Apr-2007  ad Sync with head.
 1.3.2.1 13-Mar-2007  ad Sync with head.
 1.4.2.1 11-Jul-2007  mjf Sync with head.
 1.5.6.3 10-Sep-2007  skrll Sync with HEAD.
 1.5.6.2 03-Sep-2007  skrll Sync with HEAD.
 1.5.6.1 15-Aug-2007  skrll Sync with HEAD.
 1.6.6.2 23-Jul-2007  kiyohara Remove printf for debugging.
 1.6.6.1 23-Jul-2007  kiyohara file btuart.c was added on branch matt-mips64 on 2007-07-23 03:45:28 +0000
 1.6.4.6 03-Dec-2007  joerg Sync with HEAD.
 1.6.4.5 11-Nov-2007  joerg Sync with HEAD.
 1.6.4.4 04-Nov-2007  jmcneill Sync with HEAD.
 1.6.4.3 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.6.4.2 03-Sep-2007  jmcneill Sync with HEAD.
 1.6.4.1 16-Aug-2007  jmcneill Sync with HEAD.
 1.7.2.2 09-Jan-2008  matt sync with HEAD
 1.7.2.1 06-Nov-2007  matt sync with HEAD
 1.8.4.2 13-Nov-2007  bouyer Sync with HEAD
 1.8.4.1 25-Oct-2007  bouyer Sync with HEAD.
 1.10.2.3 27-Dec-2007  mjf Sync with HEAD.
 1.10.2.2 08-Dec-2007  mjf Sync with HEAD.
 1.10.2.1 19-Nov-2007  mjf Sync with HEAD.
 1.16.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.16.2.1 26-Dec-2007  ad Sync with head.
 1.17.6.3 17-Jan-2009  mjf Sync with HEAD.
 1.17.6.2 29-Jun-2008  mjf Sync with HEAD.
 1.17.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.18.8.1 18-Jun-2008  simonb Sync with head.
 1.18.6.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.18.4.3 11-Mar-2010  yamt sync with head
 1.18.4.2 16-May-2009  yamt sync with head
 1.18.4.1 04-May-2009  yamt sync with head.
 1.18.2.1 17-Jun-2008  yamt sync with head.
 1.19.10.2 30-Dec-2008  christos fix dev_t format
 1.19.10.1 12-Jun-2008  christos file btuart.c was added on branch christos-time_t on 2008-12-30 19:32:51 +0000
 1.19.4.2 28-Apr-2009  skrll Sync with HEAD.
 1.19.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.20.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.23.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.24.4.1 06-Jun-2011  jruoho Sync with HEAD.
 1.24.2.1 31-May-2011  rmind sync with head
 1.26.26.1 10-Aug-2014  tls Rebase.
 1.26.12.2 03-Dec-2017  jdolecek update from HEAD
 1.26.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.27.4.1 22-Sep-2015  skrll Sync with HEAD
 1.28.18.1 10-Jun-2019  christos Sync with HEAD
 1.28.16.1 26-Jan-2019  pgoyette Sync with HEAD
 1.28.8.1 17-May-2017  pgoyette At suggestion of chuq@, modify config_attach_pseudo() to return with a
reference held on the device.

Adapt callers to expect the reference to exist, and to ensure that the
reference is released.
 1.31.8.1 02-Aug-2025  perseant Sync with HEAD
 1.4 15-Apr-2008  plunky some changes to serial bluetooth host controller interfaces

btuartd(8) should be named btattach(8) for consistency
with other parts of NetBSD

make btattach(8) a single-use tool for less complexity

device specicific initialisation (from btuart(4)) is carried
out prior to activating the line discipline (in btattach(8)),
which simplifies the API somewhat and means that the user
tool and the kernel do not need to be kept in sync.

btuart(4) driver is much reduced; naming is made consistent
and all tsleep() and delay() are removed to userland
 1.3 02-Dec-2007  kiyohara branches: 1.3.14;
Add support bgb2xx. (not test X-)
Add configuration rate with ericsson.
Change initialization at stlc2500.
Obsolate BTUART_HCITYPE_BT2000C.
 1.2 30-Sep-2007  kiyohara branches: 1.2.4;
Add bcsp(4). However, it is debuging state.
 1.1 20-Feb-2007  kiyohara branches: 1.1.2; 1.1.6; 1.1.8; 1.1.20; 1.1.22; 1.1.24;
Supprot Bluetooth HCI UART (H4) driver and daemon.
 1.1.24.1 06-Oct-2007  yamt sync with head.
 1.1.22.2 09-Jan-2008  matt sync with HEAD
 1.1.22.1 06-Nov-2007  matt sync with HEAD
 1.1.20.2 03-Dec-2007  joerg Sync with HEAD.
 1.1.20.1 02-Oct-2007  joerg Sync with HEAD.
 1.1.8.1 09-Oct-2007  ad Sync with head.
 1.1.6.2 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.1.6.1 20-Feb-2007  yamt file btuart.h was added on branch yamt-idlelwp on 2007-02-27 16:53:51 +0000
 1.1.2.4 07-Dec-2007  yamt sync with head
 1.1.2.3 27-Oct-2007  yamt sync with head.
 1.1.2.2 26-Feb-2007  yamt sync with head.
 1.1.2.1 20-Feb-2007  yamt file btuart.h was added on branch yamt-lazymbuf on 2007-02-26 09:10:00 +0000
 1.2.4.1 08-Dec-2007  mjf Sync with HEAD.
 1.3.14.1 02-Jun-2008  mjf Sync with HEAD.
 1.16 08-May-2019  isaki Merge isaki-audio2 branch, the overhaul of audio subsystem.
- Interrupt-oriented system rather than thread-oriented.
- Improve stability, quality and performance.
- Split playback and record cleanly. Improve halfduplex support.
- Many bugs are fixed including deadlocks, resource leaks, abuses, etc.
- Simplify audio filter mechanism. The encoding/channels/frequency
conversions are completely handled in the upper layer. So the hard-
ware driver only converts its hardware encoding (if necessary).
- audio_hw_if changes:
- Obsoletes query_encoding and add query_format instead.
- Obsoletes set_params and add set_format instead.
- Remove drain, setfd, mappage.
- The call sequences are changed.
- ioctl AUDIO_GETFD/SETFD, AUDIO_GETCHAN/SETCHAN are obsoleted.
- ioctl AUDIO_{QUERY,GET,SET}FORMAT are introduced.
- cleanup config attributes: au*conv and mulaw.
- All hardware drivers should follow it (I've done as much as possible).

Some file paths are changed:
- dev/audio.c -> dev/audio/audio.c (rewritten)
- dev/audiovar.h -> dev/audio/audiovar.h
- dev/audio_dai.h -> dev/audio/audio_dai.h
- dev/audio_if.h -> dev/audio/audio_if.h
- dev/audiobell.c -> dev/audio/audiobell.c
- dev/audiobellvar.h -> dev/audio/audiobellvar.h
- dev/mulaw.[ch] -> dev/audio/mulaw.[ch] + dev/audio/alaw.c
 1.15 10-Aug-2017  nat branches: 1.15.4; 1.15.8;
Add support for btuart h5 3-wire protocol.
 1.14 22-May-2010  plunky branches: 1.14.18; 1.14.36;
add Magic Mouse driver and manpage btmagic(4)
 1.13 10-Jun-2008  drochner branches: 1.13.6; 1.13.16; 1.13.18;
use new "defpseudodev" where appropriate, and remove dummy interface
attribute definitions which were only to trick config(8)
 1.12 30-Sep-2007  kiyohara branches: 1.12.18; 1.12.20; 1.12.22; 1.12.24; 1.12.26;
Add bcsp(4). However, it is debuging state.
 1.11 20-Feb-2007  kiyohara branches: 1.11.4; 1.11.16; 1.11.18; 1.11.20;
Supprot Bluetooth HCI UART (H4) driver and daemon.
 1.10 10-Sep-2006  plunky branches: 1.10.6;
update to bluetooth device attachment:

remove pseudo-device btdev(4) and inherent limitations

add bthub(4) which autoconfigures at bluetooth controllers as they
are enabled. bluetooth devices now attach here.

btdevctl(8) and its cache is updated to handle new semantics

etc/rc.d/btdevctl is updated to configure devices from a list
in /etc/bluetooth/btdevctl.conf
 1.9 26-Jul-2006  tron branches: 1.9.2; 1.9.4;
Bluetooth fixes by Iain Hibbert:
Remove bthset(4) device and add btsco(4) in its place. This is an
improved version which is not just for headsets, as it can receive
incoming connections (eg for Hands Free Profile). Update bthset(1)
control utlitiy to relate to new device.
 1.8 26-Jul-2006  tron Bluetooth fixes by Iain Hibbert:
Change the way in which bluetooth devices attach to system. The
new way is for devices to attach directly to a btdevN device via
its own control file /dev/btdevN.
- bthub(4) is replaced by btdev(4).
- /dev/bthubctl is replaced by /dev/btdevN.
- configuration now uses proplib(3) property lists.
- btcontrol(8) updated to use new API, and now uses private
- XML config file /var/db/btdev.xml.
 1.7 21-Jun-2006  drochner make some bluetooth devices just devices, not interface attributes
 1.6 19-Jun-2006  gdamore Initial import of bluetooth stack on behalf of Iain Hibbert. (plunky@,
NetBSD Foundation Membership still pending.) This stack was written by
Iain under sponsorship from Itronix Inc.

The stack includes support for rfcomm networking (networking via your
bluetooth enabled cell phone), hid devices (keyboards/mice), and headsets.

Drivers for both PCMCIA and USB bluetooth controllers are included.
 1.5 11-Dec-2005  christos branches: 1.5.4; 1.5.8; 1.5.14; 1.5.16;
merge ktrace-lwp.
 1.4 22-Jun-2004  soren branches: 1.4.12;
Make ubt build; bluetooth.c is btbus code, not bthcidrv.
 1.3 11-Jan-2003  dsainty branches: 1.3.2;
Add bthci_util.c
 1.2 10-Oct-2002  thorpej branches: 1.2.2;
Move IR and Bluetooth config defns missed in previous commit.
 1.1 10-Oct-2002  thorpej Move IR and Bluetooth config defns to their own files.
 1.2.2.3 15-Jan-2003  thorpej Sync with HEAD.
 1.2.2.2 18-Oct-2002  nathanw New files in merge.
 1.2.2.1 10-Oct-2002  nathanw file files.bluetooth was added on branch nathanw_sa on 2002-10-18 03:20:34 +0000
 1.3.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.3.2.1 03-Aug-2004  skrll Sync with HEAD
 1.4.12.4 27-Oct-2007  yamt sync with head.
 1.4.12.3 26-Feb-2007  yamt sync with head.
 1.4.12.2 30-Dec-2006  yamt sync with head.
 1.4.12.1 21-Jun-2006  yamt sync with head.
 1.5.16.1 13-Jul-2006  gdamore Merge from HEAD.
 1.5.14.1 22-Jun-2006  chap Complete a sync sys/ with head.
 1.5.8.3 14-Sep-2006  yamt sync with head.
 1.5.8.2 11-Aug-2006  yamt sync with head
 1.5.8.1 26-Jun-2006  yamt sync with head.
 1.5.4.1 09-Sep-2006  rpaulo sync with head
 1.9.4.1 18-Nov-2006  ad Sync with head.
 1.9.2.1 14-Sep-2006  riz Pull up following revision(s) (requested by plunky in ticket #161):
sys/dev/bluetooth/btdev.h: revision 1.4
distrib/sets/lists/comp/mi: revision 1.922
usr.sbin/postinstall/postinstall: revision 1.25
sys/netbt/hci_unit.c: revision 1.3
sys/netbt/hci_ioctl.c: revision 1.4
usr.sbin/sdpd/profile.c: revision 1.2
usr.sbin/btdevctl/btdevctl.c: revision 1.2
share/man/man4/Makefile: revision 1.405
distrib/sets/lists/man/mi: revision 1.930
distrib/sets/lists/etc/mi: revision 1.176
usr.sbin/sdpd/profile.c: revision 1.3
usr.sbin/btdevctl/btdevctl.c: revision 1.3
etc/MAKEDEV.tmpl: revision 1.62
distrib/sets/lists/base/mi: revision 1.650
usr.sbin/btdevctl/btdevctl.h: revision 1.2
usr.bin/sdpquery/sdpquery.1: revision 1.4
sys/netbt/rfcomm_session.c: revision 1.2
usr.sbin/btdevctl/btdevctl.8: revision 1.3
usr.bin/sdpquery/search.c: revision 1.2
usr.sbin/sdpd/Makefile: revision 1.2
sys/dev/bluetooth/Makefile: revision 1.3
usr.sbin/btdevctl/cfg.c: file removal
sys/netbt/files.netbt: revision 1.4
usr.sbin/btdevctl/sdp.c: revision 1.1
sys/dev/bluetooth/bthidev.c: revision 1.3
etc/bluetooth/Makefile: revision 1.3
sys/dev/pcmcia/files.pcmcia: revision 1.51
sys/dev/bluetooth/bthidev.c: revision 1.4
sys/dev/bluetooth/bthidev.h: revision 1.3
usr.sbin/btdevctl/dev.c: file removal
sys/dev/bluetooth/files.bluetooth: revision 1.10
sys/arch/i386/conf/GENERIC: revision 1.777
share/man/man4/ubt.4: revision 1.6
share/man/man4/bthub.4: revision 1.3
sys/netbt/hci.h: revision 1.5
sys/arch/i386/conf/GENERIC_LAPTOP: revision 1.202
lib/libsdp/sdp.h: revision 1.2
usr.sbin/btdevctl/print.c: revision 1.1
share/man/man4/bthidev.4: revision 1.5
share/man/man4/btdev.4: file removal
usr.sbin/btdevctl/print.c: revision 1.2
sys/arch/i386/conf/GENERIC_LAPTOP: revision 1.205
usr.sbin/btdevctl/Makefile: revision 1.2
sys/dev/usb/files.usb: revision 1.70
sys/netbt/l2cap_signal.c: revision 1.2
sys/netbt/hci_link.c: revision 1.4
sys/dev/bluetooth/bthub.c: revision 1.3
share/man/man4/btsco.4: revision 1.5
sys/netbt/hci_link.c: revision 1.5
share/man/man4/btdev.4: revision 1.4
sys/dev/bluetooth/btkbd.c: revision 1.3
sys/dev/bluetooth/btdev.c: file removal
sys/netbt/hci_event.c: revision 1.2
sys/dev/bluetooth/btsco.h: revision 1.2
etc/mtree/special: revision 1.101
sys/dev/bluetooth/btsco.c: revision 1.3
sys/conf/majors: revision 1.27
usr.sbin/sdpd/hf.c: revision 1.1
sys/dev/bluetooth/btsco.c: revision 1.4
share/man/man5/rc.conf.5: revision 1.107
sys/dev/bluetooth/btdev.c: revision 1.2
etc/rc.d/btdevctl: revision 1.2
usr.sbin/btdevctl/db.c: revision 1.1
etc/rc.d/btdevctl: revision 1.3
etc/bluetooth/btdevctl.conf: revision 1.1
usr.sbin/btdevctl/hid.c: file removal
sys/arch/i386/conf/GENERIC: revision 1.781
sys/dev/bluetooth/btdev.h: revision 1.3
Make btdev default count explicit
Fix typo in variable name
update to bluetooth device attachment:
remove pseudo-device btdev(4) and inherent limitations
add bthub(4) which autoconfigures at bluetooth controllers as they
are enabled. bluetooth devices now attach here.
btdevctl(8) and its cache is updated to handle new semantics
etc/rc.d/btdevctl is updated to configure devices from a list
in /etc/bluetooth/btdevctl.conf
also include service name in dictionary being sent to kernel.
(this is not used just yet, but it might be in the future and it will
be easier if we dont have to provide code to handle its absence)
clarify the CAVEAT section somewhat
Add service discovery support for the Handsfree profile
Replace static 'FreeBSD' string with operating system name gleaned
from uname(3)
Halt the callout on detach
btsco.c:
- sco_getopt(..., SO_SCO_MTU, ...) expects the address of a uint16_t,
not an int. So change sc_mtu's type to uint16_t.
- Try a little harder to ensure btsco_round_blocksize() does not
return zero. Prevents a subsequent panic in audio_init_ringbuffer().
from scw@
Endian issues:
hci_event.c:
- Convert memo->response.clock_offset to host-endian.
hci_ioctl.c:
- printf format tweak (size_t)
hci_link.c:
- Convert memo->response.clock_offset from host-endian.
- Tweak a DIAGNOSTIC message.
l2cap_signal.c:
- In l2cap_recv_config_req(), rp->scid is little-endian so make sure
we convert from host-endian.
from scw@
hci_link.c:
- In hci_link_free(), do not unlink items from a LIST queue within
a LIST_FOREACH() iterator.
rfcomm_session.c:
- In rfcomm_session_recv_mcc_nsc(), do not unlink items from a LIST
queue within a LIST_FOREACH() iterator.
from scw@
guard against a possible situation where the list of l2cap channels is changed
when the bluetooth code is not expecting it to be. During a disconnect, we can
detach the channel that is being disconnected, but its not really safe to detach
any others.
Print explicit 64-bit types using the format macros from int_fmtio.h.
Unbreaks the build for our LP64 ports, where "long long" typically is
not 64 bits.
 1.10.6.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.11.20.1 06-Oct-2007  yamt sync with head.
 1.11.18.1 06-Nov-2007  matt sync with HEAD
 1.11.16.1 02-Oct-2007  joerg Sync with HEAD.
 1.11.4.1 09-Oct-2007  ad Sync with head.
 1.12.26.1 18-Jun-2008  simonb Sync with head.
 1.12.24.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.12.22.2 11-Aug-2010  yamt sync with head.
 1.12.22.1 04-May-2009  yamt sync with head.
 1.12.20.1 17-Jun-2008  yamt sync with head.
 1.12.18.1 29-Jun-2008  mjf Sync with HEAD.
 1.13.18.1 30-May-2010  rmind sync with head
 1.13.16.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.13.6.1 21-Nov-2010  riz Pull up following revision(s) (requested by plunky in ticket #1407):
sys/dev/bluetooth/btdev.h: revision 1.9
sys/arch/iyonix/conf/GENERIC: revision 1.60
sys/arch/sparc64/conf/GENERIC: revision 1.129
sys/dev/usb/hid.c: revision 1.30
sys/dev/usb/hid.h: revision 1.13
sys/arch/i386/conf/GENERIC: revision 1.983
usr.sbin/btdevctl/print.c: revision 1.10
sys/arch/evbarm/conf/MPCSA_GENERIC: revision 1.16
sys/arch/alpha/conf/GENERIC: revision 1.337
sys/dev/bluetooth/files.bluetooth: revision 1.14
sys/arch/evbarm/conf/GUMSTIX: revision 1.49
sys/dev/usb/usbdevs: revision 1.550
sys/arch/evbppc/conf/OPENBLOCKS266_OPT: revision 1.14
sys/arch/hpcsh/conf/GENERIC: revision 1.91
sys/dev/bluetooth/btmagic.c: revision 1.1
distrib/sets/lists/man/mi: revision 1.1210
sys/arch/amd64/conf/GENERIC: revision 1.279
sys/arch/i386/conf/ALL: revision 1.258
sys/arch/amd64/conf/XEN3_DOM0: revision 1.54
sys/arch/hpcarm/conf/JORNADA720: revision 1.78
sys/dev/usb/hid.c: revision 1.29
share/man/man4/btmagic.4: revision 1.1
hid_get_data() does not work if the size of data is less than
a byte and crosses a byte boundary, and it always returns a
sign-extended value.
fix this by using the algorithm from libusbhid to read bytes,
and provide a hid_get_udata() function to return unsigned data
values.
while here, const args
update DPRINTF to reflect actual function name
add Apple Magic Mouse product-id
regen for Magic Mouse id
allow for vendor-id and product-id properties, passing them
through to child devices
add Magic Mouse driver and manpage btmagic(4)
additionally query the "PnP Information" service record to discover
any USB Forum vendor-id and product-id values and store them in the
property list if found.
add btmagic(4) where other Bluetooth drivers are listed
 1.14.36.1 28-Aug-2017  skrll Sync with HEAD
 1.14.18.1 03-Dec-2017  jdolecek update from HEAD
 1.15.8.1 05-May-2019  isaki Remove obsoleted au{,rate,vol}conv and mulaw attributes.
audio provides the equivalent of them inseparably.
 1.15.4.1 10-Jun-2019  christos Sync with HEAD

RSS XML Feed