Closed
Bug 934891
Opened 11 years ago
Closed 11 years ago
[fugu][Bluetooth]Can not disconnect bluetooth headset
Categories
(Firefox OS Graveyard :: Bluetooth, defect)
Tracking
(blocking-b2g:koi+, firefox26 wontfix, firefox27 wontfix, firefox28 fixed, b2g-v1.2 fixed)
People
(Reporter: xinhe.yan, Assigned: gyeh)
Details
(Keywords: regression)
Attachments
(1 file, 1 obsolete file)
4.65 KB,
patch
|
Details | Diff | Splinter Review |
User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.19 (KHTML, like Gecko) Ubuntu/11.04 Chromium/18.0.1025.151 Chrome/18.0.1025.151 Safari/535.19 Steps to reproduce: 1 Connect A2DP bluetooth headset(N9) 2 Make a call out 3 Press home button 4 Enter setting app and choose blueooth 5 Click N9 in Paired devices and Choose Disconnect Actual results: Can not disconnect heaset Expected results: headset will be disconnect and phone sound turn to handset
I found BluetoothHfpManager::Disconnect is not called. The root cause is in BluetoothA2dpManager.cpp BluetoothA2dpManager::HandleSinkPropertyChanged. When got SINK_DISCONNECTED signal, // case 7 only if (prevState == SinkState::SINK_DISCONNECTING) { OnDisconnect(EmptyString()); } In external/bluetooth/bluez/audio/sink.c static char *str_state[] = { "SINK_STATE_DISCONNECTED", "SINK_STATE_CONNECTING", "SINK_STATE_CONNECTED", "SINK_STATE_PLAYING", }; But qualcomm add a new state SINK_STATE_DISCONNECTING. So this SINK_STATE_DISCONNECTING state cause OnDisconnect can not be called. I remove this state check, just call OnDisconnect(EmptyString()), fugu can also disconnect hfp.
OS: All → Gonk (Firefox OS)
Hardware: All → ARM
Assignee | ||
Comment 2•11 years ago
|
||
Could you give me some more information about the BlueZ you're using? Which repo and the version number is? Thanks.
Flags: needinfo?(xinhe.yan)
For qualcomm bluez, I use hamachi code which download form https://github.com/mozilla-b2g/b2g-manifest/blob/v1.2/hamachi.xml. git commit is 4586e7d69d07e96704b506a91d90d5a0b8495afe For sprd bluez, fugu is not push to mozilla github now. But the bluez code can be download from our server, you can ask steven yang for manifest. Our git commit in bluez is 2e14f94021d37685f17644fb171cae403cbea45d.
Flags: needinfo?(xinhe.yan)
Assignee | ||
Comment 4•11 years ago
|
||
Thanks for your quick reply. The solutions seems great to me. When disconnecting from remote devices, OnDisconnect() is invoked and returns immediately since mController is null in this case. void BluetoothA2dpManager::OnDisconnect(const nsAString& aErrorStr) { MOZ_ASSERT(NS_IsMainThread()); /** * On the one hand, notify the controller that we've done for outbound * connections. On the other hand, we do nothing for inbound connections. */ NS_ENSURE_TRUE_VOID(mController); ... } Let me refine comments and create a patch. I'll also ask some feedback from Xinhe Yan. :)
Assignee: nobody → gyeh
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Assignee | ||
Updated•11 years ago
|
blocking-b2g: --- → koi?
Assignee | ||
Comment 5•11 years ago
|
||
Attachment #827838 -
Flags: review?(echou)
Assignee | ||
Updated•11 years ago
|
Attachment #827838 -
Flags: feedback?(xinhe.yan)
Hi Gina, I test this patch on v1.2 and master branch, this patch resolved our problem. Thanks.
Assignee | ||
Comment 7•11 years ago
|
||
Great! Would you mind setting flag feedback to '+'? Thanks. (Click "Review" in the attachments section, then you can set the feedback from '?' to '+'.)
Comment on attachment 827838 [details] [diff] [review] Patch 1(v1): Remove state DISCONNECTING Review of attachment 827838 [details] [diff] [review]: ----------------------------------------------------------------- This patch fix fugu problem.
Updated•11 years ago
|
Attachment #827838 -
Flags: feedback?(xinhe.yan) → feedback+
Comment 9•11 years ago
|
||
There is no option for Xinhe to change the flag, so I changed it based on his comments.
Assignee | ||
Comment 10•11 years ago
|
||
I see. Thanks, Steven.
Comment 11•11 years ago
|
||
Comment on attachment 827838 [details] [diff] [review] Patch 1(v1): Remove state DISCONNECTING Review of attachment 827838 [details] [diff] [review]: ----------------------------------------------------------------- r=me with nits addressed and question answered. ::: dom/bluetooth/BluetoothA2dpManager.cpp @@ +269,5 @@ > const BluetoothValue& value = arr[0].value(); > MOZ_ASSERT(value.type() == BluetoothValue::TnsString); > + SinkState newState = StatusStringToSinkState(value.get_nsString()); > + NS_ENSURE_TRUE_VOID((newState != SinkState::SINK_UNKNOWN) && > + (newState != mSinkState)); Question: is it possible that newState == SinkState::SINK_UNKNOWN and current mSinkState != SinkState::SINK_UNKNOWN ? If it is, then should we save SinkState::SINK_UNKNOWN to mSinkState? On the other hand, if newState is impossible to be SinkState::SINK_UNKNOWN, how about adding an assertion check? @@ +303,2 @@ > // case 2: Connection attempt failed > if (prevState == SinkState::SINK_CONNECTING) { nit: trailing whitespaces @@ +304,5 @@ > if (prevState == SinkState::SINK_CONNECTING) { > OnConnect(NS_LITERAL_STRING("A2dpConnectionError")); > break; > } > nit: trailing whitespaces @@ +312,1 @@ > nit: trailing whitespaces
Attachment #827838 -
Flags: review?(echou) → review+
Comment 12•11 years ago
|
||
Apologies if this shouldn't be marked regression (it seemed like it to me).
blocking-b2g: koi? → koi+
Keywords: regression
Assignee | ||
Comment 13•11 years ago
|
||
(In reply to Eric Chou [:ericchou] [:echou] from comment #11) > @@ +269,5 @@ > > const BluetoothValue& value = arr[0].value(); > > MOZ_ASSERT(value.type() == BluetoothValue::TnsString); > > + SinkState newState = StatusStringToSinkState(value.get_nsString()); > > + NS_ENSURE_TRUE_VOID((newState != SinkState::SINK_UNKNOWN) && > > + (newState != mSinkState)); > > Question: is it possible that > > newState == SinkState::SINK_UNKNOWN and current mSinkState != > SinkState::SINK_UNKNOWN ? > > If it is, then should we save SinkState::SINK_UNKNOWN to mSinkState? > > On the other hand, if newState is impossible to be SinkState::SINK_UNKNOWN, > how about adding an assertion check? > Oops! It should be OR rather than AND here. That is to say, two cases should be ignored and returned earlier: 1. The state equals to the previous one. Normally we shouldn't receive state change, however, sometimes we might got the same state twice. I think it might be a bug of our stack. 2. UNKNOWN state should be skipped. Does it make sense to you?
Comment 14•11 years ago
|
||
(In reply to Gina Yeh [:gyeh] [:ginayeh] from comment #13) > (In reply to Eric Chou [:ericchou] [:echou] from comment #11) > > @@ +269,5 @@ > > > const BluetoothValue& value = arr[0].value(); > > > MOZ_ASSERT(value.type() == BluetoothValue::TnsString); > > > + SinkState newState = StatusStringToSinkState(value.get_nsString()); > > > + NS_ENSURE_TRUE_VOID((newState != SinkState::SINK_UNKNOWN) && > > > + (newState != mSinkState)); > > > > Question: is it possible that > > > > newState == SinkState::SINK_UNKNOWN and current mSinkState != > > SinkState::SINK_UNKNOWN ? > > > > If it is, then should we save SinkState::SINK_UNKNOWN to mSinkState? > > > > On the other hand, if newState is impossible to be SinkState::SINK_UNKNOWN, > > how about adding an assertion check? > > > > Oops! It should be OR rather than AND here. That is to say, two cases should > be ignored and returned earlier: > > 1. The state equals to the previous one. Normally we shouldn't receive state > change, however, sometimes we might got the same state twice. I think it > might be a bug of our stack. > > 2. UNKNOWN state should be skipped. > > Does it make sense to you? Yes, it's fair enough. You have answered my questions. Thanks. However, based on your answer, I think using AND is right and you don't need to change. Is that correct?
Assignee | ||
Comment 15•11 years ago
|
||
AND is right... I need more coffee :(
Assignee | ||
Comment 16•11 years ago
|
||
(In reply to Andrew Overholt [:overholt] from comment #12) > Apologies if this shouldn't be marked regression (it seemed like it to me). It could be a regression from the users' point of view, and I think that it would be great if we have this fix in v1.2 :)
Assignee | ||
Comment 17•11 years ago
|
||
https://tbpl.mozilla.org/?tree=Try&rev=87a3d52646cb
Attachment #827838 -
Attachment is obsolete: true
Assignee | ||
Comment 18•11 years ago
|
||
https://hg.mozilla.org/integration/b2g-inbound/rev/b6376e52dd5e
Comment 19•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/b6376e52dd5e
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Assignee | ||
Comment 21•11 years ago
|
||
Sorry about that. Later I'll push it again. I'm waiting for the result of try server. https://tbpl.mozilla.org/?tree=Try&rev=1f965b21ee12
Updated•11 years ago
|
Target Milestone: --- → 1.3 Sprint 4 - 11/8
Assignee | ||
Comment 22•11 years ago
|
||
https://hg.mozilla.org/integration/b2g-inbound/rev/ba4cb364ad6d
Comment 23•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/ba4cb364ad6d
Status: REOPENED → RESOLVED
Closed: 11 years ago → 11 years ago
Resolution: --- → FIXED
Comment 24•11 years ago
|
||
https://hg.mozilla.org/releases/mozilla-b2g26_v1_2/rev/24aea16490ba
status-b2g-v1.2:
--- → fixed
status-firefox26:
--- → wontfix
status-firefox27:
--- → wontfix
status-firefox28:
--- → fixed
You need to log in
before you can comment on or make changes to this bug.
Description
•