Navigation Menu

Skip to content

Commit

Permalink
Add work-around to allow for loading g_file_storage with older kernels
Browse files Browse the repository at this point in the history
  • Loading branch information
philippedeswert committed Aug 7, 2012
1 parent 06fce1a commit d7d828a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
22 changes: 21 additions & 1 deletion src/usb_moded-modules.c
Expand Up @@ -52,6 +52,16 @@ int usb_moded_load_module(const char *module)

command = g_strconcat("modprobe ", module, NULL);
ret = system(command);
if(!strcmp(module, MODULE_MASS_STORAGE) && (ret != 0))
{
command = g_strconcat("modprobe ", MODULE_FILE_STORAGE, NULL);
ret = system(command);
}
if(!strcmp(module, MODULE_CHARGING) && (ret != 0))
{
command = g_strconcat("modprobe ", MODULE_CHARGE_FALLBACK, NULL);
ret = system(command);
}
g_free(command);
if( ret == 0)
log_info("Module %s loaded successfully\n", module);
Expand Down Expand Up @@ -98,11 +108,16 @@ const char * usb_moded_find_module(void)
break;
}
if( strstr(text, "g_file_storage") )
{
result = MODULE_FILE_STORAGE;
break;
}
if( strstr(text, "g_mass_storage") )
{
result = MODULE_MASS_STORAGE;
break;
}
if( strstr(text, "g_ether") )
if( strstr(text, "g_ether") )
{
result = MODULE_WINDOWS_NET;
break;
Expand All @@ -112,6 +127,11 @@ const char * usb_moded_find_module(void)
result = "g_ncm";
break;
}
if( strstr(text, "g_ffs") )
{
result = MODULE_MTP;
break;
}
/* if switching without disconnect we might have some dynamic module loaded */
if(strstr(text, get_usb_module()))
{
Expand Down
2 changes: 2 additions & 0 deletions src/usb_moded-modules.h
Expand Up @@ -26,7 +26,9 @@
#define MODULE_NETWORK_MTP "g_nokia"
#endif /* NOKIA */
#define MODULE_MASS_STORAGE "g_mass_storage"
#define MODULE_FILE_STORAGE "g_file_storage"
#define MODULE_CHARGING "g_mass_storage luns=1 stall=0 removable=1"
#define MODULE_CHARGE_FALLBACK "g_file_storage luns=1 stall=0 removable=1"
#define MODULE_NONE "none"
#define MODULE_WINDOWS_NET "g_ether"
#define MODULE_DEVELOPER "g_ether"
Expand Down

0 comments on commit d7d828a

Please sign in to comment.