Commit Graph

35 Commits

Author SHA1 Message Date
plunky e27c48bf6a const lookup argument 2011-09-17 08:23:36 +00:00
plunky 2c6dc8c043 upon device initialisation, query and cache the device features,
and cache the maximum ACL/SCO packet buffers.

provide an additional SIOCGBTFEAT ioctl to retrieve the cached
features, and add the max values to the SIOC?BTINFO results.

(btreq does not change size)
2010-11-22 19:56:51 +00:00
plunky 003e844b73 add feature bits from 3.0 specification 2009-09-11 18:35:50 +00:00
plunky 7216fe5048 update/correct specification IDs according to recently published
Assigned Numbers documents at www.bluetooth.com
2009-09-01 18:02:44 +00:00
plunky b7dec17fbf add a per-unit master setting, to control requesting the master role
when accepting connections.
2009-08-20 21:40:59 +00:00
plunky 80c6ec5db1 remove last usage of KAUTH_ISSUSER in bluetooth code by adding
some requests to the device scope:

	KAUTH_DEVICE_BLUETOOTH_SEND_COMMAND
	KAUTH_DEVICE_BLUETOOTH_RECV_COMMAND
	KAUTH_DEVICE_BLUETOOTH_RECV_EVENT
	KAUTH_DEVICE_BLUETOOTH_RECV_DATA

and a listener tied to the HCI protocol that will approve the basic
minimum to be sent and received.

handle the requests in the bsd44_suser listener by approving all
when the credential is root.
2009-08-10 18:25:20 +00:00
plunky 4a0feb42e7 add const to unchanged argument 2009-05-14 15:34:38 +00:00
gmcgarry 0de5da9678 Replace most gcc-specific __attribute__ uses with BSD-style sys/cdef.h
preprocessor macros.
2008-09-08 23:36:53 +00:00
plunky fd7356a917 Convert socket options code to use a sockopt structure
instead of laying everything into an mbuf.

approved by core
2008-08-06 15:01:23 +00:00
ad 15e29e981b 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@.
2008-04-24 11:38:36 +00:00
plunky a09c132d77 move the updating of num_cmd_pkts to its own function, mostly so that
pending commands will be output on the device in the order that they
were queued.
2008-03-17 09:16:17 +00:00
plunky 5f997830fe we always know the bdaddr and type of a link when creating it, so
pass them to the _alloc() function and let it set them.
2008-03-16 23:28:10 +00:00
plunky d0e804ff6e a "Create Connection" command can sometimes fail to start for whatever
reason and the command_status event returns failure but we get no
indication of which connection failed (for instance in the case where
we tried to open too many connections all at once)

So, keep a flag on the link to indicate pending status until the
command_status event is returned to help us decide which should
be failed.
2008-03-06 20:56:26 +00:00
plunky 7acc9392e5 add HCI definitions from the Bluetooth 2.1 spec 2008-02-10 17:40:54 +00:00
plunky aeab3db895 request and keep a mask of supported commands per unit in order
to block unsupported HCI commands sent by unprivileged users
reaching the device.
2007-12-30 18:26:42 +00:00
plunky 2f47a8f906 remove unused def for btr_uclass 2007-12-29 11:30:27 +00:00
plunky 736a9db087 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
2007-11-28 20:16:11 +00:00
plunky 176a9c6143 include <sys/device.h> for device_t 2007-11-12 19:08:29 +00:00
plunky 0b799668fb 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.
2007-11-10 23:12:22 +00:00
plunky fb65dc6e6b 'struct device *' -> 'device-t' 2007-11-10 12:33:21 +00:00
plunky 644e69cd47 "struct callout" -> callout_t
don't use callout_reset()
do use callout_destroy()
2007-11-03 17:20:17 +00:00
plunky b9a4fe408b constify hci_devname 2007-11-02 20:27:14 +00:00
plunky a0c60c7e8f improve memo taking of known bluetooth devices
- centralise creation of new memo into function
  hci_memo_new(), when a memo exists for that address,
  just update the timestamp.

- all results of inquiry/rssi result are processed; even
  if no memo can be allocated, we may update a timestamp.

- for new connections, query the clock offset of the remote
  device, in order that we can use it to facilitate future
  reconnections

- as a connection is removed, make a memo of the clock offset
2007-09-16 19:59:30 +00:00
plunky 9ab5b2f6b0 add event processing for "Inquiry result with RSSI", and modify the memo
contents so that this will fit.
2007-09-07 18:37:30 +00:00
plunky ef349c282b adjust typedef name for consistency with other parts, since hci_rssi_response
is only a packet segment it should not be in _ep namespace.
2007-09-07 18:14:33 +00:00
plunky f5db72e7b7 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)
2007-04-21 06:15:22 +00:00
kiyohara 10abd6f2e2 Supprot Bluetooth HCI UART (H4) driver and daemon. 2007-02-20 16:53:20 +00:00
yamt 8bf7662829 merge yamt-splraiseipl branch.
- finish implementing splraiseipl (and makeiplcookie).
	  http://mail-index.NetBSD.org/tech-kern/2006/07/01/0000.html
	- complete workqueue(9) and fix its ipl problem, which is reported
	  to cause audio skipping.
	- fix netbt (at least compilation problems) for some ports.
	- fix PR/33218.
2006-12-21 15:55:21 +00:00
christos 168cd830d2 __unused removal on arguments; approved by core. 2006-11-16 01:32:37 +00:00
plunky b1b95bf647 Reduce memory usage by not allocating a chunk for a bitmask. 2006-10-01 10:13:54 +00:00
plunky 4f1cbddc12 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
2006-09-10 15:45:55 +00:00
plunky c980b109dd 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.
2006-08-27 11:41:58 +00:00
tron 1b42d7e7dc Bluetooth fixes by Iain Hibbert:
- Clarify some deprecated commands from the 2.0 spec.
2006-07-26 10:13:49 +00:00
ad f474dceb13 Use the LWP cached credentials where sane. 2006-07-23 22:06:03 +00:00
gdamore a5c89047c0 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.
2006-06-19 15:44:33 +00:00