Commit d7d828ab authored by phdeswer's avatar phdeswer

Add work-around to allow for loading g_file_storage with older kernels

parent 06fce1a8
......@@ -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);
......@@ -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;
......@@ -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()))
{
......
......@@ -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"
......
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