1``` 2adb can be configured to work with systemd-style socket activation, 3allowing the daemon to start automatically when the adb control port 4is forwarded across a network. You need two files, placed in the usual 5systemd service directories (e.g., ~/.config/systemd/user for a user 6service). 7 8adb.service: 9 10--- START adb.service CUT HERE --- 11[Unit] 12Description=adb 13After=adb.socket 14Requires=adb.socket 15[Service] 16Type=simple 17# FD 3 is part of the systemd interface 18ExecStart=/path/to/adb server nodaemon -L acceptfd:3 19--- END adb.service CUT HERE --- 20 21--- START adb.socket CUT HERE --- 22[Unit] 23Description=adb 24PartOf=adb.service 25[Socket] 26ListenStream=127.0.0.1:5037 27Accept=no 28[Install] 29WantedBy=sockets.target 30--- END adb.socket CUT HERE --- 31 32After installing the adb service, the adb server will be started 33automatically on any connection to 127.0.0.1:5037 (the default adb 34control port), even after adb kill-server kills the server. 35 36Other "superserver" launcher systems (like macOS launchd) can be 37configured analogously. The important part is that adb be started with 38"server" and "nodaemon" command line arguments and that the listen 39address (passed to -L) name a file descriptor that's ready to 40accept(2) connections and that's already bound to the desired address 41and listening. inetd-style pre-accepted sockets do _not_ work in this 42configuration: the file descriptor passed to acceptfd must be the 43serve socket, not the accepted connection socket. 44```