Skip to content

Commit

Permalink
[usb-moded] clean-up mode if one is set before switching
Browse files Browse the repository at this point in the history
Previous mode was not cleaned-up, so when switching modes some apps
kept running, and did not start correctly again when switching back
to a previous mode without disconnect.

Fixes: nemomobile/usb-moded#23

Thanks to jklingen for reporting!

Signed-off-by: Philippe De Swert <philippe.deswert@jollamobile.com>
  • Loading branch information
philippedeswert committed Mar 9, 2015
1 parent d2f2e9b commit cc9687c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/usb_moded-dbus.c
Expand Up @@ -33,6 +33,7 @@
#include "usb_moded-dbus-private.h"
#include "usb_moded.h"
#include "usb_moded-modes.h"
#include "usb_moded-modesetting.h"
#include "usb_moded-config-private.h"
#include "usb_moded-network.h"
#include "usb_moded-log.h"
Expand Down Expand Up @@ -102,7 +103,10 @@ static DBusHandlerResult msg_handler(DBusConnection *const connection, DBusMessa
goto error_reply;
/* do not change mode if the mode requested is the one already set */
if(strcmp(use, get_usb_mode()) != 0)
{
usb_moded_mode_cleanup(get_usb_module());
set_usb_mode(use);
}
if((reply = dbus_message_new_method_return(msg)))
dbus_message_append_args (reply, DBUS_TYPE_STRING, &use, DBUS_TYPE_INVALID);
else
Expand Down

0 comments on commit cc9687c

Please sign in to comment.