Commit 4e7f9709 authored by spiiroin's avatar spiiroin

[dsme] Make device state tracking asynchronous. MER#1694

Usb-moded is making repeated blocking device state queries even when the
component providing the service is not running.

Use cached device state and keep it up to date fully asynchronously by
tracking dsme service availability and state changes it signals.
Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
parent d72c59ae
......@@ -689,7 +689,7 @@ static void usb_moded_get_name_owner_cb(DBusPendingCall *pc, void *aptr)
DBUS_TYPE_INVALID) )
{
if( strcmp(err.name, DBUS_ERROR_NAME_HAS_NO_OWNER) )
log_warning("parse error: %s: %s", err.name, err.message);
log_err("parse error: %s: %s", err.name, err.message);
goto EXIT;
}
......
This diff is collapsed.
/**
@file usb_moded-dsme.h
Copyright (C) 2013 Jolla. All rights reserved.
Copyright (C) 2013-2016 Jolla. All rights reserved.
@author: Philippe De Swert <philippe.deswert@jollamobile.com>
@author: Simo Piiroinen <simo.piiroinen@jollamobile.com>
This program is free software; you can redistribute it and/or
modify it under the terms of the Lesser GNU General Public License
......@@ -20,4 +21,6 @@
02110-1301 USA
*/
int is_in_user_state(void);
gboolean is_in_user_state(void);
gboolean dsme_listener_start(void);
void dsme_listener_stop(void);
......@@ -38,6 +38,7 @@
#include "usb_moded.h"
#include "usb_moded-modes.h"
#include "usb_moded-dsme.h"
#include "usb_moded-dbus.h"
#include "usb_moded-dbus-private.h"
#include "usb_moded-hw-ab.h"
......@@ -1191,6 +1192,11 @@ int main(int argc, char* argv[])
goto EXIT;
}
if( !dsme_listener_start() ) {
log_crit("dsme tracking could not be started");
goto EXIT;
}
  • Might need an #ifdef for MEEGOLOCK, otherwise this will break usb-moded for devices without dsme.

  • This particular place will exit only if dbus daemon is not working (starts waiting for dsme to appear on system bus).

    But yeah, if dsme never appears (i.e. device without dsme) -> arrival to USER mode never happens - I guess that needs to change in does not have dsme -cases?

  • If dsme is not installed / started -> the result is that is_in_user_state() keeps on returning FALSE forever.

    However every place where is_in_user_state() is called from is already within "#ifdef MEEGOLOCK", so effectively it should still work without dsme too as long as MEEGOLOCK is not defined.

    However the usb_moded-dsme.c is not included in the build without MEEGOLOCK -> have to add #ifdefs or it will not even build.

  • Well the dsme code does not get compiled when the devicelock/dsme is omitted, so it would already fail at build time. See src/Makefile.am

    if MEEGOLOCK usb_moded_SOURCES +=
    usb_moded-devicelock.h
    usb_moded-devicelock.c
    usb_moded-dsme.h
    usb_moded-dsme.c endif

  • Yeah, just arrived to the same conclusion -> will fix.

Please register or sign in to reply
/* init daemon into a clean state first, then dbus and hw_abstraction last */
usb_moded_init();
......@@ -1244,6 +1250,7 @@ int main(int argc, char* argv[])
result = EXIT_SUCCESS;
g_main_loop_run(mainloop);
EXIT:
dsme_listener_stop();
handle_exit();
allow_suspend();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment