Commit Graph

8690 Commits

Author SHA1 Message Date
Luiz Augusto von Dentz
e2482a5ee3 Fix removing inotify watch whenever an adapter is removed
This sometimes cause bluetoothd to burn cpu when an adapter is removed
from the system.

Since the watch is not really bond to any adapter, in fact it is added on
plugin .init, its removal is now moved to plugin .exit.
2011-07-26 12:59:54 +03:00
Luiz Augusto von Dentz
9a7e2cc81c Fix possible invalid read/free on manager.c
Invalid read of size 4
    at 0x178A20: adapter_get_address (string3.h:52)
    by 0x174C28: adapter_cmp (manager.c:324)
    by 0x4EA95B0: g_slist_find_custom (in /lib64/libglib-2.0.so.0.2908.0)
    by 0x174ED9: manager_find_adapter (manager.c:333)
    by 0x16ABFA: sdp_record_remove (sdpd-database.c:270)
    by 0x16A4D6: remove_record_from_server (sdpd-service.c:286)
    by 0x12A947: avrcp_unregister (control.c:972)
    by 0x1208CC: avrcp_server_remove (manager.c:1066)
    by 0x4EA9826: g_slist_foreach (in /lib64/libglib-2.0.so.0.2908.0)
    by 0x178985: adapter_remove (adapter.c:2326)
    by 0x4EA9826: g_slist_foreach (in /lib64/libglib-2.0.so.0.2908.0)
    by 0x4EA984A: g_slist_free_full (in /lib64/libglib-2.0.so.0.2908.0)
  Address 0x603ccd0 is 16 bytes inside a block of size 448 free'd
    at 0x4A055FE: free (vg_replace_malloc.c:366)
    by 0x4E938F2: g_free (in /lib64/libglib-2.0.so.0.2908.0)
    by 0x11EB59: remove_interface (object.c:563)
    by 0x11F380: g_dbus_unregister_interface (object.c:715)
    by 0x1787EC: btd_adapter_unref (adapter.c:2496)
    by 0x4EA9826: g_slist_foreach (in /lib64/libglib-2.0.so.0.2908.0)
    by 0x4EA984A: g_slist_free_full (in /lib64/libglib-2.0.so.0.2908.0)
    by 0x174E96: manager_cleanup (manager.c:301)
    by 0x11CCE8: main (main.c:305)
2011-07-26 12:38:09 +03:00
Claudio Takahasi
e501b00e02 Add Link Loss device driver skeleton 2011-07-26 11:13:05 +03:00
Claudio Takahasi
b81ddf51e9 Add Proximity Monitor skeleton
Registers hard-coded D-Bus object path for Proximity Monitor and
exports GetProperties and SetProperty.
2011-07-26 11:13:03 +03:00
Claudio Takahasi
37c3958aba Add Proximity Profile plugin skeleton 2011-07-26 11:13:01 +03:00
Andrei Emeltchenko
8a617a8df5 l2test: enhance L2CAP mode option 2011-07-26 11:01:00 +03:00
Andrei Emeltchenko
3a94d5d09c l2test: Make use of L2CAP extended feature mask definitions 2011-07-26 11:00:57 +03:00
Andrei Emeltchenko
c7aac05539 Add L2CAP extended feature mask definitions 2011-07-26 11:00:02 +03:00
Szymon Janc
53e6e763d2 Fix telephony driver compilation with GLib < 2.28 2011-07-19 00:05:40 +03:00
Claudio Takahasi
16072709d1 Try to connect when registering the first callback
If the device is disconnected and the first ATT connection callback is
registered, the first connection attempt can be triggered instead of
waiting the timer.
2011-07-14 19:48:52 +03:00
Claudio Takahasi
b405d2da26 Drop GAttrib ref if callback list is empty
If all ATT connection callbacks are unregistered, GAttrib reference
can be dropped.
2011-07-14 19:48:35 +03:00
Claudio Takahasi
1eddeb66e8 Enable ATT re-connection
If the link is lost and there is at least one connection callback
registered the timer for ATT automatic connection shall be enabled.
2011-07-14 17:41:52 +03:00
Claudio Takahasi
bc80d767ab Add auto connection based on registered callbacks
This initial approach uses a hardcoded timer(45s). Passive scanning
or any other mechanism to avoid unnecessary connection attempt is not
supported at the moment. For LE, device discovery needs to be executed
to update the kernel advertising cache to allow re-connections.
2011-07-14 17:41:28 +03:00
Claudio Takahasi
ed57f0d28a Add ATT disconnect callback 2011-07-14 17:40:29 +03:00
Claudio Takahasi
1557acd733 Notify the GAttrib instance if already connected
When registering the connect and disconnect callbacks for ATT, GAttrib
instance should be informed to the caller if the link is up.
2011-07-14 17:40:17 +03:00
Claudio Takahasi
f6e2c8c614 Fix crash when create device is cancelled
If the owner leaves the bus or cancels the device creation process
the connection callback is called causing invalid memory access.
2011-07-14 17:39:33 +03:00
Claudio Takahasi
f61a6cad34 Add a function to remove ATT connection callback 2011-07-14 17:38:13 +03:00
Claudio Takahasi
55f9fbf822 Add ATT connection callback registration
Function intends to be used by profiles to inform that a connection
is required and the callback that needs to be called when the it is
established. New header is required to avoid non GATT based profiles
including GAttrib header.
2011-07-14 17:37:15 +03:00
Claudio Takahasi
37cd89f003 Set primary services before probing
Fix accessing primary services data in the probing function of GATT
based plugins.
2011-07-14 17:35:57 +03:00
David Herrmann
1106efd440 Add support for wiimote pairing
The Nintendo Wii Remote requires binary bluetooth addresses as PINs.
This is not possible via dbus agent API. So this adds a plugin that
registers a pin-callback and forces the right pin for every
authentication request of wiimotes.
2011-07-14 17:25:05 +03:00
David Herrmann
092df7b4f9 Add pin-code hook to adapter API
Plugins may now register pincode callbacks which are called when the
authentication of a new device requires a pincode. This allows to have
hard-coded binary pins inside the daemon to circumvent the public D-Bus
API restrictions (only valid UTF8 strings).

The callbacks shall check via VID/PID information whether they support
the device and if not, return 0 so the D-Bus API is used to query the
current agent for pin input.
2011-07-14 17:22:36 +03:00
David Herrmann
564197f21a Fix read_pin_code to return ssize_t
read_pin_code returns the length of a memory block and hence should use
ssize_t as type.
2011-07-14 17:21:41 +03:00
Claudio Takahasi
3dfad1a62c Remove unneeded hcid.h header include 2011-07-14 17:08:43 +03:00
Claudio Takahasi
ff7fd6ef1a Move attrib server init/exit declaration to hcid.h
Avoids GATT/ATT headers dependency in main.c.
2011-07-14 16:35:53 +03:00
Claudio Takahasi
860b8161ea Remove unnecessary assignment
D-Bus connection is set by the callers of the discover primary service
function on both situations: create device without bonding or after
bonding complete.
2011-07-14 16:35:01 +03:00
Szymon Janc
c3dd10b572 Add SAP driver for ST-Ericsson U8500 platform 2011-07-13 11:44:28 +03:00
Johan Hedberg
c92a4af85f Clean up device bonding removal 2011-07-11 15:45:28 +03:00
Dmitriy Paliy
33cdfcb0fa Fix unpair device when disconnected for No Bonding
Fix Paired device property if 'No Bonding' authentication is used. It is
set to be false when device is disconnected and no link key is stored.
Otherwise, there can be cases when device is still valid and being
claimed as paired without available bonding information.

For instanse, use of CreateDevice method call and obex client file
transfer is such use case.
2011-07-11 15:30:35 +03:00
Lukasz Rymanowski
c34e795644 Fix headset state callback in Media API
Headset watch is not registered per device. Therefore, when headset
disconnects, there is need to check for which audio device it is called.
2011-07-10 10:57:17 +03:00
Peter Hurley
5d88d8d690 avdtp: fix race condition when starting a stream
The AVDTP spec allows for a race condition between remote and local
device when issuing an AVDTP_START cmd on a stream in the OPEN state.

However, the internal state must continue to be consistent. For example,
suppose that avdtp_start() has been called while in the OPEN state and
a AVDTP_START cmd is sent.  Now before we have received a response (and
thus entered the STREAMING state), we *receive* a START cmd. Prior to
this fix, since the sep is still in the OPEN state, we would accept
the new START cmd. This will leads us to send both a Start_Ind and
Start_Cfm - not good.

Now, we track this transitional state (starting == TRUE).

NB - 'starting' is only in a valid state while the sep is in the
OPEN state. 'starting' is reset when we return to the OPEN state.
2011-07-10 10:55:19 +03:00
Lucas De Marchi
13568564b1 avrcp: remove unused dbus reply message
Fix leak of dbus messages being created but not unreferenced after
method returns.
2011-07-10 10:40:47 +03:00
Vinicius Costa Gomes
c141fcc366 btio: Fix the return value of bt_io functions
Some bt_io methods were ignoring the value stored in errno when
reporting the error to the caller.
2011-07-09 19:22:50 +03:00
Syam Sidhardhan
e1d2db4976 gdbus: Fix white space coding style issue
- corrected the space before '{'
2011-07-09 19:10:04 +03:00
Claudio Takahasi
9897721d7f Add Proximity API
Covers the Proximity Monitor for Link Loss, Tx Power and Immediate
Alert services. This first proposal considers that the connections
will be managed by the bluetoothd core based on the registered
connection callbacks.

Only one instance of Immediate Alert service is allowed, "Alert Level"
characteristic of this service is used by Find Me and Path Loss. Note
that "Alert Level" for Path Loss is a LOCAL property written in the
Immediate Alert service when the threshold is reached. For Find Me
the user/application needs to actively enable the alert in the Immediate
Alert service. Link Loss has it's own instance of Alert Level
characteristic.
2011-07-09 18:31:31 +03:00
Santiago Carot-Nemesio
7aa662d813 Health Thermometer Profile API 2011-07-09 18:29:46 +03:00
Luiz Augusto von Dentz
e202485107 Fix possible invalid read/free when using g_slist_free_full
This is probably a glib bug on g_slist_free_full which doesn't handle the
case where the list is modified inside the callback:

 Invalid read of size 8
    at 0x50AD5B2: g_slice_free_chain_with_offset (in /usr/lib64/libglib-2.0.so.0.2800.8)
    by 0x13057B: a2dp_unregister (a2dp.c:1550)
    by 0x12144C: a2dp_server_remove (manager.c:1032)
    by 0x50ADF16: g_slist_foreach (in /usr/lib64/libglib-2.0.so.0.2800.8)
    by 0x178B55: adapter_remove (adapter.c:2326)
    by 0x175205: manager_remove_adapter (manager.c:290)
    by 0x50ADF16: g_slist_foreach (in /usr/lib64/libglib-2.0.so.0.2800.8)
    by 0x50ADF3A: g_slist_free_full (in /usr/lib64/libglib-2.0.so.0.2800.8)
    by 0x175086: manager_cleanup (manager.c:298)
    by 0x11D7A8: main (main.c:305)
  Address 0x637a5e8 is 8 bytes inside a block of size 16 free'd
    at 0x4C27D6E: free (vg_replace_malloc.c:366)
    by 0x50AD9FC: g_slist_remove (in /usr/lib64/libglib-2.0.so.0.2800.8)
    by 0x12E5C6: a2dp_remove_sep (a2dp.c:1667)
    by 0x50ADF16: g_slist_foreach (in /usr/lib64/libglib-2.0.so.0.2800.8)
    by 0x50ADF3A: g_slist_free_full (in /usr/lib64/libglib-2.0.so.0.2800.8)
    by 0x13057B: a2dp_unregister (a2dp.c:1550)
    by 0x12144C: a2dp_server_remove (manager.c:1032)
    by 0x50ADF16: g_slist_foreach (in /usr/lib64/libglib-2.0.so.0.2800.8)
    by 0x178B55: adapter_remove (adapter.c:2326)
    by 0x175205: manager_remove_adapter (manager.c:290)
    by 0x50ADF16: g_slist_foreach (in /usr/lib64/libglib-2.0.so.0.2800.8)
    by 0x50ADF3A: g_slist_free_full (in /usr/lib64/libglib-2.0.so.0.2800.8)

 Invalid free() / delete / delete[]
    at 0x4C27D6E: free (vg_replace_malloc.c:366)
    by 0x50AD5A3: g_slice_free_chain_with_offset (in /usr/lib64/libglib-2.0.so.0.2800.8)
    by 0x13057B: a2dp_unregister (a2dp.c:1550)
    by 0x12144C: a2dp_server_remove (manager.c:1032)
    by 0x50ADF16: g_slist_foreach (in /usr/lib64/libglib-2.0.so.0.2800.8)
    by 0x178B55: adapter_remove (adapter.c:2326)
    by 0x175205: manager_remove_adapter (manager.c:290)
    by 0x50ADF16: g_slist_foreach (in /usr/lib64/libglib-2.0.so.0.2800.8)
    by 0x50ADF3A: g_slist_free_full (in /usr/lib64/libglib-2.0.so.0.2800.8)
    by 0x175086: manager_cleanup (manager.c:298)
    by 0x11D7A8: main (main.c:305)
  Address 0x637a5e0 is 0 bytes inside a block of size 16 free'd
    at 0x4C27D6E: free (vg_replace_malloc.c:366)
    by 0x50AD9FC: g_slist_remove (in /usr/lib64/libglib-2.0.so.0.2800.8)
    by 0x12E5C6: a2dp_remove_sep (a2dp.c:1667)
    by 0x50ADF16: g_slist_foreach (in /usr/lib64/libglib-2.0.so.0.2800.8)
    by 0x50ADF3A: g_slist_free_full (in /usr/lib64/libglib-2.0.so.0.2800.8)
    by 0x13057B: a2dp_unregister (a2dp.c:1550)
    by 0x12144C: a2dp_server_remove (manager.c:1032)
    by 0x50ADF16: g_slist_foreach (in /usr/lib64/libglib-2.0.so.0.2800.8)
    by 0x178B55: adapter_remove (adapter.c:2326)
    by 0x175205: manager_remove_adapter (manager.c:290)
    by 0x50ADF16: g_slist_foreach (in /usr/lib64/libglib-2.0.so.0.2800.8)
    by 0x50ADF3A: g_slist_free_full (in /usr/lib64/libglib-2.0.so.0.2800.8)

Invalid read of size 8
    at 0x50AD5B2: g_slice_free_chain_with_offset (in /usr/lib64/libglib-2.0.so.0.2800.8)
    by 0x175086: manager_cleanup (manager.c:298)
    by 0x11D7A8: main (main.c:305)
  Address 0x62b7ea8 is 8 bytes inside a block of size 16 free'd
    at 0x4C27D6E: free (vg_replace_malloc.c:366)
    by 0x50AD9FC: g_slist_remove (in /usr/lib64/libglib-2.0.so.0.2800.8)
    by 0x1751AE: manager_remove_adapter (manager.c:275)
    by 0x50ADF16: g_slist_foreach (in /usr/lib64/libglib-2.0.so.0.2800.8)
    by 0x50ADF3A: g_slist_free_full (in /usr/lib64/libglib-2.0.so.0.2800.8)
    by 0x175086: manager_cleanup (manager.c:298)
    by 0x11D7A8: main (main.c:305)

 Invalid free() / delete / delete[]
    at 0x4C27D6E: free (vg_replace_malloc.c:366)
    by 0x50AD5A3: g_slice_free_chain_with_offset (in /usr/lib64/libglib-2.0.so.0.2800.8)
    by 0x175086: manager_cleanup (manager.c:298)
    by 0x11D7A8: main (main.c:305)
  Address 0x62b7ea0 is 0 bytes inside a block of size 16 free'd
    at 0x4C27D6E: free (vg_replace_malloc.c:366)
    by 0x50AD9FC: g_slist_remove (in /usr/lib64/libglib-2.0.so.0.2800.8)
    by 0x1751AE: manager_remove_adapter (manager.c:275)
    by 0x50ADF16: g_slist_foreach (in /usr/lib64/libglib-2.0.so.0.2800.8)
    by 0x50ADF3A: g_slist_free_full (in /usr/lib64/libglib-2.0.so.0.2800.8)
    by 0x175086: manager_cleanup (manager.c:298)
    by 0x11D7A8: main (main.c:305)

To fix this now adapter_remove and a2dp_unregister_sep are passed
directly as a callbacks so g_slist_remove is not triggered.
2011-07-05 10:51:57 +03:00
Marcel Holtmann
f9a27a69d5 Release 4.95 2011-07-04 21:57:21 +02:00
Marcel Holtmann
4179958d06 Update library version 2011-07-04 21:49:40 +02:00
Marcel Holtmann
3f553a30ad Allow building with GLib 2.16 for now 2011-07-04 11:09:55 +02:00
Peter Hurley
a128f02646 Improve input server connect log messages
Added error log message for connection refusals and added
remote device BDADDR to existing debug messages.
2011-07-03 14:42:01 +03:00
Lucas De Marchi
fcb426c76a Fix common misspelled words
Accounting of misspelled words, as detected by codespell:

acording      2
ancilliary    1
appropiate    1
atribute      1
cant          1
comming       2
gracefull     1
lenght        1
mispelled     1
occured       1
occurences    1
ocurred       3
prefered      1
presense      1
reponse       1
seperate      1
succesful     1
successully   1
sucessfull    1
sucessfully   1
2011-07-03 14:36:14 +03:00
Marcel Holtmann
488af0f4da build: Remove deprecated options from bootstrap-configure 2011-07-01 20:51:10 -07:00
Lucas De Marchi
7849eeee2a build: Add support for systemd service configuration 2011-07-01 20:48:33 -07:00
Lucas De Marchi
c053eac034 build: Remove udevrules option
Use the new datafiles options instead.
2011-07-01 20:48:04 -07:00
Lucas De Marchi
9cec49b283 build: Rename configfiles option to datafiles
Instead of passing --[disable|enable]-configfiles, now we use
--[disable|enable]-datafiles as not all of the files are installed for
configuration but are rather data files.
2011-07-01 20:47:23 -07:00
Lucas De Marchi
b72a3526a8 avrcp: return NOT_IMPLEMENTED on request for vendor dep command
When a vendor dependent command is requested but target does not
implement it, the correct return value is CTYPE_NOT_IMPLEMENTED instead
of CTYPE_REJECTED.

AVRCP 1.3 spec clearly says so on section 4.5.1:
	[ It is assumed that devices that do not support this metadata
	transfer related features shall return a response of NOT
	IMPLEMENTED as per AV/C protocol specification ]

And AV/C General Specification, section 8.3.2 talks about legacy
behavior and mandates that NOT_IMPLEMENTED is returned.

Finally, in section 11.6.1 we see that VENDOR-DEPENDENT command frame
depends on the company_ID. Therefore we can't assume it has the same
format as the one specified for metadata transfer (in case the company
ID is 0x001958)
2011-06-30 22:52:28 +03:00
Lucas De Marchi
4560a956e9 avrcp: Factor out function to handle vendordep pdu
In order to support vendordep pdu as required by AVRCP 1.3 this part
will get very large. So, separate it to a new function like is done for
panel_passthrough.
2011-06-30 22:52:25 +03:00
Lucas De Marchi
027c6819f1 avrcp: Check that AVCTP packet is of type COMMAND 2011-06-30 22:52:23 +03:00
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