B2G/Bluetooth
This wiki page will be updated irregularly.
Contents
Overview
Bluetooth of Firefox OS 1.0 has basic functionalities. It allows users to:
- Discover visible Bluetooth devices nearby
- Pair with found devices
- Send files to/Receive files from remote Bluetooth devices
- Connect with Bluetooth headsets, then headset can be used for basic call controls, such as Answer/Hang up/Redial
For Firefox OS 1.0, the Bluetooth Web API is considered a Certified API, which means that only certified applications (applications that ship with the OS itself) may use bluetooth. Applications retreived from Firefox Marketplace or elsewhere on the web are not able to use the Bluetooth API at this time.
The Bluetooth version in Firefox OS is 3.0.
New Features and Enhancements
Firefox OS v1.1
- Users can select and send multiple pictures via Bluetooth at a time in Gallery app. (bug 869287)
Firefox OS v1.2
- Support A2DP 1.2. Users can listen to music via Bluetooth. (bug 892162)
- Support AVRCP 1.3. Users can control media playing and get playing status via Bluetooth. (bug 892164) (bug 892165)
- Make HFP compatible with CDMA network (bug 873006)
Firefox OS v1.3
- Support a new protocol stack: Bluedroid. (bug 876583)
- Fully support multiple file transfer. (bug 921085)
- Make HFP be able to handle multi-SIM scenario. (bug 921991)
Firefox OS v2.2
Firefox OS v2.5
- Support Bluetooth GATT
- Bluetooth Web API refinement
- Jocelyn Liu/Ben Tian are the driver of this item. Please see more discussion here.
Supported Bluetooth Profiles
Currently our developers are working on several Bluetooth profiles which are relatively more popular for a mobile device, such as HFP/HSP/A2DP/AVRCP/OPP. To support these profiles, implementions in both Gecko (for protocol layer) and Gaia (for applications like Settings and Dialer) are needed. Below is a list indicating the relation of supported Bluetooth profiles and the mapping version of Firefox OS.
Firefox OS v1.0.1
- HFP (Handsfree Profile) 1.5
- HSP (Headset Profile) 1.2
- OPP (Object Push Profile) 1.1
Firefox OS v1.2
- HFP 1.6 (bug 879196)
- Support command 'AT+BIA'
- A2DP 1.2 (Advanced Audio Distribution Profile) (bug 807758)
- AVRCP (Audio/Video Remote Control Profile) (bug 834553)
- AVRCP 1.0 (bug 834554)
- AVRCP 1.3 (bug 842948)
Firefox OS v2.5
- HFP 1.6 wideband speech (bug 911635)
- BLE (Bluetooth Low Energy)
- GATT (Generic Attribute Profile) (bug 872460)
Unsupported Bluetooth Profiles
- HID (Human Interface Device Profile) (bug 880759, bug 943809)
- FTP (File Transfer Profile)
- PBAP (Phone Book Access Profile) (bug 892179)
- PAN (Personal Area Network Profile) (bug 947085)
In-house Scheduled PTS (Profile Tuning Suite) Test
The target version we used for PTS testing is aurora.
After v1.2, the PTS test was scheduled right after each branching out.
- v2.5(Flame-KK)
- v2.2(Nexus5-L)
- v2.2(Flame-KK)
- v2.1(Bluez)
- v2.1(Bluedroid)
- v2.0(Bluez)
- v2.0(BlueDroid)
- v1.4(Bluez)
- v1.4(BlueDroid)
- v1.3
- v1.2
Before v1.2, the PTS test was scheduled monthly.
FAQ
- 1. Why can't I hear music from connected Bluetooth headset even when a song is playing?
- That's because A2DP was not implemented in your OS version. Before Firefox OS 1.2, only voice stream of phone calls can be heard from Bluetooth headset. A2DP and AVRCP have been supported in Firefox OS 1.2. For more information, please see the meta bug above.
- 2. I would like to share a song via Bluetooth, but I can't find the share button.
- Please press and hold on a song, then you should be able to see the Bluetooth paired device list.
- Please see Bug 830040 comment 1 for more information.
- 3. I just successfully received a photo from another Bluetooth device (e.g. Android phone, laptop ...), but I could neither find that photo in Gallery app, nor open that photo by pressing the successful-transfer notofication. What happened?
- For Firefox OS 1.0, Gallery app would ignore images that have a file size of > 3 megabytes or a resolution of more than 5 megapixels.
- Please see Bug 815079 comment 4 for more information.
- 4. Why can't I send a file to my iPhone/iPad?
- It's because iOS doesn't support file-transfer profiles.
- Please see http://support.apple.com/kb/HT3647 for more information about iOS supported profiles.
- 5. Why can't I send a file to or receive a file from my Mac?
- If you would like to share files to Mac, the file-transfer function should be enabled beforehand.
- 1. Click the Bluetooth icon at the top-right corner of the screen
- 2. Select "Open Bluetooth Preferences" from the drop down menu, then click the "Sharing Setup..." button at the bottom right of the dialog that opens
- 3. Make sure the "Bluetooth Sharing" checkbox is enabled.
- Please see https://support.apple.com/kb/PH18969 for more information.
- If your Firefox OS version is older than v1.1, once you have done the above steps, please go to the Bluetooth settings page in your phone, and unpair/pair your Mac. Then it should work normally.
- 6. Why can't I receive a file from my Ubuntu laptop/desktop?
- On Ubuntu 12.04/12.10, the function of receiving a file from remote Bluetooth devices is disabled by default. Therefore you have to turn it on then try again.
- 1. Go to "Personal File Saring"
- 2. Check the item "Receive files in Downloads folder over Bluetooth"
- If your Firefox OS version is before v1.1, once you have done the above steps, please go to Bluetooth page and unpair/pair your Ubuntu device then it should work normally.
- 7. Why can't my bluetooth headset work well with my phone?
- Some bluetooth headsets have known interoperability issues with Firefox OS. A meta bug on bugzilla is tracking interoperability issues for bluetooth headsets.
- List these bluetooth headsets here:
- Rocketfish RF-QX4 (bug 923743)
- 8. Why can't my bluetooth car kit work well with my phone?
- Some bluetooth car kits have known interoperability issues with Firefox OS. A meta bug on bugzilla is tracking interoperability issues for bluetooth car kits.
File a Bug
If you have read the FAQ and still have problems. Please file a bug to Bugzilla. To help developers finding bugs more easily, please make sure the component is set to any of these three:
- Firefox OS::Bluetooth
- Gaia::Settings
- Gaia::Bluetooth File Transfer
Helpful Debugging Information
When filing a bug related to Bluetooth, please provide information about your test environment as much as possible, such as:
- Device (Otoro, Unagi ...)
- Software information
- Build Identifier (Go to "Settings" > "Device information" > "More Information")
- Git commit info
- Gecko version
- Gaia version
- STR (Step to Reproduce)
- Actual result/Expected result
- Occurence
- GDB backtrace
- adb logcat,
- In newer release, you can enable Bluetooth log (Go to "Settings" > "Device information" > "More Information" > "Developer")
- hcidump log
- hcidump is a tool for Bluetooth protocol analysis.
- If you're using release build, hcidump would not be included. Please refer to Bug 828810 comment 7 for the step-by-step about how to get hcidump from release build.
- Take the following steps to get hcidump log:
- 1. Turn on Bluetooth
- 2 - 1. For headset/car kit issues, please enter adb shell hcidump --ascii -t > hcidump.txt
- 2 - 2. For file transferring and other issues, please enter adb shell hcidump --hex -t > hcidump.txt
- 3. Do the test
- 4. Attach hcidump.txt to the bug
- hcidump snoop log
- It will be easier to debug A2DP/AVRCP profiles using snoop format log.
- To enable it, please enter adb shell hcidump -R -w/data/whatever.cfa , this will dump log into /data/whatever.cfa
- It will be easier to debug A2DP/AVRCP profiles using snoop format log.
- Logs for Firefox OS v1.4 (Bluedroid)
In /system/etc/bluetooth/bt_stack.conf defined logging level and logger output.
#Enable BtSnoop logging function #valid value : true, false BtSnoopLogOutput=true #BtSnoop log output file BtSnoopFileName=/sdcard/btsnoop_hci.log
In /system/etc/bluetooth/bt_stack.conf defined
logging level, this effected what we saw in logcat
You can use Wireshark or frontline viewer to open it.
- Log level
#Trace level configuration #BT_TRACE_LEVEL_NONE 0 ( No trace messages to be generated ) #BT_TRACE_LEVEL_ERROR 1 ( Error condition trace messages ) #BT_TRACE_LEVEL_WARNING 2 ( Warning condition trace messages ) #BT_TRACE_LEVEL_API 3 ( API traces ) #BT_TRACE_LEVEL_EVENT 4 ( Debug messages for events ) #BT_TRACE_LEVEL_DEBUG 5 ( Full debug messages ) TRC_HCI=2 TRC_L2CAP=2 TRC_RFCOMM=2
Grab offline tool from [1]
togglelog.sh: Enable/Disable bluedroid log openlog.sh: Download bluedroid log and use wireshark to check
- To build b2g-desktop
- Steps
- 1. Edit mozconfig , you might change -j if you have a powerful workstation
- 2. Install following packages: gtk+-2.0 libdbus-1-dev libdbus-glib-1-dev yasm libasound2-dev libgstreamer-plugins-base0.10-dev
- 3. Build ./mach build
- 4. Run "obj-debug/dist/bin/b2g -no-remote -profile [path-to-gaia]/profile" to launch
- Steps
Example for .mozconfig
$./mach build with .mozconfig mk_add_options AUTOCLOBBER=1 mk_add_options MOZ_OBJDIR=obj-debug MOZ_B2G_BT_BLUEZ=1 mk_add_options MOZ_MAKE_FLAGS="-j4 -s --no-print-directory" ac_add_options --enable-application=b2g ac_add_options --enable-debug ac_add_options --enable-debug-symbols ac_add_options --enable-b2g-bt ac_add_options --with-ccache=/usr/bin/ccache ENABLE_MARIONETTE=1
Bluetooth Marionette Tests
Setup python environment for Marionette Install “python-setuptools” Setup marionette client
$ pip install virtualenv $ mkdir ~/pyEnv $ virtualenv ~/pyEnv/ $ cd $GECKO_DIR/testing/marionette/client' $ sudo ~/pyEnv/bin/python setup.py develop
Run BT tests on ICS emulator
$ cd $GECKO_DIR $ ~/pyEnv/bin/python testing/marionette/client/marionette/runtests.py --emulator arm --homedir ../ --type=b2g dom/bluetooth/tests/marionette/manifest.ini
Run BT tests on device
$ cd $GECKO_DIR $ adb forward tcp:2828 tcp:2828 $ ~/pyEnv/bin/python testing/marionette/client/marionette/runtests.py --address=localhost:2828 --type=b2g dom/bluetooth/tests/marionette/manifest.ini
Team Members
Currently we have a small Gecko Bluetooth team responsible for:
- Dealing with bugs which are assigned to component "Bluetooth"
- Implementing new Bluetooth features
- Maintaining Gecko Bluetooth
- Designing WebBluetooth API
- Implementing Bluetooth WebAPI test cases
The team members are Shawn Huang, Ben Tian, Thomas Zimmermann, Jocelyn Liu, Bruce Sun, Will Wang, Louis Chang, and Tom Tung. Except Thomas is working from Europe, all other team members are located in Taipei. Shawn is the owner of Bluetooth module, and Ben, Thomas, Jocelyn, and Bruce are Bluetooth module peers. You can pass Bluetooth related patches to them for review.
You're more than welcome to contact us on IRC (#bluetooth), on bugzilla, or via sending an email. The following is a more detailed list about our job assignment:
- Shawn Huang (shuang@mozilla.com)
- A2DP/AVRCP (Media playing and controlling)
- Ben Tian (btian@mozilla.com)
- WebBluetooth API design/discussion/implementation
- HFP/HSP (Phone call control)
- OPP (File transfer)
- Thomas Zimmermann (tzimmermann@mozilla.com)
- Gecko Bluetooth integration with multiple Bluetooth backends, including BlueZ and Bluedroid
- Bluetooth daemon
- Jocelyn Liu (joliu@mozilla.com)
- WebBluetooth API design/discussion/implementation
- BLE (GATT Client / GATT Server) API design/discussion/implementation
- Bruce Sun (brsun@mozilla.com)
- BLE (GATT Client / GATT Server) API implementation
- Will Wang (wiwang@mozilla.com)
- Bluetooth tests on KK emulator
- PTS test
You can always contact Shawn once you're not sure who is the right person to contact with.
Communication
You can fire questions on IRC channel #bluetooth.
Mailing list
You can subscribe to dev-bluetooth. https://lists.mozilla.org/listinfo/dev-bluetooth