Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'mer1765_broken_config' into 'master'
Use MEEGOLOCK features only when enabled

See merge request !24
  • Loading branch information
spiiroin committed Mar 13, 2017
2 parents 3b81d0f + 1e3378f commit 62d2183
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/usb_moded-dsme.h
Expand Up @@ -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);
5 changes: 5 additions & 0 deletions src/usb_moded-network.c
Expand Up @@ -53,10 +53,15 @@
#define UDHCP_CONFIG_LINK "/etc/udhcpd.conf"

const char default_interface[] = "usb0";

/** IP forwarding configuration block */
typedef struct ipforward_data
{
/** Address of primary DNS */
char *dns1;
/** Address of secondary DNS */
char *dns2;
/** Interface from which packets should be forwarded */
char *nat_interface;
}ipforward_data;

Expand Down
3 changes: 3 additions & 0 deletions src/usb_moded-udev.c
Expand Up @@ -50,8 +50,11 @@ static int cleanup = 0;
static int cable = 0, charger = 0;
static guint cable_connection_timeout_id = 0;

/** Bookkeeping data for power supply locating heuristics */
typedef struct power_device {
/** Device path used by udev */
const char *syspath;
/** Likelyhood of being power supply */
int score;
} power_device;

Expand Down
5 changes: 4 additions & 1 deletion src/usb_moded.c
Expand Up @@ -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"
Expand All @@ -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
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 62d2183

Please sign in to comment.