Skip to content

Commit

Permalink
[clean-up] Remove unused legacy dsme code
Browse files Browse the repository at this point in the history
Signed-off-by: Philippe De Swert <philippe.deswert@jollamobile.com>
  • Loading branch information
philippedeswert committed Aug 9, 2013
1 parent 3367df5 commit 476d8c7
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 79 deletions.
7 changes: 0 additions & 7 deletions src/usb_moded-dbus-private.h
Expand Up @@ -29,10 +29,3 @@ int usb_moded_send_signal(const char *state_ind);

/* send error signal system bus */
int usb_moded_send_error_signal(const char *error);

#ifdef NOKIA
/* track dsme shutdown indication signal */
int usb_moded_dsme_listener(void);


#endif
63 changes: 0 additions & 63 deletions src/usb_moded-dbus.c
Expand Up @@ -36,10 +36,6 @@
#include "usb_moded-config-private.h"
#include "usb_moded-log.h"

#ifdef NOKIA
static DBusHandlerResult usb_moded_dsme_cb(DBusConnection *conn, DBusMessage *msg, void *user_data);
#endif

static DBusConnection *dbus_connection_sys = NULL;
extern gboolean rescue_mode;

Expand Down Expand Up @@ -353,62 +349,3 @@ int usb_moded_send_error_signal(const char *error)

return result;
}

#ifdef NOKIA
int usb_moded_dsme_listener(void)
{
DBusError err = DBUS_ERROR_INIT;
DBusConnection *dbus_conn_dsme = NULL;

if( (dbus_conn_dsme = dbus_bus_get(DBUS_BUS_SYSTEM, &err)) == 0 )
{
log_err("Could not connect to dbus for dsme\n");
goto cleanup;
}

dbus_bus_add_match(dbus_conn_dsme, "type='signal',interface='com.nokia.dsme.signal',path='/com/nokia/dsme/signal'", &err);
if( dbus_error_is_set(&err) )
{
goto cleanup;
}
if( !dbus_connection_add_filter(dbus_conn_dsme, usb_moded_dsme_cb , 0, 0) )
{
log_err("adding system dbus filter for dsme failed");
goto cleanup;
}
dbus_connection_setup_with_g_main(dbus_conn_dsme, NULL);

cleanup:
dbus_error_free(&err);
return(1);
}

static DBusHandlerResult usb_moded_dsme_cb(DBusConnection *conn, DBusMessage *msg, void *user_data)
{
DBusHandlerResult result = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
const char *interface = dbus_message_get_interface(msg);
const char *member = dbus_message_get_member(msg);
const char *object = dbus_message_get_path(msg);
int type = dbus_message_get_type(msg);

(void) user_data;

// sanity checks
if( !interface || !member || !object ) goto cleanup;
if( type != DBUS_MESSAGE_TYPE_SIGNAL ) goto cleanup;
if( strcmp(interface, "com.nokia.dsme.signal") ) goto cleanup;
if( strcmp(object, "/com/nokia/dsme/signal") ) goto cleanup;

// handle known signals
else if( !strcmp(member, "shutdown_ind") )
{
log_debug("Shutdown indication. Cleaning up.\n");
set_usb_mode(MODE_CHARGING);
}
result = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;

cleanup:
return result;
}

#endif /* NOKIA */
10 changes: 1 addition & 9 deletions src/usb_moded.c
Expand Up @@ -61,7 +61,6 @@ extern int log_type;

gboolean rescue_mode;

gboolean runlevel_ignore = FALSE;
gboolean hw_fallback = FALSE;
struct usb_mode current_mode;
guint charging_timeout = 0;
Expand Down Expand Up @@ -509,7 +508,6 @@ static void usage(void)
" -h, --help display this help and exit\n"
" -r, --rescue rescue mode\n"
" -v, --version output version information and exit\n"
" -w, --watch-off do not act on runlevel change\n"
"\n");
}

Expand All @@ -533,7 +531,7 @@ int main(int argc, char* argv[])
log_name = basename(*argv);

/* Parse the command-line options */
while ((opt = getopt_long(argc, argv, "fsTDhrvw", options, &opt_idx)) != -1)
while ((opt = getopt_long(argc, argv, "fsTDhrv", options, &opt_idx)) != -1)
{
switch (opt)
{
Expand Down Expand Up @@ -564,10 +562,6 @@ int main(int argc, char* argv[])
printf("USB mode daemon version: %s\n", VERSION);
exit(0);

case 'w':
runlevel_ignore = TRUE;
printf("Ignore runlevel changes.\n");
break;
default:
usage();
exit(0);
Expand Down Expand Up @@ -608,8 +602,6 @@ int main(int argc, char* argv[])
}
#ifdef MEEGOLOCK
start_devicelock_listener();
if(!runlevel_ignore)
usb_moded_dsme_listener();
#endif /* MEEGOLOCK */

/* init succesful, run main loop */
Expand Down

0 comments on commit 476d8c7

Please sign in to comment.