OSDN Git Service

android-x86/external-bluetooth-bluez.git
11 years agogdbus: Remove proxies when client disconnects
Henrique Dante de Almeida [Mon, 27 May 2013 17:15:34 +0000 (14:15 -0300)]
gdbus: Remove proxies when client disconnects

Remove proxies and generate proxy_removed callbacks even when there are
no corresponding InterfaceRemoved signals.

This patch fixes having zombie gdbus proxy object when a server
disconnects without sending InterfaceRemoved signals. These objects
may interact with new server instances, for example, making
InterfaceAdded signals of new objects with the same name be filtered
out as duplicated, or staying allocated, but unused, if the new server
doesn't reuse the object paths. Note that as a side-effect, the
lifetime of a gdbus proxy becomes stricter: it lives at most for the
duration of a single connection to a single instance of a server
process.

11 years agoopp: Register Session interface for OPP transfers
Gustavo Padovan [Mon, 27 May 2013 23:07:04 +0000 (20:07 -0300)]
opp: Register Session interface for OPP transfers

The Session interface wasn't registered when a new transfer arrives.

11 years agosession: only add Target if it exists
Gustavo Padovan [Mon, 27 May 2013 23:07:01 +0000 (20:07 -0300)]
session: only add Target if it exists

11 years agotools/l2cap-tester: Add basic server socket test case
Johan Hedberg [Mon, 27 May 2013 15:20:06 +0000 (18:20 +0300)]
tools/l2cap-tester: Add basic server socket test case

11 years agoemulator: Add L2CAP connection tracking to bthost
Johan Hedberg [Tue, 28 May 2013 08:09:27 +0000 (11:09 +0300)]
emulator: Add L2CAP connection tracking to bthost

11 years agoemulator: Add ACL connection tracking to bthost
Johan Hedberg [Tue, 28 May 2013 06:38:18 +0000 (09:38 +0300)]
emulator: Add ACL connection tracking to bthost

11 years agoemulator: Fix L2CAP Config req/rsp handling in bthost
Johan Hedberg [Mon, 27 May 2013 17:59:06 +0000 (20:59 +0300)]
emulator: Fix L2CAP Config req/rsp handling in bthost

11 years agoshared: Add necessary APIs for L2CAP connection initiation to hciemu
Johan Hedberg [Mon, 27 May 2013 17:34:06 +0000 (20:34 +0300)]
shared: Add necessary APIs for L2CAP connection initiation to hciemu

11 years agoemulator: Fix btdev connectability test (0x02 is page scan)
Johan Hedberg [Mon, 27 May 2013 17:29:12 +0000 (20:29 +0300)]
emulator: Fix btdev connectability test (0x02 is page scan)

11 years agoshared: Add new connection callback API to hciemu
Johan Hedberg [Mon, 27 May 2013 15:30:16 +0000 (18:30 +0300)]
shared: Add new connection callback API to hciemu

11 years agoemulator: Add API to initiate ACL connections
Johan Hedberg [Mon, 27 May 2013 13:13:14 +0000 (16:13 +0300)]
emulator: Add API to initiate ACL connections

11 years agoemulator: Make bthost L2CAP command function public
Johan Hedberg [Mon, 27 May 2013 13:01:50 +0000 (16:01 +0300)]
emulator: Make bthost L2CAP command function public

11 years agoemulator: Add ACL connection callback to bthost
Johan Hedberg [Mon, 27 May 2013 12:56:54 +0000 (15:56 +0300)]
emulator: Add ACL connection callback to bthost

11 years agomonitor: L2CAP Conf Response CID is a Source CID
Johan Hedberg [Mon, 27 May 2013 18:38:20 +0000 (21:38 +0300)]
monitor: L2CAP Conf Response CID is a Source CID

11 years agoemulator: Add L2CAP Disconnect Request handler to bthost
Johan Hedberg [Mon, 27 May 2013 12:26:56 +0000 (15:26 +0300)]
emulator: Add L2CAP Disconnect Request handler to bthost

11 years agoemulator: Simpify bthost L2CAP signaling channel code
Johan Hedberg [Mon, 27 May 2013 09:26:55 +0000 (12:26 +0300)]
emulator: Simpify bthost L2CAP signaling channel code

11 years agotools/l2cap-tester: Add basic L2CAP connect failure test case
Johan Hedberg [Mon, 27 May 2013 09:03:24 +0000 (12:03 +0300)]
tools/l2cap-tester: Add basic L2CAP connect failure test case

11 years agotools/l2cap-tester: Refactor L2CAP socket functions
Johan Hedberg [Mon, 27 May 2013 08:56:31 +0000 (11:56 +0300)]
tools/l2cap-tester: Refactor L2CAP socket functions

11 years agotools/l2cap-tester: Add basic connect test case
Johan Hedberg [Sun, 26 May 2013 17:21:19 +0000 (20:21 +0300)]
tools/l2cap-tester: Add basic connect test case

11 years agoemulator: Add basic L2CAP Config Response handling to bthost
Johan Hedberg [Mon, 27 May 2013 08:47:40 +0000 (11:47 +0300)]
emulator: Add basic L2CAP Config Response handling to bthost

11 years agoemulator: Add basic L2CAP Config Request handling to bthost
Johan Hedberg [Mon, 27 May 2013 08:42:02 +0000 (11:42 +0300)]
emulator: Add basic L2CAP Config Request handling to bthost

11 years agoshared: Add simple hciemu client server PSM API
Johan Hedberg [Mon, 27 May 2013 08:36:04 +0000 (11:36 +0300)]
shared: Add simple hciemu client server PSM API

11 years agoemulator: Add basic server PSM support to bthost
Johan Hedberg [Mon, 27 May 2013 08:35:12 +0000 (11:35 +0300)]
emulator: Add basic server PSM support to bthost

11 years agomonitor: Fix using bt.h defines for ACL header parsing
Johan Hedberg [Mon, 27 May 2013 04:17:14 +0000 (07:17 +0300)]
monitor: Fix using bt.h defines for ACL header parsing

11 years agoemulator: Add stub for L2CAP connect requests to bthost
Johan Hedberg [Sun, 26 May 2013 15:11:46 +0000 (16:11 +0100)]
emulator: Add stub for L2CAP connect requests to bthost

11 years agoemulator: Log unsupported L2CAP packet types
Johan Hedberg [Sun, 26 May 2013 15:06:09 +0000 (16:06 +0100)]
emulator: Log unsupported L2CAP packet types

11 years agoemulator: Add stub for completed packets event to bthost
Johan Hedberg [Sun, 26 May 2013 15:04:36 +0000 (16:04 +0100)]
emulator: Add stub for completed packets event to bthost

11 years agoemulator: Add basic L2CAP signaling handling to bthost
Johan Hedberg [Sun, 26 May 2013 15:01:29 +0000 (16:01 +0100)]
emulator: Add basic L2CAP signaling handling to bthost

11 years agomonitor: Add struct for ACL header
Johan Hedberg [Sun, 26 May 2013 14:38:40 +0000 (15:38 +0100)]
monitor: Add struct for ACL header

11 years agoemulator: Add stub for connect complete handling to bthost
Johan Hedberg [Sun, 26 May 2013 03:35:23 +0000 (04:35 +0100)]
emulator: Add stub for connect complete handling to bthost

11 years agoemulator: Add stub for ACL data handling to bthost
Johan Hedberg [Sun, 26 May 2013 03:32:10 +0000 (04:32 +0100)]
emulator: Add stub for ACL data handling to bthost

11 years agoshared: Add bdaddr getter functions to hciemu
Johan Hedberg [Sun, 26 May 2013 03:25:44 +0000 (04:25 +0100)]
shared: Add bdaddr getter functions to hciemu

11 years agoemulator: Add connect request handling to bthost
Johan Hedberg [Sun, 26 May 2013 03:24:30 +0000 (04:24 +0100)]
emulator: Add connect request handling to bthost

11 years agotools/l2cap-tester: Add connectable enabling for hciemu client
Johan Hedberg [Sun, 26 May 2013 01:26:18 +0000 (18:26 -0700)]
tools/l2cap-tester: Add connectable enabling for hciemu client

11 years agoemulator: Add scan_enable cmd_complete handler for bthost
Johan Hedberg [Sun, 26 May 2013 01:21:52 +0000 (18:21 -0700)]
emulator: Add scan_enable cmd_complete handler for bthost

11 years agoemulator: implement write_scan_enable support
Johan Hedberg [Wed, 22 May 2013 19:28:51 +0000 (12:28 -0700)]
emulator: implement write_scan_enable support

11 years agoemulator: Add bdaddr reading support to bthost
Johan Hedberg [Sun, 19 May 2013 18:51:03 +0000 (21:51 +0300)]
emulator: Add bdaddr reading support to bthost

11 years agoemulator: Add HCI command queuing support
Johan Hedberg [Sun, 19 May 2013 18:26:28 +0000 (21:26 +0300)]
emulator: Add HCI command queuing support

11 years agoemulator: Add basic cmd_complete/status handling for bthost
Johan Hedberg [Sun, 19 May 2013 17:35:15 +0000 (20:35 +0300)]
emulator: Add basic cmd_complete/status handling for bthost

11 years agotools: Add L2CAP end-to-end test tool
Johan Hedberg [Sun, 19 May 2013 17:19:05 +0000 (20:19 +0300)]
tools: Add L2CAP end-to-end test tool

11 years agocontrol: Remove control_update
Luiz Augusto von Dentz [Thu, 23 May 2013 18:56:23 +0000 (11:56 -0700)]
control: Remove control_update

It is no longer used

11 years agoaudio: Make use of .device_probe in all AVRCP profile drivers
Luiz Augusto von Dentz [Thu, 23 May 2013 18:35:33 +0000 (11:35 -0700)]
audio: Make use of .device_probe in all AVRCP profile drivers

We should not rely on the order of the profile driver registration nor
recheck if the UUID match every time.

11 years agoaudio: Remove auto_connect flag from audio-avrcp-target
Luiz Augusto von Dentz [Thu, 23 May 2013 18:06:09 +0000 (11:06 -0700)]
audio: Remove auto_connect flag from audio-avrcp-target

By the time the profile is registered it is not really possible to
tell which role of AVRCP should be connected, currently this cause
a problem with headsets that normally are controllers/sink but since
it normally also has target record for features related to things like
volume control the target profile is also probed and as it currently
has the auto_connect set it would lead to the wrong profile to start
connecting.

11 years agolib: Fix sdp_seq_alloc_with_length accessing invalid index/memory
Luiz Augusto von Dentz [Thu, 23 May 2013 19:01:12 +0000 (12:01 -0700)]
lib: Fix sdp_seq_alloc_with_length accessing invalid index/memory

The sequence itself is not an index of dtds, values, lengths, thats why
SDP_SEQ8 is used directly as dtd, so accessing length[i] is always off
by one.

Furthermore the length is not really used by sdp_data_alloc_with_length
when the dtd is SDP_SEQ8 which is probably why it doesn't crash.

11 years agoobexd: Fix SetPath response
Christian Fetzer [Thu, 23 May 2013 16:33:30 +0000 (18:33 +0200)]
obexd: Fix SetPath response

This fixes the issue, that failed attempts to the OBEX SetPath command
are not propagated through the D-Bus API.

Trace:

  method call sender=:1.942 -> dest=:1.934 serial=8
  path=/org/bluez/obex/client/session3;
  interface=org.bluez.obex.MessageAccess1; member=SetFolder
     string "test"
  method return sender=:1.934 -> dest=:1.942 reply_serial=8

  method call sender=:1.946 -> dest=:1.945 serial=8
  path=/org/bluez/obex/client/session0;
  interface=org.bluez.obex.MessageAccess1; member=SetFolder
     string "test"
  error sender=:1.945 -> dest=:1.946
  error_name=org.bluez.obex.Error.Failed reply_serial=8
     string "Not Found"

11 years agoprofile: Fix incoming connections without SDP record
Christian Fetzer [Tue, 21 May 2013 15:26:24 +0000 (17:26 +0200)]
profile: Fix incoming connections without SDP record

After commit 7bd3626b6715ac6a117d56b95b455960f7cf34de, incoming
connections require the service being available from SDP. This is not
always guaranteed because some services might not be listed in SDP (like
MNS).

11 years agolib: Update company identifiers
Johan Hedberg [Sun, 19 May 2013 04:08:31 +0000 (07:08 +0300)]
lib: Update company identifiers

11 years agotools: Add script for updating bt_compidtostr() implementation
Anderson Lizardo [Fri, 17 May 2013 14:21:59 +0000 (10:21 -0400)]
tools: Add script for updating bt_compidtostr() implementation

This script uses curl and html2text to fetch company IDs from
bluetooth.org's "Assigned Numbers" section.

11 years agobtiotest: Fix wrong variable in log message
Johan Hedberg [Fri, 17 May 2013 08:28:11 +0000 (11:28 +0300)]
btiotest: Fix wrong variable in log message

11 years agobtiotest: Add support for listening on a specific addr type
Johan Hedberg [Fri, 17 May 2013 08:17:54 +0000 (11:17 +0300)]
btiotest: Add support for listening on a specific addr type

11 years agobtiotest: Add support for listening on a fixed CID
Johan Hedberg [Fri, 17 May 2013 08:16:09 +0000 (11:16 +0300)]
btiotest: Add support for listening on a fixed CID

11 years agocore: Always specify local LE address type with btio
Johan Hedberg [Fri, 17 May 2013 08:08:56 +0000 (11:08 +0300)]
core: Always specify local LE address type with btio

11 years agobtio: Add BT_IO_OPT_SOURCE_TYPE option for source bdaddr type
Johan Hedberg [Fri, 17 May 2013 08:03:11 +0000 (11:03 +0300)]
btio: Add BT_IO_OPT_SOURCE_TYPE option for source bdaddr type

11 years agotest/ftp-client: Fix syntax error for python 3.0
Emilio Pozuelo Monfort [Thu, 16 May 2013 17:27:23 +0000 (19:27 +0200)]
test/ftp-client: Fix syntax error for python 3.0

11 years agoA2DP: Fix regression introduce by 99c6f5221800a48e8ce0b1e070e97d1c26a0f90b
Luiz Augusto von Dentz [Thu, 16 May 2013 11:17:31 +0000 (14:17 +0300)]
A2DP: Fix regression introduce by 99c6f5221800a48e8ce0b1e070e97d1c26a0f90b

Commit 99c6f5221800a48e8ce0b1e070e97d1c26a0f90b checks if there is a
pending resume and in case OPEN fails it abort it as well, but it can
cause a crash if resume was not requested and the setup is freed by
finalize_config:

Invalid read of size 4
   at 0x4214AD: open_cfm (a2dp.c:730)
   by 0x424D07: handle_transport_connect (avdtp.c:878)
   by 0x4288F2: avdtp_connect_cb (avdtp.c:2419)
   by 0x4458B8: connect_cb (btio.c:230)
   by 0x4E79D12: g_main_context_dispatch (gmain.c:2539)
   by 0x4E7A05F: g_main_context_iterate.isra.23 (gmain.c:3146)
   by 0x4E7A459: g_main_loop_run (gmain.c:3340)
   by 0x44B0AC: main (main.c:583)
 Address 0x62c8564 is 68 bytes inside a block of size 88 free'd
   at 0x4C2A82E: free (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
   by 0x420094: setup_free (a2dp.c:156)
   by 0x420101: setup_unref (a2dp.c:168)
   by 0x4201CF: setup_cb_free (a2dp.c:191)
   by 0x4203DC: finalize_config (a2dp.c:234)
   by 0x4214A8: open_cfm (a2dp.c:728)
   by 0x424D07: handle_transport_connect (avdtp.c:878)
   by 0x4288F2: avdtp_connect_cb (avdtp.c:2419)
   by 0x4458B8: connect_cb (btio.c:230)
   by 0x4E79D12: g_main_context_dispatch (gmain.c:2539)
   by 0x4E7A05F: g_main_context_iterate.isra.23 (gmain.c:3146)
   by 0x4E7A459: g_main_loop_run (gmain.c:3340)

11 years agotools/mpris-player: Emit changes to HasTrackList
Luiz Augusto von Dentz [Wed, 15 May 2013 14:21:52 +0000 (17:21 +0300)]
tools/mpris-player: Emit changes to HasTrackList

11 years agotools/mpris-player: Use playlist proxy instead of object path
Luiz Augusto von Dentz [Wed, 15 May 2013 12:44:53 +0000 (15:44 +0300)]
tools/mpris-player: Use playlist proxy instead of object path

This is more convenient as it gives access to all properties including
the Name of the playlist.

11 years agotools/mpris-player: Wait MediaFolder interface appear to enable TrackList
Luiz Augusto von Dentz [Wed, 15 May 2013 10:25:36 +0000 (13:25 +0300)]
tools/mpris-player: Wait MediaFolder interface appear to enable TrackList

This avoids having to use g_dbus_proxy_new which may create a new proxy
when the interface is no registered yet and might not be ready for use.

11 years agotools/mpris-player: Always register Playlists and TrackList
Luiz Augusto von Dentz [Wed, 15 May 2013 07:47:17 +0000 (10:47 +0300)]
tools/mpris-player: Always register Playlists and TrackList

MPRIS spec does not make use of ObjectManager so the interfaces need
to be registered all together otherwise clients may get errors and
assume the interfaces will never be registered.

11 years agotools/mpris-player: Map mpris:trackid to Item
Luiz Augusto von Dentz [Tue, 14 May 2013 10:55:24 +0000 (13:55 +0300)]
tools/mpris-player: Map mpris:trackid to Item

mpris:trackid is used as identifier of the current track.

11 years agotools/mpris-player: Add implementation of Playlists.GetPlaylists
Luiz Augusto von Dentz [Fri, 26 Apr 2013 11:03:27 +0000 (14:03 +0300)]
tools/mpris-player: Add implementation of Playlists.GetPlaylists

11 years agotools/mpris-player: Add implementation of Playlists.ActivatePlaylist
Luiz Augusto von Dentz [Wed, 24 Apr 2013 20:55:59 +0000 (23:55 +0300)]
tools/mpris-player: Add implementation of Playlists.ActivatePlaylist

11 years agotools/mpris-player: Add support for MPRIS Playlists interface
Luiz Augusto von Dentz [Wed, 24 Apr 2013 14:35:27 +0000 (17:35 +0300)]
tools/mpris-player: Add support for MPRIS Playlists interface

This adds support for Playlists interface as defined in MPRIS:
http://specifications.freedesktop.org/mpris-spec/latest/Playlists_Interface.html

11 years agotools/mpris-player: Add support for MPRIS TrackList.TrackMetadataChanged signal
Luiz Augusto von Dentz [Wed, 24 Apr 2013 09:23:58 +0000 (12:23 +0300)]
tools/mpris-player: Add support for MPRIS TrackList.TrackMetadataChanged signal

11 years agotools/mpris-player: Add support for MPRIS TrackList.TrackRemoved signal
Luiz Augusto von Dentz [Wed, 24 Apr 2013 09:12:17 +0000 (12:12 +0300)]
tools/mpris-player: Add support for MPRIS TrackList.TrackRemoved signal

11 years agotools/mpris-player: Add support for MPRIS TrackList.TrackAdded signal
Luiz Augusto von Dentz [Wed, 24 Apr 2013 09:06:11 +0000 (12:06 +0300)]
tools/mpris-player: Add support for MPRIS TrackList.TrackAdded signal

11 years agotools/mpris-player: Add implementation of TrackList.GoTo
Luiz Augusto von Dentz [Mon, 22 Apr 2013 09:41:52 +0000 (12:41 +0300)]
tools/mpris-player: Add implementation of TrackList.GoTo

11 years agotools/mpris-player: Add implementation of TrackList.GetTracksMetadata
Luiz Augusto von Dentz [Mon, 22 Apr 2013 09:26:36 +0000 (12:26 +0300)]
tools/mpris-player: Add implementation of TrackList.GetTracksMetadata

11 years agotools/mpris-player: Add support for MPRIS TrackList interface
Luiz Augusto von Dentz [Mon, 22 Apr 2013 09:17:15 +0000 (12:17 +0300)]
tools/mpris-player: Add support for MPRIS TrackList interface

This adds support for TrackList interface as defined in MPRIS:
http://specifications.freedesktop.org/mpris-spec/latest/Track_List_Interface.html

11 years agotools/l2test: Fix passing address type to bind()
Johan Hedberg [Wed, 15 May 2013 10:23:55 +0000 (13:23 +0300)]
tools/l2test: Fix passing address type to bind()

11 years agotools: Fix printing of PlayItem pdu in hcidump
Luiz Augusto von Dentz [Tue, 14 May 2013 10:54:03 +0000 (13:54 +0300)]
tools: Fix printing of PlayItem pdu in hcidump

11 years agoRelease 5.5
Marcel Holtmann [Tue, 14 May 2013 07:04:15 +0000 (09:04 +0200)]
Release 5.5

11 years agobuild: Update library version
Marcel Holtmann [Tue, 14 May 2013 07:00:10 +0000 (09:00 +0200)]
build: Update library version

11 years agoAUTHORS: Mention Alex's contributions
Marcel Holtmann [Tue, 14 May 2013 06:58:51 +0000 (08:58 +0200)]
AUTHORS: Mention Alex's contributions

11 years agoAVRCP: Fix crash when no A2DP role is detected
Luiz Augusto von Dentz [Sun, 12 May 2013 06:49:51 +0000 (09:49 +0300)]
AVRCP: Fix crash when no A2DP role is detected

Invalid read of size 4
   at 0x468370: btd_service_connecting_complete (service.c:315)
   by 0x41B70F: session_ct_init_control (avrcp.c:2790)
   by 0x41B1E0: state_changed (avrcp.c:2933)
   by 0x418054: avctp_set_state (avctp.c:548)
   by 0x41A2E4: avctp_connect_cb (avctp.c:1201)
   by 0x44F989: accept_cb (btio.c:201)
   by 0x4E77044: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.3400.2)
   by 0x4E77377: g_main_context_iterate.isra.24 (in /usr/lib64/libglib-2.0.so.0.3400.2)
   by 0x4E77771: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.3400.2)
   by 0x40A8EE: main (main.c:583)
 Address 0x20 is not stack'd, malloc'd or (recently) free'd

 If no A2DP is found assume the controller is the initiator as the
 target should not be able to initate a connection.

11 years agoavctp: Fix missing UUID registration
Mikel Astiz [Fri, 10 May 2013 11:41:04 +0000 (13:41 +0200)]
avctp: Fix missing UUID registration

When there is an incoming connection to AVCTP PSM, there is no way to
know if the remote UUID corresponds to AVRCP_REMOTE_UUID or
AVRCP_TARGET_UUID. Therefore both UUIDs should be reported to the core.

Without this patch, a crash has been observed with the iPhone 5
immediately after pairing.

11 years agoobexd: Fix using the same prefix for client and server sessions
Luiz Augusto von Dentz [Wed, 10 Apr 2013 11:41:00 +0000 (14:41 +0300)]
obexd: Fix using the same prefix for client and server sessions

This avoids using the same path for different sessions which fail since
it cannot register a second time causing an unexpected error.

11 years agomedia: Check MPRIS Can* properties before calling the respective method
Luiz Augusto von Dentz [Fri, 10 May 2013 11:02:07 +0000 (14:02 +0300)]
media: Check MPRIS Can* properties before calling the respective method

With MPRIS the player can disable support for certain control using
properties such as CanPlay, CanPause..., in this case these methods
should not be called and the code should fallback to uinput method.

11 years agomedia: Ignore signess for D-Bus int types
Luiz Augusto von Dentz [Fri, 10 May 2013 11:02:06 +0000 (14:02 +0300)]
media: Ignore signess for D-Bus int types

Some players such as Spotify implements some properties that are
defined in MPRIS as int64 as uint64 which makes it fail to register.

11 years agomedia: Fix not handling "Playlist" as possible value to LoopStatus
Luiz Augusto von Dentz [Fri, 10 May 2013 11:02:05 +0000 (14:02 +0300)]
media: Fix not handling "Playlist" as possible value to LoopStatus

11 years agomedia: Implement new callbacks for pass-through operations
Luiz Augusto von Dentz [Fri, 10 May 2013 11:02:04 +0000 (14:02 +0300)]
media: Implement new callbacks for pass-through operations

This implements newly introduced callbacks for pass-through operation so
they are directly sent to the active player.

11 years agoAVRCP: Register pass-through handler for CT
Luiz Augusto von Dentz [Fri, 10 May 2013 11:02:03 +0000 (14:02 +0300)]
AVRCP: Register pass-through handler for CT

Register pass-through handler for CT role if version >= 1.3 and creates
callbacks to direct this commands to the active player.

11 years agoAVCTP: Add timeout for pass-through commands with value pressed
Luiz Augusto von Dentz [Fri, 10 May 2013 11:02:02 +0000 (14:02 +0300)]
AVCTP: Add timeout for pass-through commands with value pressed

From AV/C spec 1.23, page 76:

"A command with the pressed value is valid for two seconds from the time
when a target sends back a response of the command. The controller shall
continue sending pressed value with identical operation id value in the
operation_id field while the command is wished to stay valid. Either if
the target has not received the pressed command within two seconds or the
target receives the pressed command with another operation id, then the
target regards that the released command was sent but missed to receive."

11 years agoAVCTP: Don't allocate memory for every key pressed
Luiz Augusto von Dentz [Fri, 10 May 2013 11:02:01 +0000 (14:02 +0300)]
AVCTP: Don't allocate memory for every key pressed

The timer field can be used to detect if the key is currectly active
instead of relying on a pointer that needs to be allocated for every
single key press.

11 years agoAVCTP: Add support to register pass-through handler
Luiz Augusto von Dentz [Fri, 10 May 2013 11:02:00 +0000 (14:02 +0300)]
AVCTP: Add support to register pass-through handler

Pass-through handler can be used to capture AV/C Panel commands before
they are sent to uinput.

11 years agodoc: Document missing errors returned by the Device1 API.
Alex Deymo [Thu, 9 May 2013 19:09:48 +0000 (12:09 -0700)]
doc: Document missing errors returned by the Device1 API.

There were two groups of missing error messages in the documentation:
* For org.bluez.Device1.DisconnectProfile:
  This method could certainly call btd_error_not_supported or
  btd_error_failed returning those errors.
* For org.bluez.Device1.Pair:
  The pairing process could certainly call new_authentication_return
  which can return (and actualy does) five other different errors.

11 years agoautopair: Clean up coding style
Johan Hedberg [Fri, 10 May 2013 07:31:16 +0000 (10:31 +0300)]
autopair: Clean up coding style

11 years agoautopair: Try a fixed pincode for keyboards rejecting random codes
Alex Deymo [Thu, 9 May 2013 00:38:02 +0000 (17:38 -0700)]
autopair: Try a fixed pincode for keyboards rejecting random codes

This patch makes the autopair plugin try a fixed "0000" pincode for
keyboards that reject the pincode too fast (less than 500ms). This too
short delay rejecting the pincode means that the user didn't have time
to type the random pincode in the bluetooth keyboard and was the
keyboard who actually rejected it.

11 years agocore: Expose the last bonding attempt timeout on retry
Alex Deymo [Thu, 9 May 2013 00:38:01 +0000 (17:38 -0700)]
core: Expose the last bonding attempt timeout on retry

One of the interesting values for pincode plugins is the timeout of a
bonding attempt. For keyboards supporting any random pincode as long as
it is also typed in the keyboard, the timeout until it fails is in the
order of the seconds to allow the user type the pincode on the bluetooth
keyboard. In the case of a dumb keyboard accepting only a fixed pincode
the timeout before the keyboard fails is in the order of a fraction of a
second.

This patch computes the elapsed time between the pairing started or the
pin code was sent to the device and the device returns with an error.
This measured duration is exposed in milliseconds to the plugins when
retrying the bonding attempt.

11 years agoautopair: Add the autopair plugin
Alex Deymo [Thu, 9 May 2013 00:38:00 +0000 (17:38 -0700)]
autopair: Add the autopair plugin

The autopair plugin tries standard pincodes for different devices with
dumb pincodes. It also generates a random 6 digit pincode for keyboards
that support any pincode but fallbacks to the agent call in case the
random generated pincode didn't work.

11 years agocore: Add device_get_class to the public interface
Alex Deymo [Thu, 9 May 2013 00:37:59 +0000 (17:37 -0700)]
core: Add device_get_class to the public interface

Exports the device class to plugins.

11 years agocore: Retry bonding attempt until the iterator reaches the end
Alex Deymo [Thu, 9 May 2013 00:37:58 +0000 (17:37 -0700)]
core: Retry bonding attempt until the iterator reaches the end

This patch splits the bonding process in an interative process
consisting of one or more "bonding attempts". The user/agent starts a
new "bonding" that may involve several rounds of "bonding attempts" with
the device before it gets back to the user/agent.

Some functions were split in two parts to reflect this change. When a
bonding attempt fails with an authentication error and a pin code was
provided, a new bonding attempt is initiated (after a short delay) to
retry with the next function (or next call to the same function) in the
pincode callback list. If no pin code was provided to the device, no
retry is attempted and the authentication error is returned to the
client. This effectively allows a plugin try different pincodes for the
same device during the same bonding.

11 years agocore: Add support for retrying a bonding
Alex Deymo [Thu, 9 May 2013 00:37:57 +0000 (17:37 -0700)]
core: Add support for retrying a bonding

In order to retry a bonding we need a timer that will perform the retry,
we need to stash the status of the bonding request so we can use it
again. In the case of a retrying bonding attempt we need to not tear
down the temporary D-Bus device object on the adapter.

11 years agoplugins: Extend the pin code callback with the call number
Alex Deymo [Thu, 9 May 2013 00:37:56 +0000 (17:37 -0700)]
plugins: Extend the pin code callback with the call number

The plugin's pin code callback doesn't know about the pairing process.
It just provides a pin code based on the information provided to this
function. Although limited state could be added through other new
callbacks, this fix achieves this by providing more information to the
callback itself. The new argument "attempt" states the pin callback
attempt of the particular plugin for the current pairing of the device.
This allows a plugin to try different pincodes for the same device in
the same pairing process.

To signal that the plugin doesn't provide any pin code for the provided
device the current implementation returns 0 (an empty pin code).
Analogously, with this fix, a plugin should return 0 when it doesn't
have any other pin code to provide for the given device.

11 years agocore: Convert the pincode callback to an interable list.
Alex Deymo [Thu, 9 May 2013 00:37:55 +0000 (17:37 -0700)]
core: Convert the pincode callback to an interable list.

The current pincode callback list on the adapter keeps track of all the
pincode callbacks registered by a plugin for that adapter and calls each
one until one provides a pincode for the current bonding. This mechanism
forgets about what happened with previous bonding attempts and pushes
the status track to the plugin side.

This patch creates an iterator struct (struct pincb_iter) that keeps
track of the last function called and the number of times called. This
will allow to provide more information about the bonding status to the
pincode callback.

11 years agogdbus: Fix using NULL DBusPendingCall when disconnected from D-Bus
Anderson Lizardo [Sat, 4 May 2013 19:39:43 +0000 (15:39 -0400)]
gdbus: Fix using NULL DBusPendingCall when disconnected from D-Bus

From D-Bus documentation for dbus_connection_send_with_reply():

"Warning: if the connection is disconnected or you try to send Unix file
descriptors on a connection that does not support them, the
DBusPendingCall will be set to NULL, so be careful with this."

Fix these errors when killing D-Bus daemon with the client still
running:

process 5712: arguments to dbus_pending_call_set_notify() were
incorrect, assertion "pending != NULL" failed in file
../../dbus/dbus-pending-call.c line 596.
This is normally a bug in some application using the D-Bus library.
process 5712: arguments to dbus_pending_call_unref() were incorrect,
assertion "pending != NULL" failed in file
../../dbus/dbus-pending-call.c line 572.
This is normally a bug in some application using the D-Bus library.

11 years agogdbus: Fix segfault when D-Bus daemon exits
Anderson Lizardo [Sat, 4 May 2013 19:39:42 +0000 (15:39 -0400)]
gdbus: Fix segfault when D-Bus daemon exits

Fix this crash if D-Bus exits while the client is still connected to it:

==5570== Invalid read of size 1
==5570==    at 0x402D28E: strcmp (in
/usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==5570==    by 0x4070E22: g_str_equal (ghash.c:1704)
==5570==    by 0x8055F61: message_filter (client.c:1123)
==5570==    by 0x4141500: dbus_connection_dispatch (in
/lib/i386-linux-gnu/libdbus-1.so.3.5.8)
==5570==    by 0x80506F7: message_dispatch (mainloop.c:76)
==5570==    by 0x4081A7E: g_timeout_dispatch (gmain.c:3882)
==5570==    by 0x4080D85: g_main_context_dispatch (gmain.c:2539)
==5570==    by 0x4081124: g_main_context_iterate.isra.21 (gmain.c:3146)
==5570==    by 0x408156A: g_main_loop_run (gmain.c:3340)
==5570==    by 0x41BF4D2: (below main) (libc-start.c:226)
==5570==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
==5570==
==5570==

11 years agocore: Don't update a known long name with a short name.
Alex Deymo [Tue, 7 May 2013 03:31:57 +0000 (20:31 -0700)]
core: Don't update a known long name with a short name.

update_found_devices() could attempt to update a device with new information
containing only a short verstion of the name. If the struct eir_data passed
has a short or NULL name, it will never update a previous name and will
also trigger a "HCI Command: Remote Name Request" if the previous name was
unknown.

11 years agoprofile: Error-cases for incoming connections
Mikel Astiz [Tue, 7 May 2013 16:58:15 +0000 (18:58 +0200)]
profile: Error-cases for incoming connections

When an incoming connection attempt is received, if the corresponding
device or service is not found, handle the error-case.

11 years agoprofile: Fix remotely initiated connections without service
Mikel Astiz [Tue, 7 May 2013 16:58:14 +0000 (18:58 +0200)]
profile: Fix remotely initiated connections without service

Remotely initiated connections need to be associated to a service
instance to avoid the following crash as reported by Vinicius Costa:

bluetoothd[14366]: src/profile.c:ext_confirm() incoming connect from A0:4E:04:F6:F5:05
bluetoothd[14366]: src/profile.c:ext_confirm() hfp_hf authorizing connection from A0:4E:04:F6:F5:05
bluetoothd[14366]: src/agent.c:agent_ref() 0x6a85e0: ref=2
bluetoothd[14366]: src/agent.c:agent_authorize_service() authorize service request was sent for /org/bluez/hci0/dev_A0_4E_04_F6_F5_05
bluetoothd[14366]: src/profile.c:ext_svc_complete() Services resolved for A0:4E:04:F6:F5:05
bluetoothd[14366]: src/profile.c:ext_svc_complete() Services resolved but still waiting for authorization
bluetoothd[14366]: src/profile.c:ext_auth() A0:4E:04:F6:F5:05 authorized to connect to hfp_hf
bluetoothd[14366]: src/agent.c:agent_unref() 0x6a85e0: ref=1
bluetoothd[14366]: src/profile.c:ext_connect() hfp_hf connected to A0:4E:04:F6:F5:05

Program received signal SIGSEGV, Segmentation fault.
btd_service_connecting_complete (service=0x0, err=err@entry=0) at src/service.c:315
315 if (service->state != BTD_SERVICE_STATE_DISCONNECTED &&