Commit Graph

8793 Commits

Author SHA1 Message Date
Luiz Augusto von Dentz
c612aee09d AVRCP: rename avrcp_spec_avc_pdu to avrcp_header
Since old avrcp_header got renamed to avc_header now we can use
avrcp_header for AVRCP PDUs.
2011-09-13 10:44:53 +03:00
Luiz Augusto von Dentz
222b464a6d AVRCP: rename avrcp_header to avc_header
AVCTP carries AV/C packets/PDUs not AVRCP as avrcp_header suggests.
2011-09-13 10:44:51 +03:00
Luiz Augusto von Dentz
09984fd9c6 AVRCP: use a vtable to simplify PDU parsing/handling
This simplify a bit the handling by introducing common checks before
calling the handler callback, it is also much easier to add/remove
new PDUs in this way.
2011-09-13 10:44:48 +03:00
Bruno Dilly
a48d5487c7 Add test for serial proxy and serial proxy manager 2011-09-13 10:42:39 +03:00
Claudio Takahasi
e327f964ce Return EALREADY if the adapter is already up/down 2011-09-12 15:17:24 +03:00
Claudio Takahasi
11ddc90c92 Serialize powering up/down in maemo6 plugin
This patch fixes wrong adapter state when using Management interface.
When bluetoothd starts, the adapter should be switched to the state
informed by Maemo6 MCE. In the current implementation, Maemo6 plugin
sends set powered command when the adapter is still powering up, the
last command sent fails(kernel returns EALREADY).
2011-09-12 15:17:22 +03:00
Claudio Takahasi
1851670a46 Fix adapter->up declaration
Minor code convention fix. This patch fix "up" variable declaration in
adapter structure. Convert "up" to gboolean making it compliant with
its usage.
2011-09-12 15:17:20 +03:00
Johan Hedberg
2784b03ab5 Fix minor coding-style issue 2011-09-12 11:02:21 +03:00
Claudio Takahasi
97fa351ab2 Prevents sending Write Local Name when not needed
Fix unneeded Write Local Name command being sent when bluetoothd starts
or switching the adapter on. Using an array of chars it is not possible
to distinguish if there is a valid value to be set since empty is a
valid value.
2011-09-12 10:59:28 +03:00
Claudio Takahasi
7aeeea795a Fix loop when setting adapter name
When management interface is enabled, name changed event comes when the
adapter is initialized as consequence of the Read Local Name. Use the
same function to set and handle event causes looping when bluetoothd
starts if the name stored in the controller is different from the name
provided by the adapter name plugin.

Splitting the adapter_update_local_name also fix the PropertyChanged
(for Name) signal being sent before AdapterAdded.
2011-09-12 10:59:27 +03:00
Claudio Takahasi
4211e2558e Remove not referenced function 2011-09-12 10:58:29 +03:00
Claudio Takahasi
d1bd2e58bb Remove leftover function declaration 2011-09-12 10:58:27 +03:00
Claudio Takahasi
8654b1bccc Remove unneeded header include 2011-09-12 10:58:25 +03:00
Claudio Takahasi
2c69682571 Remove forward declaration 2011-09-12 10:58:22 +03:00
Claudio Takahasi
362cef3d98 Fix ATT disconnect callback not being called
GAttrib disconnect function needs to be set after discovering the
primary services if the connection callback list is not empty. After
creating a device the connection can stay up, for this scenario the
registered disconnection callbacks are not being called.
2011-09-07 15:22:35 +03:00
Claudio Takahasi
c0930456c4 Write Link Loss Alert level if connected
When SetProperty gets called for LinkLossAlertLevel, the alert level
can be written in the remote is the link is up.
2011-09-07 15:22:33 +03:00
Maarten Bosmans
d337cc5098 sbc: Use __asm__ keyword
There are two reasons for this change:

First: consistency. __asm__ was already used elsewhere in the files, so
using that throughout is cleaner.

Second: both asm and __asm__ are GCC-specific extensions, not defined in
the C standard. When compiling with --std=gnu99 both are recognized, but
when using --std=c99 only __asm__ is recognized to make it perfectly
clear that you're not using some standard C99 construct, but a
GCC-extension.
2011-09-06 13:56:08 +03:00
Antti Julku
396607837a Add support for blacklisting events
Add support for mgmt interface events for device blocking/unblocking.
Kernel sends a mgmt event when a device has been blocked by another
management socket or with ioctl command (e.g. by hciconfig).

Parameter update_only is added to device_block/unblock functions in
device.c to avoid code copying. When update_only is true, blocking
command is not sent to kernel, but only device status is updated and
dbus signal is sent.
2011-09-01 16:02:10 +03:00
Andrei Emeltchenko
14ca2df11b Add definition for L2CAP Ext Window Size
This is needed e.g. by hcidump.
2011-08-31 13:22:05 +03:00
Lucas De Marchi
dec26ee50d Fix fd usage when not connected
When the avctp channel is not connected, we call
g_io_channel_unix_get_fd() with a NULL pointer. Glib does not check the
pointer before dereferencing it, causing bluetoothd to segv.

Move the function call to the place it's actually needed, after the
safety checks.
2011-08-30 15:53:57 +03:00
Burt Silverman
1e36c9b468 Print an error message if g_dbus_setup_bus fails.
That is standard processing when dbus_error_is_set() returns true, according to
dbus/dbus/dbus-errors.c.
In this case of g_dbus_setup_bus(), it provides extra help for determing the
specific cause of the error.
2011-08-30 13:11:50 +03:00
Bruno Dilly
04a4e9a650 Add Serial Proxy and Serial Proxy Manager doc 2011-08-30 13:05:12 +03:00
Pavel Raiskup
b52dc7e907 Off-by-one error in uses_rfcomm
Variable len could be assigned to PATH_MAX + 1 length (returned
 from readlink) and this variable is used as index to array link
of size only PATH_MAX + 1.
2011-08-29 13:45:59 +03:00
Pavel Raiskup
7af9f8687e formfactor: Add missing comma
Missing comma in static array chassis_map definition between
"Blade" and "Blade Enclosure" field.

Typing error fixed.
2011-08-29 13:45:41 +03:00
Pavel Raiskup
edb505b8c0 Off-by-one(two) error in form factor detection
Indexing of chassis_map array has to be done like that:
    chassis_map[chassis_type * 2 - 1]

because if not, everything is shifted by one. When (e.g.) chassis_type
is 0x04 result should be "Low Profile Desktop" =>  "desktop" (not a
"Pizza Box" => "server"). Lets see the 2.6.1 document on:

http://www.dmtf.org/standards/smbios
2011-08-29 13:44:33 +03:00
Marcel Holtmann
a1e585d99a build: Link bluetoothd with private copy of libbluetooth 2011-08-28 16:07:43 -07:00
Marcel Holtmann
35906565c9 audio: Update license for shared header files
The header files with constants and structures for audio specific
interaction with Pulseaudio are suppose to be under LGPL license.

For some odd reason a2dp-codecs.h ended up being under GPL license
which is against the intention of this being shared and re-used by
non-GPL programs. Fix this now to avoid any future confusion.
2011-08-26 11:18:54 -07:00
Frédéric Dalleau
021813afd9 Implement media_transport for HFP_HS_UUID
The transport is used by pulseaudio to suspend and resume streams.
2011-08-24 14:22:38 +03:00
Frédéric Dalleau
06eb47dec5 Introduce gateway locking mechanism 2011-08-24 14:22:31 +03:00
Frédéric Dalleau
9ce8d3f01e Set state to "connecting" when AG connects.
This state is used by media.c to trigger pulseaudio configuration.
2011-08-24 14:21:12 +03:00
Frédéric Dalleau
270f3bb47c Fix RFCOMM disconnect on suspend request
When pulseaudio release an audio stream, gateway.c disconnects
RFCOMM instead of disconnecting only SCO.
2011-08-24 14:21:09 +03:00
Frédéric Dalleau
d3f534025c Update g_strcmp0 to strcasecmp 2011-08-24 14:21:07 +03:00
Frédéric Dalleau
9a0bab4796 Use state change callback from media interface
When a HFPHS endpoint is created, media will start to watch for
HandsfreeGateway state changes. media call SetConfiguration upon
connection and ClearConfiguration upon disconnection.
2011-08-24 14:21:03 +03:00
Frédéric Dalleau
083177c86c Add state change callback to HandsfreeGateway
Media interface needs to monitor state changes of HandsfreeGateway.
2011-08-24 14:20:59 +03:00
Frédéric Dalleau
a471827d1f Fix double free in error case in endpoint_reply
If SetConfiguration call fails, the headset or gateway for which
SetConfiguration is called is disconnected. This will free any
pending request, but this does not prevent the request to
terminate (endpoint_reply) and try to free itself once again.
Note that a copy of the freed pointer is tested which has not
been updated.
2011-08-24 14:20:55 +03:00
Claudio Takahasi
9d509ed83d Disable Path Loss service in configuration file
Path Loss service requires kernel and userspace patches to work
properly. Keep it disabled while the implementation is not ready.
2011-08-24 12:47:25 +03:00
Claudio Takahasi
885b9613e4 Change default Link Loss alert level to high
After creating a Proximity device, Link Loss alert level is always
written. Setting the default value to "high" enables alert without
requiring an application to change it later.
2011-08-24 12:47:23 +03:00
Gustavo F. Padovan
74baed6cc8 Add Trusted to DeviceFound signal
This makes it consistent with the documentation which says that this
signal is has the same parameters as GetProperties reply.
2011-08-24 12:43:56 +03:00
Dmitriy Paliy
4920323c77 Fix remove temporary link key for No Bonding
This fixes regression caused by 33cdfcb0fa.
Temporary link key should be removed after device is disconnected if
bonding information is not stored in file system.

Currently, the key is deleted only when paired device is removed, or
adapter is powered off. In case of No Bonding authentication, device is
not paired after disconnection, which results in link key left in memory.

On the other hand, device is not necessarily removed after disconnection
that also leaves unneeded temporary link key in memory. Therefore,
btd_adapter_remove_bonding is moved to device_set_paired(device, FALSE)
covering both cases.
2011-08-23 14:58:02 +03:00
Marcel Holtmann
f2c61eb4ff build: Fix external plugin installation 2011-08-22 06:00:21 -07:00
Claudio Takahasi
bf857b7a57 Read local extended features at the initialization
Local extended features bitmask may change when Write LE Host Supported
Command is sent by the kernel. This patch adds reading of the local
extended features in the initialization sending a HCI command, extend
the ioctl HCIGETDEVINFO is not suitable due possible inconsistency
between kernel and userspace.
2011-08-22 13:39:10 +03:00
Claudio Takahasi
d7e1f84d30 Remove EnableLE option from the user-space
Deprecated configure option after adding "enable_le" parameter in the
bluetooth module. Write LE Host Supported Command is now sent by the
kernel if "enable_le" is enabled and the controller supports LE.
2011-08-22 13:39:08 +03:00
Vinicius Costa Gomes
319f66f7c8 Add support for listing all adapters using test-adapter 2011-08-22 13:13:23 +03:00
Peter Hurley
84f4d71d7d Fix get/set_hfp_active to match name conventions
These two functions are defined exclusively for headsets, so
follow established name conventions.
2011-08-22 11:04:24 +03:00
Peter Hurley
f9dddf3f41 Increase timeout before initiating AVDTP connection
AVDTP_CONNECT_TIMEOUT controls the delay between HSP/HFP
connection establishment and AVDTP signal channel establishment.
The original value of 1 sec. is too short to avoid racing for AVDTP
connection establishment (eg., if the device continues to configure
the HFP service level connection with additional AT cmds).

Some devices have broken AVDTP implementations that just cannot
handle the race conditions that arise if both devices are attempting
stream establishment at the same time. However, these conditions arise
only when the remote device is the ACL initiator (and in practice, the
RFCOMM initiator as well).  This fix bumps out the timeout value only
when the headset has initiated the link.
2011-08-22 10:49:02 +03:00
Marcel Holtmann
87b332e34c plugin: Use weak reference for external debug statements 2011-08-16 09:16:20 -07:00
Marcel Holtmann
8cd91d18de plugin: Add debug support for exteranl plugins 2011-08-14 14:56:20 -07:00
Marcel Holtmann
6b5b53f5d8 build: Allow loading of plugins from development tree 2011-08-14 14:39:14 -07:00
Szymon Janc
5a0c179b9a Add external dummy plugin for testing 2011-08-14 14:08:29 -07:00
Johan Hedberg
8ec11b427e Clean up code in control.c 2011-08-12 11:26:11 +03:00