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

remove disconnect debouncing as it is unneeded these days

Signed-off-by: default avatarPhilippe De Swert <phdeswer@lumi.maa>
parent 27ef7d15
AC_INIT([usb_moded], [0.41])
AC_INIT([usb_moded], [0.43])
AM_INIT_AUTOMAKE([-Wall -Werror foreign])
AM_CONFIG_HEADER([config.h])
......
usb-moded (0.44) unstable; urgency=low
* Make disconnect debouncing timeout longer for USB cert Fixes: NB#266884
-- Philippe De Swert <philippe.de-swert@nokia.com> Thu, 23 Jun 2011 12:03:58 +0300
usb-moded (0.43) unstable; urgency=low
* Tweak disconnect debouncing and make sure we do not execute the disconnect
handler when we are connected. Fixes: NB#266157
-- Philippe De Swert <philippe.de-swert@nokia.com> Thu, 16 Jun 2011 14:43:37 +0300
usb-moded (0.42) unstable; urgency=low
* Debounce trigger events
* Only send disconnect signal when we were previously connected
* Make mass storage blocking more verbose
* Retry more before giving up the eMMC unmount. Fixes: NB#258488
-- Philippe De Swert <philippe.de-swert@nokia.com> Wed, 08 Jun 2011 14:23:01 +0300
usb-moded (0.41) unstable; urgency=low
* Fix forgotten case for devicelock/trigger. Fixes: NB#261558
......
......@@ -38,7 +38,7 @@
#include "usb_moded-config.h"
#include "usb_moded-modesetting.h"
static void report_mass_storage_blocker(const char *mountpoint);
static void report_mass_storage_blocker(const char *mountpoint, int try);
#ifdef MAYBE_NEEDED
int find_number_of_mounts(void)
......@@ -147,17 +147,18 @@ umount: command = g_strconcat("mount | grep ", mounts[i], NULL);
g_free(command);
if(ret != 0)
{
if(try != 1)
if(try != 3)
{
try++;
sleep(1);
log_err("Umount failed. Retrying\n");
report_mass_storage_blocker(mount, 1);
goto umount;
}
else
{
log_err("Unmounting %s failed\n", mount);
report_mass_storage_blocker(mount);
report_mass_storage_blocker(mount, 2);
#ifdef NOKIA
usb_moded_send_error_signal("qtn_usb_filessystem_inuse");
#else
......@@ -194,7 +195,7 @@ umount: command = g_strconcat("mount | grep ", mounts[i], NULL);
}
static void report_mass_storage_blocker(const char *mountpoint)
static void report_mass_storage_blocker(const char *mountpoint, int try)
{
FILE *stream = 0;
gchar *lsof_command = 0;
......@@ -223,6 +224,8 @@ static void report_mass_storage_blocker(const char *mountpoint)
pclose(stream);
}
g_free(lsof_command);
if(try == 2)
log_err("Setting Mass storage blocked. Giving up.\n");
}
......
......@@ -103,6 +103,11 @@ const char * usb_moded_find_module(void)
result = MODULE_WINDOWS_NET;
break;
}
if( strstr(text, "g_ncm") )
{
result = "g_ncm";
break;
}
/* if switching without disconnect we might have some dynamic module loaded */
if(strstr(text, get_usb_module()))
{
......
......@@ -179,7 +179,8 @@ static void udev_parse(struct udev_device *dev)
#ifdef NOKIA
if(!usb_moded_get_export_permission())
#endif /* NOKIA */
set_usb_mode(get_trigger_mode());
if(strcmp(get_trigger_mode(), get_usb_mode()) != 0)
set_usb_mode(get_trigger_mode());
}
else
......@@ -190,7 +191,8 @@ static void udev_parse(struct udev_device *dev)
#ifdef NOKIA
if(!usb_moded_get_export_permission())
#endif /* NOKIA */
set_usb_mode(get_trigger_mode());
if(strcmp(get_trigger_mode(), get_usb_mode()) != 0)
set_usb_mode(get_trigger_mode());
}
return;
}
......
......@@ -101,11 +101,6 @@ void set_usb_connected(gboolean connected)
if(current_mode.connected)
return;
if(debounce)
{
g_source_remove(debounce);
debounce = 0;
}
#ifdef NOKIA
if(timeout_source)
{
......@@ -117,29 +112,32 @@ void set_usb_connected(gboolean connected)
set_usb_connected_state();
}
else
if(!debounce)
debounce = g_timeout_add_seconds(2, set_disconnected, NULL);
{
current_mode.connected = FALSE;
set_disconnected(NULL);
}
}
static gboolean set_disconnected(gpointer data)
{
current_mode.connected = FALSE;
/* signal usb disconnected */
log_debug("usb disconnected\n");
/* clean-up state */
usb_moded_mode_cleanup(get_usb_module());
usb_moded_send_signal(USB_DISCONNECTED);
/* only disconnect for real if we are actually still disconnected */
if(!get_usb_connection_state())
{
/* signal usb disconnected */
log_debug("usb disconnected\n");
usb_moded_send_signal(USB_DISCONNECTED);
#ifdef NOKIA
timeout_source = g_timeout_add_seconds(5, usb_module_timeout_cleanup, NULL);
/* delayed clean-up of state */
timeout_source = g_timeout_add_seconds(5, usb_module_timeout_cleanup, NULL);
#else
/* unload modules and general cleanup */
usb_moded_module_cleanup(get_usb_module());
/* unload modules and general cleanup */
usb_moded_module_cleanup(get_usb_module());
#endif /* NOKIA */
set_usb_mode(MODE_UNDEFINED);
return FALSE;
set_usb_mode(MODE_UNDEFINED);
}
return FALSE;
}
/** set the chosen usb state
......@@ -348,7 +346,7 @@ gboolean get_usb_connection_state(void)
/** set connection status for some corner cases
*
* @param: connection status that needs to be set. Connected (TRUE)
* @param state The connection status that needs to be set. Connected (TRUE)
*
*/
void set_usb_connection_state(gboolean state)
......
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