Closed Bug 950220 Opened 10 years ago Closed 10 years ago

Unable to change Bluetooth device name from Settings UI

Categories

(Firefox OS Graveyard :: Bluetooth, defect)

ARM
Gonk (Firefox OS)
defect
Not set
major

Tracking

(blocking-b2g:1.3+, firefox27 wontfix, firefox28 fixed, firefox29 fixed, b2g-v1.3 fixed, b2g-v1.3T fixed, b2g-v1.4 fixed)

RESOLVED FIXED
1.3 C2/1.4 S2(17jan)
blocking-b2g 1.3+
Tracking Status
firefox27 --- wontfix
firefox28 --- fixed
firefox29 --- fixed
b2g-v1.3 --- fixed
b2g-v1.3T --- fixed
b2g-v1.4 --- fixed

People

(Reporter: bhargavg1, Assigned: shawnjohnjr)

References

()

Details

(Whiteboard: [caf priority: p2][CR 588688] )

Attachments

(3 files, 2 obsolete files)

With BlueZ + JB build configuration, I am unable to change the device name

STR:
Settings -> Bluetooth -> Enable Bluetooth -> Rename Device (input any name different than shown) wont take effect.

Upon debugging see that we arent hitting either,
 bluez/src/adapter.c:set_name
or
 dom/bluetooth/BluetoothAdapter.cpp:SetName

SHA1's
GAIA:1abda08e450cb66a61a31bdcfd3352e2df9d9ace
GECKO:e5638ae70aad34961a65e6a51b15ffe2f3553b0d
Whiteboard: [PRISM:588688]
blocking-b2g: --- → 1.3?
Tim,

Please look at it from Bluetooth perspective.

Else, please reassign appropriately.
Flags: needinfo?(timdream)
Flags: needinfo?(timdream) → needinfo?(gyeh)
OK, Gina told me on IRC we should look for regression in Gaia first. It's strange because there isn't any code change in that part of Settings I've known of.

EJ, could you help? Please ni? Gina again if you can rule out Gaia.
Component: Bluetooth → Gaia::Settings
Flags: needinfo?(gyeh) → needinfo?(ejchen)
OK, I can take it first and I'll discuss with Arthur about this bug later.

Thanks Tim.
Assignee: nobody → ejchen
Flags: needinfo?(ejchen)
Triage: must fix functional regression.
blocking-b2g: 1.3? → 1.3+
I tried to reproduce the bug with the build information as shown in the following. However, failed to repro in around 15 times.

GECKO_REV=a0bb585098cc89c454fac0297b5ef748d5cab82c
GAIA_REV=fbb6ce88ce8b7bd4d2efdb7a4a9f5a3c145f3eab
GECKO_BRANCH=mozillaorg/master
GAIA_BRANCH=mozillaorg/master
BUILD_TAG=jenkins-B2G.master.flatfish-80
BuildID=20131210064521
(In reply to Gina Yeh [:gyeh] [:ginayeh] from comment #5)
> I tried to reproduce the bug with the build information as shown in the
> following. However, failed to repro in around 15 times.
> 
> GECKO_REV=a0bb585098cc89c454fac0297b5ef748d5cab82c
> GAIA_REV=fbb6ce88ce8b7bd4d2efdb7a4a9f5a3c145f3eab
> GECKO_BRANCH=mozillaorg/master
> GAIA_BRANCH=mozillaorg/master
> BUILD_TAG=jenkins-B2G.master.flatfish-80
> BuildID=20131210064521

What is the combo are you testing, is it JB + v1.3 ?
Yes. It's JB + v1.3 + blueZ.




[Gecko]
commit a0bb585098cc89c454fac0297b5ef748d5cab82c
Author: Carsten "Tomcat" Book <cbook@mozilla.com>
Date:   Mon Dec 9 13:00:59 2013 +0100

    Backed out changeset 85196889c598 (bug 945042) PGO Test Bustage

[Gaia]
commit fbb6ce88ce8b7bd4d2efdb7a4a9f5a3c145f3eab
Merge: 1010882 51add1b
Author: Ben Kelly <bkelly@mozilla.com>
Date:   Mon Dec 9 14:16:17 2013 -0800

    Merge pull request #14462 from wanderview/build-push-userjs
    
    Bug 947204: Push user.js file using full path.  r=yurenju


[blueZ]
  <project name="platform/external/bluetooth/bluez" path="external/bluetooth/bluez" remote="caf" revision="f0689ac1914cdbc59e53bdc9edd9013dc157c299"/>
commit f0689ac1914cdbc59e53bdc9edd9013dc157c299
Merge: d307ea5 74b459e
Author: Linux Build Service Account <lnxbuild@localhost>
Date:   Fri May 24 15:55:13 2013 -0700

    Merge "Bluetooth: Fix to cleanup proper search_context for browse_req."
4 Build tested on Flatfish, not able to reproduce this.

GECKO_REV=0e3362fb5625eb6d98c7617b1b3019a2cc553d47
GAIA_REV=f23aebebcd28c4d19347def77c4836c8baebc2ce
GECKO_BRANCH=mozillaorg/master
GAIA_BRANCH=mozillaorg/master
BUILD_TAG=jenkins-B2G.master.flatfish-65
BuildID=20131202064521

GECKO_REV=cacf62c269344f53c22fecb27f06166c282d1c9a
GAIA_REV=1abda08e450cb66a61a31bdcfd3352e2df9d9ace
GECKO_BRANCH=mozillaorg/master
GAIA_BRANCH=mozillaorg/master
BUILD_TAG=jenkins-B2G.master.flatfish-78
BuildID=20131208064521

GECKO_REV=4bde6cfc066c0f2b64f12512ae460f22d1b23c57
GAIA_REV=1abda08e450cb66a61a31bdcfd3352e2df9d9ace
GECKO_BRANCH=mozillaorg/master
GAIA_BRANCH=mozillaorg/master
BUILD_TAG=jenkins-B2G.master.flatfish-79
BuildID=20131209064521

GECKO_REV=a0bb585098cc89c454fac0297b5ef748d5cab82c
GAIA_REV=fbb6ce88ce8b7bd4d2efdb7a4a9f5a3c145f3eab
GECKO_BRANCH=mozillaorg/master
GAIA_BRANCH=mozillaorg/master
BUILD_TAG=jenkins-B2G.master.flatfish-80
BuildID=20131210064521
Eric/Gina, to double confirm can you check the names are reflected in both

on phone, /data/misc/bluetootd/<device_bd_addr>/config

on the debugfs entry as well in adb shell, /sys/class/bluetooth/hci0/name

all these(including UI) should match

I debugged this further, see that we are hitting the gecko SetName [1] but not the bluez or the stack one.

My guess is somehow the dbus messages arent going through. do you know if any specific logs can be enabled. 

I already enabled logs in Developer Options and kernel logs for net/bluetooth/mgmt.c file but dont see anything specific

[1] #0  mozilla::ipc::ProcessLink::SendMessage (this=0xb4824080, msg=0xb30afe80) at ../../../../../../../../gecko/ipc/glue/MessageLink.cpp:154
#1  0xb587cc6a in mozilla::ipc::MessageChannel::Send (this=<optimized out>, aMsg=0xb30afe80) at ../../../../../../../../gecko/ipc/glue/MessageChannel.cpp:263
#2  0xb589431a in mozilla::dom::bluetooth::PBluetoothChild::SendPBluetoothRequestConstructor (this=0xb3b802b0, actor=0x2, request=...) at PBluetoothChild.cpp:189
#3  0xb5cbe536 in mozilla::dom::bluetooth::BluetoothServiceChildProcess::SetProperty (this=<optimized out>, aType=mozilla::dom::bluetooth::TYPE_ADAPTER, aValue=..., aRunnable=0xb2f16560)
    at ../../../../../../../../gecko/dom/bluetooth/ipc/BluetoothServiceChildProcess.cpp:147
#4  0xb5cbc38a in mozilla::dom::bluetooth::BluetoothPropertyContainer::SetProperty (this=0xb1e04ea8, aOwner=<optimized out>, aProperty=..., aRv=...)
    at ../../../../../../../../gecko/dom/bluetooth/BluetoothPropertyContainer.cpp:50
#5  0xb5cb94c0 in mozilla::dom::bluetooth::BluetoothAdapter::SetName (this=0xb1e04e80, aName=..., aRv=...) at ../../../../../../../../gecko/dom/bluetooth/BluetoothAdapter.cpp:460
#6  0xb59f5266 in mozilla::dom::BluetoothAdapterBinding::setName (cx=0xb3422660, obj=<optimized out>, self=0xb1e04e80, args=...) at BluetoothAdapterBinding.cpp:1121
#7  0xb59f363e in mozilla::dom::BluetoothAdapterBinding::genericMethod (cx=0xb3422660, argc=<optimized out>, vp=0xb3bff0e8) at BluetoothAdapterBinding.cpp:2158
Assignee: ejchen → nobody
Component: Gaia::Settings → Bluetooth
It seems that it is not Gaia work after confirming with Gina. Just untook this bug and left for the others, Thanks :)
Assignee: nobody → gyeh
Target Milestone: --- → 1.3 C2/1.4 S2(17jan)
This is what they used.
<project name="platform/external/bluetooth/bluez" path="external/bluetooth/bluez" revision="f0689ac1914cdbc59e53bdc9edd9013dc157c299" upstream="b2g/jb_mr1_rb2.17"/>
<project name="kernel/msm" path="kernel" revision="acaf0fce57ce3a60cd0bda89e0923a92c4e1d688" upstream="b2g_jb_3.2">
Flatfish uses the same branch jb_mr1_rb2.17. We don't see the problem on flatfish...
All are consistent and the UI is successfully updated to new name.

root@android:/data/misc/bluetoothd/00:23:12:39:BF:FC # cat config              
name BCD
pairable yes

root@android:/sys/class/bluetooth/hci0 # cat name
BCD

root@android:/sys/class/bluetooth/hci0 # hciconfig dev0 name                   
hci0:	Type: BR/EDR  Bus: UART
	BD Address: 00:23:12:39:BF:FC  ACL MTU: 1021:8  SCO MTU: 64:1
	Name: 'BCD'

Settings UI shows 'BCD' correctly.
It is also okay here, but besides this rename problem, is other Bluetooth functionality working okay?

GECKO_REV=cacf62c269344f53c22fecb27f06166c282d1c9a
GAIA_REV=1abda08e450cb66a61a31bdcfd3352e2df9d9ace
GECKO_BRANCH=mozillaorg/master
GAIA_BRANCH=mozillaorg/master
BUILD_TAG=jenkins-B2G.master.flatfish-78
BuildID=20131208064521

root@android:/data/misc/bluetoothd/00:23:12:37:DA:38 # cat config              
name FishInMyPlate
pairable yes

root@android:/sys/class/bluetooth/hci0 # hciconfig dev name                    
hci0:	Type: BR/EDR  Bus: UART
	BD Address: 00:23:12:37:DA:38  ACL MTU: 1021:8  SCO MTU: 64:1
	Name: 'FishInMyPlate'
Keywords: regression
Keywords: regression
cannot reproduce. unassign from Gina since there is nothing can be done

mvines, is your team able to help fixing this? since there is no suitable device for mozilla to reproduce this on. Thanks
Assignee: gyeh → nobody
Flags: needinfo?(mvines)
Target Milestone: 1.3 C2/1.4 S2(17jan) → ---
Seems like the incoming message is wrong,

ON 7x27a we correctly call the set_name funcation not in 8x10

7x27A
------------
#0  set_name (conn=<value optimized out>, msg=0x94ee48, data=0x952280) at external/bluetooth/bluez/src/adapter.c:1062
#1  set_property (conn=<value optimized out>, msg=0x94ee48, data=0x952280) at external/bluetooth/bluez/src/adapter.c:1604
#2  0x400b9144 in process_message (connection=0x94c100, message=0x94ee48, user_data=<value optimized out>) at external/bluetooth/bluez/gdbus/object.c:224
#3  generic_message (connection=0x94c100, message=0x94ee48, user_data=<value optimized out>) at external/bluetooth/bluez/gdbus/object.c:447
#4  0x40221f5a in _dbus_object_tree_dispatch_and_unlock (tree=0x94bf20, message=0x94ee48) at external/dbus/dbus/dbus-object-tree.c:858
#5  0x40200988 in dbus_connection_dispatch (connection=0x94c100) at external/dbus/dbus/dbus-connection.c:4720
#6  0x400b8afa in message_dispatch (data=<value optimized out>) at external/bluetooth/bluez/gdbus/mainloop.c:80
#7  0x40199d20 in g_timeout_dispatch (source=0x9555b8, callback=0, user_data=0x0) at external/bluetooth/glib/glib/gmain.c:3250
#8  0x4019965c in g_main_dispatch (context=0x94ef60) at external/bluetooth/glib/glib/gmain.c:1814
#9  IA__g_main_context_dispatch (context=0x94ef60) at external/bluetooth/glib/glib/gmain.c:2367
#10 0x4019ae22 in g_main_context_iterate (context=0x94ef60, block=<value optimized out>, dispatch=<value optimized out>, self=<value optimized out>) at external/bluetooth/glib/glib/gmain.c:2445
#11 0x4019b8ae in IA__g_main_loop_run (loop=0x951c18) at external/bluetooth/glib/glib/gmain.c:2653
#12 0x400a094c in main (argc=1, argv=0xbe962c74) at external/bluetooth/bluez/src/main.c:504
#13 0x40101a76 in __libc_init (elfdata=<value optimized out>, onexit=<value optimized out>, slingshot=0x83a4 <_start+20>, structors=0x954fca) at bionic/libc/bionic/libc_init_dynamic.c:114
#14 0xb00045aa in call_constructors (si=0x0, wr_offset=<value optimized out>) at bionic/linker/linker.c:1619
#15 __dl_$t (si=0x0, wr_offset=<value optimized out>) at bionic/linker/linker.c:2013
#16 0xbe962fc8 in ?? ()
#17 0xbe962fc8 in ?? ()

8x10 device
---------------
#0  mgmt_set_io_capability (index=0, io_capability=3 '\003') at external/bluetooth/bluez/plugins/mgmtops.c:2323
#1  0xb6f7c628 in agent_removed (agent=<optimized out>, adapter=0xb75e3a80) at external/bluetooth/bluez/src/adapter.c:2209
#2  0xb6f81ffe in agent_free (agent=0xb75e5998) at external/bluetooth/bluez/src/agent.c:159
#3  0xb6f9d956 in service_filter (connection=0xb75df280, message=<optimized out>, user_data=0xb75e40d8) at external/bluetooth/bluez/gdbus/watch.c:477
#4  0xb6f9db1e in message_filter (connection=0xb75df280, message=0xb75e1fc8, user_data=<optimized out>) at external/bluetooth/bluez/gdbus/watch.c:527
#5  0xb6e37da0 in dbus_connection_dispatch (connection=0xb75df280) at external/dbus/dbus/dbus-connection.c:4642
#6  0xb6f9c18e in message_dispatch (data=0xb75df280) at external/bluetooth/bluez/gdbus/mainloop.c:80
#7  0xb6e80fcc in g_timeout_dispatch (source=0xb75e72a0, callback=0xb6f9c181 <message_dispatch>, user_data=<optimized out>) at external/bluetooth/glib/glib/gmain.c:3250
#8  0xb6e803c8 in g_main_dispatch (context=0xb75e20f8) at external/bluetooth/glib/glib/gmain.c:1814
#9  IA__g_main_context_dispatch (context=0xb75e20f8) at external/bluetooth/glib/glib/gmain.c:2367
#10 0xb6e807f2 in g_main_context_iterate (context=0xb75e20f8, block=<optimized out>, dispatch=1, self=Unhandled dwarf expression opcode 0xfa
) at external/bluetooth/glib/glib/gmain.c:2445
#11 0xb6e80b78 in IA__g_main_loop_run (loop=0xb75e4010) at external/bluetooth/glib/glib/gmain.c:2653
#12 0xb6f881c8 in main (argc=1, argv=0xbe8eeae4) at external/bluetooth/bluez/src/main.c:517
#13 0xb6effcf8 in __libc_init (raw_args=0xbe8eeae0, onexit=<optimized out>, slingshot=0xb6f87bad <main>, structors=<optimized out>) at bionic/libc/bionic/libc_init_dynamic.cpp:112
#14 0xb6fbe2f0 in _start ()
also in the logs see a completely different sequence being initiated,

E/        (  938): Agent exited without calling Unregister
E/        (  938): hci0 io_capability 0x03
E/        (  938): cond 1
E/        (  938): Received 8 bytes from management socket
E/        (  938): Opcode: 1
E/        (  938): set_io_capability complete
After enabling dbus logs, see following messages in 8x10

D/libdbus (  290): Failed to validate message body code 39
...
D/libdbus (  290): Corrupted message stream, disconnecting
...

On 7x27A clearly see the following in logs,
D/libdbus (  131):   trying to add message interface=org.bluez.Adapter member=SetProperty error=(unset) to transaction
D/libdbus (  131):   trying to add message interface=org.bluez.Adapter member=PropertyChanged error=(unset) to transaction


on 8x10

seems like somehow the connection is lost

D/libdbus (  131):   trying to add message interface=org.bluez.Adapter member=SetProperty error=(unset) to transaction
D/libdbus (  290):   trying to add reply interface=(unset) member=(unset) error=(unset) to transaction
Attached file 8x10_dbus.log
the logs contain only logs for device name change scenario
Flags: needinfo?(mvines)
Attached file 7x27a_dbus.log
when compared to 8x10 see that the "org.bluez.Adapter" connection is always valid
Bhargav,

Is this blocker actionable? What next steps? It does seem reproducible but need to understand next steps.
Flags: needinfo?(bhargavg1)
(In reply to Preeti Raghunath(:Preeti) from comment #21)
> Bhargav,
> 
> Is this blocker actionable? What next steps? It does seem reproducible but
> need to understand next steps.

Preeti, I guess the next action is to check why the dbus connection info is coming wrong, seeing issues in the dbus messages
Flags: needinfo?(bhargavg1)
Greg

Please check if QC still needs this bug fixed.
Flags: needinfo?(ggrisco)
Yes.
Flags: needinfo?(ggrisco)
Looks like this may be on the Gonk side, moving this to Vendcom for now.
Component: Bluetooth → Vendcom
Flags: needinfo?(bhargavg1)
Whiteboard: [PRISM:588688] → [CR 588688] [POVB]
the failure seems to be coming when the dbus fails to validate the message correctly. From the logs see the following,

D/libdbus (  290): validating body from pos 136 len 22 sig 'sv'
D/libdbus (  290): Failed to validate message body code 39

I see this message everytime when update name fails

error code 39 is DBUS_INVALID_BAD_UTF8_IN_STRING 

coming from, https://www.codeaurora.org/cgit/quic/la/platform/external/dbus/tree/dbus/dbus-marshal-validate.c?h=b2g/jb_mr1_rb2.17#n436
Flags: needinfo?(bhargavg1)
If you replace dbus to AOSP dbus version, will the problem still happen? I tried JB bluez + AOSP dbus, I don't see setName problem.
blocking-b2g: 1.3+ → ---
Shawn, see that the incoming string is getting corrupted, I tried to put a debug statement[1] when we fail. See the following invalid entries

W/libdbus (  299): failed to validate string :h`­	 error:39
W/libdbus (  295): failed to validate string :è­	 error:39

definetly see that incoming string is corrupted

[1] https://www.codeaurora.org/cgit/quic/la/platform/external/dbus/tree/dbus/dbus-marshal-validate.c?h=b2g/jb_mr1_rb2.17#n436
Assignee: nobody → shuang
I got OpenC device now, I will check in parallel.
(In reply to bhargavg1 from comment #28)
> Shawn, see that the incoming string is getting corrupted, I tried to put a
> debug statement[1] when we fail. See the following invalid entries
> 
> W/libdbus (  299): failed to validate string :h`­	 error:39
> W/libdbus (  295): failed to validate string :è­	 error:39
> 
> definetly see that incoming string is corrupted
> 
> [1]
> https://www.codeaurora.org/cgit/quic/la/platform/external/dbus/tree/dbus/
> dbus-marshal-validate.c?h=b2g/jb_mr1_rb2.17#n436

Bhargav, thanks a lot. I think I found something wrong.
Whiteboard: [CR 588688] [POVB] → [CR 588688]
Adding blocking+ back at this has been declared as no longer a vendor issue.
blocking-b2g: --- → 1.3+
Component: Vendcom → Bluetooth
Root cause:
https://github.com/mozilla/gecko-dev/blob/master/dom/bluetooth/bluez/linux/BluetoothDBusService.cpp#L2380
life scope variable char* tempStr only exists in if-block, this is why we saw dbus string is corrupted. 
On 7x27a platform, I'm not sure why we cannot hit this problem, but it's also a potential bug.

Proposal:
Move up char* tempStr.

Since the now dbus call is all async, we shall take care these variable that pass to dbus carefully.
Comment on attachment 8360804 [details] [diff] [review]
Bug 950220 - Unable to change Bluetooth device name from Settings UI

Review of attachment 8360804 [details] [diff] [review]:
-----------------------------------------------------------------

I think we can land this first as a hotfix, but since all dbus operations have turned out to be async calls and moved to DBus thread, we have to keep arguments which are passed into the function alive until the callback is invoked. Please file a followup.
Attachment #8360804 - Flags: review?(echou) → review+
Comment on attachment 8360804 [details] [diff] [review]
Bug 950220 - Unable to change Bluetooth device name from Settings UI

Review of attachment 8360804 [details] [diff] [review]:
-----------------------------------------------------------------

LGTM.
Attachment #8360804 - Flags: feedback?(btian) → feedback+
Follow up bug: Bug 960408 - [Bluetooth]Keep dbus arguments which are passed into the function alive until the callback is invoked
Whiteboard: [CR 588688] → [CR 588688] [status: uplift needed]
Whiteboard: [CR 588688] [status: uplift needed] → [CR 588688]
https://hg.mozilla.org/mozilla-central/rev/634300f4402d
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → 1.3 C2/1.4 S2(17jan)
Flags: in-testsuite?
Flags: in-moztrap?
Flags: in-moztrap? → in-moztrap+
Whiteboard: [CR 588688] → [caf priority: p2][CR 588688]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: