Android command line under Bluetooth use

Source: Internet
Author: User

Note: This section only applies to Broadcom series Bluetooth chip, for example RK903, Ap6xxx Series

Switch to the root user via the SU command

1, first confirm that the Rfkill driver has been loaded

ls/sys/class/rfkill/rfkill0/

If the Rfkill0 directory is not found, there is a problem with the Bluetooth driver.

Check to see if the Bluetooth option in kernel is checked.

Please see the information in the kernel print message that starts with "[Bt_rfkill]".

2. Turn off Bluetooth:

A. Turn off Bluetooth in the settings interface

B. Power down the Bluetooth device:

echo 0 >/sys/class/rfkill/rfkill0/state

C. Close the two service BLUETOOTHD and Hciattach:

SetProp Ctl.stop BLUETOOTHD

SetProp Ctl.stop Hciattach

D. for Android4.2, you also need to close the process Com.android.bluetooth

BusyBox Killall Com.android.bluetooth

3. After the Bluetooth has been turned off, manually power on the Bluetooth:

Echo 1 >/sys/class/rfkill/rfkill0/state

4. Download Bluetooth firmware

BROADCOMD Series Chip Use command:

RK30:

Brcm_patchram_plus--patchram bychip--baudrate 1500000--enable_lpm--enable_hci/dev/ttys0-d &

RK29:

Brcm_patchram_plus--patchram bychip--baudrate 1500000--enable_lpm--enable_hci/dev/ttys2-d &

If there is no problem with Bluetooth hardware and drivers, you can see the print after this step is completed:

E/BLUETOOTH_BRCM (402): Done setting line Discpline

If this line of printing does not appear, there is a problem with Bluetooth hardware or software.

Realtek rtl8723as Use command:

/system/bin/hciattach-n-S 115200/DEV/TTYS0 rtk_h5

5. Confirm that Hci0 interface has been created:

# hciconfig-a

Hci0:type:br/edr Bus:uart

BD address:20:00:00:00:01:09 ACL mtu:1021:7 SCO mtu:64:1

Down

RX bytes:485 acl:0 sco:0 events:18 errors:0

TX bytes:95 acl:0 sco:0 commands:18 errors:0

Features:0xff 0xff 0x8f 0xfe 0x9b 0xff 0x79 0x87

Packet type:dm1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3

Link Policy:rswitch hold SNIFF PARK

Link Mode:slave ACCEPT

6. Activating bluetooth

# Hciconfig Hci0 up

7. Confirm the success of Bluetooth activation

# Hcitool Dev

Devices:

Hci0 20:00:00:00:01:09

8. After successful Bluetooth activation, you can start scanning the surrounding Bluetooth devices

# Hcitool Scan

Scanning ...

90:c1:15:0f:c2:78 Xperia Neo


Other:

1. open detection, allowing peripheral devices to detect

# Hciconfig Hcix Piscan

2. Connect bluetooth

# hcitool CC a0:e9:db:26:36:98

3. Pairing

# Hcitool Auth a0:e9:db:26:36:98


summary: The principle is to disable bluedroid, enable BlueZ then you can use Bluz-based hciconfig/ Hcitool and so on debugging tools to do a simple test. Try these tools for late pairing experiments, but there is no function, in fact, to this step can also basically determine that the local Bluetooth device is working properly, more about the use of tools see Bluetooth Debugging Tool Hcitool use instances.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.