Navigation Menu

Skip to content

Commit

Permalink
Add buteo mtp service starting hack
Browse files Browse the repository at this point in the history
Signed-off-by: Philippe De Swert <philippedeswert@gmail.com>
  • Loading branch information
philippedeswert committed Aug 7, 2012
1 parent 523e337 commit 78b758c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/usb_moded-modesetting.c
Expand Up @@ -25,6 +25,7 @@
#include <unistd.h>
#include <string.h>
#include <stdio.h>
#include <sys/stat.h>

#include <glib.h>

Expand Down Expand Up @@ -233,8 +234,19 @@ static void report_mass_storage_blocker(const char *mountpoint, int try)

}


/* TODO: clean up buteo-mtp hack */
int set_mtp_mode(void)
{
int pid = 1;

mkdir("/dev/mtp", S_IRWXO|S_IRWXU);
system("mount -t functionfs mtp /dev/mtp\n");

if ((pid=fork()) == 0)
{
execl("/usr/bin/mtp_service", "mtp_service", NULL);
}
}


Expand Down Expand Up @@ -328,7 +340,7 @@ int usb_moded_mode_cleanup(const char *module)
appsync_stop();
#endif /* UPSTART */

if(!strcmp(module, MODULE_MASS_STORAGE))
if(!strcmp(module, MODULE_MASS_STORAGE)|| !strcmp(module, MODULE_FILE_STORAGE))
{
mount = find_mounts();
if(mount)
Expand Down Expand Up @@ -393,6 +405,10 @@ int usb_moded_mode_cleanup(const char *module)
system("killall -SIGTERM acm");
}
#endif /* N900 */
if(!strcmp(module, MODULE_MTP))
{
system("umount /dev/mtp");
}


return(ret);
Expand Down
1 change: 1 addition & 0 deletions src/usb_moded-modesetting.h
Expand Up @@ -28,6 +28,7 @@ int find_number_of_mounts(void);
int write_to_file(const char *path, const char *text);
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);
int usb_moded_mode_cleanup(const char *module);
#ifdef NOKIA
Expand Down
2 changes: 2 additions & 0 deletions src/usb_moded.c
Expand Up @@ -269,6 +269,8 @@ else if(!strcmp(mode, MODE_DEVELOPER))
check_module_state(MODULE_MTP);
set_usb_module(MODULE_MTP);
ret = usb_moded_load_module(MODULE_MTP);
if(!ret)
ret = set_mtp_mode();
goto end;
}
else if(!strcmp(mode, MODE_ASK))
Expand Down

0 comments on commit 78b758c

Please sign in to comment.