History log of /external/adhd/cras/src/server/cras_bt_device.h
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
dab3c96c7ea42a321f1ef60034a76ae435af5270 20-Sep-2016 Cheng-Yi Chiang <cychiang@chromium.org> CRAS: hfp_ag_profile - Start audio gateway in bt device

On HFP/HSP only headset, cras_hfp_ag_start is called in
cras_hfp_ag_slc_initialized when SetConfiguration is called from bluez.
However, that does not mark HFP/HSP as connected, and cause connection
watcher to fail after timeout because it thinks HFP/HSP is still not
connected.
Move cras_hfp_ag_start from cras_hfp_ag_slc_initialized to
cras_bt_device_audio_gateway_initialized to unify the path to start
audio gateway. With that, the HFP/HSP will be mark as connected and
connection watcher will not fail.

BUG=chromium:647468
TEST=Test with HM1100 (HFP only device), connection is not lost.
TEST=Test with IKBT74 (A2DP and HFP), playback and record both work.

Change-Id: I45029c2a9ab855bbf27bdd950fe5dc779b74fef8
Signed-off-by: Cheng-Yi Chiang <cychiang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/386603
Reviewed-by: Chinyue Chen <chinyue@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
/external/adhd/cras/src/server/cras_bt_device.h
3b611c7f640f3ddc6ec1443958d4f0d9f805f10e 30-Aug-2016 Hsin-Yu Chao <hychao@chromium.org> CRAS: a2dp_endpoint - Rename and refactor start function

Rename the start function of bt_endpoing to set_configuration
which aligns with the corresponding BlueZ dbus method. Also adds
additional layer to notify bt_device about a2dp connection is
configured, this will allow future commit to defer the actual
starting of A2DP audio until all supported profiles are connected.

BUG=chromium:543444
TEST=None

Change-Id: I32ccc6c49fd903706a3a138dc95be7458daf2ca7
Reviewed-on: https://chromium-review.googlesource.com/377846
Commit-Ready: Hsinyu Chao <hychao@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
/external/adhd/cras/src/server/cras_bt_device.h
86e3223766559de97cf81abe3cd91fd86905f075 29-Aug-2016 Hsin-Yu Chao <hychao@chromium.org> CRAS: bt_device - Add connection watch timer

For a BT headset supporting more than one profile, we should not
assume the headset handles profile connection perfectly and just
wait for each profile to be ready.
This change adds the responsibility to CRAS to catch cases that
any profile fails or forgets to connect. A timer is used since
BT device change to 'connected' state and watches the readiness
of each supported profile.

BUG=chromium:543444
TEST=Use Motorola S10-HD headset, press the 'call' button while
it's not connected. Verify that both HFP and A2DP will connect.

Change-Id: Icec49d6b1c6d437fac8aaa0ffb6a90f7a3cd3020
Reviewed-on: https://chromium-review.googlesource.com/377845
Commit-Ready: Hsinyu Chao <hychao@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
/external/adhd/cras/src/server/cras_bt_device.h
f6120d16bb048c25d4125e93aea0d1118483818b 15-Aug-2016 Hsin-Yu Chao <hychao@chromium.org> CRAS: hfp_ag - Delete a2dp delay timer

This is a preparation for future change to handle the case where
HFP/HSP connected but A2DP failed. Delayed callback waiting for
A2DP connection was used as a workaround to avoid user hear BT
audio transition between profiles. But it turns out not good enough
so delete it and replace by a better mechanism later.
This change adds additional layer when HFP SLC is initialized and
notify bt_device to actually start the HFP audio gateway. This is
a preparion for later commits to defer starting HFP audio until
A2DP is ready.

BUG=chromium:543444
TEST=None

Change-Id: I269d3b459f0e575ab1e0e3021cb531580a285562
Reviewed-on: https://chromium-review.googlesource.com/377844
Commit-Ready: Hsinyu Chao <hychao@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
/external/adhd/cras/src/server/cras_bt_device.h
2232117de7c9542713986c95235bb088d0fa6c40 15-Aug-2016 Hsin-Yu Chao <hychao@chromium.org> CRAS: bt_device - Migrate a2dp suspend timer to bt_device

This is a refactor change to move a2dp suspend timer to
bt_device so it can be managed with all other timer objects.

BUG=chromium:543444
TEST=Manual test A2DP audio

Change-Id: If83e8ebd31de2dfe709d8663ba86e6ba0d14eb22
Reviewed-on: https://chromium-review.googlesource.com/375621
Commit-Ready: Hsinyu Chao <hychao@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
/external/adhd/cras/src/server/cras_bt_device.h
dace0e596c97dfa4b0a2b3baa3004376eb2fd2c0 22-Jun-2016 Hsin-Yu Chao <hychao@chromium.org> CRAS: bt_device - Fix bug in profile switching

cras_bt_device exposes functions for profile switching at iodev
open and at close. The reason is that when bt iodev is about to
open and meets the condition to switch profile, main thread needs
to re-enable this iodev after profile switching is done.
In addion to open/close, when each profile(A2DP or HFP) is connected
profile switch could happen but we should leave the enable/disable
status of bt iodev unchanged, or it could accidentally be enabled
while other device is in use.

This change fixes the bug that BT headset got enabled while internal
speaker is active. Also the profile switching functions are renamed
from
- cras_bt_device_switch_profile_on_open()
- cras_bt_device_switch_profile_on_close()
to
- cras_bt_device_switch_profile_enable_dev()
- cras_bt_device_switch_profile()

so it is more clear in which scenario we need to do the extra task
to enable the dev.

Note that this bug wasn't discovered until latest release because Chrome
always selected BT headset for active output when it is connected. And
now the behavior is changed to auto-select BT headset based on user's
last preference.

BUG=chrome-os-partner:54176
TEST=Connect BT headset, play audio and select output to internal
speaker. Restart system, seeing that internal speaker is the active
output. Play audio and now try connect BT headset, verify that when
BT headset is connected it doesn't play audio.

Change-Id: If30088a7bbe5d2b8caa726bce7feb79f73f44d31
Reviewed-on: https://chromium-review.googlesource.com/354793
Commit-Ready: Hsinyu Chao <hychao@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
Reviewed-by: Cheng-Yi Chiang <cychiang@chromium.org>
Reviewed-by: Chinyue Chen <chinyue@chromium.org>
/external/adhd/cras/src/server/cras_bt_device.h
fe893eec58b3cf3dcec71b3d5f2c814aa0cb7d9e 29-Apr-2016 Hsin-Yu Chao <hychao@chromium.org> CRAS: bt_device - Update hardware volume reported by headset

This change hooks volume change events from both AVRCP and
HFP to iodev layer and then signal to Chrome.
Also with this change the hardware volume is enabled if and
only if the BT headset reports a valid transport volume,
the use_hardware_volume flag will be set accordingly.

BUG=chromium:605035
TEST=Test with Plantronics Edge headset, verify pressing
the volume button on device could reflect to Chrome OS.
and changing volume from Chrome OS keyboard will affect
the sound from headset.
Test with Jabra Easycall headset, which doesn't support
AVRCP, can still change its volume from UI and keyboard
by software volume.

Change-Id: I65a9fd496e42ebd480a50edfb2d521d64cc30571
Reviewed-on: https://chromium-review.googlesource.com/341954
Commit-Ready: Hsinyu Chao <hychao@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
Reviewed-by: Chinyue Chen <chinyue@chromium.org>
/external/adhd/cras/src/server/cras_bt_device.h
c6162bcc6625f3ba6d3ec921cceed625f6793083 21-Apr-2016 Hsin-Yu Chao <hychao@chromium.org> CRAS: bt_device - Add use_hardware_volume flag

Add a flag to cras_bt_device to indicate it's okay to use
device's hardware volume instead of relies on CRAS to scale
audio in software.
This is a preparation change to add new flag. Later commits
will use this flag to control enabling hardware volume, and
also set this flag base on the capability reported by BT
headset/speaker.

BUG=chromium:605035
TEST=None. Since the flags is not used yet.

Change-Id: I784ebeee8cace78f73c2c050a2615169d0c6b7cf
Reviewed-on: https://chromium-review.googlesource.com/340866
Commit-Ready: Hsinyu Chao <hychao@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
Reviewed-by: Chinyue Chen <chinyue@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
/external/adhd/cras/src/server/cras_bt_device.h
dbacec54658bd09622322a9298fbc110b846514f 21-Apr-2016 Hsin-Yu Chao <hychao@chromium.org> CRAS: bt_device - Remove uneccessary function

hfp_iodev already holds a pointer to slc_handle so it doesn't
need to access through bt_device.

BUG=None
TEST=None

Change-Id: I36927a8ab1b92aaca6663adcc26a590d842ed0f9
Reviewed-on: https://chromium-review.googlesource.com/340344
Commit-Ready: Hsinyu Chao <hychao@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
/external/adhd/cras/src/server/cras_bt_device.h
2c1665d62406a1f1eac1b9530e13eabf942b218c 24-Apr-2015 Hsin-Yu Chao <hychao@chromium.org> CRAS: hfp_ag - Cancel delay timer when destroy audio gateway

There's a case when HFP connected and immediately got disconnected
for some reason, but the a2dp delay timer still holds a pointer
to the freed audio gateway and cause CRAS crash.

BUG=chromium:461636
TEST=Connect A2DP/HFP headset and stream audio.

Change-Id: I2db53ae818cbcb4a93d279d43b6e06cf5534adf5
Reviewed-on: https://chromium-review.googlesource.com/267071
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Hsinyu Chao <hychao@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
/external/adhd/cras/src/server/cras_bt_device.h
6dce077a0e0fcb463e44b74e60194ca587378604 22-Apr-2015 Hsin-Yu Chao <hychao@chromium.org> CRAS: hfp_ag_profile - Delay the action to remove conflict audio gateway

When an A2DP/HFP headset connects while an HFP-only headset in use, the
new HFP connection kicks out the 1st HFP-only device but still takes a
few seconds before its A2DP part get connected. Delay the action until
the new device's A2DP connection is established to avoid the audio
output got routes to internal speaker for a short period.

BUG=chromium:479247
TEST=Connect HFP-only device and stream audio, connect a 2nd
A2DP/HFP headset, verify that the 1st headset gets disconnected and
audio transfers to the 2nd headset seemslessly without noticing
a short while that audio routes to internal speaker.

Change-Id: I2a754bc5eac2f70c27906e1ff06c6ec5d8681fdf
Reviewed-on: https://chromium-review.googlesource.com/267012
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Hsinyu Chao <hychao@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
/external/adhd/cras/src/server/cras_bt_device.h
268efdc1e2ca122cf96e814e883804edd59665af 23-Mar-2015 Hsin-Yu Chao <hychao@chromium.org> CRAS: hfp_ag_profile - Add a2dp delay

When a bluetooth headset connects or reconnects, CRAS actually sees
different profiles connect separately and could have a long delay
in between. When on output stream exists while HFP/HSP connects
first, user will hear low quality sound and notice the sound changed
to HD when A2DP connects later.
Sometimes when powers off and on the device to make it reconnect,
the audio quality during transition could get distorted.
This change delays the start of audio I/O to wait until A2DP is
connected. Set the delay period to 500 ms and retry 10 times max.
This introduces at most 5 secounds delay to the headset connect
process before user can hear audio, but prevents the bad user
experience to hear choppy audio.

BUG=chromium:461636
TEST=Manual test A2DP/HFP headset, stream audio, power off the
headset and then power it on. Should not notice audio quality
change for most of the time.

Change-Id: I4ec5d34f01ae24d78e52e40e153bd6b67f796e01
Reviewed-on: https://chromium-review.googlesource.com/261882
Reviewed-by: Cheng-Yi Chiang <cychiang@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
Commit-Queue: Hsinyu Chao <hychao@chromium.org>
/external/adhd/cras/src/server/cras_bt_device.h
58ce2f4836f725ab16a122bfad83e156869f9654 20-Mar-2015 Hsin-Yu Chao <hychao@chromium.org> CRAS: bt_device - Add function to disconnect bt device

On Chrome OS we support only single headset so when multiple
headsets are connected the old one will be removed to avoid
user getting into a state that two headsets are used for input
and output respectively. To better improve user experience,
force disconnect BT headset so it'll shown as disconnected
when it's no longer listed as an audio input/ouput option.

BUG=chromium:468882
TEST=Connect HFP/HSP-only headset, play audio. Try connect
to an A2DP/HFP headset from bluetooth UI. Verify audio has
transferred to the A2DP/HFP headset and the previous HFP/HSP
only headset show disconnected in bluetooth UI.

Change-Id: Ice8fb5f5952bc0d17d0d8df4028f901d060a566e
Reviewed-on: https://chromium-review.googlesource.com/261541
Reviewed-by: Cheng-Yi Chiang <cychiang@chromium.org>
Commit-Queue: Hsinyu Chao <hychao@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
/external/adhd/cras/src/server/cras_bt_device.h
5f01b1beb131b2c1e184970bba53d748a077f7e8 17-Mar-2015 Hsin-Yu Chao <hychao@chromium.org> CRAS: hfp_iodev - Register callback for when SCO packet size changed

Add the ability to hfp_iodev to modify the buffer size after open.
This is important for some BT adapters prefers a smaller SCO packet
size other than the reported MTU to update the accurate buffer size
so that audio thread doesn't confuse with the room to fill buffer but
never get enough buffer from hfp iodev.

BUG=chrome-os-partner:36187
TEST=Test HFP/HSP headset on veyron_minnie
Use 'cras_test_client --dump_a | head -n20' while playing
YouTube to verify the buffer size displayed is slightly
less than the max allowed buffer size.

Change-Id: Iff64b97c4b37a3b539b547274a01a31a1ada1208
Reviewed-on: https://chromium-review.googlesource.com/260519
Reviewed-by: Cheng-Yi Chiang <cychiang@chromium.org>
Commit-Queue: Hsinyu Chao <hychao@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
/external/adhd/cras/src/server/cras_bt_device.h
356760223b3fef46e7edfa3a5688c0f70828aaff 11-Feb-2015 Hsin-Yu Chao <hychao@chromium.org> CRAS: bt_device - API to determine preferred mtu value for SOC

This change adds the API to query the preferred SCO MTU values.
48 bytes is preffered for adapters on USB bus, otherwise query
from driver for the mtu value in sco_options.

BUG=chrome-os-partner:35957
TEST=Apply full patch set, test bluetooth headset on
Daisy, Nyan, Rambi, Link.

Change-Id: I3acf49d0fa2bdda2c8c83fd4740edecde3f6d849
Reviewed-on: https://chromium-review.googlesource.com/249081
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
Commit-Queue: Hsinyu Chao <hychao@chromium.org>
/external/adhd/cras/src/server/cras_bt_device.h
971f1da15d17fe613cf83e59beb84d0b66a1fadd 30-Jan-2015 Hsin-Yu Chao <hychao@chromium.org> CRAS: bt_io - Change detect logic of bt profile

Originally we rely on the profile capability stored in the
cras_bt_device structure to determine if it's ok to switch
to the other profile. However this is not reliable when more
than one headsets are connected, only the 1st headset supporting
A2DP will be enumerated in CRAS, due to that bluetoothd sends
notification to configure only one a2dp device.

This change fixes the issue by checking if a bt_io has a node
attached of certain profile, instead of checking the supported
profiles claimed in cras_bt_device.

BUG=chromium:448594
TEST=unittest. Connect bt headset A, and then connect a second
bt headset B. Open YouTube to test audio output on headset B,
and then use 'cras_test_client --capture_file /tmp/1' to open
an input stream, ctrl+C to stop the recording, verify audio
output is still good.

Change-Id: I1bc51017b7a8cc637c0aeea864794dc5968213f5
Reviewed-on: https://chromium-review.googlesource.com/244636
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Hsinyu Chao <hychao@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
/external/adhd/cras/src/server/cras_bt_device.h
5b799f1d3f67c9db7d47b00dd8a8684c629862aa 09-Dec-2014 Hsin-Yu Chao <hychao@chromium.org> CRAS: HFP - Implement set speaker gain for HFP iodev

Set speaker gain is supported in handsfree profile,
hooks the service level event all the way to bt iodev
so that when switches to HFP we can get rid of soft volume.

BUG=chromium:432432
TEST=Connect BT headset, open AudioVisualizer webapp to force
switch to HFP, adjust volume from keyboard.

Change-Id: I8b33b899abe70e9c79629d3a5d7e986d76e5c685
Reviewed-on: https://chromium-review.googlesource.com/234625
Commit-Queue: Hsinyu Chao <hychao@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
/external/adhd/cras/src/server/cras_bt_device.h
583ddd2776fd9639e34fc138a692cd58dabd3306 27-Nov-2014 Hsin-Yu Chao <hychao@chromium.org> CRAS: bt_io - detect and switch profile

Implements the logic to detect the use scenario and auto switches
to the preferred profile.

BUG=chromium:432434
TEST=unittest

Change-Id: If687fdfcfa67a97021312406519bc09d1dab1c1e
Reviewed-on: https://chromium-review.googlesource.com/231872
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
Commit-Queue: Hsinyu Chao <hychao@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
/external/adhd/cras/src/server/cras_bt_device.h
e02c0a29cd919867c024ae353010d537db7efa51 25-Nov-2014 Hsin-Yu Chao <hychao@chromium.org> CRAS: bt_io - API to switch between A2DP and HFP/HSP

At events that a bluetooth device opens or closes, we might
want to switch to a different profile. When switches the profile
of a bt device, it is required to reinitialize the bt_ios.
This change adds the function to temporarily close the active
bt_ios and activate them later so they can switch to the preferred
profile.

BUG=chromium:432434
TEST=unittest

Change-Id: I7ac2feab38b1dd4eb4a4def0bbc2323eb5842bbd
Reviewed-on: https://chromium-review.googlesource.com/231870
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Hsinyu Chao <hychao@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
/external/adhd/cras/src/server/cras_bt_device.h
732ac405775cad8dc049806fc040282fabd77608 25-Nov-2014 Hsin-Yu Chao <hychao@chromium.org> CRAS: bt_device - stores the active profile to use

A bluetooth audio device can be used for different profile
depend on how user configures it. This change stores the preffered
profile to cras_bt_device that CRAS side wants to be configured.
In later changes bt_io will look up this value when setting format
or alters its value when we decides to switch profile.

BUG=chromium:432434
TEST=None

Change-Id: If7ac132bd46448f6e0280971e69d90ddf2d34179
Reviewed-on: https://chromium-review.googlesource.com/231871
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
Commit-Queue: Hsinyu Chao <hychao@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
/external/adhd/cras/src/server/cras_bt_device.h
0d17ce053a25f0c1bb7c15573a4253372d95c8e9 20-Aug-2014 Hsin-Yu Chao <hychao@chromium.org> CRAS: bt_io - Add bt_io to cras_bt_device

Make cras_bt_device holds a list of iodev of different stream
direction and add functions to append or remove profile specific
iodev to/from a cras_bt_device. In later changes, a2dp and hfp/hsp
iodev will not add to iodev_list directly but instead append to the
corresponding cras_bt_device and operates behind the bt_io wrapper.

BUG=chromium:432434
TEST=unittest

Change-Id: Iefe20a689f394f9d40849e82ff5410c04ae39232
Reviewed-on: https://chromium-review.googlesource.com/231868
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Hsinyu Chao <hychao@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
/external/adhd/cras/src/server/cras_bt_device.h
d3837f02a514c6093b5577da8d104a4a9d6729bc 24-Nov-2014 Hsin-Yu Chao <hychao@chromium.org> CRAS: bt_profile - Use bt device to replace transport

The transport object carries information and is used in Bluez's
media API. We borrowed it for the cras_bt_profile module and
it turns out redundant in cases when we want to associate a profile
or HFP related objects with cras_bt_device.
This change refactors the code to better align with Bluez profile
API and will allow the device disconnected event be notified to bt
profiles in a clean way.

BUG=chromium:432434
TEST=Test A2DP playback. Manual enable HFP, test playback & capture.

Change-Id: I2fab0b32965227512ad841bd7df785cd1af4a2ab
Reviewed-on: https://chromium-review.googlesource.com/231864
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
Commit-Queue: Hsinyu Chao <hychao@chromium.org>
/external/adhd/cras/src/server/cras_bt_device.h
40c45701d14087b01a12f151d3a62cd25a9efb9e 01-Sep-2014 Hsin-Yu Chao <hychao@chromium.org> CRAS: bt_device - Name bluetooth constants by profile and role

In order to differentiate HSP and HFP devices, name profile and
uuid variables by profile name and role defined in specification.
HFP: handsfree, audio gateway
HSP: headset, audio gateway

BUG=None
TEST=None

Change-Id: I0947a7bd46143c85b91c15238a569ce15b3ac552
Reviewed-on: https://chromium-review.googlesource.com/231861
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
Commit-Queue: Hsinyu Chao <hychao@chromium.org>
/external/adhd/cras/src/server/cras_bt_device.h
a67190546dcf8a283d9474c5cab24d7a152bf7f8 01-Mar-2013 Scott James Remnant <keybuk@chromium.org> CRAS: bluetooth - rewrite for BlueZ 5.2

BlueZ 5.2 brings us support for Bluetooth 4.0 and LE, but at the cost
of a different D-Bus API. It was easier to write fresh clean code
for the new API and remove the old code than incrementally refactor.

BUG=204431
TEST=build and run cras, verify logs

Change-Id: I3147aa7d59535b743425c7d48737f8c70614e5cd
Signed-off-by: Scott James Remnant <keybuk@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/45103
Reviewed-by: Dylan Reid <dgreid@chromium.org>
/external/adhd/cras/src/server/cras_bt_device.h