Commit a41635a5 authored by Philippe De Swert's avatar Philippe De Swert

adding upstart appsync option

parent 77679b78
* verify appsync/usb_moded functionality with multiple sessions
* Fix daemon mode
* Make sure that --enable-dynamic-modes enables app-sync by default
AC_INIT([usb_moded], [0.49])
AC_INIT([usb_moded], [0.52])
AM_INIT_AUTOMAKE([-Wall -Werror foreign])
AM_CONFIG_HEADER([config.h])
......@@ -11,7 +11,7 @@ AC_C_CONST
AC_HEADER_STDC
test_gcc_flag() {
AC_LANG_CONFTEST([int main() {}])
# AC_LANG_CONFTEST([int main() {}])
$CC -c conftest.c $CFLAGS $@ > /dev/null 2> /dev/null
ret=$?
rm -f conftest.o
......@@ -53,11 +53,11 @@ AM_CONDITIONAL([NOKIA], [test x$nokia = xtrue])
AC_ARG_ENABLE([meegodevlock], AS_HELP_STRING([--enable-meegodevlock], [Enable Meego devicelock @<:@default=false@:>@]),
[case "${enableval}" in
yes) meegodevlock=true ; CFLAGS="-DMLOCK $CFLAGS" ;;
yes) meegodevlock=true ; CFLAGS="-DMEEGOLOCK $CFLAGS" ;;
no) meegodevlock=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-meegodevlock]) ;;
esac],[meegodevlock=false])
AM_CONDITIONAL([MLOCK], [test x$meegodevlock = xtrue])
AM_CONDITIONAL([MEEGOLOCK], [test x$meegodevlock = xtrue])
AC_ARG_ENABLE([n900], AS_HELP_STRING([--enable-n900], [Enable N900 extra's @<:@default=false@:>@]),
[case "${enableval}" in
......@@ -87,10 +87,18 @@ AC_ARG_ENABLE([app_sync], AS_HELP_STRING([--enable-app-sync], [Enable applicatio
[case "${enableval}" in
yes) app_sync=true ; CFLAGS="-DAPP_SYNC $CFLAGS" ;;
no) app_sync=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-app_sync]) ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-app-sync]) ;;
esac],[app_sync=false])
AM_CONDITIONAL([APP_SYNC], [test x$app_sync = xtrue])
AC_ARG_ENABLE([dynamic_modes], AS_HELP_STRING([--enable-dynamic-modes], [Enable adding modes with ini files @<:@default=false@:>@]),
[case "${enableval}" in
yes) dynamic_modes=true ; CFLAGS="-DDYN_MODE $CFLAGS" ;;
no) dynamic_modes=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-dynamic-modes]) ;;
esac],[dynamic_modes=false])
AM_CONDITIONAL([DYN_MODE], [test x$dynamic_modes = xtrue])
AC_ARG_ENABLE([hal], AS_HELP_STRING([--enable-hal], [Enable deprecated hal interface @<:@default=false@:>@]),
[case "${enableval}" in
yes) hal=true ; CFLAGS="-DHAL -I/usr/include/hal -lhal $CFLAGS" ;;
......@@ -107,6 +115,14 @@ AC_ARG_ENABLE([udev], AS_HELP_STRING([--enable-udev], [Enable udev interface @<:
esac],[udev=false])
AM_CONDITIONAL([UDEV], [test x$udev = xtrue])
AC_ARG_ENABLE([upstart], AS_HELP_STRING([--enable-upstart], [Enable upstart interface for appsync @<:@default=true@:>@]),
[case "${enableval}" in
yes) upstart=true ; CFLAGS="-DUPSTART $CFLAGS" ;;
no) upstart=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-upstart]) ;;
esac],[upstart=false])
AM_CONDITIONAL([UPSTART], [test x$upstart = xtrue])
#TODO: Figure out how to check for this depending on the gconf flag
# gconf-2.0 >= 2.16.0
......
usb-moded (0.52) unstable; urgency=low
* Add upstart appsync functionality
* Coverity fixes
-- Philippe De Swert <philippe.de-swert@nokia.com> Thu, 01 Mar 2012 13:57:21 +0200
usb-moded (0.50) unstable; urgency=low
* Make sure multiple types of devicelock can be used
* Switch to g_ether by default for the time being
-- Philippe De Swert <philippe.de-swert@nokia.com> Wed, 15 Feb 2012 17:42:51 +0200
usb-moded (0.49) unstable; urgency=low
* small memory usage fixes
......
......@@ -51,7 +51,7 @@ usb_moded_SOURCES += \
usb_moded-trigger.c
endif
if MLOCK
if MEEGOLOCK
usb_moded_SOURCES += \
usb_moded-devicelock.h \
usb_moded-devicelock.c
......@@ -63,7 +63,17 @@ usb_moded_SOURCES += \
usb_moded-appsync.h \
usb_moded-appsync-dbus.c \
usb_moded-appsync-dbus.h \
usb_moded-appsync-dbus-private.h \
usb_moded-appsync-dbus-private.h
endif
if UPSTART
usb_moded_SOURCES += \
usb_moded-upstart.h \
usb_moded-upstart.c
endif
if DYN_MODE
usb_moded_SOURCES += \
usb_moded-dyn-config.c \
usb_moded-dyn-config.h
endif
......
......@@ -38,6 +38,7 @@
#include "usb_moded-appsync-dbus-private.h"
#include "usb_moded-modesetting.h"
#include "usb_moded-log.h"
#include "usb_moded-upstart.h"
static struct list_elem *read_file(const gchar *filename);
static gboolean enumerate_usb(gpointer data);
......@@ -123,6 +124,8 @@ static struct list_elem *read_file(const gchar *filename)
log_debug("Launch = %s\n", list_item->launch);
list_item->mode = g_key_file_get_string(settingsfile, APP_INFO_ENTRY, APP_INFO_MODE_KEY, NULL);
log_debug("Launch mode = %s\n", list_item->mode);
list_item->upstart = g_key_file_get_integer(settingsfile, APP_INFO_ENTRY, APP_INFO_UPSTART_KEY, NULL);
log_debug("Upstart control = %d\n", list_item->upstart);
cleanup:
......@@ -198,7 +201,15 @@ int activate_sync(const char *mode)
if(!strcmp(mode, data->mode))
{
log_debug("launching app %s\n", data->launch);
usb_moded_dbus_app_launch(data->launch);
#ifdef UPSTART
if(data->upstart)
{
if(!upstart_control_job(data->name, UPSTART_START))
mark_active(data->name);
}
else
#endif /* UPSTART */
usb_moded_dbus_app_launch(data->launch);
}
}
......@@ -259,9 +270,12 @@ static gboolean enumerate_usb(gpointer data)
}
else
{
#ifdef NOKIA_EXTRA
/* activate usb connection/enumeration */
write_to_file("/sys/devices/platform/musb_hdrc/gadget/softconnect", "1");
log_debug("Softconnect enumeration done\n");
#endif
enum_tag = sync_tag;
......@@ -276,3 +290,23 @@ static gboolean enumerate_usb(gpointer data)
/* return false to stop the timer from repeating */
return FALSE;
}
#ifdef UPSTART
int appsync_stop(void)
{
GList *iter = 0;
for( iter = sync_list; iter; iter = g_list_next(iter) )
{
struct list_elem *data = iter->data;
if(data->upstart)
{
log_debug("Stopping %s\n", data->launch);
if(upstart_control_job(data->name, UPSTART_STOP))
log_debug("Failed to stop %s\n", data->name);
}
}
return(0);
}
#endif /* UPSTART */
......@@ -25,6 +25,7 @@
#define APP_INFO_MODE_KEY "mode"
#define APP_INFO_NAME_KEY "name"
#define APP_INFO_LAUNCH_KEY "launch"
#define APP_INFO_UPSTART_KEY "upstart"
/**
* keep all the needed info together for launching an app
......@@ -36,9 +37,11 @@ typedef struct list_elem
char *mode; /* mode in which to launch the app */
char *launch; /* dbus launch command/address */
int active; /* marker to check if the app has started sucessfully */
int upstart; /* marker to know if we start it with upstart or not */
/*@}*/
}list_elem;
void readlist(void);
int activate_sync(const char *mode);
int mark_active(const gchar *name);
int appsync_stop(void);
......@@ -148,9 +148,8 @@ static const char * get_conf_string(const gchar *entry, const gchar *key)
{
GKeyFile *settingsfile;
gboolean test = FALSE;
gchar **keys;
const char *ret = NULL, *tmp_char;
gchar **keys, *tmp_char;
const char *ret = NULL;
settingsfile = g_key_file_new();
test = g_key_file_load_from_file(settingsfile, FS_MOUNT_CONFIG_FILE, G_KEY_FILE_NONE, NULL);
if(!test)
......@@ -170,13 +169,12 @@ static const char * get_conf_string(const gchar *entry, const gchar *key)
if(tmp_char)
{
log_debug("key %s value = %s\n", key, tmp_char);
ret = g_strdup(tmp_char);
}
}
keys++;
}
g_key_file_free(settingsfile);
return(ret);
return(g_strdup(tmp_char));
}
......
......@@ -32,6 +32,7 @@
#include <dbus/dbus-glib-lowlevel.h>
#include "usb_moded-devicelock.h"
#include "usb_moded-lock.h"
#include "usb_moded-log.h"
#include "usb_moded.h"
#include "usb_moded-modes.h"
......
......@@ -22,8 +22,6 @@
*/
/*============================================================================= */
int usb_moded_get_export_permission(void);
int start_devicelock_listener(void);
#define DEVICELOCK_SERVICE "com.nokia.devicelock"
#define DEVICELOCK_REQUEST_PATH "/request"
......
/*
Copyright (C) 2012 Nokia Corporation. All rights reserved.
Author: Philippe De Swert <philippe.de-swert@nokia.com>
This program is free software; you can redistribute it and/or
modify it under the terms of the Lesser GNU General Public License
version 2 as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the Lesser GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
02110-1301 USA
*/
/*
* Function definitions to interact with a security lock to know if
we can expose the system contents or not
*/
/*============================================================================= */
int usb_moded_get_export_permission(void);
int start_devicelock_listener(void);
......@@ -27,4 +27,5 @@
#define MODE_UNDEFINED "undefined"
#define MODE_ASK "ask"
#define MODE_WINDOWS_NET "windows_network"
#define MODE_DEVELOPER "developer_mode"
......@@ -38,6 +38,7 @@
#include "usb_moded-config.h"
#include "usb_moded-modesetting.h"
#include "usb_moded-network.h"
#include "usb_moded-upstart.h"
static void report_mass_storage_blocker(const char *mountpoint, int try);
......@@ -240,11 +241,10 @@ int set_ovi_suite_mode(void)
int timeout = 1;
#endif /* NOKIA */
#ifdef APP_SYNC
activate_sync(MODE_OVI_SUITE);
#else
//system("echo 1 > /sys/devices/platform/musb_hdrc/gadget/softconnect");
write_to_file("/sys/devices/platform/musb_hdrc/gadget/softconnect", "1");
#endif /* APP_SYNC */
/* bring network interface up in case no other network is up */
......@@ -263,19 +263,21 @@ int set_ovi_suite_mode(void)
}
#endif /* N900 */
#ifdef APP_SYNC
#ifdef DYN_MODE
int set_dynamic_mode(struct mode_list_elem *data)
{
char command[256];
if(data->appsync)
activate_sync(data->mode_name);
if(data->network)
{
g_snprintf(command, 256, "ifdown %s ; ifup %s", data->network_interface, data->network_interface);
system(command);
}
return(0);
}
#endif /* APP_SYNC */
#endif /* DYN_MODE */
#ifdef NOKIA
gboolean export_cdrom(gpointer data)
......@@ -316,6 +318,11 @@ int usb_moded_mode_cleanup(const char *module)
gchar **mounts;
int ret = 0, i = 0;
log_debug("Cleaning up mode\n");
#ifdef UPSTART
appsync_stop();
#endif /* UPSTART */
if(!strcmp(module, MODULE_MASS_STORAGE))
{
......@@ -375,9 +382,9 @@ int usb_moded_mode_cleanup(const char *module)
sync();
/* bring network down immediately */
/*system("ifdown usb0"); */
/* do soft disconnect */
usb_network_down();
write_to_file("/sys/devices/platform/musb_hdrc/gadget/softconnect", "0");
/* do soft disconnect
write_to_file("/sys/devices/platform/musb_hdrc/gadget/softconnect", "0"); */
/* DIRTY WORKAROUND: acm/phonet does not work as it should, remove when it does */
system("killall -SIGTERM acm");
}
......
......@@ -21,7 +21,7 @@
/* module name definitions */
#define MODULE_NETWORK "g_nokia"
#ifdef NOKIA
#define MODULE_NETWORK_MTP "g_nokia use_mtp=1 connect=0"
#define MODULE_NETWORK_MTP "g_nokia devmode=0"
#else
#define MODULE_NETWORK_MTP "g_nokia"
#endif /* NOKIA */
......@@ -29,6 +29,7 @@
#define MODULE_CHARGING "g_mass_storage luns=1 stall=0 removable=1"
#define MODULE_NONE "none"
#define MODULE_WINDOWS_NET "g_ether"
#define MODULE_DEVELOPER "g_nokia devmode=1"
/* load module */
int usb_moded_load_module(const char *module);
......
......@@ -67,7 +67,7 @@ int usb_network_up(void)
return(ret);
#else
system("ifdown usb0 && ifup usb0");
system("ifconfig usb0 192.168.201.42");
return(0);
#endif /* CONNMAN */
}
......@@ -80,7 +80,7 @@ int usb_network_down(void)
{
#if CONNMAN
#else
system("ifdown usb0 down");
system("ifconfig usb0 down");
return(0);
#endif /* CONNMAN */
}
......@@ -38,9 +38,9 @@
#include "usb_moded-hw-ab.h"
#include "usb_moded-modesetting.h"
#include "usb_moded-trigger.h"
#ifdef MLOCK
#include "usb_moded-devicelock.h"
#endif /* MLOCK */
#if defined MEEGOLOCK
#include "usb_moded-lock.h"
#endif /* MEEGOLOCK */
/* global variables */
static struct udev *udev;
......@@ -172,38 +172,46 @@ void trigger_stop(void)
static void udev_parse(struct udev_device *dev)
{
const char *tmp;
tmp = udev_device_get_property_value(dev, get_trigger_property());
const char *tmp, *trigger = 0;
trigger = get_trigger_property();
tmp = udev_device_get_property_value(dev, trigger);
if(!tmp)
{
/* do nothing and return */
free((void *)trigger);
return;
}
else
{
if(get_trigger_value())
free((void *)trigger);
trigger = get_trigger_value();
if(trigger)
{
if(!strcmp(tmp, get_trigger_value()))
if(!strcmp(tmp, trigger))
{
#ifdef MLOCK
#if defined MEEGOLOCK
if(!usb_moded_get_export_permission())
#endif /* MLOCK */
#endif /* MEEGOLOCK */
if(strcmp(get_trigger_mode(), get_usb_mode()) != 0)
{
usb_moded_mode_cleanup(get_usb_module());
set_usb_mode(get_trigger_mode());
}
free((void *)trigger);
}
else
{
free((void *)trigger);
return;
}
}
else
/* for triggers without trigger value */
{
#ifdef MLOCK
#if defined MEEGOLOCK
if(!usb_moded_get_export_permission())
#endif /* MLOCK */
#endif /* MEEGOLOCK */
if(strcmp(get_trigger_mode(), get_usb_mode()) != 0)
{
usb_moded_mode_cleanup(get_usb_module());
......
/**
@file usb_moded-upstart.c
Copyright (C) 2012 Nokia Corporation. All rights reserved.
@author: Philippe De Swert <philippe.de-swert@nokia.com>
This program is free software; you can redistribute it and/or
modify it under the terms of the Lesser GNU General Public License
version 2 as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the Lesser GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
02110-1301 USA
*/
#define _GNU_SOURCE
#include <stdio.h>
#include <string.h>
#include <dbus/dbus.h>
#include <dbus/dbus-glib.h>
#include <dbus/dbus-glib-lowlevel.h>
#include "usb_moded-dbus.h"
#include "usb_moded-dbus-private.h"
#include "usb_moded.h"
#include "usb_moded-log.h"
#define SYSTEM_BUS_ADDRESS "unix:path=/var/run/dbus/system_bus_socket"
#define UPSTART_BUS_ADDRESS "unix:abstract=/com/ubuntu/upstart"
#define UPSTART_SERVICE "com.ubuntu.Upstart"
#define UPSTART_REQUEST_PATH "/com/ubuntu/Upstart"
#define UPSTART_INTERFACE "com.ubuntu.Upstart0_6"
#define UPSTART_JOB_INTERFACE "com.ubuntu.Upstart0_6.Job"
static DBusConnection * get_upstart_dbus_connection(void)
{
DBusError error;
DBusConnection *conn = 0;
dbus_error_init(&error);
conn = dbus_connection_open_private("unix:abstract=/com/ubuntu/upstart", &error);
if (!conn)
{
if (dbus_error_is_set(&error))
log_err("Cannot connect to upstart: %s", error.message);
else
log_err("Cannot connect to upstart");
return 0;
}
return conn;
}
static char *get_upstart_job_by_name(const char *name)
{
DBusError error;
DBusConnection *conn = 0;
DBusMessage *msg = NULL, *reply = NULL;
char *ret = 0;
dbus_error_init(&error);
conn = get_upstart_dbus_connection();
if(!conn)
return NULL;
if ((msg = dbus_message_new_method_call(UPSTART_SERVICE, UPSTART_REQUEST_PATH, UPSTART_INTERFACE, "GetJobByName")) != NULL)
{
dbus_message_append_args (msg, DBUS_TYPE_STRING, &name, DBUS_TYPE_INVALID);
if ((reply = dbus_connection_send_with_reply_and_block(conn, msg, -1, NULL)) != NULL)
{
dbus_message_get_args(reply, NULL, DBUS_TYPE_OBJECT_PATH, &ret, DBUS_TYPE_INVALID);
/* log_debug("got following path from upstart: %s for job name %s\n", ret, name);*/
dbus_message_unref(reply);
}
dbus_message_unref(msg);
}
dbus_connection_close(conn);
return ret;
}
int upstart_control_job(const char *name, const char * action)
{
DBusError error;
DBusConnection *conn = 0;
char *job = 0, *arg = 0;
DBusMessageIter iter, iter2;
DBusMessage *msg = NULL, *reply = NULL;
dbus_bool_t wait = FALSE;
conn = get_upstart_dbus_connection();
if(!conn)
return 1;
job = get_upstart_job_by_name(name);
if(job)
if ((msg = dbus_message_new_method_call(UPSTART_SERVICE, job, UPSTART_JOB_INTERFACE, action)) != NULL)
{
dbus_message_iter_init_append(msg, &iter);
if(!dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, "s", &iter2))
{
log_err("Could not open dbus container\n");
goto fail;
}
asprintf(&arg, "NAME=%s", name);
if (!dbus_message_iter_append_basic(&iter2, DBUS_TYPE_STRING, &arg))
{
log_err("Could not add string array\n");
dbus_message_iter_abandon_container(&iter, &iter2);
goto fail;
}
if (!dbus_message_iter_close_container(&iter, &iter2))
{
log_err( "Cannot close container");
goto fail;
}
if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_BOOLEAN, &wait))
{
log_err("Could not set wait state\n");
goto fail;
}
if ((reply = dbus_connection_send_with_reply_and_block(conn, msg, -1, NULL)) != NULL)
{
dbus_message_unref(reply);
}
dbus_message_unref(msg);
}
else
log_err("No upstart path for %s\n", name);
dbus_connection_close(conn);
return 0;
fail:
dbus_connection_close(conn);
return 1;
}
/**
@file usb_moded-upstart.h
Copyright (C) 2012 Nokia Corporation. All rights reserved.
@author: Philippe De Swert <philippe.de-swert@nokia.com>
This program is free software; you can redistribute it and/or
modify it under the terms of the Lesser GNU General Public License
version 2 as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the Lesser GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include <stdio.h>
#include <string.h>
#include <dbus/dbus.h>
#include <dbus/dbus-glib.h>
#include <dbus/dbus-glib-lowlevel.h>
#define UPSTART_START "Start"
#define UPSTART_STOP "Stop"
int upstart_control_job(const char *name, const char * action);
......@@ -37,7 +37,7 @@
#include "usb_moded-gconf.h"
#include "usb_moded-modules.h"
#include "usb_moded-log.h"
#include "usb_moded-devicelock.h"
#include "usb_moded-lock.h"
#include "usb_moded-modesetting.h"
#include "usb_moded-modules.h"
#include "usb_moded-appsync.h"
......@@ -154,23 +154,26 @@ void set_usb_connected_state(void)
{
const char *mode_to_set;
#ifdef MLOCK
int export = 0, act_dead = 0;
#endif /* MLOCK */
#if defined MEEGOLOCK
int export = 0;
#endif /* MEEGOLOCK */
/* signal usb connected */
log_debug("usb connected\n");
usb_moded_send_signal(USB_CONNECTED);
mode_to_set = get_mode_setting();
#ifdef MLOCK
#if defined MEEGOLOCK
/* check if we are allowed to export system contents 0 is unlocked */
export = usb_moded_get_export_permission();
#endif
#ifdef MEEGOLOCK
int act_dead = 0;
/* check if we are in acting dead or not, /tmp/USER will not exist in acting dead */
act_dead = access("/tmp/USER", R_OK);
if(mode_to_set && !export && !act_dead)
#else
if(mode_to_set)
#endif /* MLOCK */
if(mode_to_set && !export)
#endif /* MEEGOLOCK */
{
#ifdef NOKIA
/* If we switch to another mode than the one that is still set before the
......@@ -202,7 +205,7 @@ void set_usb_connected_state(void)
*/
set_usb_mode(MODE_CHARGING);
}
free((void *)mode_to_set);
}
/** set the usb mode
......@@ -235,7 +238,14 @@ void set_usb_mode(const char *mode)
ret = usb_moded_load_module(MODULE_CHARGING);
goto end;
}
else if(!strcmp(mode, MODE_DEVELOPER))
{
check_module_state(MODULE_DEVELOPER);
set_usb_module(MODULE_NETWORK);
ret = usb_moded_load_module(MODULE_DEVELOPER);
net = usb_network_up();
goto end;
}
#ifdef N900
else if(!strcmp(mode, MODE_OVI_SUITE))
{
......@@ -256,8 +266,9 @@ void set_usb_mode(const char *mode)
net = usb_network_up();
goto end;
}
#ifdef APP_SYNC
#ifdef DYN_MODE
/* go through all the dynamic modes if the modelist exists*/
if(modelist)
{
......@@ -275,7 +286,7 @@ void set_usb_mode(const char *mode)
}
}
}
#endif /* APP_SYNC */
#endif /* DYN_MODE */
end:
/* if ret != 0 then usb_module loading failed */
......@@ -297,10 +308,11 @@ end:
int valid_mode(const char *mode)
{
if(!strcmp(MODE_MASS_STORAGE, mode) || !strcmp(MODE_OVI_SUITE, mode) || !strcmp(MODE_CHARGING, mode) || !strcmp(MODE_WINDOWS_NET, mode))
if(!strcmp(MODE_MASS_STORAGE, mode) || !strcmp(MODE_OVI_SUITE, mode) || !strcmp(MODE_CHARGING, mode)
|| !strcmp(MODE_WINDOWS_NET, mode) || !strcmp(MODE_DEVELOPER,mode))
return(0);
else
#ifdef APP_SYNC
#ifdef DYN_MODE
{
/* check dynamic modes */
if(modelist)
......@@ -315,7 +327,7 @@ int valid_mode(const char *mode)
}
}
}
#endif /* APP_SYNC */
#endif /* DYN_MODE */
return(1);
}
......@@ -335,7 +347,7 @@ inline const char * get_usb_mode(void)
* @param module The module name for the requested mode
*
*/
inline void set_usb_module(const char *module)
void set_usb_module(const char *module)
{
free(current_mode.module);
current_mode.module = strdup(module);
......@@ -401,8 +413,11 @@ static void usb_moded_init(void)
#endif /* NOKIA_NSU */
#ifdef APP_SYNC
readlist();
modelist = read_mode_list();
#endif /* APP_SYNC */
#ifdef DYN_MODE
modelist = read_mode_list();
#endif /* DYN_MODE */
#ifdef UDEV
if(check_trigger())
trigger_init();
......@@ -658,11 +673,11 @@ int main(int argc, char* argv[])
log_crit("hwal init failed\n");
goto EXIT;
}
#ifdef MLOCK