Skip to content

Commit

Permalink
Make sure we don't try to mount cleaning up charging mode, avoid spur…
Browse files Browse the repository at this point in the history
…ious disconnects and clean-up actions when we use g_file_storage

Signed-off-by: Philippe De Swert <philippedeswert@gmail.com>
  • Loading branch information
philippedeswert committed Aug 23, 2012
1 parent 9af2c5f commit 215538f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/usb_moded-modesetting.c
Expand Up @@ -337,6 +337,10 @@ int usb_moded_mode_cleanup(const char *module)

if(!strcmp(module, MODULE_MASS_STORAGE)|| !strcmp(module, MODULE_FILE_STORAGE))
{
/* no clean-up needs to be done when we come from charging mode. We need
to check since we use fake mass-storage for charging */
if(!strcmp(MODE_CHARGING, get_usb_mode()))
return 0;
mount = find_mounts();
if(mount)
{
Expand Down
1 change: 1 addition & 0 deletions src/usb_moded-modesetting.h
Expand Up @@ -30,6 +30,7 @@ int set_mass_storage_mode(void);
int set_ovi_suite_mode(void);
int set_mtp_mode(void);
int set_dynamic_mode(struct mode_list_elem *data);
/* clean up for the mode changes on disconnect */
int usb_moded_mode_cleanup(const char *module);
#ifdef NOKIA
gboolean export_cdrom (gpointer data);
Expand Down
6 changes: 6 additions & 0 deletions src/usb_moded-modules.c
Expand Up @@ -165,6 +165,12 @@ int usb_moded_module_cleanup(const char *module)
*/

failure = usb_moded_unload_module(module);

/* if we have MODULE_MASS_STORAGE it might be MODULE_FILE_STORAGE might
be loaded. So check and unload that one if unloading fails first time */
if(failure && !strcmp(MODULE_MASS_STORAGE, module))
failure = usb_moded_unload_module(module);

while(failure)
{
// SP: up to 2 second sleep -> worth a warning log?
Expand Down
3 changes: 0 additions & 3 deletions src/usb_moded-modules.h
Expand Up @@ -43,9 +43,6 @@ int usb_moded_unload_module(const char *module);
/* find which module is loaded */
const char * usb_moded_find_module(void);

/* clean up for the mode changes on disconnect */
int usb_moded_mode_cleanup(const char *module);

/* clean up modules when usb gets disconnected */
int usb_moded_module_cleanup(const char *module);

Expand Down

0 comments on commit 215538f

Please sign in to comment.