Add support for service debugging

This commit is contained in:
Marcel Holtmann 2007-01-24 05:45:11 +00:00
parent 3021d8e125
commit 398f681448
3 changed files with 34 additions and 0 deletions

View File

@ -1426,3 +1426,32 @@ void input_dbus_exit(void)
dbus_connection_unref(connection);
}
void internal_service(const char *identifier)
{
DBusMessage *msg, *reply;
const char *name = "Input Service Debug", *desc = "";
info("Registering service");
msg = dbus_message_new_method_call("org.bluez", "/org/bluez",
"org.bluez.Database", "RegisterService");
if (!msg) {
error("Can't create service register method");
return;
}
dbus_message_append_args(msg, DBUS_TYPE_STRING, &identifier,
DBUS_TYPE_STRING, &name,
DBUS_TYPE_STRING, &desc, DBUS_TYPE_INVALID);
reply = dbus_connection_send_with_reply_and_block(connection, msg, -1, NULL);
if (!reply) {
error("Can't register service");
return;
}
dbus_message_unref(reply);
dbus_connection_flush(connection);
}

View File

@ -27,4 +27,6 @@
int input_dbus_init(void);
void input_dbus_exit(void);
void internal_service(const char *identifier);
#endif /* __INPUT_SERVICE_H */

View File

@ -76,6 +76,9 @@ int main(int argc, char *argv[])
exit(1);
}
if (argc > 1 && !strcmp(argv[1], "-s"))
internal_service("input");
server_start();
g_main_loop_run(main_loop);