mirror of
https://git.kernel.org/pub/scm/bluetooth/bluez.git
synced 2024-11-17 01:04:40 +08:00
Add support for service debugging
This commit is contained in:
parent
3021d8e125
commit
398f681448
@ -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);
|
||||
}
|
||||
|
@ -27,4 +27,6 @@
|
||||
int input_dbus_init(void);
|
||||
void input_dbus_exit(void);
|
||||
|
||||
void internal_service(const char *identifier);
|
||||
|
||||
#endif /* __INPUT_SERVICE_H */
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user