File: adbd-allow-notifying-systemd.patch

package info (click to toggle)
android-platform-tools 34.0.5-12~bpo12%2B1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-backports
  • size: 150,904 kB
  • sloc: cpp: 805,786; java: 293,500; ansic: 128,288; xml: 127,491; python: 41,481; sh: 14,245; javascript: 9,665; cs: 3,846; asm: 2,049; makefile: 1,917; yacc: 440; 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();