Files
bumble_mirror/extras/android_remote_hci.html
2023-10-29 09:04:27 -07:00

2341 lines
48 KiB
HTML

<!doctype html>
<html lang="en" class="no-js">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<link rel="prev" href="index.html">
<link rel="next" href="../hive/index.html">
<link rel="icon" href="../images/favicon.ico">
<meta name="generator" content="mkdocs-1.5.3, mkdocs-material-9.4.5">
<title>Android Remote HCI - Bumble</title>
<link rel="stylesheet" href="../assets/stylesheets/main.6a10b989.min.css">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,300i,400,400i,700,700i%7CRoboto+Mono:400,400i,700,700i&display=fallback">
<style>:root{--md-text-font:"Roboto";--md-code-font:"Roboto Mono"}</style>
<link rel="stylesheet" href="../assets/_mkdocstrings.css">
<script>__md_scope=new URL("..",location),__md_hash=e=>[...e].reduce((e,_)=>(e<<5)-e+_.charCodeAt(0),0),__md_get=(e,_=localStorage,t=__md_scope)=>JSON.parse(_.getItem(t.pathname+"."+e)),__md_set=(e,_,t=localStorage,a=__md_scope)=>{try{t.setItem(a.pathname+"."+e,JSON.stringify(_))}catch(e){}}</script>
</head>
<body dir="ltr">
<script>var palette=__md_get("__palette");if(palette&&"object"==typeof palette.color)for(var key of Object.keys(palette.color))document.body.setAttribute("data-md-color-"+key,palette.color[key])</script>
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
<label class="md-overlay" for="__drawer"></label>
<div data-md-component="skip">
<a href="#android-remote-hci-app" class="md-skip">
Skip to content
</a>
</div>
<div data-md-component="announce">
</div>
<header class="md-header md-header--shadow" data-md-component="header">
<nav class="md-header__inner md-grid" aria-label="Header">
<a href="../index.html" title="Bumble" class="md-header__button md-logo" aria-label="Bumble" data-md-component="logo">
<img src="../images/logo.png" alt="logo">
</a>
<label class="md-header__button md-icon" for="__drawer">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 6h18v2H3V6m0 5h18v2H3v-2m0 5h18v2H3v-2Z"/></svg>
</label>
<div class="md-header__title" data-md-component="header-title">
<div class="md-header__ellipsis">
<div class="md-header__topic">
<span class="md-ellipsis">
Bumble
</span>
</div>
<div class="md-header__topic" data-md-component="header-topic">
<span class="md-ellipsis">
Android Remote HCI
</span>
</div>
</div>
</div>
<div class="md-header__source">
<a href="https://github.com/google/bumble" title="Go to repository" class="md-source" data-md-component="source">
<div class="md-source__icon md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Free 6.4.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2023 Fonticons, Inc.--><path d="M439.55 236.05 244 40.45a28.87 28.87 0 0 0-40.81 0l-40.66 40.63 51.52 51.52c27.06-9.14 52.68 16.77 43.39 43.68l49.66 49.66c34.23-11.8 61.18 31 35.47 56.69-26.49 26.49-70.21-2.87-56-37.34L240.22 199v121.85c25.3 12.54 22.26 41.85 9.08 55a34.34 34.34 0 0 1-48.55 0c-17.57-17.6-11.07-46.91 11.25-56v-123c-20.8-8.51-24.6-30.74-18.64-45L142.57 101 8.45 235.14a28.86 28.86 0 0 0 0 40.81l195.61 195.6a28.86 28.86 0 0 0 40.8 0l194.69-194.69a28.86 28.86 0 0 0 0-40.81z"/></svg>
</div>
<div class="md-source__repository">
GitHub
</div>
</a>
</div>
</nav>
</header>
<div class="md-container" data-md-component="container">
<main class="md-main" data-md-component="main">
<div class="md-main__inner md-grid">
<div class="md-sidebar md-sidebar--primary" data-md-component="sidebar" data-md-type="navigation" >
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--primary" aria-label="Navigation" data-md-level="0">
<label class="md-nav__title" for="__drawer">
<a href="../index.html" title="Bumble" class="md-nav__button md-logo" aria-label="Bumble" data-md-component="logo">
<img src="../images/logo.png" alt="logo">
</a>
Bumble
</label>
<div class="md-nav__source">
<a href="https://github.com/google/bumble" title="Go to repository" class="md-source" data-md-component="source">
<div class="md-source__icon md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Free 6.4.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2023 Fonticons, Inc.--><path d="M439.55 236.05 244 40.45a28.87 28.87 0 0 0-40.81 0l-40.66 40.63 51.52 51.52c27.06-9.14 52.68 16.77 43.39 43.68l49.66 49.66c34.23-11.8 61.18 31 35.47 56.69-26.49 26.49-70.21-2.87-56-37.34L240.22 199v121.85c25.3 12.54 22.26 41.85 9.08 55a34.34 34.34 0 0 1-48.55 0c-17.57-17.6-11.07-46.91 11.25-56v-123c-20.8-8.51-24.6-30.74-18.64-45L142.57 101 8.45 235.14a28.86 28.86 0 0 0 0 40.81l195.61 195.6a28.86 28.86 0 0 0 40.8 0l194.69-194.69a28.86 28.86 0 0 0 0-40.81z"/></svg>
</div>
<div class="md-source__repository">
GitHub
</div>
</a>
</div>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../index.html" class="md-nav__link">
<span class="md-ellipsis">
Introduction
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../getting_started.html" class="md-nav__link">
<span class="md-ellipsis">
Getting Started
</span>
</a>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_3" >
<label class="md-nav__link" for="__nav_3" id="__nav_3_label" tabindex="0">
<span class="md-ellipsis">
Development
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_3_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_3">
<span class="md-nav__icon md-icon"></span>
Development
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../development/python_environments.html" class="md-nav__link">
<span class="md-ellipsis">
Python Environments
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../development/contributing.html" class="md-nav__link">
<span class="md-ellipsis">
Contributing
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../development/code_style.html" class="md-nav__link">
<span class="md-ellipsis">
Code Style
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_4" >
<label class="md-nav__link" for="__nav_4" id="__nav_4_label" tabindex="0">
<span class="md-ellipsis">
Use Cases
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_4_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_4">
<span class="md-nav__icon md-icon"></span>
Use Cases
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../use_cases/index.html" class="md-nav__link">
<span class="md-ellipsis">
Overview
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../use_cases/use_case_1.html" class="md-nav__link">
<span class="md-ellipsis">
Use Case 1
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../use_cases/use_case_2.html" class="md-nav__link">
<span class="md-ellipsis">
Use Case 2
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../use_cases/use_case_3.html" class="md-nav__link">
<span class="md-ellipsis">
Use Case 3
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../use_cases/use_case_4.html" class="md-nav__link">
<span class="md-ellipsis">
Use Case 4
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../use_cases/use_case_5.html" class="md-nav__link">
<span class="md-ellipsis">
Use Case 5
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../use_cases/use_case_6.html" class="md-nav__link">
<span class="md-ellipsis">
Use Case 6
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_5" >
<label class="md-nav__link" for="__nav_5" id="__nav_5_label" tabindex="0">
<span class="md-ellipsis">
Components
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_5_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_5">
<span class="md-nav__icon md-icon"></span>
Components
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../components/controller.html" class="md-nav__link">
<span class="md-ellipsis">
Controller
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../components/host.html" class="md-nav__link">
<span class="md-ellipsis">
Host
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../components/gatt.html" class="md-nav__link">
<span class="md-ellipsis">
GATT
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../components/security_manager.html" class="md-nav__link">
<span class="md-ellipsis">
Security Manager
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_6" >
<label class="md-nav__link" for="__nav_6" id="__nav_6_label" tabindex="0">
<span class="md-ellipsis">
Transports
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_6_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_6">
<span class="md-nav__icon md-icon"></span>
Transports
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../transports/index.html" class="md-nav__link">
<span class="md-ellipsis">
Overview
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../transports/serial.html" class="md-nav__link">
<span class="md-ellipsis">
Serial
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../transports/usb.html" class="md-nav__link">
<span class="md-ellipsis">
USB
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../transports/pty.html" class="md-nav__link">
<span class="md-ellipsis">
PTY
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../transports/udp.html" class="md-nav__link">
<span class="md-ellipsis">
UDP
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../transports/tcp_client.html" class="md-nav__link">
<span class="md-ellipsis">
TCP Client
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../transports/tcp_server.html" class="md-nav__link">
<span class="md-ellipsis">
TCP Server
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../transports/ws_client.html" class="md-nav__link">
<span class="md-ellipsis">
WebSocket Client
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../transports/ws_server.html" class="md-nav__link">
<span class="md-ellipsis">
WebSocket Server
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../transports/vhci.html" class="md-nav__link">
<span class="md-ellipsis">
VHCI
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../transports/hci_socket.html" class="md-nav__link">
<span class="md-ellipsis">
HCI Socket
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../transports/android_emulator.html" class="md-nav__link">
<span class="md-ellipsis">
Android Emulator
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../transports/file.html" class="md-nav__link">
<span class="md-ellipsis">
File
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_7" >
<label class="md-nav__link" for="__nav_7" id="__nav_7_label" tabindex="0">
<span class="md-ellipsis">
Drivers
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_7_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_7">
<span class="md-nav__icon md-icon"></span>
Drivers
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../drivers/index.html" class="md-nav__link">
<span class="md-ellipsis">
Overview
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../drivers/realtek.html" class="md-nav__link">
<span class="md-ellipsis">
Realtek
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_8" >
<label class="md-nav__link" for="__nav_8" id="__nav_8_label" tabindex="0">
<span class="md-ellipsis">
API
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_8_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_8">
<span class="md-nav__icon md-icon"></span>
API
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../api/guide.html" class="md-nav__link">
<span class="md-ellipsis">
Guide
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../api/examples.html" class="md-nav__link">
<span class="md-ellipsis">
Examples
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../api/reference.html" class="md-nav__link">
<span class="md-ellipsis">
Reference
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_9" >
<label class="md-nav__link" for="__nav_9" id="__nav_9_label" tabindex="0">
<span class="md-ellipsis">
Apps & Tools
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_9_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_9">
<span class="md-nav__icon md-icon"></span>
Apps & Tools
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../apps_and_tools/index.html" class="md-nav__link">
<span class="md-ellipsis">
Overview
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../apps_and_tools/console.html" class="md-nav__link">
<span class="md-ellipsis">
Console
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../apps_and_tools/bench.html" class="md-nav__link">
<span class="md-ellipsis">
Bench
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../apps_and_tools/speaker.html" class="md-nav__link">
<span class="md-ellipsis">
Speaker
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../apps_and_tools/hci_bridge.html" class="md-nav__link">
<span class="md-ellipsis">
HCI Bridge
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../apps_and_tools/gg_bridge.html" class="md-nav__link">
<span class="md-ellipsis">
Golden Gate Bridge
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../apps_and_tools/show.html" class="md-nav__link">
<span class="md-ellipsis">
Show
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../apps_and_tools/gatt_dump.html" class="md-nav__link">
<span class="md-ellipsis">
GATT Dump
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../apps_and_tools/pair.html" class="md-nav__link">
<span class="md-ellipsis">
Pair
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../apps_and_tools/unbond.html" class="md-nav__link">
<span class="md-ellipsis">
Unbond
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../apps_and_tools/usb_probe.html" class="md-nav__link">
<span class="md-ellipsis">
USB Probe
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../apps_and_tools/link_relay.html" class="md-nav__link">
<span class="md-ellipsis">
Link Relay
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_10" >
<label class="md-nav__link" for="__nav_10" id="__nav_10_label" tabindex="0">
<span class="md-ellipsis">
Hardware
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_10_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_10">
<span class="md-nav__icon md-icon"></span>
Hardware
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../hardware/index.html" class="md-nav__link">
<span class="md-ellipsis">
Overview
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_11" >
<label class="md-nav__link" for="__nav_11" id="__nav_11_label" tabindex="0">
<span class="md-ellipsis">
Platforms
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_11_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_11">
<span class="md-nav__icon md-icon"></span>
Platforms
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../platforms/index.html" class="md-nav__link">
<span class="md-ellipsis">
Overview
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../platforms/macos.html" class="md-nav__link">
<span class="md-ellipsis">
macOS
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../platforms/linux.html" class="md-nav__link">
<span class="md-ellipsis">
Linux
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../platforms/windows.html" class="md-nav__link">
<span class="md-ellipsis">
Windows
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../platforms/android.html" class="md-nav__link">
<span class="md-ellipsis">
Android
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../platforms/zephyr.html" class="md-nav__link">
<span class="md-ellipsis">
Zephyr
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_12" >
<label class="md-nav__link" for="__nav_12" id="__nav_12_label" tabindex="0">
<span class="md-ellipsis">
Examples
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_12_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_12">
<span class="md-nav__icon md-icon"></span>
Examples
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../examples/index.html" class="md-nav__link">
<span class="md-ellipsis">
Overview
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--active md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_13" checked>
<label class="md-nav__link" for="__nav_13" id="__nav_13_label" tabindex="0">
<span class="md-ellipsis">
Extras
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_13_label" aria-expanded="true">
<label class="md-nav__title" for="__nav_13">
<span class="md-nav__icon md-icon"></span>
Extras
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="index.html" class="md-nav__link">
<span class="md-ellipsis">
Overview
</span>
</a>
</li>
<li class="md-nav__item md-nav__item--active">
<input class="md-nav__toggle md-toggle" type="checkbox" id="__toc">
<label class="md-nav__link md-nav__link--active" for="__toc">
<span class="md-ellipsis">
Android Remote HCI
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<a href="android_remote_hci.html" class="md-nav__link md-nav__link--active">
<span class="md-ellipsis">
Android Remote HCI
</span>
</a>
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
<label class="md-nav__title" for="__toc">
<span class="md-nav__icon md-icon"></span>
Table of contents
</label>
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
<li class="md-nav__item">
<a href="#building" class="md-nav__link">
Building
</a>
</li>
<li class="md-nav__item">
<a href="#running" class="md-nav__link">
Running
</a>
<nav class="md-nav" aria-label="Running">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#preconditions" class="md-nav__link">
Preconditions
</a>
<nav class="md-nav" aria-label="Preconditions">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#disabling-selinux" class="md-nav__link">
Disabling SELinux
</a>
</li>
<li class="md-nav__item">
<a href="#stopping-the-bluetooth-process" class="md-nav__link">
Stopping the bluetooth process
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#starting-the-app" class="md-nav__link">
Starting the app
</a>
<nav class="md-nav" aria-label="Starting the app">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#launching-from-the-launcher" class="md-nav__link">
Launching from the launcher
</a>
</li>
<li class="md-nav__item">
<a href="#launching-with-adb" class="md-nav__link">
Launching with adb
</a>
</li>
<li class="md-nav__item">
<a href="#selecting-a-tcp-port" class="md-nav__link">
Selecting a TCP port
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#connecting-to-the-proxy" class="md-nav__link">
Connecting to the proxy
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_14" >
<label class="md-nav__link" for="__nav_14" id="__nav_14_label" tabindex="0">
<span class="md-ellipsis">
Hive
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_14_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_14">
<span class="md-nav__icon md-icon"></span>
Hive
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../hive/index.html" class="md-nav__link">
<span class="md-ellipsis">
Overview
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../hive/web/speaker/speaker.html" class="md-nav__link">
<span class="md-ellipsis">
Speaker
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../hive/web/scanner/scanner.html" class="md-nav__link">
<span class="md-ellipsis">
Scanner
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../hive/web/heart_rate_monitor/heart_rate_monitor.html" class="md-nav__link">
<span class="md-ellipsis">
Heart Rate Monitor
</span>
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
<label class="md-nav__title" for="__toc">
<span class="md-nav__icon md-icon"></span>
Table of contents
</label>
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
<li class="md-nav__item">
<a href="#building" class="md-nav__link">
Building
</a>
</li>
<li class="md-nav__item">
<a href="#running" class="md-nav__link">
Running
</a>
<nav class="md-nav" aria-label="Running">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#preconditions" class="md-nav__link">
Preconditions
</a>
<nav class="md-nav" aria-label="Preconditions">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#disabling-selinux" class="md-nav__link">
Disabling SELinux
</a>
</li>
<li class="md-nav__item">
<a href="#stopping-the-bluetooth-process" class="md-nav__link">
Stopping the bluetooth process
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#starting-the-app" class="md-nav__link">
Starting the app
</a>
<nav class="md-nav" aria-label="Starting the app">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#launching-from-the-launcher" class="md-nav__link">
Launching from the launcher
</a>
</li>
<li class="md-nav__item">
<a href="#launching-with-adb" class="md-nav__link">
Launching with adb
</a>
</li>
<li class="md-nav__item">
<a href="#selecting-a-tcp-port" class="md-nav__link">
Selecting a TCP port
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#connecting-to-the-proxy" class="md-nav__link">
Connecting to the proxy
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-content" data-md-component="content">
<article class="md-content__inner md-typeset">
<h1 id="android-remote-hci-app">ANDROID REMOTE HCI APP<a class="headerlink" href="#android-remote-hci-app" title="Permanent link">&para;</a></h1>
<p>This application allows using an android phone's built-in Bluetooth controller with
a Bumble host stack running outside the phone (typically a development laptop or desktop).
The app runs an HCI proxy between a TCP socket on the "outside" and the Bluetooth HCI HAL
on the "inside". (See <a href="https://source.android.com/docs/core/connect/bluetooth">this page</a> for a high level
description of the Android Bluetooth HCI HAL).
The HCI packets received on the TCP socket are forwarded to the phone's controller, and the
packets coming from the controller are forwarded to the TCP socket.</p>
<h2 id="building">Building<a class="headerlink" href="#building" title="Permanent link">&para;</a></h2>
<p>You can build the app by running <code>./gradlew build</code> (use <code>gradlew.bat</code> on Windows) from the <code>RemoteHCI</code> top level directory.
You can also build with Android Studio: open the <code>RemoteHCI</code> project. You can build and/or debug from there.</p>
<p>If the build succeeds, you can find the app APKs (debug and release) at:</p>
<ul>
<li>[Release] <code>app/build/outputs/apk/release/app-release-unsigned.apk</code></li>
<li>[Debug] <code>app/build/outputs/apk/debug/app-debug.apk</code></li>
</ul>
<h2 id="running">Running<a class="headerlink" href="#running" title="Permanent link">&para;</a></h2>
<h3 id="preconditions">Preconditions<a class="headerlink" href="#preconditions" title="Permanent link">&para;</a></h3>
<p>When the proxy starts (tapping the "Start" button in the app's main activity), it will try to
bind to the Bluetooth HAL. This requires disabling SELinux temporarily, and being the only HAL client.</p>
<h4 id="disabling-selinux">Disabling SELinux<a class="headerlink" href="#disabling-selinux" title="Permanent link">&para;</a></h4>
<p>Binding to the Bluetooth HCI HAL requires certain SELinux permissions that can't simply be changed
on a device without rebuilding its system image. To bypass these restrictions, you will need
to disable SELinux on your phone (please be aware that this is global, not just for the proxy app,
so proceed with caution).
In order to disable SELinux, you need to root the phone (it may be advisable to do this on a
development phone).</p>
<div class="admonition tip">
<p class="admonition-title">Disabling SELinux Temporarily</p>
<p>Restart <code>adb</code> as root:
<div class="highlight"><pre><span></span><code>$<span class="w"> </span>adb<span class="w"> </span>root
</code></pre></div></p>
<p>Then disable SELinux
<div class="highlight"><pre><span></span><code>$<span class="w"> </span>adb<span class="w"> </span>shell<span class="w"> </span>setenforce<span class="w"> </span><span class="m">0</span>
</code></pre></div></p>
<p>Once you're done using the proxy, you can restore SELinux, if you need to, with
<div class="highlight"><pre><span></span><code>$<span class="w"> </span>adb<span class="w"> </span>shell<span class="w"> </span>setenforce<span class="w"> </span><span class="m">1</span>
</code></pre></div></p>
<p>This state will also reset to the normal SELinux enforcement when you reboot.</p>
</div>
<h4 id="stopping-the-bluetooth-process">Stopping the bluetooth process<a class="headerlink" href="#stopping-the-bluetooth-process" title="Permanent link">&para;</a></h4>
<p>Since the Bluetooth HAL service can only accept one client, and that in normal conditions
that client is the Android's bluetooth stack, it is required to first shut down the
Android bluetooth stack process.</p>
<div class="admonition tip">
<p class="admonition-title">Checking if the Bluetooth process is running</p>
<p><div class="highlight"><pre><span></span><code>$<span class="w"> </span>adb<span class="w"> </span>shell<span class="w"> </span><span class="s2">&quot;ps -A | grep com.google.android.bluetooth&quot;</span>
</code></pre></div>
If the process is running, you will get a line like:
<div class="highlight"><pre><span></span><code>bluetooth 10759 876 17455796 136620 do_epoll_wait 0 S com.google.android.bluetooth
</code></pre></div>
If you don't, it means that the process is not running and you are clear to proceed.</p>
</div>
<p>Simply turning Bluetooth off from the phone's settings does not ensure that the bluetooth process will exit.
If the bluetooth process is still running after toggling Bluetooth off from the settings, you may try enabling
Airplane Mode, then rebooting. The bluetooth process should, in theory, not restart after the reboot.</p>
<div class="admonition tip">
<p class="admonition-title">Stopping the bluetooth process with adb</p>
<div class="highlight"><pre><span></span><code>$<span class="w"> </span>adb<span class="w"> </span>shell<span class="w"> </span>cmd<span class="w"> </span>bluetooth_manager<span class="w"> </span>disable
</code></pre></div>
</div>
<h3 id="starting-the-app">Starting the app<a class="headerlink" href="#starting-the-app" title="Permanent link">&para;</a></h3>
<p>You can start the app from the Android launcher, from Android Studio, or with <code>adb</code></p>
<h4 id="launching-from-the-launcher">Launching from the launcher<a class="headerlink" href="#launching-from-the-launcher" title="Permanent link">&para;</a></h4>
<p>Just tap the app icon on the launcher, check the TCP port that is configured, and tap
the "Start" button.</p>
<h4 id="launching-with-adb">Launching with <code>adb</code><a class="headerlink" href="#launching-with-adb" title="Permanent link">&para;</a></h4>
<p>Using the <code>am</code> command, you can start the activity, and pass it arguments so that you can
automatically start the proxy, and/or set the port number.</p>
<div class="admonition tip">
<p class="admonition-title">Launching from adb with auto-start</p>
<div class="highlight"><pre><span></span><code>$<span class="w"> </span>adb<span class="w"> </span>shell<span class="w"> </span>am<span class="w"> </span>start<span class="w"> </span>-n<span class="w"> </span>com.github.google.bumble.remotehci/.MainActivity<span class="w"> </span>--ez<span class="w"> </span>autostart<span class="w"> </span><span class="nb">true</span>
</code></pre></div>
</div>
<div class="admonition tip">
<p class="admonition-title">Launching from adb with auto-start and a port</p>
<p>In this example, we auto-start the proxy upon launch, with the port set to 9995
<div class="highlight"><pre><span></span><code>$<span class="w"> </span>adb<span class="w"> </span>shell<span class="w"> </span>am<span class="w"> </span>start<span class="w"> </span>-n<span class="w"> </span>com.github.google.bumble.remotehci/.MainActivity<span class="w"> </span>--ez<span class="w"> </span>autostart<span class="w"> </span><span class="nb">true</span><span class="w"> </span>--ei<span class="w"> </span>port<span class="w"> </span><span class="m">9995</span>
</code></pre></div></p>
</div>
<h4 id="selecting-a-tcp-port">Selecting a TCP port<a class="headerlink" href="#selecting-a-tcp-port" title="Permanent link">&para;</a></h4>
<p>The RemoteHCI app's main activity has a "TCP Port" setting where you can change the port on
which the proxy is accepting connections. If the default value isn't suitable, you can
change it there (you can also use the special value 0 to let the OS assign a port number for you).</p>
<h3 id="connecting-to-the-proxy">Connecting to the proxy<a class="headerlink" href="#connecting-to-the-proxy" title="Permanent link">&para;</a></h3>
<p>To connect the Bumble stack to the proxy, you need to be able to reach the phone's network
stack. This can be done over the phone's WiFi connection, or, alternatively, using an <code>adb</code>
TCP forward (which should be faster than over WiFi).</p>
<div class="admonition tip">
<p class="admonition-title">Forwarding TCP with <code>adb</code></p>
<p>To connect to the proxy via an <code>adb</code> TCP forward, use:
<div class="highlight"><pre><span></span><code>$<span class="w"> </span>adb<span class="w"> </span>forward<span class="w"> </span>tcp:&lt;outside-port&gt;<span class="w"> </span>tcp:&lt;inside-port&gt;
</code></pre></div>
Where <code>&lt;outside-port&gt;</code> is the port number for a listening socket on your laptop or
desktop machine, and <inside-port> is the TCP port selected in the app's user interface.
Those two ports may be the same, of course.
For example, with the default TCP port 9993:
<div class="highlight"><pre><span></span><code>$<span class="w"> </span>adb<span class="w"> </span>forward<span class="w"> </span>tcp:9993<span class="w"> </span>tcp:9993
</code></pre></div></p>
</div>
<p>Once you've ensured that you can reach the proxy's TCP port on the phone, either directly or
via an <code>adb</code> forward, you can then use it as a Bumble transport, using the transport name:
<code>tcp-client:&lt;host&gt;:&lt;port&gt;</code> syntax.</p>
<div class="admonition example">
<p class="admonition-title">Connecting a Bumble client</p>
<p>Connecting the <code>bumble-controller-info</code> app to the phone's controller.
Assuming you have set up an <code>adb</code> forward on port 9993:
<div class="highlight"><pre><span></span><code>$<span class="w"> </span>bumble-controller-info<span class="w"> </span>tcp-client:localhost:9993
</code></pre></div></p>
<p>Or over WiFi with, in this example, the IP address of the phone being <code>192.168.86.27</code>
<div class="highlight"><pre><span></span><code>$<span class="w"> </span>bumble-controller-info<span class="w"> </span>tcp-client:192.168.86.27:9993
</code></pre></div></p>
</div>
</article>
</div>
</div>
</main>
<footer class="md-footer">
<div class="md-footer-nav">
<nav class="md-footer-nav__inner md-grid">
<a href="index.html" title="Overview" class="md-flex md-footer-nav__link md-footer-nav__link--prev" rel="prev">
<div class="md-flex__cell md-flex__cell--shrink">
<i class="md-icon md-icon--arrow-back md-footer-nav__button"></i>
</div>
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
<span class="md-flex__ellipsis">
<span class="md-footer-nav__direction">
Previous
</span>
Overview
</span>
</div>
</a>
<a href="../hive/index.html" title="Overview" class="md-flex md-footer-nav__link md-footer-nav__link--next" rel="next">
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
<span class="md-flex__ellipsis">
<span class="md-footer-nav__direction">
Next
</span>
Overview
</span>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<i class="md-icon md-icon--arrow-forward md-footer-nav__button"></i>
</div>
</a>
</nav>
</div>
<div class="md-footer-meta md-typeset">
<div class="md-footer-meta__inner md-grid">
<div class="md-footer-copyright">
<div class="md-footer-copyright__highlight">
Copyright 2021-2023 Google LLC
</div>
</div>
<div class="md-social">
</div>
</div>
</div>
</footer>
</div>
<div class="md-dialog" data-md-component="dialog">
<div class="md-dialog__inner md-typeset"></div>
</div>
<script id="__config" type="application/json">{"base": "..", "features": [], "search": "../assets/javascripts/workers/search.f886a092.min.js", "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}}</script>
<script src="../assets/javascripts/bundle.aecac24b.min.js"></script>
</body>
</html>