Пример #1
0
DSME_HANDLER(DSM_MSGTYPE_DBUS_CONNECT, client, msg)
{
  dsme_log(LOG_DEBUG, "thermalobject_hw: DBUS_CONNECT");
  dsme_dbus_bind_methods(&bound, methods, service, interface);
}
Пример #2
0
void
module_fini(void)
{
    dsme_dbus_unbind_signals(&bound, signals);
    dsme_log(LOG_DEBUG, "libwlanloader.so unloaded");
}
Пример #3
0
void
module_init(module_t * handle)
{
    dsme_log(LOG_DEBUG, "wlanloader.so loaded");
}
Пример #4
0
DSME_HANDLER(DSM_MSGTYPE_DBUS_DISCONNECT, client, msg)
{
    dsme_log(LOG_DEBUG, "wlanloader: DBUS_DISCONNECT");
    dsme_dbus_unbind_signals(&bound, signals);
}
Пример #5
0
DSME_HANDLER(DSM_MSGTYPE_DBUS_CONNECT, client, msg)
{
    dsme_log(LOG_DEBUG, "wlanloader: DBUS_CONNECT");

    check_loader_needed();
}
Пример #6
0
static dbus_bool_t dbus_bus_get_unix_process_id(DBusConnection* conn,
                                                const char*     name,
                                                pid_t*          pid)
{
  DBusMessage*  msg;
  DBusMessage*  reply;
  DBusError     err;
  dbus_uint32_t pid_arg;

  msg = dbus_message_new_method_call("org.freedesktop.DBus",
                                     "/org/freedesktop/DBus",
                                     "org.freedesktop.DBus",
                                     "GetConnectionUnixProcessID");
  if (!msg) {
      dsme_log(LOG_DEBUG, "Unable to allocate new message");
      return FALSE;
  }

  if (!dbus_message_append_args(msg,
                                DBUS_TYPE_STRING,
                                &name,
                                DBUS_TYPE_INVALID))
  {
      dsme_log(LOG_DEBUG, "Unable to append arguments to message");
      dbus_message_unref(msg);
      return FALSE;
  }

  // TODO: it is risky that we are blocking
  dbus_error_init(&err);
  reply = dbus_connection_send_with_reply_and_block(conn, msg, -1, &err);
  if (dbus_error_is_set(&err)) {
      dsme_log(LOG_DEBUG,
               "Sending GetConnectionUnixProcessID failed: %s",
               err.message);
      dbus_error_free(&err);
      dbus_message_unref(msg);
      return FALSE;
  }

  dbus_error_init(&err);
  dbus_message_get_args(reply,
                        &err,
                        DBUS_TYPE_UINT32,
                        &pid_arg,
                        DBUS_TYPE_INVALID);
  if (dbus_error_is_set(&err)) {
      dsme_log(LOG_DEBUG,
               "Getting GetConnectionUnixProcessID args failed: %s",
               err.message);
      dbus_error_free(&err);
      dbus_message_unref(msg);
      dbus_message_unref(reply);
      return FALSE;
  }

  *pid = pid_arg;

  dbus_message_unref(msg);
  dbus_message_unref(reply);

  return TRUE;
}