Commit 57d404a3 authored by spiiroin's avatar spiiroin

[usb-moded] Move synchronous mode switch to worker thread. Fixes JB#42757

Mode switching in usb-moded is done via synchronous ipc / otherwise
blocking operations - which makes usb-moded mainloop unable to process
for example udev events / dbus requests from clients during the swich
and causes potentially stale events to be seen after the mode switch.

Separate mode selection from mode activation so that the latter is
executed from worker thread.

Distribute existing code in manner that makes the selection vs activation,
or mainloop / worker thread separation more apparent:
- control.c: Mode selection logic
- worker.c:  Mode activation logic

And move miscellaneous functions that have accumulated into the main
usb-moded module to:

- common.c:  Generic helper functions
- sigpipe.c: Asynchronous signal trapping

Rename all moved functions so that they still have prefix indicating the
containing module.

Refuse synchronous sleeps in order to terminate ongoing mode switch
if udev events / other inputs invalidate the target of transition.
Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
parent dd587133
This diff is collapsed.
......@@ -169,10 +169,13 @@ LDLIBS += $(PKG_LDLIBS)
# ----------------------------------------------------------------------------
usb_moded-OBJS += src/usb_moded.o
usb_moded-OBJS += src/usb_moded-android.o
usb_moded-OBJS += src/usb_moded-appsync.o
usb_moded-OBJS += src/usb_moded-common.o
usb_moded-OBJS += src/usb_moded-config.o
usb_moded-OBJS += src/usb_moded-configfs.o
usb_moded-OBJS += src/usb_moded-control.o
usb_moded-OBJS += src/usb_moded-dbus.o
usb_moded-OBJS += src/usb_moded-devicelock.o
usb_moded-OBJS += src/usb_moded-dsme.o
......@@ -182,10 +185,12 @@ usb_moded-OBJS += src/usb_moded-mac.o
usb_moded-OBJS += src/usb_moded-modesetting.o
usb_moded-OBJS += src/usb_moded-modules.o
usb_moded-OBJS += src/usb_moded-network.o
usb_moded-OBJS += src/usb_moded-sigpipe.o
usb_moded-OBJS += src/usb_moded-ssu.o
usb_moded-OBJS += src/usb_moded-systemd.o
usb_moded-OBJS += src/usb_moded-trigger.o
usb_moded-OBJS += src/usb_moded-udev.o
usb_moded-OBJS += src/usb_moded-worker.o
usb_moded : $(usb_moded-OBJS)
$(CC) -o $@ $^ $(LDFLAGS) $(LDLIBS)
......@@ -217,8 +222,10 @@ usb_moded_util : $(usb_moded_util-OBJS)
CLEAN_SOURCES += src/usb_moded-android.c
CLEAN_SOURCES += src/usb_moded-appsync-dbus.c
CLEAN_SOURCES += src/usb_moded-appsync.c
CLEAN_SOURCES += src/usb_moded-common.c
CLEAN_SOURCES += src/usb_moded-config.c
CLEAN_SOURCES += src/usb_moded-configfs.c
CLEAN_SOURCES += src/usb_moded-control.c
CLEAN_SOURCES += src/usb_moded-dbus.c
CLEAN_SOURCES += src/usb_moded-devicelock.c
CLEAN_SOURCES += src/usb_moded-dsme.c
......@@ -228,11 +235,13 @@ CLEAN_SOURCES += src/usb_moded-mac.c
CLEAN_SOURCES += src/usb_moded-modesetting.c
CLEAN_SOURCES += src/usb_moded-modules.c
CLEAN_SOURCES += src/usb_moded-network.c
CLEAN_SOURCES += src/usb_moded-sigpipe.c
CLEAN_SOURCES += src/usb_moded-ssu.c
CLEAN_SOURCES += src/usb_moded-systemd.c
CLEAN_SOURCES += src/usb_moded-trigger.c
CLEAN_SOURCES += src/usb_moded-udev.c
CLEAN_SOURCES += src/usb_moded-util.c
CLEAN_SOURCES += src/usb_moded-worker.c
CLEAN_SOURCES += src/usb_moded.c
CLEAN_SOURCES += utils/udev-search.c
......@@ -241,8 +250,10 @@ CLEAN_HEADERS += src/usb_moded-appsync-dbus-private.h
CLEAN_HEADERS += src/usb_moded-appsync-dbus.h
CLEAN_HEADERS += src/usb_moded-appsync.h
CLEAN_HEADERS += src/usb_moded-config-private.h
CLEAN_HEADERS += src/usb_moded-common.h
CLEAN_HEADERS += src/usb_moded-config.h
CLEAN_HEADERS += src/usb_moded-configfs.h
CLEAN_HEADERS += src/usb_moded-control.h
CLEAN_HEADERS += src/usb_moded-dbus-private.h
CLEAN_HEADERS += src/usb_moded-dbus.h
CLEAN_HEADERS += src/usb_moded-devicelock.h
......@@ -254,10 +265,12 @@ CLEAN_HEADERS += src/usb_moded-modes.h
CLEAN_HEADERS += src/usb_moded-modesetting.h
CLEAN_HEADERS += src/usb_moded-modules.h
CLEAN_HEADERS += src/usb_moded-network.h
CLEAN_HEADERS += src/usb_moded-sigpipe.h
CLEAN_HEADERS += src/usb_moded-ssu.h
CLEAN_HEADERS += src/usb_moded-systemd.h
CLEAN_HEADERS += src/usb_moded-trigger.h
CLEAN_HEADERS += src/usb_moded-udev.h
CLEAN_HEADERS += src/usb_moded-worker.h
CLEAN_HEADERS += src/usb_moded.h
# Files with whitespace issues
......
USB_MODED_CFLAGS += -D_GNU_SOURCE
USB_MODED_LIBS += -lpthread
sbin_PROGRAMS = usb_moded \
usb_moded_util
......@@ -24,6 +25,8 @@ usb_moded_SOURCES = \
usb_moded-modules.h \
usb_moded-log.h \
usb_moded-log.c \
usb_moded-common.c \
usb_moded-common.h \
usb_moded-config.c \
usb_moded-config.h \
usb_moded-network.c \
......@@ -39,8 +42,14 @@ usb_moded_SOURCES = \
usb_moded-modules.c \
usb_moded-configfs.c \
usb_moded-configfs.h \
usb_moded-worker.h \
usb_moded-worker.c \
usb_moded-android.h \
usb_moded-android.c
usb_moded-android.c \
usb_moded-sigpipe.h \
usb_moded-sigpipe.c \
usb_moded-control.h \
usb_moded-control.c
if USE_MER_SSU
usb_moded_SOURCES += \
......
This diff is collapsed.
#ifndef USB_MODED_COMMON_H_
# define USB_MODED_COMMON_H_
# include <glib.h>
/* ========================================================================= *
* Types
* ========================================================================= */
/** Mode list types
*/
typedef enum mode_list_type_t {
/** All configured modes */
SUPPORTED_MODES_LIST,
/** Configured modes that can be activated */
AVAILABLE_MODES_LIST
} mode_list_type_t;
typedef enum {
CABLE_STATE_UNKNOWN,
CABLE_STATE_DISCONNECTED,
CABLE_STATE_CHARGER_CONNECTED,
CABLE_STATE_PC_CONNECTED,
CABLE_STATE_NUMOF
} cable_state_t;
/* ========================================================================= *
* Functions
* ========================================================================= */
/* -- cable -- */
const char *cable_state_repr(cable_state_t state);
/* -- common -- */
const char *common_map_mode_to_hardware (const char *internal_mode);
const char *common_map_mode_to_external (const char *internal_mode);
void common_send_supported_modes_signal (void);
void common_send_available_modes_signal (void);
void common_send_hidden_modes_signal (void);
void common_send_whitelisted_modes_signal(void);
void common_acquire_wakelock (const char *wakelock_name);
void common_release_wakelock (const char *wakelock_name);
int common_system_ (const char *file, int line, const char *func, const char *command);
FILE *common_popen_ (const char *file, int line, const char *func, const char *command, const char *type);
void common_usleep_ (const char *file, int line, const char *func, useconds_t usec);
int common_valid_mode (const char *mode);
gchar *common_get_mode_list (mode_list_type_t type);
/* ========================================================================= *
* Macros
* ========================================================================= */
# define common_system(command) common_system_(__FILE__,__LINE__,__FUNCTION__,(command))
# define common_popen(command, type) common_popen_(__FILE__,__LINE__,__FUNCTION__,(command),(type))
# define common_usleep(usec) common_usleep_(__FILE__,__LINE__,__FUNCTION__,(usec))
# define common_msleep(msec) common_usleep_(__FILE__,__LINE__,__FUNCTION__,(msec)*1000)
# define common_sleep(sec) common_usleep_(__FILE__,__LINE__,__FUNCTION__,(sec)*1000000)
#endif /* USB_MODED_COMMON_H_ */
......@@ -36,6 +36,8 @@
# include "usb_moded-config.h"
# include <glib.h>
/* ========================================================================= *
* Prototypes
* ========================================================================= */
......
......@@ -50,6 +50,9 @@
#include "usb_moded-modes.h"
#include "usb_moded-modesetting.h"
#include "usb_moded-dbus-private.h"
#include "usb_moded-worker.h"
#include "usb_moded-control.h"
#include "usb_moded-common.h"
#ifdef USE_MER_SSU
# include "usb_moded-ssu.h"
......@@ -463,7 +466,7 @@ set_config_result_t config_set_config_setting(const char *entry, const char *key
set_config_result_t config_set_mode_setting(const char *mode)
{
if (strcmp(mode, MODE_ASK) && usbmoded_valid_mode(mode))
if (strcmp(mode, MODE_ASK) && common_valid_mode(mode))
return SET_CONFIG_ERROR;
return (config_set_config_setting(MODE_SETTING_ENTRY, MODE_SETTING_KEY, mode));
}
......@@ -540,9 +543,9 @@ set_config_result_t config_set_hide_mode_setting(const char *mode)
}
if(ret == SET_CONFIG_UPDATED) {
usbmoded_send_hidden_modes_signal();
usbmoded_send_supported_modes_signal();
usbmoded_send_available_modes_signal();
common_send_hidden_modes_signal();
common_send_supported_modes_signal();
common_send_available_modes_signal();
}
g_free(hidden_modes);
......@@ -561,9 +564,9 @@ set_config_result_t config_set_unhide_mode_setting(const char *mode)
}
if(ret == SET_CONFIG_UPDATED) {
usbmoded_send_hidden_modes_signal();
usbmoded_send_supported_modes_signal();
usbmoded_send_available_modes_signal();
common_send_hidden_modes_signal();
common_send_supported_modes_signal();
common_send_available_modes_signal();
}
g_free(hidden_modes);
......@@ -580,22 +583,22 @@ set_config_result_t config_set_mode_whitelist(const char *whitelist)
const char *current_mode;
mode_setting = config_get_mode_setting();
if (strcmp(mode_setting, MODE_ASK) && usbmoded_valid_mode(mode_setting))
if (strcmp(mode_setting, MODE_ASK) && common_valid_mode(mode_setting))
config_set_mode_setting(MODE_ASK);
g_free(mode_setting);
current_mode = usbmoded_get_usb_mode();
current_mode = control_get_usb_mode();
if (!strcmp(current_mode, MODE_UNDEFINED)) {
/* Disconnected -> do nothing */
}
else if (strcmp(current_mode, MODE_CHARGING_FALLBACK) && strcmp(current_mode, MODE_ASK) && usbmoded_valid_mode(current_mode)) {
else if (strcmp(current_mode, MODE_CHARGING_FALLBACK) && strcmp(current_mode, MODE_ASK) && common_valid_mode(current_mode)) {
/* Invalid mode that is not MODE_ASK or MODE_CHARGING_FALLBACK
* -> switch to MODE_CHARGING_FALLBACK */
usbmoded_set_usb_mode(MODE_CHARGING_FALLBACK);
control_set_usb_mode(MODE_CHARGING_FALLBACK);
}
umdbus_send_whitelisted_modes_signal(whitelist);
usbmoded_send_available_modes_signal();
common_send_available_modes_signal();
}
return ret;
......@@ -690,7 +693,7 @@ char * config_get_network_setting(const char *config)
goto end;
/* no interface override specified, let's use the one
* from the mode config */
data = usbmoded_get_usb_mode_data();
data = worker_get_usb_mode_data();
if(data)
{
if(data->network_interface)
......
......@@ -36,6 +36,7 @@
#include "usb_moded-modesetting.h"
#include "usb_moded-config-private.h"
#include "usb_moded-mac.h"
#include "usb_moded-common.h"
/* ========================================================================= *
* Constants
......@@ -598,7 +599,7 @@ configfs_init_values(void)
/* Prep: mtp_mode */
configfs_register_function(FUNCTION_MTP);
if( access("/dev/mtp/ep0", F_OK) == -1 ) {
usbmoded_system("/bin/mount -o uid=100000,gid=100000 -t functionfs mtp /dev/mtp");
common_system("/bin/mount -o uid=100000,gid=100000 -t functionfs mtp /dev/mtp");
}
/* Prep: developer_mode */
......
/**
* @file usb_moded-control.c
*
* Copyright (C) 2013-2018 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
* 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 "usb_moded-control.h"
#include "usb_moded.h"
#include "usb_moded-config-private.h"
#include "usb_moded-dbus-private.h"
#include "usb_moded-log.h"
#include "usb_moded-modes.h"
#include "usb_moded-worker.h"
#include "usb_moded-common.h"
/* ========================================================================= *
* Prototypes
* ========================================================================= */
/* -- usbmoded -- */
void control_rethink_usb_charging_fallback(void);
const char *control_get_external_mode (void);
static void control_set_external_mode (const char *mode);
void control_clear_external_mode (void);
static void control_update_external_mode (void);
const char *control_get_usb_mode (void);
void control_clear_internal_mode (void);
void control_set_usb_mode (const char *mode);
void control_mode_switched (const char *override);
void control_select_usb_mode (void);
void control_set_cable_state (cable_state_t cable_state);
cable_state_t control_get_cable_state (void);
void control_clear_cable_state (void);
bool control_get_connection_state (void);
/* ========================================================================= *
* Data
* ========================================================================= */
/* The external mode;
*
* What was the last mode signaled over D-Bus.
*/
char *control_external_mode = NULL;
/** The logical mode name
*
* Full set of valid modes can occur here
*/
char *control_internal_mode = NULL;
/** Connection status
*
* Access only via:
* - control_set_cable_state()
* - control_get_connection_state()
*/
cable_state_t control_cable_state = CABLE_STATE_UNKNOWN;
/* ========================================================================= *
* Functions
* ========================================================================= */
/** Check if we can/should leave charging fallback mode
*
* Called when device lock status, or device status (dsme)
* changes.
*/
void
control_rethink_usb_charging_fallback(void)
{
/* Cable must be connected to a pc */
if( control_get_cable_state() != CABLE_STATE_PC_CONNECTED )
goto EXIT;
/* Switching can happen only from MODE_UNDEFINED
* or MODE_CHARGING_FALLBACK */
const char *usb_mode = control_get_usb_mode();
if( strcmp(usb_mode, MODE_UNDEFINED) &&
strcmp(usb_mode, MODE_CHARGING_FALLBACK) )
goto EXIT;
if( !usbmoded_can_export() ) {
log_notice("exporting data not allowed; stay in %s", usb_mode);
goto EXIT;
}
log_debug("attempt to leave %s", usb_mode);
control_select_usb_mode();
EXIT:
return;
}
const char *control_get_external_mode(void)
{
return control_external_mode ?: MODE_UNDEFINED;
}
static void control_set_external_mode(const char *mode)
{
gchar *previous = control_external_mode;
if( !g_strcmp0(previous, mode) )
goto EXIT;
log_debug("external_mode: %s -> %s",
previous, mode);
control_external_mode = g_strdup(mode);
g_free(previous);
// DO THE DBUS BROADCAST
if( !strcmp(control_external_mode, MODE_ASK) ) {
/* send signal, mode will be set when the dialog service calls
* the set_mode method call. */
umdbus_send_state_signal(USB_CONNECTED_DIALOG_SHOW);
}
umdbus_send_state_signal(control_external_mode);
EXIT:
return;
}
void control_clear_external_mode(void)
{
g_free(control_external_mode),
control_external_mode = 0;
}
static void control_update_external_mode(void)
{
const char *internal_mode = control_get_usb_mode();
const char *external_mode = common_map_mode_to_external(internal_mode);
control_set_external_mode(external_mode);
}
/** get the usb mode
*
* @return the currently set mode
*
*/
const char * control_get_usb_mode(void)
{
return control_internal_mode;
}
void control_clear_internal_mode(void)
{
g_free(control_internal_mode),
control_internal_mode = 0;
}
/** set the usb mode
*
* @param mode The requested USB mode
*/
void control_set_usb_mode(const char *mode)
{
gchar *previous = control_internal_mode;
if( !g_strcmp0(previous, mode) )
goto EXIT;
log_debug("internal_mode: %s -> %s",
previous, mode);
control_internal_mode = g_strdup(mode);
g_free(previous);
/* Invalidate current mode for the duration of mode transition */
control_set_external_mode(MODE_BUSY);
/* Propagate down to gadget config */
worker_request_hardware_mode(control_internal_mode);
EXIT:
return;
}
/* Worker thread has finished mode switch
*
* @param mode The activated USB mode
*/
void control_mode_switched(const char *mode)
{
/* Update state data - without retriggering the worker thread
*/
if( g_strcmp0(control_internal_mode, mode) ) {
log_debug("internal_mode: %s -> %s",
control_internal_mode, mode);
g_free(control_internal_mode),
control_internal_mode = g_strdup(mode);
}
/* Propagate up to D-Bus */
control_update_external_mode();
return;
}
/** set the chosen usb state
*
* gauge what mode to enter and then call control_set_usb_mode()
*
*/
void control_select_usb_mode(void)
{
char *mode_to_set = 0;
if( usbmoded_rescue_mode ) {
log_debug("Entering rescue mode!\n");
control_set_usb_mode(MODE_DEVELOPER);
goto EXIT;
}
if( usbmoded_diag_mode ) {
log_debug("Entering diagnostic mode!\n");
if( usbmoded_modelist ) {
/* XXX 1st entry is just assumed to be diag mode??? */
GList *iter = usbmoded_modelist;
struct mode_list_elem *data = iter->data;
control_set_usb_mode(data->mode_name);
}
goto EXIT;
}
mode_to_set = config_get_mode_setting();
/* If there is only one allowed mode, use it without
* going through ask-mode */
if( !strcmp(MODE_ASK, mode_to_set) ) {
// FIXME free() vs g_free() conflict
gchar *available = common_get_mode_list(AVAILABLE_MODES_LIST);
if( *available && !strchr(available, ',') ) {
free(mode_to_set), mode_to_set = available, available = 0;
}
g_free(available);
}
if( mode_to_set && usbmoded_can_export() ) {
control_set_usb_mode(mode_to_set);
}
else {
/* config is corrupted or we do not have a mode configured, fallback to charging
* We also fall back here in case the device is locked and we do not
* export the system contents. Or if we are in acting dead mode.
*/
control_set_usb_mode(MODE_CHARGING_FALLBACK);
}
EXIT:
free(mode_to_set);
}
/** set the usb connection status
*
* @param cable_state CABLE_STATE_DISCONNECTED, ...
*/
void control_set_cable_state(cable_state_t cable_state)
{
cable_state_t prev = control_cable_state;
control_cable_state = cable_state;
if( control_cable_state == prev )
goto EXIT;
log_debug("control_cable_state: %s -> %s",
cable_state_repr(prev),
cable_state_repr(control_cable_state));
switch( control_cable_state ) {
default:
case CABLE_STATE_DISCONNECTED:
control_set_usb_mode(MODE_UNDEFINED);
break;
case CABLE_STATE_CHARGER_CONNECTED:
control_set_usb_mode(MODE_CHARGER);
break;
case CABLE_STATE_PC_CONNECTED:
control_select_usb_mode();
break;
}
EXIT:
return;
}
/** get the usb connection status
*
* @return CABLE_STATE_DISCONNECTED, ...
*/
cable_state_t control_get_cable_state(void)
{
return control_cable_state;
}
void control_clear_cable_state(void)
{
control_cable_state = CABLE_STATE_UNKNOWN;
}
/** Get if the cable (pc or charger) is connected or not
*
* @ return true if connected, false if disconnected
*/
bool control_get_connection_state(void)
{
bool connected = false;
switch( control_get_cable_state() ) {
case CABLE_STATE_CHARGER_CONNECTED:
case CABLE_STATE_PC_CONNECTED:
connected = true;
break;
default:
break;
}
return connected;
}
/**
* @file usb_moded-control.h
*
* Copyright (C) 2013-2018 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
* 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
*/
#ifndef USB_MODED_CONTROL_H_
# define USB_MODED_CONTROL_H_
# include "usb_moded.h"
# include "usb_moded-common.h"
/* -- usbmoded -- */
void control_rethink_usb_charging_fallback(void);
const char *control_get_external_mode (void);
void control_clear_external_mode (void);
const char *control_get_usb_mode (void);
void control_clear_internal_mode (void);
void control_set_usb_mode (const char *mode);
void control_mode_switched (const char *override);
void control_select_usb_mode (void);
void control_set_cable_state (cable_state_t cable_state);
cable_state_t control_get_cable_state (void);
void control_clear_cable_state (void);
bool control_get_connection_state (void);
#endif /* USB_MODED_CONTROL_H_ */
......@@ -46,6 +46,8 @@
#include "usb_moded-config-private.h"
#include "usb_moded-network.h"
#include "usb_moded-log.h"
#include "usb_moded-control.h"
#include "usb_moded-common.h"
/* ========================================================================= *
* Constants
......@@ -254,7 +256,7 @@ static DBusHandlerResult umdbus_msg_handler(DBusConnection *const connection, DB
if(!strcmp(member, USB_MODE_STATE_REQUEST))
{
const char *mode = usbmoded_get_external_mode();
const char *mode = control_get_external_mode();
/* To the outside we want to keep CHARGING and CHARGING_FALLBACK the same */
if(!strcmp(MODE_CHARGING_FALLBACK, mode))
......@@ -272,17 +274,17 @@ static DBusHandlerResult umdbus_msg_handler(DBusConnection *const connection, DB
else
{
/* check if usb is connected, since it makes no sense to change mode if it isn't */
if( usbmoded_get_cable_state() != CABLE_STATE_PC_CONNECTED ) {
if( control_get_cable_state() != CABLE_STATE_PC_CONNECTED ) {
log_warning("USB not connected, not changing mode!\n");
goto error_reply;
}
/* check if the mode exists */
if(usbmoded_valid_mode(use))
if(common_valid_mode(use))
goto error_reply;
/* do not change mode if the mode requested is the one already set */
if(strcmp(use, usbmoded_get_usb_mode()) != 0)
if(strcmp(use, control_get_usb_mode()) != 0)
{
usbmoded_set_usb_mode(use);
control_set_usb_mode(use);
}
if((reply = dbus_message_new_method_return(msg)))
dbus_message_append_args (reply, DBUS_TYPE_STRING, &use, DBUS_TYPE_INVALID);
......@@ -434,7 +436,7 @@ static DBusHandlerResult umdbus_msg_handler(DBusConnection *const connection, DB
}
else if(!strcmp(member, USB_MODE_LIST))
{
gchar *mode_list = usbmoded_get_mode_list(SUPPORTED_MODES_LIST);
gchar *mode_list = common_get_mode_list(SUPPORTED_MODES_LIST);
if((reply = dbus_message_new_method_return(msg)))
dbus_message_append_args (reply, DBUS_TYPE_STRING, (const char *) &mode_list, DBUS_TYPE_INVALID);
......@@ -442,7 +444,7 @@ static DBusHandlerResult umdbus_msg_handler(DBusConnection *const connection, DB
}
else if(!strcmp(member, USB_MODE_AVAILABLE_MODES_GET))
{
gchar *mode_list = usbmoded_get_mode_list(AVAILABLE_MODES_LIST);
gchar *mode_list = common_get_mode_list(AVAILABLE_MODES_LIST);
if((reply = dbus_message_new_method_return(msg)))
dbus_message_append_args (reply, DBUS_TYPE_STRING, (const char *) &mode_list, DBUS_TYPE_INVALID);
......
......@@ -42,6 +42,7 @@
#include "usb_moded.h"
#include "usb_moded-modes.h"
#include "usb_moded-dbus-private.h"
#include "usb_moded-control.h"
/* ========================================================================= *
* Types
......@@ -147,7 +148,7 @@ static void devicelock_state_changed(devicelock_state_t state)
devicelock_state_repr(state));
device_lock_state = state;
usbmoded_rethink_usb_charging_fallback();
control_rethink_usb_charging_fallback();
EXIT:
return;
......
......@@ -31,6 +31,7 @@
#include "usb_moded-modesetting.h"
#include "usb_moded-dbus-private.h"
#include "usb_moded-log.h"
#include "usb_moded-control.h"
#include <dsme/state.h>
#include <dsme/protocol.h>
......@@ -200,7 +201,7 @@ dsme_state_update(dsme_state_t state)
dsme_user_state = user_state;
log_debug("in user state: %s", dsme_user_state ? "true" : "false");
usbmoded_rethink_usb_charging_fallback();
control_rethink_usb_charging_fallback();
}
/* Handle entry to / exit from SHUTDOWN / REBOOT state */
......