Commit 04e3a753 authored by spiiroin's avatar spiiroin

[usb-moded] Use MEEGOLOCK features only when enabled. Fixes MER#1765

The is_in_user_state() is used unconditionally, but it is available only
when --enable-meegodevlock option has been passed to configure. Also,
the related "usb_moded-dsme.h" is included both unconditionally and from
withing a #ifdef MEEGOLOCK block - which hides the configuration problem
until build proceeds to linking phase.

Make the call is_in_user_state() only if MEEGOLOCK is defined.

Remove the extraneous "usb_moded-dsme.h" include to make such errors
visible already in compilation stage due to missing prototypes.

Also, make sure the "usb_moded-dsme.h" can't be included without
warnings unless MEEGOLOCK is defined.
Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
parent 3b81d0f9
......@@ -21,6 +21,10 @@
02110-1301 USA
*/
#ifndef MEEGOLOCK
# warning usb_moded-dsme.h included without enabling MEEGOLOCK
#endif
gboolean is_in_user_state(void);
gboolean dsme_listener_start(void);
void dsme_listener_stop(void);
......@@ -32,13 +32,13 @@
#include <signal.h>
#include <libkmod.h>
#ifdef SYSTEMD
#include <systemd/sd-daemon.h>
#endif
#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"
......@@ -55,6 +55,7 @@
#include "usb_moded-mac.h"
#include "usb_moded-android.h"
#include "usb_moded-systemd.h"
#ifdef MEEGOLOCK
#include "usb_moded-dsme.h"
#endif
......@@ -280,10 +281,12 @@ rethink_usb_charging_fallback(void)
/* Device must be in USER state or in rescue mode
*/
#ifdef MEEGOLOCK
if( !is_in_user_state() && !rescue_mode ) {
log_notice("device is not in USER mode; stay in %s", usb_mode);
goto EXIT;
}
#endif
log_debug("attempt to leave %s", usb_mode);
set_usb_connected_state();
......
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