Closed Bug 1162893 Opened 9 years ago Closed 9 years ago

[bluetooth2] App crashed after write characteristic

Categories

(Firefox OS Graveyard :: Bluetooth, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(firefox41 fixed)

RESOLVED FIXED
Tracking Status
firefox41 --- fixed

People

(Reporter: elin, Assigned: brsun)

References

Details

Attachments

(2 files, 1 obsolete file)

https://bugzilla.mozilla.org/show_bug.cgi?id=1161939
After this bug fixed,
I rebuilt b2g and tried to write characteristic again,
now it crashed with some error logs.

I guess these two lines are closest to the root cause?
maybe I'm wrong...

I/Gecko   ( 3696): IPDL protocol error: Error deserializing 'writeType' (BluetoothGattWriteType) member of 'GattClientWriteCharacteristicValueRequest'
I/Gecko   ( 3696): IPDL protocol error: Error deserializing 'Request'

also detail logs are attached.
I will take a look, thanks for reporting.
Assignee: nobody → joliu
In addition,
here's the code I use to write descriptor:
https://github.com/elin-moco/ble-explorer/blob/master/main.js#L531
basically I create the value array the same way as descriptor.writeValue,
and my write descriptor code is working fine.
I guess the root cause should be because |ParamTraits| of |BluetoothGattCharAttribute|[1] doesn't pass |mWriteType| during serialization and deserialization[2], so |BluetoothGattCharacteristic::mWriteType|[3] doesn't have chances to have a proper value during its initialization[4]. When |BluetoothGattCharacteristic::WriteValue()|[5] is called, the value validation for |BluetoothGattWriteType|[6] could fail easily due to passing a garbage value.

[1] https://dxr.mozilla.org/mozilla-central/source/dom/bluetooth/bluetooth2/ipc/BluetoothMessageUtils.h#115
[2] https://dxr.mozilla.org/mozilla-central/source/dom/bluetooth/BluetoothCommon.h#718
[3] https://dxr.mozilla.org/mozilla-central/source/dom/bluetooth/bluetooth2/BluetoothGattCharacteristic.cpp#66
[4] https://dxr.mozilla.org/mozilla-central/source/dom/bluetooth/bluetooth2/BluetoothGattService.cpp#109
[5] https://dxr.mozilla.org/mozilla-central/source/dom/bluetooth/bluetooth2/BluetoothGattCharacteristic.cpp#319
[6] https://dxr.mozilla.org/mozilla-central/source/dom/bluetooth/bluetooth2/ipc/BluetoothMessageUtils.h#41
Attachment #8603304 - Flags: feedback?(elin)
Eddie,

Would you help to try the patch on comment 4 to see if it helps or not?
Reassign to Bruce since he found the root cause. :)
Assignee: joliu → brsun
(In reply to Bruce Sun [:brsun] from comment #5)
> Eddie,
> 
> Would you help to try the patch on comment 4 to see if it helps or not?

OK, I'll try to build with the patch first,
and I'll try it on my flame on Monday.
Comment on attachment 8603304 [details] [diff] [review]
bug1162893_gatt_characteristic_writetype_serialization.patch

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

Hooray!!!
I'm able to blink LED and rotate servo through characteristic.writeValue now!
Thanks for the patch!
Attachment #8603304 - Flags: feedback?(elin) → feedback+
Attachment #8603304 - Flags: review?(joliu)
Comment on attachment 8603304 [details] [diff] [review]
bug1162893_gatt_characteristic_writetype_serialization.patch

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

LGTM.
Thanks for fixing this.
Attachment #8603304 - Flags: review?(joliu) → review+
Attachment #8603304 - Attachment is obsolete: true
Attachment #8604006 - Flags: review+
Attachment #8604006 - Flags: feedback+
Keywords: checkin-needed
Files under bluetooth2 is not built/compiled by default for the moment.
https://hg.mozilla.org/mozilla-central/rev/ddb0bfa1e15a
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Blocks: 1165848
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: