Commit Graph

8592 Commits

Author SHA1 Message Date
Luiz Augusto von Dentz
8306448148 Make use of g_slist_free_full on audio plugin 2011-06-30 14:38:59 +03:00
Luiz Augusto von Dentz
634f0a0436 Make use of g_slist_free_full on hciops plugin 2011-06-30 12:32:29 +03:00
Luiz Augusto von Dentz
da608774df Make use of g_slist_free_full on serial plugin 2011-06-30 12:32:26 +03:00
Luiz Augusto von Dentz
5a30030a32 Make use of g_slist_free_full on network plugin 2011-06-30 12:32:23 +03:00
Luiz Augusto von Dentz
05cb01fc32 Make use of g_slist_free_full on attrib 2011-06-30 12:32:19 +03:00
Luiz Augusto von Dentz
3058efa787 Make use of g_slist_free_full when elements are dynamically-allocated
This avoid having to iterate twice in the list to free its elements.
2011-06-30 12:32:17 +03:00
Luiz Augusto von Dentz
9c6e404f93 Mark Headset.Play method deprecated
SCO socket should be connected using either unix socket ipc or Media API
2011-06-30 11:11:02 +03:00
Bastien Nocera
c98f635b44 Add adaptername plugin
Replacing the name setting code in src/adapter.c.

Moving the adapter naming allows us to use the /etc/machine-info [1]
pretty hostname, as implemented by hostnamed [2] in systemd.

If /etc/machine-info is not present, the adapter name stored
on disk in /var/lib/bluetooth will be used. If no adapter name
has been set yet, the default from the main.conf will be used.

We don't currently number the name of hci0 if a pretty name is
available, but we should instead number it if it happens not
to be the default adapter. As we cannot be told when the default
adapter changes, we'll behave this way for now.

Note that when an adapter name is set automatically from
the pretty hostname, changing it through the D-Bus interface
will fail.

[1]: http://0pointer.de/public/systemd-man/machine-info.html
[2]: http://www.freedesktop.org/wiki/Software/systemd/hostnamed
2011-06-28 13:19:20 +03:00
Bastien Nocera
016df2cc8f Add ability to block name changes 2011-06-28 11:22:17 +03:00
Bastien Nocera
2ff8caf4f4 Simplify "SetName" D-Bus call
By merging most of the functionality into adapter_update_local_name()
This also allows us to drop the adapter->name_stored struct member
as in any calls to adapter_update_local_name(), we would want to
write out the adapter name.
2011-06-28 11:17:48 +03:00
Peter Hurley
9a653953dc Fix finalize discovery if all stream end points are In Use
When handling the discover response, if all stream end points are
in use, then we must finalize discovery, as no GET_CAPABILITIES
command will be issued.
2011-06-28 11:05:04 +03:00
Lukasz Rymanowski
cb60fce5fc Fix hid2hci compilation error
Do not compile hid2hci if udev is not present.
2011-06-28 10:53:32 +03:00
Lukasz Rymanowski
d70388cda5 Fix SAP message padding macro
With this patch it is not possible to have incorrect padding equal to 4.
2011-06-28 10:51:15 +03:00
Steven Luo
9edfc88f77 test/agent.c: Wait for reply from CreatePairedDevice before exiting
This matches the behavior of the Python sample agent, and is needed to
get my Bluetooth keyboard to pair.
2011-06-28 10:42:23 +03:00
Marcel Holtmann
7822123d08 Update company identifiers 2011-06-17 10:14:15 -07:00
Andre Guedes
4c893ee487 Cleanup: read_local_features callback is no longer used
This patch removes read_local_features callback from struct
btd_adapter_ops and its hciops/mgmtops implementations.
2011-06-17 13:36:38 +03:00
Andre Guedes
ae6b64c085 Cleanup: 'features' in btd_adapter is no longer used. 2011-06-17 13:35:22 +03:00
Nobuhiro Iwamatsu
afc11a2ab4 Fix typo from deamon to daemon 2011-06-17 13:33:06 +03:00
Johan Hedberg
650feaacca Update Johan's email address 2011-06-16 21:54:15 +03:00
Antti Julku
6c558d3620 Add blacklisting support for management interface
Management interface commands for blocking and unblocking devices.
2011-06-16 21:51:44 +03:00
Bastien Nocera
e93fae6f51 Re-add manager_get_default_adapter()
This will be useful for upcoming plugins like the sixaxis one or the
adaptername one.
2011-06-15 23:48:46 +03:00
Dmitriy Paliy
aacd845305 Add capability option to simple-agent
A new option is added to simple-agent facilitating use of "DisplayOnly",
"DisplayYesNo", "KeyboardOnly" and "NoInputNoOutput" agent capabilities.
2011-06-15 15:44:38 +03:00
Dmitriy Paliy
6ae6016523 Fix remove device alias when bonding deleted
Device alias is removed together with bonding information, such that
new pairing does not reuse old name. This is useful in cases when
name of paired device was changed after it was ones deleted.
2011-06-14 16:20:22 +03:00
Rafal Michalski
b70fae3807 Fix invalid memory access issues in AVDTP module
Changing stream state from STREAMING to IDLE can be associated with side
effects under some circumstances (such as terminating bluetoothd during
music is streamed). In this case, after connection is lost, stream state
changes from STREAMING to IDLE - "avdtp_sep_set_state" is triggered which
invokes callback called "stream_state_changed" which internally invokes
"avdtp_sep_set_state" (state of stream doesn't change and stays as IDLE)
second time and then stream object is freed by "stream_free"
at the end of "avdtp_sep_set_state". After returning from callback,
first triggered "avdtp_sep_set_state" attempts to free stream object
again ("if (state == AVDTP_STATE_IDLE)" condition is still satisfied)
and it leads to invalid read/write/free issues (reported by valgrind)
in "stream free" body, since "stream" is "alias" pointer to stream object
which is already out of date (memory for stream object has been already
freed).

This patch prevents from this special case by freeing stream object only
when it is present on streams list and removing from this list when
stream object would be freed.
2011-06-14 12:07:56 +03:00
Rafal Michalski
d9b27da3cc Fix invalid read from memory issue in AVDTP module
Changing stream state from STREAMING to IDLE can be associated with side
effects under some circumstances (such as terminating bluetoothd during
music is streamed). In this case, after connection is lost, stream state
changes from STREAMING to IDLE - "avdtp_sep_set_state" is triggered which
invokes callback called "stream_state_changed" which internally invokes
"avdtp_sep_set_state" (state of stream doesn't change and stays as IDLE)
second time and then stream callbacks list is discarded by "stream_free"
("g_slist_free(stream->callbacks)"). After returning from callback,
"stream->callbacks" list (and "l" pointer as well) is already out of date,
so attempting to fetch "l->next" pointer (returned by "g_slist_next(l)"
to be prepared to next iteration of "for" loop) from node on discarded
list leads to invalid read issue (reported by valgrind).

This patch prevents from this issue by moving "l = g_slist_next(l)"
instruction just before invoking callback - loop has been modified and
"while" used instead of "for" loop variant.
2011-06-14 12:07:35 +03:00
Rafal Michalski
a2d3f2d5c5 Fix invalid write to memory issue in media module
Under some circumstances (such as terminating bluetoothd during music is
streamed) endpoint object may be destroyed (memory for endpoint object is
internally freed, directly by "media_endpoint_remove") after invoking
"media_transport_destroy" (in "media_endpoint_clear_configuration") to
destroy transport object (memory for transport object is directly freed by
"media_transport_free"). It leads to invalid write issue (reported by
valgrind) after assignment "endpoint->transport = NULL", since "endpoint"
is "alias" pointer to endpoint object which is already out of date
(memory for endpoint object has been already freed).

This patch prevents from this issue by ensuring that assignment
"endpoint->transport = NULL" would be executed when endpoint object
certainly exists.
2011-06-14 12:07:18 +03:00
Rafal Michalski
94a49c7082 Fix invalid write to memory issue in A2DP module
Under some circumstances (such as terminating bluetoothd during music is
streamed) sep object may be destroyed (memory for sep object is internally
freed, directly by "a2dp_unregister_sep") after invoking
"media_endpoint_clear_configuration" (in "stream_state_changed").
It leads to invalid write issue (reported by valgrind) after assignment
"sep->stream = NULL", since "sep" is "alias" pointer to sep object which
is already out of date (memory for sep object has been already freed)

This patch prevents from this issue by ensuring that assignment
"sep->stream = NULL" would be executed when sep object certainly exists.
2011-06-14 12:06:42 +03:00
Szymon Janc
3a916a0067 Fix AVCTP reply for message with invalid PID
Reply for control message with invalid (not registered for reception
of messages) PID should not have message information field present.

This was affecting AVCTP 1.3 qualification test case TP/NFR/BI-01-C.
2011-06-14 11:13:57 +03:00
Szymon Janc
d3750509b3 Remove SAP_BUF_SIZE define from sap/server.c
It is already defined in sap/sap.h which is included by sap/server.c.
2011-06-14 10:46:21 +03:00
Szymon Janc
4866561a97 Remove unused enum from sap.h
This is a leftover from sap code upstreaming process.
2011-06-14 10:46:16 +03:00
Santiago Carot-Nemesio
8ab32a35e7 Fix typo error in the attribute API documentation 2011-06-14 10:42:37 +03:00
Peter Hurley
63c3e0561a Fix udev rule for Logitech devices
The *real* history of this file is a nightmare. Now that it's
back in the bluez project, fix the problems that were added
while it was in udev.

1) Only hiddev* devices provide the ioctl interface hid2hci uses
to switch from HID->HCI for --method=logitech-hid.  (inquiring
minds can look in the kernel git tree at drivers/hid/usbhid/hiddev.c)
2) hidraw* devices don't belong to subsystem=usb (they are
subsystem=hidraw).  This means that the udev rule that matched based on
hidraw* would never have been run anyway because of the early-out
subsystem!=usb on line 4.

This fix is going to cause major regressions in distros because there
is currently no way provided by bluez to *NOT* run hid2hci.

Many, many users (and maintainers) mistakenly believe that because
the keyboard and mouse works when the vid/pid of their device is matched
by the hidraw* rule, that "bluetooth" must be working. Of course, what's
really happening is the keyboard and mouse are working as HID input
devices instead.
2011-06-09 13:26:46 +09:00
Waldemar Rymarkiewicz
90ec29300d Add support of secure pin code in mgmt code
Use secure pin code parameter received from the kernel in
MGMT_EV_PIN_CODE_REQUEST event and propagate this to agent
code.

Secure flag is specific for the pin code request only.
2011-06-08 10:04:23 +09:00
Johan Hedberg
4b609b812f Add "quit" to gatttool supported commands 2011-06-08 09:59:20 +09:00
Lukasz Pawlik
7fec07d69c Fix type in conditional expression
Function media_endpoint_create returns pointer to structure. In
conditional expression it is safer to compare returned value with NULL
and not with gboolean as it is done in register_endpoint function.
2011-06-06 18:40:04 +09:00
Rafal Michalski
f182cf8618 Fix disconnect devices after enabling offline mode
Previously paired and connected devices were disconnected automatically
after turning bluetooth off directly via bluetooth UI. This patch makes
that also other ways of turning bluetooth off (which should lead to
disconnecting paired and connected devices), such as enabling offline
mode (which turns bluetooth off as well), can be handled properly.
2011-06-01 16:30:54 +03:00
Luiz Augusto von Dentz
571d97d3fe telephony-ofono: fix features initialization
Features should be ready before telephony_init return, otherwise the
record might contain invalid features.
2011-06-01 15:08:38 +03:00
Waldemar Rymarkiewicz
05e51adf10 Simplify return value in disconnect_req 2011-06-01 14:47:41 +03:00
Waldemar Rymarkiewicz
d77b3e021a Coding style cleanup in sap server 2011-06-01 14:47:04 +03:00
Waldemar Rymarkiewicz
6890d51291 Fix return value in send_message
send_message returns the number of sent bytes and -EIO in case of
IO error now
2011-06-01 14:44:21 +03:00
Waldemar Rymarkiewicz
b90dd1154c Clean SAP server error printouts 2011-06-01 14:43:53 +03:00
Slawomir Bochenski
f8e0916e2d Remove unnecessary jumps 2011-06-01 14:41:01 +03:00
Daniel Orstadius
3b7e90d9db Init telephony before adding the HFP SDP record
By patch b9d85c0010 the initialization
of the telephony subsystem is delayed in the bluetoothd startup
procedure. As a result the SupportedFeatures bitmap has not been set
when creating the HFP SDP record. This patch changes the order of
the telephony initialization (via the state_changed function) and
the registration of the record, so that it gets the right value.

Although the corresponding bit in +BRSF is correctly set, the
missing bit for the "Three-way calling" feature in the SDP record
causes some headsets not to send AT+CHLD=? in certain situations.
This results in failed connections since BlueZ does not enter the
"connected" state on the headset interface before that command is
received, if the feature is supported by both sides.
2011-06-01 11:15:33 +03:00
Marcel Holtmann
bf14614c5f Release 4.94 2011-05-31 08:13:22 -07:00
Marcel Holtmann
c78787f6ff Update library version 2011-05-31 01:30:37 -07:00
Marcel Holtmann
595abb225e Fix the broken change for udevdir and PCMCIA 2011-05-31 01:29:35 -07:00
Nobuhiro Iwamatsu
5dd8b9aa11 Fix install path for udevdir
If PCMCIA enabled, udevdir value override from /lib/udev to
$(libexecdir)/udev.
2011-05-31 10:55:41 +03:00
Ilia Kolomisnky
bb91e5ed10 Fix response for vendor dependent AVRCP commands
AVRCP TG now returns a REJECTED response with the "Invalid command"
error code for VENDOR DEPENDENT commands. This fixes test case
AVRCP/TG/INV/TC_TG_INV_BI_01_C with recent PTS version.
2011-05-31 10:48:30 +03:00
Marcel Holtmann
d552baf1ff Revert "Parse pin codes starting with '$' as hexadecimal encoded strings" 2011-05-30 22:38:09 -07:00
Marcel Holtmann
11338bdb09 Revert "Remove 16 byte limit for PIN codes returned by agents" 2011-05-30 22:37:58 -07:00