Commit Graph

70 Commits

Author SHA1 Message Date
Johan Hedberg
b9efb73d37 Refactor pairing code to match the management interface
This patch refactors the pairing code in hciops and the core daemon to
better match the management interface. Particularly all logic regarding
IO capabilities and authentication requirements are moved into hciops.c.
The patch is quite big because there are a lot of cross-dependencies
which makes it difficult to split the changes up into smaller chunks.

The important adapter_ops preparations for the management interface in
this patch are the create_bonding and cancel_bonding callbacks. Those
will be directly mapped to corresponding management commands.
2011-01-28 23:34:39 +02:00
Johan Hedberg
9634f5c410 mgmt: Add set_io_capability command 2011-01-25 13:45:24 +02:00
Johan Hedberg
3c8ab480f9 mgmt: Add command complete detection for PIN code handling 2011-01-25 13:43:58 +02:00
Johan Hedberg
8b77225e7b mgmt: Add PIN Code request handling 2011-01-24 11:51:47 +02:00
Johan Hedberg
f871d16282 mgmt: Fix new_key event content validation
This patch adds some stricter checks for the new_key management
interface event.
2011-01-24 11:51:22 +02:00
Johan Hedberg
1e862b561c mgmt: add support for get_connections command 2011-01-21 13:55:44 +02:00
Johan Hedberg
d6fda82e31 mgmt: add support for connect failed event 2011-01-21 10:57:41 +02:00
Johan Hedberg
1d87257dc5 mgmt: add core daemon callbacks for connected events 2011-01-21 10:08:46 +02:00
Johan Hedberg
cc8588d684 Add support for disconnect management command 2011-01-21 10:06:50 +02:00
Johan Hedberg
48908574c4 mgmt: Add support for connected/disconnected events 2011-01-21 07:03:02 +02:00
Johan Hedberg
bda6bb0079 Keep connection handle information inside adapter_ops
There's no point to export connection handle details to the core daemon
since it will not be available in the management interface. Instead
track the handles inside hciops (managment interface will do this inside
the kernel).
2011-01-21 06:56:55 +02:00
Johan Hedberg
b115f34444 mgmt: add initial support for link key handling 2011-01-21 05:28:45 +02:00
Johan Hedberg
006301ab40 Update Class of Device handling to the latest management interface
This patch updates the class of device handling code to match the latest
management interface. A notable feature is that UUID to service class
mapping policy remains in user space with the help of the svc_hint
parameter of the add_uuid command. This is to make it easy to update the
mapping table when new profiles come along.
2011-01-16 23:09:40 +02:00
Johan Hedberg
dbc131f84d mgmt: Fix opcode endianess in commands 2011-01-03 22:57:44 +02:00
Johan Hedberg
a31b2bfb5f mgmt: Add preliminary UUID handling
This patch adds support for the add_uuid and remove_uuid management
commands. The kernel uses them to track the list of UUIDs and
automatically set the service class bits as well as the EIR value
accordingly.
2011-01-03 22:27:21 +02:00
Johan Hedberg
6964bd2dd5 mgmt: Implement set_pairable
This patch implements support for the set_pairable managment command.
Due to the async nature of it a new btd_adapter_pairable_changed
function is added to the core daemon.
2010-12-30 15:06:16 +02:00
Johan Hedberg
3e1b64c81d Refactor handling of UUIDs with respect to adapter_ops
The management interface will have simple add_uuid and remove_uuid
methods so it makes sense to have the adapter_ops interface reflect
that. This patch removes the services_updated callback and replaces it
with add_uuid and remove_uuid callbacks.
2010-12-30 12:20:43 +02:00
Johan Hedberg
6e48f26366 Rename mgmt_update_mode to mgmt_update_powered for clarity 2010-12-30 00:13:48 +02:00
Johan Hedberg
fb88bd2992 mgmt: Use a common structure for powered, discoverable and connectable
The events, commands and responses to these modes are represented by
identical management messages. By having a unified struct for all of
them quite a lot of code can simplified and reused.
2010-12-30 00:13:48 +02:00
Johan Hedberg
d8426949bd mgmt: Clean up scan mode evaluation code 2010-12-30 00:13:47 +02:00
Johan Hedberg
14655825c9 mgmt: Implement set_connectable 2010-12-30 00:13:47 +02:00
Johan Hedberg
528432cc7a mgmt: Implement set_discoverable 2010-12-30 00:13:47 +02:00
Johan Hedberg
07481cab56 mgmt: Implement set_powered 2010-12-30 00:13:47 +02:00
Johan Hedberg
833c7ab1a6 Remove unneeded set_connectable adapter_ops callback 2010-12-29 13:33:29 +02:00
Johan Hedberg
8440ce6ac8 Rename btd_adapter_get_state to btd_adapter_get_mode
There's already an adapter_get_state function so to avoid confusion it's
better to have a different name.
2010-12-28 11:35:35 +02:00
Johan Hedberg
27c58425af Change power_on & power_off adapter_ops callbacks to set_powered
The current idea is to have a single set_powered management command
which for the switching on case would leave the controller in a
non-connectable, non-pairable and non-discoverable state.
2010-12-23 14:38:52 +02:00
Johan Hedberg
dccef4954d Move debug key handling into adapter_ops
There's no need for the core daemon to have special handling for debug
keys anymore as long as it tells adapter_ops if they are enabled or not
(new parameter added to adapter_ops->load_keys).
2010-12-20 19:38:43 +02:00
Johan Hedberg
27a311476a Add initial code for mgmtops adapter power control 2010-12-20 19:15:07 +02:00
Johan Hedberg
6b9921107e Get rid of unneeded btd_adapter_get_conn_handle function 2010-12-19 16:50:27 +02:00
Johan Hedberg
58b68d33c5 Fix handle endianess issues with btd_adapter_read_clock 2010-12-19 16:34:44 +02:00
Johan Hedberg
8e17ca3a78 Remove unnecessary btd_adapter_get_remote_version function 2010-12-19 15:35:07 +02:00
Johan Hedberg
4efb97bdae Add manager_foreach_adapter()
Ultimately manager_get_adapters shouldn't be needed at all. By
introducing manager_foreach_adapter most instances can be removed.
2010-12-19 13:25:51 +02:00
Johan Hedberg
b95ef500f7 Implement storing of link keys in runtime memory
The management interface will enable storing link keys in runtime memory
in the kernel. This patch makes the adapter interface match this model
and adds storing of link keys into hciops.
2010-12-19 01:25:24 +02:00
Johan Hedberg
423b80f993 Add missing mgmtops callbacks 2010-12-18 13:55:04 +02:00
Johan Hedberg
63ff6738ab Switch to using power_on & power_off adapter_ops callbacks
These map better to the new management interface.
2010-12-18 13:55:04 +02:00
Johan Hedberg
2db4f654cb Remove unnecessary read_local_ext_features callback 2010-12-18 13:55:03 +02:00
Johan Hedberg
5c1c35eb38 Refactor adapter initialization and power control
This (rather big) patch refactors the way that adapters are initialized
and powered on/off. The purpose is to align the adapter_ops <-> core
daemon interface with how the management interface will behave.
2010-12-18 13:55:03 +02:00
Johan Hedberg
8582b8e4cd Implement support for management powered event 2010-12-16 00:54:34 +02:00
Johan Hedberg
6a63c31255 Rename set_powered callbacks accordingly 2010-12-16 00:53:43 +02:00
Johan Hedberg
00c2267405 Refactor class of device (and related values) handling to adapter_ops
The management interface will move class of device and extended inquiry
response handling to the kernel side so the same functionality needs to
be moved into hciops. These features are quite tightly coupled in
bluetoothd so splitting this into multiple patches would have been hard
(if not impossible). Thus this quite large single commit.
2010-12-13 11:41:20 +02:00
Johan Hedberg
983bc0f8cc Remove unused adapter_ops->read_link_policy function
There is no code to react to the command complete of this HCI command so
there's really no value in issuing it to begin with.
2010-12-12 00:04:18 +02:00
Johan Hedberg
24a34a8b1f Merge read_mode management command into read_info
The read_mode and read_info commands are issued only once in the
beginning for each adapter so it doesn't make sense to have the
information fetching split across two different commands. Instead all
necessary info can be fetched through the read_info command.
2010-12-12 00:04:17 +02:00
Johan Hedberg
c3ebed5a7d Use hci_send_cmd instead of hci_send_req for authentication
In addition to blocking the mainloop hci_send_req changes the socket
filters which makes it unusable for the per-adapter HCI socket in
hciops.c. Using hci_send_cmd makes much more sense here.
2010-11-27 16:51:37 +02:00
Johan Hedberg
bd7f8939b5 Move local name reading into hciops 2010-11-12 22:15:03 +02:00
Johan Hedberg
7afa48dcf3 Move SSP mode reading into hciops
Since the only thing the code does upon a write_ssp_mode_complete event
is issue a read_ssp_mode command it makes sense to have this internal to
hciops.
2010-11-12 22:01:38 +02:00
Johan Hedberg
be49c2621d Move SSP mode setting into hciops 2010-11-12 21:41:48 +02:00
Johan Hedberg
b8486f046a Move more hciops specific functionality into hciops
Several adapter initialization features will be handled by the new
management interface in the future, so move these from adapter.c into
hciops. This also gets rid of a couple of unnecessary adapter_ops
callbacks.
2010-11-12 18:37:40 +02:00
Johan Hedberg
6f59ffc28f mgmtops: implement mgmt_read_local_version 2010-11-08 21:41:47 +02:00
Johan Hedberg
dd41f8f9a4 mgmtops: implement mgmt_read_local_features 2010-11-08 21:10:48 +02:00
Johan Hedberg
8c442fd677 mgmtops: add version information to read_info response 2010-11-08 21:08:41 +02:00