From e8dd83c537b5a74a08263fb8b5a5a7812185d4da Mon Sep 17 00:00:00 2001 From: Jeremy Whiting <jeremy.whiting@collabora.com> Date: Fri, 18 Mar 2022 10:40:16 -0600 Subject: [PATCH] Add avahi txt section with defaults for now. TODO: Add command line options parsing to set hooks paths, devkit entry point, etc. Pass register data to register hooks. Provide properties.json. --- src/steamos-devkit-service.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/steamos-devkit-service.py b/src/steamos-devkit-service.py index e2996f8..2f50c7f 100644 --- a/src/steamos-devkit-service.py +++ b/src/steamos-devkit-service.py @@ -37,7 +37,9 @@ import urllib.parse SERVICE_PORT = 32000 PACKAGE = "steamos-devkit-service" DEVKIT_HOOKS_DIR = "/usr/share/steamos-devkit/hooks" +CURRENT_TXTVERS = "txtvers=1" +entry_point = "devkit-1" # root until config is loaded and told otherwise, etc. entry_point_user = "root" device_users = [] @@ -161,11 +163,13 @@ class DevkitService: if 'Settings' in global_config: settings = global_config["Settings"] + self.settings = dict(settings.items()) if 'Port' in settings: self.port = int(settings["Port"]) if 'Settings' in user_config: settings = user_config["Settings"] + self.settings = dict(settings.items()) if 'Port' in settings: self.port = int(settings["Port"]) @@ -198,7 +202,15 @@ class DevkitService: self.httpd.server_activate() def publish(self): + global entry_point + global entry_point_user + bus = dbus.SystemBus() + self.text = ["{}".format(CURRENT_TXTVERS).encode(), + "settings={}".format(json.dumps(self.settings)).encode(), + "login={}".format(entry_point_user).encode(), + "devkit1={}".format(entry_point).encode() + ] server = dbus.Interface( bus.get_object( avahi.DBUS_NAME, @@ -211,7 +223,7 @@ class DevkitService: avahi.DBUS_INTERFACE_ENTRY_GROUP) g.AddService(avahi.IF_UNSPEC, avahi.PROTO_UNSPEC, dbus.UInt32(0), self.name, self.stype, self.domain, self.host, - dbus.UInt16(self.port), self.text) + dbus.UInt16(int(self.port)), self.text) g.Commit() self.group = g -- GitLab