[systemd-devel] ListenUSBFucntion socket together with adb service

Piotr Lobacz piotr.lobacz at softgent.com
Wed Dec 23 13:53:58 UTC 2020


Hi all,
I am trying to modify mine adb daemon to work with systemd. I have read that in order to work with daemon and socket  which will be listening on USB sockets i need to modify the implementation of mine daemon in order to work with systemd. To do this, I have modified lines in my adbd, so it is first using sd_listen_fds(0) command to check for file descriptors passed by the system manager. If this succed, than i am setting SD_LISTEN_FDS_START + proper_ep_id for control, bulk_out and bulk_in.

It all works just fine for the first connection, but if I unplug the usb cable and plug it back again, mine initialization command is run again and is falling because of calling again sd_listen_fds(0) which returns 1 instead of 3. I saw in the code that these fds may be closed by the adbd but commenting this didn' help. Is it possible that systemd on disconnecting the device may close them?

BR
Piotr Łobacz

[https://softgent.com/wp-content/uploads/2020/01/Zasob-14.png]<https://www.softgent.com>

Softgent Sp. z o.o., Budowlanych 31d, 80-298 Gdansk, POLAND

KRS: 0000674406, NIP: 9581679801, REGON: 367090912

www.softgent.com

Sąd Rejonowy Gdańsk-Północ w Gdańsku, VII Wydział Gospodarczy Krajowego Rejestru Sądowego

KRS 0000674406, Kapitał zakładowy: 25 000,00 zł wpłacony w całości.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20201223/684fec73/attachment.htm>


More information about the systemd-devel mailing list