OSDN Git Service

android-x86/external-bluetooth-bluez.git
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 &&

11 years agodevice: Add function to find a given service
Mikel Astiz [Tue, 7 May 2013 16:58:13 +0000 (18:58 +0200)]
device: Add function to find a given service

Search within the list of services for a given remote UUID.

11 years agoneard: Fix reading local OOB data when adapter is not powered
Szymon Janc [Mon, 6 May 2013 13:20:52 +0000 (15:20 +0200)]
neard: Fix reading local OOB data when adapter is not powered

Read Local OOB data only if adapter is powered. This fix replying with
error instead of CPS set to inactive when adapter is not powered.

11 years agoneard: Fix checking for unknown carrier power state
Szymon Janc [Mon, 6 May 2013 13:20:51 +0000 (15:20 +0200)]
neard: Fix checking for unknown carrier power state

Message might not contain State field and CPS needs to be set to
unknown before processing message from neard. This fix processing
RequestOOB called without parameters.

11 years agoaudio: Remove left over audio_device_cb
Luiz Augusto von Dentz [Mon, 6 May 2013 10:18:31 +0000 (13:18 +0300)]
audio: Remove left over audio_device_cb

11 years agomedia: Fix not canceling requests properly if endpoint exit
Luiz Augusto von Dentz [Sun, 5 May 2013 08:32:27 +0000 (11:32 +0300)]
media: Fix not canceling requests properly if endpoint exit

If endpoint exit while a request is pending, e.g. due to a crash, the
callback should be called with ret set to NULL otherwise the code that
has generated the request will not notice the request has been canceled
leaving the endpoint unusable.

11 years agonetwork: Fix invalid read while removing device
Luiz Augusto von Dentz [Fri, 3 May 2013 12:19:55 +0000 (15:19 +0300)]
network: Fix invalid read while removing device

Invalid read of size 8
   at 0x42F4B2: connection_unregister (connection.c:643)
   by 0x466CE6: service_shutdown (service.c:174)
   by 0x467B70: remove_service (device.c:963)
   by 0x32C3863CAC: g_slist_foreach (in /usr/lib64/libglib-2.0.so.0.3400.2)
   by 0x32C3863CCA: g_slist_free_full (in /usr/lib64/libglib-2.0.so.0.3400.2)
   by 0x46CABC: device_remove (device.c:2331)
   by 0x45E229: adapter_remove_device.constprop.44 (adapter.c:1049)
   by 0x45E31D: remove_device (adapter.c:2134)
   by 0x40CC80: process_message.isra.4 (object.c:258)
   by 0x32C641D9C4: ??? (in /usr/lib64/libdbus-1.so.3.7.2)
   by 0x32C640FC1F: dbus_connection_dispatch (in /usr/lib64/libdbus-1.so.3.7.2)
   by 0x40A807: message_dispatch (mainloop.c:76)
 Address 0x54e6e38 is 8 bytes inside a block of size 16 free'd
   at 0x4A077E6: free (vg_replace_malloc.c:446)
   by 0x32C384D79E: g_free (in /usr/lib64/libglib-2.0.so.0.3400.2)
   by 0x40DCA9: remove_interface (object.c:656)
   by 0x40DF09: g_dbus_unregister_interface (object.c:1413)
   by 0x466CE6: service_shutdown (service.c:174)
   by 0x467B70: remove_service (device.c:963)
   by 0x32C3863CAC: g_slist_foreach (in /usr/lib64/libglib-2.0.so.0.3400.2)
   by 0x32C3863CCA: g_slist_free_full (in /usr/lib64/libglib-2.0.so.0.3400.2)
   by 0x46CABC: device_remove (device.c:2331)
   by 0x45E229: adapter_remove_device.constprop.44 (adapter.c:1049)
   by 0x45E31D: remove_device (adapter.c:2134)
   by 0x40CC80: process_message.isra.4 (object.c:258)

11 years agoaudio: Remove device audio states
Luiz Augusto von Dentz [Fri, 3 May 2013 09:50:47 +0000 (12:50 +0300)]
audio: Remove device audio states

This is no longer useful without org.bluez.Audio interface

11 years agoaudio: Don't create an avctp session on avrcp disconnect
Alex Deymo [Fri, 3 May 2013 09:39:56 +0000 (12:39 +0300)]
audio: Don't create an avctp session on avrcp disconnect

If a paired and connected audio device is disconnected, the
avrcp_disconnect() could create a new avctp session that will keep
a reference to the corresponding btd_device, preventing it to be
removed as explained below. This fix prevents avrcp_disconnect()
to create a new and disconnected avctp session when it doesn't
exists.

Calling org.bluez.Device1.Disconnect on an audio device like the
"Monster ClarityHD" will cause first a a2dp_sink_disconnect() call,
and then a sink_disconnect() call.
This will change the state of the existing avdtp session to
AVCTP_STATE_DISCONNECTED triggering a series of callback calls.
Among those, the avdtp_set_state() function will call the registered
avdtp_callbacks, including avdtp_state_callback() which in turns
updates the disconnected state using sink_set_state(). This function
will call the registered sink_callbacks, including device_sink_cb().

By this point, the device_sink_cb() will attempt a avrcp_disconnect()
over a session that was already disconnected before by the device's
diconnect_cb(). This new avrcp_disconnect() causes the avctp_get() to
create a new avctp session that holds a reference to the disconnecting
btd_device.

Steps to reproduce using bluetoothctl:
1. Pair and Connect a Monter ClarityHD audio device.
2. Play some music on it.
3. Disconnect the device.
4. Remove the device.
The "remove" command succeeds, but bluetoothd does not sends a removal
signal ([DEL] message) for that device.

11 years agoaudio: Remove AVDTP timer
Luiz Augusto von Dentz [Fri, 3 May 2013 07:58:02 +0000 (10:58 +0300)]
audio: Remove AVDTP timer

The timer is no longer used after the introdution of btd_profile.

11 years agogdbus: Fix calling GetManagedObjects twice in a row
Luiz Augusto von Dentz [Thu, 18 Apr 2013 20:34:03 +0000 (23:34 +0300)]
gdbus: Fix calling GetManagedObjects twice in a row

Calling g_dbus_client_new followed by g_dbus_client_set_proxy_handlers
cause two calls to GetManagedObjects in a row as GetNameOwner reply is
asyncronously it triggers the second call because the handlers have
been set by g_dbus_client_set_proxy_handlers.

11 years agounit: Get rid of gchar
Lucas De Marchi [Wed, 1 May 2013 04:52:01 +0000 (01:52 -0300)]
unit: Get rid of gchar

Use plain char instead of gchar.

11 years agocore: Get rid of gchar
Lucas De Marchi [Wed, 1 May 2013 04:52:00 +0000 (01:52 -0300)]
core: Get rid of gchar

Use plain char instead of gchar.

11 years agoobexd: Get rid of gchar
Lucas De Marchi [Wed, 1 May 2013 04:51:59 +0000 (01:51 -0300)]
obexd: Get rid of gchar

Use plain char instead of gchar.

11 years agogobex: Get rid of gchar
Lucas De Marchi [Wed, 1 May 2013 04:51:58 +0000 (01:51 -0300)]
gobex: Get rid of gchar

Use plain char instead of gchar.

11 years agoclient: Get rid of gchar
Lucas De Marchi [Wed, 1 May 2013 04:51:57 +0000 (01:51 -0300)]
client: Get rid of gchar

Use plain char instead of gchar.

11 years agoattrib: Get rid of gchar
Lucas De Marchi [Wed, 1 May 2013 04:51:56 +0000 (01:51 -0300)]
attrib: Get rid of gchar

Use plain char instead of gchar.

11 years agounit: Get rid of gint
Lucas De Marchi [Wed, 1 May 2013 05:28:10 +0000 (02:28 -0300)]
unit: Get rid of gint

Use plain int instead of gint. In glib gint is always a typedef to int,
so it's safe to use it even for callbacks with glib.

11 years agotools: Get rid of gint
Lucas De Marchi [Wed, 1 May 2013 05:28:09 +0000 (02:28 -0300)]
tools: Get rid of gint

Use plain int instead of gint. In glib gint is always a typedef to int,
so it's safe to use it even for callbacks with glib.

11 years agocore: Get rid of gint
Lucas De Marchi [Wed, 1 May 2013 05:28:08 +0000 (02:28 -0300)]
core: Get rid of gint

Use plain int instead of gint. In glib gint is always a typedef to int,
so it's safe to use it even for callbacks with glib.

11 years agothermometer: Get rid of gint
Lucas De Marchi [Wed, 1 May 2013 05:28:07 +0000 (02:28 -0300)]
thermometer: Get rid of gint

Use plain int instead of gint. In glib gint is always a typedef to int,
so it's safe to use it even for callbacks with glib.

11 years agoscanparam: Get rid of gint
Lucas De Marchi [Wed, 1 May 2013 05:28:06 +0000 (02:28 -0300)]
scanparam: Get rid of gint

Use plain int instead of gint. In glib gint is always a typedef to int,
so it's safe to use it even for callbacks with glib.

11 years agoinput: Get rid of gint
Lucas De Marchi [Wed, 1 May 2013 05:28:05 +0000 (02:28 -0300)]
input: Get rid of gint

Use plain int instead of gint. In glib gint is always a typedef to int,
so it's safe to use it even for callbacks with glib.

11 years agoheartrate: Get rid of gint
Lucas De Marchi [Wed, 1 May 2013 05:28:04 +0000 (02:28 -0300)]
heartrate: Get rid of gint

Use plain int instead of gint. In glib gint is always a typedef to int,
so it's safe to use it even for callbacks with glib.

11 years agohealth: Get rid of gint
Lucas De Marchi [Wed, 1 May 2013 05:28:03 +0000 (02:28 -0300)]
health: Get rid of gint

Use plain int instead of gint. In glib gint is always a typedef to int,
so it's safe to use it even for callbacks with glib.

11 years agogatt: Get rid of gint
Lucas De Marchi [Wed, 1 May 2013 05:28:02 +0000 (02:28 -0300)]
gatt: Get rid of gint

Use plain int instead of gint. In glib gint is always a typedef to int,
so it's safe to use it even for callbacks with glib.

11 years agodeviceinfo: Get rid of gint
Lucas De Marchi [Wed, 1 May 2013 05:28:01 +0000 (02:28 -0300)]
deviceinfo: Get rid of gint

Use plain int instead of gint. In glib gint is always a typedef to int,
so it's safe to use it even for callbacks with glib.

11 years agocyclingspeed: Get rid of gint
Lucas De Marchi [Wed, 1 May 2013 05:28:00 +0000 (02:28 -0300)]
cyclingspeed: Get rid of gint

Use plain int instead of gint. In glib gint is always a typedef to int,
so it's safe to use it even for callbacks with glib.

11 years agoaudio: Get rid of gint
Lucas De Marchi [Wed, 1 May 2013 05:27:59 +0000 (02:27 -0300)]
audio: Get rid of gint

Use plain int instead of gint. In glib gint is always a typedef to int,
so it's safe to use it even for callbacks with glib.

11 years agoplugins: Get rid of gint
Lucas De Marchi [Wed, 1 May 2013 05:27:58 +0000 (02:27 -0300)]
plugins: Get rid of gint

Use plain int instead of gint. In glib gint is always a typedef to int,
so it's safe to use it even for callbacks with glib.

11 years agoobexd: Get rid of gint
Lucas De Marchi [Wed, 1 May 2013 05:27:57 +0000 (02:27 -0300)]
obexd: Get rid of gint

Use plain int instead of gint. In glib gint is always a typedef to int,
so it's safe to use it even for callbacks with glib.

11 years agogobex: Get rid of gint
Lucas De Marchi [Wed, 1 May 2013 05:27:56 +0000 (02:27 -0300)]
gobex: Get rid of gint

Use plain int instead of gint. In glib gint is always a typedef to int,
so it's safe to use it even for callbacks with glib.

11 years agoattrib: Get rid of gint
Lucas De Marchi [Wed, 1 May 2013 05:27:55 +0000 (02:27 -0300)]
attrib: Get rid of gint

Use plain int instead of gint. In glib gint is always a typedef to int,
so it's safe to use it even for callbacks with glib.

11 years agoemulator: Remove unneeded btdev_set_bdaddr function
Johan Hedberg [Tue, 30 Apr 2013 10:21:23 +0000 (13:21 +0300)]
emulator: Remove unneeded btdev_set_bdaddr function

11 years agolib: Fix list of company identifiers
Anderson Lizardo [Thu, 11 Apr 2013 18:59:12 +0000 (14:59 -0400)]
lib: Fix list of company identifiers

Fix minor typos on company names.

11 years agoshared: Remove static address assignment in hciemu
Jefferson Delfes [Thu, 11 Apr 2013 15:24:43 +0000 (11:24 -0400)]
shared: Remove static address assignment in hciemu

If we need multiple virtual devices, addresses should not be the same.
Inside the function btdev_create, a specific address is generated.

11 years agoshared: Return real address of master dev in hciemu
Jefferson Delfes [Thu, 11 Apr 2013 15:24:44 +0000 (11:24 -0400)]
shared: Return real address of master dev in hciemu

Exports master btdev address in hciemu.

11 years agoemulator: Add getter function for device address in btdev
Jefferson Delfes [Thu, 11 Apr 2013 15:24:42 +0000 (11:24 -0400)]
emulator: Add getter function for device address in btdev

This helper function returns bdaddr field from btdev.

11 years agoattrib-server: Fix btd_device_get_storage_path failure handling
Johan Hedberg [Mon, 29 Apr 2013 13:28:13 +0000 (16:28 +0300)]
attrib-server: Fix btd_device_get_storage_path failure handling

11 years agoproximity: Fix btd_device_get_storage_path failure handling
Johan Hedberg [Mon, 29 Apr 2013 13:27:51 +0000 (16:27 +0300)]
proximity: Fix btd_device_get_storage_path failure handling

11 years agogatt: Fix btd_device_get_storage_path failure handling
Johan Hedberg [Mon, 29 Apr 2013 13:27:38 +0000 (16:27 +0300)]
gatt: Fix btd_device_get_storage_path failure handling

11 years agoalert: Fix btd_device_get_storage_path failure handling
Johan Hedberg [Mon, 29 Apr 2013 13:27:14 +0000 (16:27 +0300)]
alert: Fix btd_device_get_storage_path failure handling

11 years agocore: Refuse storage for private addressed devices
Johan Hedberg [Mon, 29 Apr 2013 13:26:44 +0000 (16:26 +0300)]
core: Refuse storage for private addressed devices

11 years agocore: Fix storing info for private addressed devices
Johan Hedberg [Mon, 29 Apr 2013 11:02:34 +0000 (14:02 +0300)]
core: Fix storing info for private addressed devices

Devices with private addresses cannot persistently be identified by
their address. Therefore it doesn't make sense to store any information
about them as the information couldn't be looked up later once the
remote address has changed.

Once the kernel receives support for private address resolution we'll
start getting the public address of such devices to user space. However,
until then we just have to ignore such devices from a storage
perspective.

11 years agocore: Remove useless attrib server confirm callback
Johan Hedberg [Fri, 26 Apr 2013 13:38:50 +0000 (16:38 +0300)]
core: Remove useless attrib server confirm callback

11 years agoprofile: Use btd_service for connect/disconnect
Mikel Astiz [Fri, 26 Apr 2013 09:46:25 +0000 (11:46 +0200)]
profile: Use btd_service for connect/disconnect

Change the btd_profile connect/disconnect callbacks to receive a
btd_service pointer. This should make it possible to handle multiple
instances of the same profile in a specific device.

The patch strongly influences how the profiles should interact with the
core. The state transitions, previously reported using the device.h API
(device_profile_connected() and device_profile_disconnected()), have
now been replaced by the btd_service API.

The transitions will then be propagated to device.c by means of the
conventional state-changed callback mechanism.

11 years agoservice: Add callbacks to track state changes
Mikel Astiz [Fri, 26 Apr 2013 09:46:24 +0000 (11:46 +0200)]
service: Add callbacks to track state changes

Extend the btd_service API to support state observers.

11 years agoservice: Add error-code btd_service
Mikel Astiz [Fri, 26 Apr 2013 09:46:23 +0000 (11:46 +0200)]
service: Add error-code btd_service

The error-code represents the result of a connection/disconnection
procedure and can be useful when a state transition is detected.

11 years agotools: Fix parsing of PlayItem pdu in hcidump
Luiz Augusto von Dentz [Fri, 26 Apr 2013 09:38:07 +0000 (12:38 +0300)]
tools: Fix parsing of PlayItem pdu in hcidump

11 years agomonitor: Fix ATT Read By Type Response minimum length
Johan Hedberg [Fri, 26 Apr 2013 10:47:35 +0000 (13:47 +0300)]
monitor: Fix ATT Read By Type Response minimum length

11 years agoinput: Hold a reference to btd_service
Mikel Astiz [Fri, 26 Apr 2013 06:17:21 +0000 (08:17 +0200)]
input: Hold a reference to btd_service

Profile implementations are allowed to hold a reference to probed
services and make use of the service's userdata pointer, so update the
input profiles accordingly.

11 years agocontrol: Bypass manager for connect state changes
Mikel Astiz [Fri, 26 Apr 2013 06:17:20 +0000 (08:17 +0200)]
control: Bypass manager for connect state changes

Move the code to propagate the AVRCP->core state changes from manager.c
to control.c.

11 years agoaudio: Hold a reference to btd_service
Mikel Astiz [Fri, 26 Apr 2013 06:17:19 +0000 (08:17 +0200)]
audio: Hold a reference to btd_service

Profile implementations are allowed to hold a reference to probed
services, so update the audio profiles accordingly.

11 years agonetwork: Hold a reference to btd_service
Mikel Astiz [Fri, 26 Apr 2013 06:17:18 +0000 (08:17 +0200)]
network: Hold a reference to btd_service

Profile implementations are allowed to hold a reference to probed
services and make use of the service's userdata pointer, so update the
network profiles accordingly.

11 years agocore: Add user_data to btd_service
Mikel Astiz [Fri, 26 Apr 2013 06:17:17 +0000 (08:17 +0200)]
core: Add user_data to btd_service

Profile implementations can benefit from a user_data associated to a
service, which will typically be set during probe.

11 years agonetwork: Add trivial helper function
Mikel Astiz [Fri, 26 Apr 2013 06:17:16 +0000 (08:17 +0200)]
network: Add trivial helper function

Simplify the code and make it more readable by adding a trivial helper
function.

11 years agoprofile: Use btd_service for probing profiles
Mikel Astiz [Fri, 26 Apr 2013 06:17:15 +0000 (08:17 +0200)]
profile: Use btd_service for probing profiles

Change the profile probe mechanism in order to pass the btd_service
instance representing the remote service. This object is bound to a
btd_profile and a btd_device, thus replacing the previous parameters.

The probe callback is allowed to hold a reference to the btd_service
by means of btd_service_ref(), which should be unreferenced during
removal.

Keeping such a reference of the btd_service allows supporting multiple
instances of the same UUID, since the reference can serve as a handle
during the interactions between the profile implementation and the core.

11 years agodevice: Replace pending profile list with services
Mikel Astiz [Fri, 26 Apr 2013 06:17:14 +0000 (08:17 +0200)]
device: Replace pending profile list with services

Use btd_service pointers to represent the list of services pending for
connection.

This list doesn't reference count the btd_service instances, since the
pending services should be a subset of the available services, and thus
they should already be referenced by device->services. This means
special care must be taken to make sure any removed service is also
removed from the pending list, as addressed in remove_service().

11 years agodevice: Find services instead of profiles
Mikel Astiz [Fri, 26 Apr 2013 06:17:13 +0000 (08:17 +0200)]
device: Find services instead of profiles

Trivially replace the former find_connectable_profile() with
find_connectable_service().

11 years agodevice: Replace connected_profiles with btd_service
Mikel Astiz [Fri, 26 Apr 2013 06:17:12 +0000 (08:17 +0200)]
device: Replace connected_profiles with btd_service

The service state can provide enough information not to maintain such
a connected_profiles list. Therefore, avoid duplicated information and
remove the list.

11 years agocore: Add a state enum to btd_service
Mikel Astiz [Fri, 26 Apr 2013 06:17:11 +0000 (08:17 +0200)]
core: Add a state enum to btd_service

Add a state to btd_service in order to distinguish which operations are
allowed in a certain point in time.

11 years agocore: Add connect/disconnect API to btd_service
Mikel Astiz [Fri, 26 Apr 2013 06:17:10 +0000 (08:17 +0200)]
core: Add connect/disconnect API to btd_service

Make use of the btd_profile connect/disconnect callbacks directly within
service.c instead of doing it inside device.c.

11 years agocore: Add probe API to btd_service
Mikel Astiz [Fri, 26 Apr 2013 06:17:09 +0000 (08:17 +0200)]
core: Add probe API to btd_service

Make use of the btd_profile callbacks directly within service.c instead
of doing it inside device.c.

11 years agodevice: Use btd_service to represent profiles
Mikel Astiz [Fri, 26 Apr 2013 06:17:08 +0000 (08:17 +0200)]
device: Use btd_service to represent profiles

Maintain a list of btd_service pointers instead of btd_profile pointers,
for services that have been probed for this device.

This list will not only reference count the btd_service instances but
also "own" them, in the sense of destroying them (make them completely
unavailable) when the service is removed from the list. This is needed
because the btd_service does not reference count the btd_device
instance.

11 years agocore: Add btd_service to represent device services
Mikel Astiz [Fri, 26 Apr 2013 06:17:07 +0000 (08:17 +0200)]
core: Add btd_service to represent device services

Add a new object to centralize all data corresponding to a service
provided by a remote device, coupling a pair of btd_profile and
btd_device pointers.

11 years agonetwork: Bypass manager during probe/remove
Mikel Astiz [Fri, 26 Apr 2013 06:17:06 +0000 (08:17 +0200)]
network: Bypass manager during probe/remove

Use the internal device API to provide the btd_profile callback
functions, without boilerplate code in manager.c.

11 years agoinput: Remove useless forward declarations
Johan Hedberg [Fri, 26 Apr 2013 07:19:34 +0000 (10:19 +0300)]
input: Remove useless forward declarations

11 years agoinput: Bypass manager during probe/remove
Mikel Astiz [Fri, 26 Apr 2013 06:17:05 +0000 (08:17 +0200)]
input: Bypass manager during probe/remove

Use the internal device API to provide the btd_profile callback
functions, without boilerplate code in manager.c.

11 years agoinput: Remove unused UUID field
Mikel Astiz [Fri, 26 Apr 2013 06:17:04 +0000 (08:17 +0200)]
input: Remove unused UUID field

Trivially remove the field because it's actually not being used.

11 years agoinput: Move timeout setting to device.c
Mikel Astiz [Fri, 26 Apr 2013 06:17:03 +0000 (08:17 +0200)]
input: Move timeout setting to device.c

The timeout setting is global across devices and it's actually only used
inside device.c. Therefore, simplify the code by just passing it once.

11 years agoinput: Fix ignored profile shutdown
Mikel Astiz [Fri, 26 Apr 2013 06:17:02 +0000 (08:17 +0200)]
input: Fix ignored profile shutdown

Unprobing the profile should never fail which means neither should
input_device_unregister(). This requires shutting everything down
regardless of possible pending connection requests.

11 years agonetwork: Fail if multiple profile instances
Mikel Astiz [Fri, 26 Apr 2013 06:17:01 +0000 (08:17 +0200)]
network: Fail if multiple profile instances

Considerable parts codebase are assuming that there is one single
instance of each UUID and therefore return an error during probe instead
of silently ignoring duplicated entries.

11 years agoprofile: Remove UUID list from probe function
Mikel Astiz [Fri, 26 Apr 2013 06:17:00 +0000 (08:17 +0200)]
profile: Remove UUID list from probe function

Each instance of btd_profile is associated to one single remote UUID
and therefore the list provided by the callback is redundant and can be
removed.

11 years agoinput: Simplify code since UUID is known
Mikel Astiz [Fri, 26 Apr 2013 06:16:59 +0000 (08:16 +0200)]
input: Simplify code since UUID is known

The UUID in this code path is fixed so trivially use it instead of
using the provided probe parameter.

11 years agocontrol: Simplify UUID handling during probe
Mikel Astiz [Fri, 26 Apr 2013 06:16:58 +0000 (08:16 +0200)]
control: Simplify UUID handling during probe

There is actually one single UUID which can be received during probe, so
simplify the code accordingly.

11 years agodevice: Fix returned error code
Mikel Astiz [Fri, 26 Apr 2013 06:16:57 +0000 (08:16 +0200)]
device: Fix returned error code

The second 'err' shadows the main local variable which is being used to
as return value of the function. Otherwise -ENOENT was always returned
in case of error.

11 years agodoc: Fix optional properties not marked as such
Mikel Astiz [Thu, 25 Apr 2013 07:33:55 +0000 (09:33 +0200)]
doc: Fix optional properties not marked as such

Commit 826023de56896e83f35ae69a73d6a120a2f5b11e made some of the
device's properties optional but the documentation was not updated
accordingly. More specifically, the properties 'Name' and 'UUIDs' won't
be present if the information is not available.

11 years agomonitor: Add an option to dump SCO traffic
Vinicius Costa Gomes [Wed, 17 Apr 2013 15:03:42 +0000 (12:03 -0300)]
monitor: Add an option to dump SCO traffic

11 years agoattrib: Change match_event return type from gboolean
Jefferson Delfes [Wed, 17 Apr 2013 14:03:08 +0000 (10:03 -0400)]
attrib: Change match_event return type from gboolean

There is no reason to use gboolean as return type of match_event.

11 years agoattrib: Change is_response return type from gboolean
Jefferson Delfes [Wed, 17 Apr 2013 14:03:07 +0000 (10:03 -0400)]
attrib: Change is_response return type from gboolean

There is no reason to use gboolean as return type of is_response.