File: adbd-allow-notifying-systemd.patch

package info (click to toggle)
android-platform-tools 35.0.2-1~exp6
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 211,716 kB
  • sloc: cpp: 995,749; java: 290,495; ansic: 145,647; xml: 58,531; python: 39,608; sh: 14,500; javascript: 5,198; asm: 4,866; makefile: 3,115; yacc: 769; awk: 368; ruby: 183; sql: 140; perl: 88; lex: 67
file content (40 lines) | stat: -rw-r--r-- 1,220 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
From: Arnaud Ferraris <arnaud.ferraris@collabora.com>
Date: Fri, 30 Sep 2022 16:54:02 +0200
Subject: adb: daemon: allow notifying systemd when ready

When using `systemd` on Linux, we should allow `adbd` to notify
`systemd` once it has started and configured its USB/network interface.
This allows us to (for example) wait for the daemon to bind to the
FunctionFS endpoints, then activate the USB gadget.

Forwarded: https://android-review.googlesource.com/c/platform/packages/modules/adb/+/2238429
---
 packages/modules/adb/daemon/main.cpp | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/packages/modules/adb/daemon/main.cpp b/packages/modules/adb/daemon/main.cpp
index d1b999b..deba593 100644
--- a/packages/modules/adb/daemon/main.cpp
+++ b/packages/modules/adb/daemon/main.cpp
@@ -49,6 +49,10 @@
 #include "selinux/android.h"
 #endif
 
+#if defined(__linux__)
+#include <systemd/sd-daemon.h>
+#endif
+
 #include "adb.h"
 #include "adb_auth.h"
 #include "adb_listeners.h"
@@ -302,6 +306,10 @@ int adbd_main(int server_port) {
     init_jdwp();
     D("adbd_main(): post init_jdwp()");
 
+#if defined(__linux__)
+    sd_notify(1, "READY=1");
+#endif
+
     D("Event loop starting");
     fdevent_loop();