adb: Set a hostname for mDNS
Now all devices won't appear as "Android." Should make it easier to multiplex. Test: Verified locally on a raspberry pi 3 Bug: 28887278 (cherry picked from 815b23319635d264ae0ce2c8c29a5776a57b8051) Change-Id: Icfd0116477543af6a3049c14d818c1cff7fc3b93
This commit is contained in:
parent
6cd5e0b4ef
commit
1fe3cae67e
1 changed files with 7 additions and 3 deletions
|
@ -61,9 +61,13 @@ static void setup_mdns_thread(void* /* unused */) {
|
|||
start_mdns();
|
||||
std::lock_guard<std::mutex> lock(mdns_lock);
|
||||
|
||||
auto error = DNSServiceRegister(&mdns_ref, 0, 0, nullptr, "_adb._tcp",
|
||||
nullptr, nullptr, htobe16((uint16_t)port),
|
||||
0, nullptr, mdns_callback, nullptr);
|
||||
std::string hostname = "adb-";
|
||||
hostname += android::base::GetProperty("ro.serialno", "unidentified");
|
||||
|
||||
auto error = DNSServiceRegister(&mdns_ref, 0, 0, hostname.c_str(),
|
||||
kADBServiceType, nullptr, nullptr,
|
||||
htobe16((uint16_t)port), 0, nullptr,
|
||||
mdns_callback, nullptr);
|
||||
|
||||
if (error != kDNSServiceErr_NoError) {
|
||||
LOG(ERROR) << "Could not register mDNS service (" << error << ").";
|
||||
|
|
Loading…
Reference in a new issue