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

Fix charging fall-back and release 0.58

Signed-off-by: default avatarPhilippe De Swert <philippe.deswert@jollamobile.com>
parent 3e2d4394
AC_INIT([usb_moded], [0.57])
AC_INIT([usb_moded], [0.58])
AM_INIT_AUTOMAKE([-Wall -Werror foreign])
AM_CONFIG_HEADER([config.h])
......
usb-moded (0.58) unstable; urgency=low
* Fix bug with ask mode since module loading failed
* Make sure mac is generated before kmod is initialized to be sure the random mac is used
* Always call clean-up first when modules get switched
-- Philippe De Swert <philippe.deswert@jollamobile.com> Fri, 01 Feb 2013 13:36:47 +0200
usb-moded (0.57) unstable; urgency=low
* Add random mac generator so host based network tools always get the same mac
-- Philippe De Swert <philippedeswert@jollamobile.com> Thu, 17 Jan 2013 19:50:37 +0200
-- Philippe De Swert <philippe.deswert@jollamobile.com> Thu, 17 Jan 2013 19:50:37 +0200
usb-moded (0.56) unstable; urgency=low
......@@ -10,7 +18,7 @@ usb-moded (0.56) unstable; urgency=low
* Fix g_file_storage fallback which did not work anymore with kmod
* Warn when using dbus methods to change mode when not connected
-- Philippe De Swert <philippedeswert@jollamobile.com> Fri, 11 Jan 2013 18:57:58 +0200
-- Philippe De Swert <philippe.deswert@jollamobile.com> Fri, 11 Jan 2013 18:57:58 +0200
usb-moded (0.55) unstable; urgency=low
......@@ -19,7 +27,7 @@ usb-moded (0.55) unstable; urgency=low
* Add rescue mode
* Add softconnect support
-- Philippe De Swert <philippedeswert@jollamobile.com> Wed, 12 Dec 2012 22:57:42 +0200
-- Philippe De Swert <philippe.deswert@jollamobile.com> Wed, 12 Dec 2012 22:57:42 +0200
usb-moded (0.54) unstable; urgency=low
......
......@@ -28,6 +28,7 @@
#include <stdio.h>
#include <glib.h>
#include <glib/gprintf.h>
#include <libkmod.h>
......@@ -73,9 +74,30 @@ int usb_moded_load_module(const char *module)
#else
const int probe_flags = KMOD_PROBE_APPLY_BLACKLIST;
struct kmod_module *mod;
const char *charging_args = NULL;
ret = kmod_module_new_from_name(ctx, module, &mod);
char *charging_args = NULL;
char *load = NULL;
/* copy module to load as it might be modified if we're trying charging mode */
load = strdup(module);
if(!strcmp(module, MODULE_CHARGING) || !strcmp(module, MODULE_CHARGE_FALLBACK))
{
/* split the string in module name and argument, they are the same for MODULE_CHARGE_FALLBACK
so no need to handle them separately */
gchar **strings;
/* since the mass_storage module is the newer one and we check against it to avoid
loading failures we use it here, as we fall back to g_file_storage if g_mass_storage
fails to load */
strings = g_strsplit(MODULE_CHARGE_FALLBACK, " ", 2);
log_debug("module args = %s, module = %s\n", strings[1], strings[0]);
charging_args = strdup(strings[1]);
/* load was already assigned. Free it to re-assign */
free(load);
load = strdup(strings[0]);
g_strfreev(strings);
}
ret = kmod_module_new_from_name(ctx, load, &mod);
/* since kmod_module_new_from_name does not check if the module
exists we test it's path in case we deal with the mass-storage one */
if(!strcmp(module, MODULE_MASS_STORAGE) &&
......@@ -84,18 +106,16 @@ int usb_moded_load_module(const char *module)
log_debug("Fallback on older g_file_storage\n");
ret = kmod_module_new_from_name(ctx, MODULE_FILE_STORAGE, &mod);
}
if(!strcmp(module, MODULE_CHARGING) && (ret != 0))
{
/* split the string in module name and arguments, if it still fails do the same
for MODULE_CHARGE_FALLBACK */
}
if(!charging_args)
ret = kmod_module_probe_insert_module(mod, probe_flags, NULL, NULL, NULL, NULL);
else
{
ret = kmod_module_probe_insert_module(mod, probe_flags, charging_args, NULL, NULL, NULL);
free(charging_args);
}
kmod_module_unref(mod);
free(load);
#endif /* NO_KMOD */
softconnect = get_soft_connect_path();
......
......@@ -473,6 +473,7 @@ static gboolean charging_fallback(gpointer data)
* means a mode has been set */
if(strcmp(get_usb_mode(), MODE_ASK) != 0)
return FALSE;
set_usb_mode(MODE_CHARGING);
/* since this is the fallback, we keep an indication
for the UI, as we are not really in charging mode.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment