Sunday, January 11, 2015

Bluetooth 4 (Bluetooth Low energy- BLE) support for sony xperia M with android version 4.3

I was creating android app for RFduino.
RFduino has in built BLE, Bluetooth Low Energy, otherwise known as Bluetooth version 4.0
The example given in the rfduino.com was using Nexus 5.  given here http://www.rfduino.com/product/rfduino-android-application/
I choose the Hardware Sony Xperia M. In the technical specification it was mentioned it support BLE.
Android supported BLE from version 4.3 onwards. Build number 15.4.A.1.9.
but when I try out it seems the support was not there.
To test I used same application shared in rfduino site and it did not work when I scan for the device.
I used BLE Checker to test and it showed that BLE was not supported.

From Sony mobile forum (talk.sonymobile.com) came to know that there is a problem in the current firmware and would require a patch which is yet to be released.

But from this post I found the fix, which is quite simple. It turns out that adding permission for BLE fixes the issue.
Fix was given by pm_cz  In the following forum https://talk.sonymobile.com/t5/Xperia-M-M-dual/Does-Xperia-M-support-Bluetooth-BLE/td-p/673259/page/8

Basically involve rooting the phone add the permission.

Below is the steps I followed:



This is from http://techglen.com/2014/06/23/how-to-root-xperia-m-c1904-c1905-15-4-a-1-9-firmware-on-locked-bootloader/
and
https://talk.sonymobile.com/t5/Xperia-M-M-dual/Does-Xperia-M-support-Bluetooth-BLE/td-p/673259/page/8

Downloads
Towelroot APK (Click on lambda icon)
SuperSU Update zip (Unzip and extract Superuser.apk from Common folder)
RemountReboot Fix (Credit: ananthtcr)
Android Studio (This is for ADB Shell. it is available with Android SDK)
pc-companion for Sony (This is to get the driver installed for Sony xperia for enabling the debug mode. This is an optional step the other way to get driver installed is from Android studio through Android SDK manager and install Google USB Drives in Extras).

How to Root Xperia M Single SIM with Towelroot
  1. Download the copied tr.apk and Superuser.apk to phone’s internal or external memory 
  2. Using ES File Explorer, navigate to the folder where you have placed both files 
  3. Tap on tr.apk and begin installation 
  4. Once done, jump to app drawer and run the application 
  5. Now click on “make it ra1n” 
  6. The phone will reboot itself after rooting. (new version do not require reboot) 
  7. Once rebooted, navigate to the folder where you have placed the superuser.apk 
  8. Install it the same way as tr.apk 
  9. Open SuperSU from app drawer and update SU binaries if required 
  10. Now extract remountrebootfix and locate install.bat 
  11. Connect your phone with USB Debugging enabled to PC 
  12. Now run install.bat 
  13. Select option 1 (SuperSU) and press Enter on keyboard 
  14. Now just keep following on-screen options 
  15. Once the device has rebooted, you will have gained complete root access on Xperia M 
  16. That’s it! Phone is rooted. 
  17. Now to add permission. Connect your phone to the USB Debugging enabled to PC 
  18. Type the following commands in shell (CMD). (ADB generally available in path sdk\platform-tools. So if not installed and adb is not recognized, then need to navigate to this path.) 
  19. adb shell 
     su 
     mount -o rw,remount -t ext4 /system
  20. Note that prompt changed to '#' from '#39; when in super user mode.
  21. create a file named android.hardware.bluetooth_le.xml and add the content given below or download from dropbox link here https://www.dropbox.com/s/ivju57f8el61tis/android.hardware.bluetooth_le.xml?dl=0
  22. <?xml version="1.0" encoding="utf-8"?>
    <!-- Copyright (C) 2013 The Android Open Source Project
    
         Licensed under the Apache License, Version 2.0 (the "License");
         you may not use this file except in compliance with the License.
         You may obtain a copy of the License at
    
              http://www.apache.org/licenses/LICENSE-2.0
    
         Unless required by applicable law or agreed to in writing, software
         distributed under the License is distributed on an "AS IS" BASIS,
         WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
         See the License for the specific language governing permissions and
         limitations under the License.
    -->
    <!-- Adds the feature indicating support for the Bluetooth Low Energy API -->
    <permissions>
        <feature name="android.hardware.bluetooth_le" />
    </permissions>
    
  23. Copy the file to the download folder of the internal memory of the phone. 
  24. Move the file to the location /etc/permissions/ and change the permission of the file to 0644 suing below commands 
  25. cp /sdcard/download/android.hardware.bluetooth_le.xml /etc/permissions/android.hardware.bluetooth_le.xml
    chmod 0644 /etc/permissions/android.hardware.bluetooth_le.xml
  26. Can exit the ADB and Reboot the phone. 
  27. Phone is now BLE enabled. Can be verified by BLE Checker
Note: RFduino on Ubuntu(Linux) is yet to support. OS used was Windows 8.1. Now Ubuntu is supported.Details on RFduino on Linux installation

No comments:

Post a Comment

Contributors