Commit Graph

7833 Commits

Author SHA1 Message Date
Gustavo F. Padovan
27fffa4aad Add btd_error_busy() 2010-12-07 23:11:10 +02:00
Gustavo F. Padovan
cd5f44488f Add btd_error_not_available() 2010-12-07 23:10:30 +02:00
Gustavo F. Padovan
bd3cf4860d Add btd_error_in_progress() 2010-12-07 23:08:58 +02:00
Gustavo F. Padovan
64dc6dbbf3 Add btd_error_not_connected() 2010-12-07 23:08:14 +02:00
Gustavo F. Padovan
62eed980af Add btd_error_not_supported() 2010-12-07 23:00:22 +02:00
Gustavo F. Padovan
73774f1b25 Add btd_error_already_exists() 2010-12-07 22:59:28 +02:00
Gustavo F. Padovan
696c18c48f Create btd_error_invalid_args()
DBus error handling in BlueZ is a mess. This is the first patch to unify
all DBus error handling like in ConnMan and oFono. This unifies all
.InvalidArguments errors.
2010-12-07 22:58:32 +02:00
Vinicius Costa Gomes
1e35abda9f Fix writing to GAttrib socket without POLLOUT event
If the GIOChannel is in the buffered state (the default) the watch
function is called without receiving a POLLOUT from the socket. GLib
adds a G_IO_OUT condition just because there is space in the GIOChannel
internal buffer.

The solution is disabling the internal buffer, which in turn, makes the
call of g_io_channel_flush() useless.
2010-12-07 22:57:22 +02:00
Anderson Lizardo
2fd7cb5914 Check authentication permissions on attribute server
Attributes may require encryption for certain operations. This commit
adds checks to the attribute server which verify whether the current
connection is encrypted (by checking the security level) and the
attribute being accessed requires authentication. If encryption
requirements are not satisfied, the "Insufficient Encryption" error is
returned by the server.

Note that currently there is no actual distinction between
authentication and encryption. Currently, if an attribute requires
authentication, it is only checked whether the link is encrypted. Core
Specification, as of version 4.0, does not specify an explicit
"encryption" permission (see Vol.  3, Part F, 3.2.5 "Attribute
Permissions").
2010-12-07 22:55:45 +02:00
Bruna Moreira
127e0a5b75 Check attribute permissions in attribute server
The attribute server must verify if the operation (read/write) is
permitted before running the request, and send "Read Not Permitted" or
"Write Not Permitted" error response to client if appropriate.
2010-12-07 22:54:44 +02:00
Bruna Moreira
dd7a2acf88 Initial attribute permission implementation
Add enums for attribute read/write requirements, which may be "none",
"authentication required" or "authorization required". Additionally, a
"not permitted" requirement means that operation is not permitted,
allowing read-only or write-only attributes.

The attrib_db_add() API was changed to allow setting these requirements,
and the example server was changed to set requirements for its
attributes.
2010-12-07 22:52:25 +02:00
Luiz Augusto von Dentz
3dc2fef459 Fix deinitializing telephony backend when it wasn't initialized
Telephony driver is now deinitialized on headset adapter driver remove so
telephony_exit should not be called on plugin exit anymore.
2010-12-02 11:03:23 +02:00
Marcel Holtmann
cc8538b8c9 Release 4.81 2010-11-30 15:55:09 +01:00
Luiz Augusto von Dentz
68c91e63d9 Fix not canceling pending calls on maemo6 telephony driver exit
This happens when the driver exit is called quickly after init due to
adapter power changes.
2010-11-30 14:58:29 +02:00
Luiz Augusto von Dentz
6ddb42578b Use specific members in D-Bus match rules on telephony maemo6 driver
This reduces the amount of unnecessary wake-ups without breaking anything
2010-11-30 14:31:07 +02:00
Luiz Augusto von Dentz
6ed466ad32 Fix interface name of modem states on maemo6 telephony driver 2010-11-30 14:31:03 +02:00
Daniel Orstadius
ec31eb74a9 Initialize adapter services list
In case service records have been added to bluetoothd before a new
adapter is registered, the records which are shared by all adapters
(indicated by having the address set to BDADDR_ANY) need to be added
to the services list of the new adapter. This patch adds a function
for this on adapter initialization.

The issue could be reproduced by running bluetoothd and obexd on a
PC and briefly removing the BT dongle. The service records from
obexd would not be present in the adapter's local list (which is
used to set the class of device).
2010-11-30 13:50:12 +02:00
Sheldon Demario
5f9ebfaa84 Emit Connect signal for LE capable devices 2010-11-29 22:20:57 +02:00
Sheldon Demario
90dec87b5c Attrib server should truncate attribute value to pdu length
When the size of attribute value is greater than pdu size, it should be
truncated to the pdu length - 2
2010-11-29 19:24:07 +02:00
Claudio Takahasi
f68cb33e96 Don't trigger the discovering when registering the client
Discover All Primary Services should not be trigged by the attribute
client when a given device is registered. Discover services is now done
by the device entity.
2010-11-29 19:21:00 +02:00
Claudio Takahasi
dbe7a78109 Fix memory leak of sdp list in the attribute client 2010-11-29 19:20:45 +02:00
Claudio Takahasi
43e7a91f82 Return a D-Bus error if device_browse fails
If Discover All Primary Services or SDP search fails, the CreateDevice
caller will not receive a response. Error reproducible when a Discover
All Primary Services is sent over a LE link and the kernel doesn't
address properly the connections in the channel ID 4.
2010-11-29 19:20:23 +02:00
Claudio Takahasi
e0c4ed89ae Check the device type when creating the device
For CreateDevice, if the remote device is LE capable, Discover All
Primary Services shall be issued instead of SDP queries. The logic
to define if the remote is LE capable shall be based on the result
of the interleaved discovery results. Meaning, the remote device
is classified as LE capable only if an advertising event from this
device was collected during the discovery.

Limitation: Advertising event data is not being considered yet to
infer the remote properties and CreateDevice needs to be called
during the discovery session.
2010-11-29 19:19:37 +02:00
Claudio Takahasi
d49c4e8457 Implement primary service search when creating a device
Discover primary services implemented inside the device entity to allow
proper integration of attribute plugin. Implements a single entry point
to the attribute plugin no matter the transport(BR/EDR or LE), the device
probe callback is called for both types.

Add a new function to discover all primary services without additional
calls to fetch the remaining primary services, sub-procedure iterations
is handled inside this function.

The next action are: clean the attribute client removing implicity service
and characteristics discovery, issue the Discover Primary Service based on
the remote properties and fetch the characteristic on demand.
2010-11-29 19:18:33 +02:00
Claudio Takahasi
04e0628c44 Removed unused define 2010-11-29 17:01:30 +02:00
Claudio Takahasi
8e77033327 hcid header cleanup 2010-11-29 15:35:35 +02:00
Johan Hedberg
3266ab0556 Remove unused scan_mode variable 2010-11-28 21:14:13 +02:00
Johan Hedberg
9a91d21a65 Use existing bit functions from hci.h 2010-11-28 20:23:43 +02:00
Johan Hedberg
20ccc578c8 Remove unused includes 2010-11-28 13:41:35 +02:00
Johan Hedberg
872da68684 Remove unused define 2010-11-28 13:19:53 +02:00
Johan Hedberg
16348199ed Use address instead of object path in device logs 2010-11-27 18:15:25 +02:00
Johan Hedberg
0e9aac1c77 Improve hciops logging 2010-11-27 17:39:37 +02:00
Johan Hedberg
d013ad3c90 Improve agent PIN length error log 2010-11-27 17:01:03 +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
Rafal Michalski
508fdc901e Fix crash after simultaneous authentication requests
Previously simultaneous authentication requests to the same device caused
bluetoothd crash. Now if ongoing authentication occurs error is returned,
preventing from simultaneous requests to the same device.
2010-11-25 22:10:57 +02:00
Claudio Takahasi
c230755062 sdpd header cleanup 2010-11-25 22:02:00 +02:00
Luiz Augusto von Dentz
565ffe72f8 Fix telephony maemo6 driver deinitialization
Remove all match rules and unregister its interface when telephony_exit
is called.
2010-11-25 22:00:06 +02:00
Luiz Augusto von Dentz
ebccbc1806 Fix telephony dummy driver
Make it unregister its interface on telephony_exit
2010-11-25 22:00:02 +02:00
Luiz Augusto von Dentz
b9d85c0010 Fix not deinitializing telephony driver when there is no adapter powered
This changes hook telephony driver de/initialization to powered state so
telephony drivers can now free their resources when there is no adapter
active in the system.
2010-11-25 22:00:00 +02:00
Sheldon Demario
63beb887a6 Extend discover characteristic by UUID in gatttool to fetch all values
If the number of characteristics returned exceeds the MTU size, it will
be needed to ask for more data until the handle range is entirely
searched.
2010-11-25 14:19:41 +02:00
Suraj Sumangala
4e0e44626d hciattach: download configuration at user requested baud rate
This patch support downloading configuration for Atheros AR300x HCI UART
chip at user requested baud rate instead of the initial baud rate.
2010-11-23 12:09:20 +01:00
Suraj Sumangala
429877099f hciattach: make set_speed return error if any operation fails
This patch lets set_speed function changing UART baud rate to return an
error code if any one operation fails instead of returning only the last
operation's status.
2010-11-23 12:08:54 +01:00
Wade Brown
53095459ee Add a runtime option to set the BCSP communication rate 2010-11-23 10:01:58 +01:00
Jose Antonio Santos Cadenas
6b5e3cb05b Fix typo in adapter documentation 2010-11-22 23:06:23 +01:00
Jose Antonio Santos Cadenas
d6523428ac Fix MDL and MCL reference counting in IO watchers
When a io_watcher is added to an MDL or an MCL channel, its reference
should be incremented because the watcher should keep its own reference
the the structure.

Also a destroy function is added in order to decrement the reference
once the watcher is removed.
2010-11-22 18:02:26 +01:00
Santiago Carot-Nemesio
d8e13154ce Do not increment mdl reference in reconnections 2010-11-22 15:34:19 +01:00
Marcel Holtmann
78aca46d99 Release 4.80 2010-11-21 20:12:19 +01:00
Johan Hedberg
29c494df12 Make LE_LINK define private to hcitool.c for now
The value 0x03 isn't something that exists in the core spec, so it
shouldn't be used in the same API as SCO/ACL link types. Since there are
some experimental kernel patches that use it this patch makes it private
to hcitool.c.
2010-11-21 20:01:20 +01:00
Johan Hedberg
9f524fe68a Fix possible race condition when initializing adapters
Due to a possible kernel bug, sometimes the very first HCI commands that
the kernel sends might go unnoticed. Therefore check for this when one
of the last commands (read_local_name) that the kernel sends completes.
2010-11-19 21:02:56 +02:00
Luiz Augusto von Dentz
a26ae500a9 Fix not indicating disconnected state when connecting to avdtp
This cause parts of code such as audio/sink.c to keeps its internal state
as connecting and thus prevent any other connection attempt to succeed.
2010-11-19 18:19:28 +02:00