[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 36/37] ui/dbus: register D-Bus VC handler
From: |
marcandre . lureau |
Subject: |
[PATCH v2 36/37] ui/dbus: register D-Bus VC handler |
Date: |
Sun, 10 Oct 2021 01:08:37 +0400 |
From: Marc-André Lureau <marcandre.lureau@redhat.com>
Export the default consoles over the D-Bus chardev.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
ui/dbus.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 53 insertions(+)
diff --git a/ui/dbus.c b/ui/dbus.c
index 38d6ccc607..97248ceadb 100644
--- a/ui/dbus.c
+++ b/ui/dbus.c
@@ -352,6 +352,57 @@ dbus_display_class_init(ObjectClass *oc, void *data)
get_gl_mode, set_gl_mode);
}
+#define TYPE_CHARDEV_VC "chardev-vc"
+
+typedef struct DBusVCClass {
+ DBusChardevClass parent_class;
+
+ void (*parent_parse)(QemuOpts *opts, ChardevBackend *b, Error **errp);
+} DBusVCClass;
+
+DECLARE_CLASS_CHECKERS(DBusVCClass, DBUS_VC,
+ TYPE_CHARDEV_VC)
+
+static void
+dbus_vc_parse(QemuOpts *opts, ChardevBackend *backend,
+ Error **errp)
+{
+ DBusVCClass *klass = DBUS_VC_CLASS(object_class_by_name(TYPE_CHARDEV_VC));
+ const char *name = qemu_opt_get(opts, "name");
+ const char *id = qemu_opts_id(opts);
+
+ if (name == NULL) {
+ name = "";
+ if (g_str_has_prefix(id, "compat_monitor")) {
+ name = "org.qemu.monitor.hmp.0";
+ }
+ if (g_str_has_prefix(id, "serial")) {
+ name = "org.qemu.console.serial.0";
+ }
+ if (!qemu_opt_set(opts, "name", name, errp)) {
+ return;
+ }
+ }
+
+ klass->parent_parse(opts, backend, errp);
+}
+
+static void
+dbus_vc_class_init(ObjectClass *oc, void *data)
+{
+ DBusVCClass *klass = DBUS_VC_CLASS(oc);
+ ChardevClass *cc = CHARDEV_CLASS(oc);
+
+ klass->parent_parse = cc->parse;
+ cc->parse = dbus_vc_parse;
+}
+
+static const TypeInfo dbus_vc_type_info = {
+ .name = TYPE_CHARDEV_VC,
+ .parent = TYPE_CHARDEV_DBUS,
+ .class_init = dbus_vc_class_init,
+};
+
static void
early_dbus_init(DisplayOptions *opts)
{
@@ -365,6 +416,8 @@ early_dbus_init(DisplayOptions *opts)
display_opengl = 1;
}
+
+ type_register(&dbus_vc_type_info);
}
static void
--
2.33.0.721.g106298f7f9
- Re: [PATCH v2 26/37] ui: add a D-Bus display backend, (continued)
- [PATCH v2 27/37] ui/dbus: add p2p=on/off option, marcandre . lureau, 2021/10/09
- [PATCH v2 28/37] tests/qtests: add qtest_qmp_add_client(), marcandre . lureau, 2021/10/09
- [PATCH v2 29/37] tests: start dbus-display-test, marcandre . lureau, 2021/10/09
- [PATCH v2 30/37] audio: add "dbus" audio backend, marcandre . lureau, 2021/10/09
- [PATCH v2 31/37] ui/dbus: add clipboard interface, marcandre . lureau, 2021/10/09
- [PATCH v2 32/37] chardev: teach socket to accept no addresses, marcandre . lureau, 2021/10/09
- [PATCH v2 33/37] chardev: make socket derivable, marcandre . lureau, 2021/10/09
- [PATCH v2 34/37] option: add g_auto for QemuOpts, marcandre . lureau, 2021/10/09
- [PATCH v2 35/37] ui/dbus: add chardev backend & interface, marcandre . lureau, 2021/10/09
- [PATCH v2 36/37] ui/dbus: register D-Bus VC handler,
marcandre . lureau <=
- [PATCH v2 37/37] MAINTAINERS: update D-Bus section, marcandre . lureau, 2021/10/09
- Re: [PATCH v2 00/37] Add D-Bus display backend, Gerd Hoffmann, 2021/10/13