summaryrefslogtreecommitdiff
path: root/tizen/src/guest_server.c
diff options
context:
space:
mode:
authorEvgeny Voevodin <e.voevodin@samsung.com>2012-06-14 12:52:25 +0400
committerEvgeny Voevodin <e.voevodin@samsung.com>2012-06-15 11:24:52 +0400
commit44d998f5507fed17467a5c12d63ec09ce4b506a2 (patch)
treec27e6256ea6d332b3106326237f2023727b0f05a /tizen/src/guest_server.c
parent61c1de479c825eee5f50ded811dd68306a4c0c49 (diff)
downloadqemu-44d998f5507fed17467a5c12d63ec09ce4b506a2.tar.gz
qemu-44d998f5507fed17467a5c12d63ec09ce4b506a2.tar.bz2
qemu-44d998f5507fed17467a5c12d63ec09ce4b506a2.zip
Merge remote-tracking branch 'score/develop' into tizen-arm-v1.1.0
Diffstat (limited to 'tizen/src/guest_server.c')
-rw-r--r--tizen/src/guest_server.c60
1 files changed, 59 insertions, 1 deletions
diff --git a/tizen/src/guest_server.c b/tizen/src/guest_server.c
index 976cf92aaf..79b7958ea2 100644
--- a/tizen/src/guest_server.c
+++ b/tizen/src/guest_server.c
@@ -32,6 +32,8 @@
#include <string.h>
#include <unistd.h>
#include <stdint.h>
+#include <assert.h>
+#include <glib.h>
#ifdef _WIN32
#include <windows.h>
@@ -73,6 +75,28 @@ pthread_t start_guest_server( int server_port ) {
}
+/* get_tizen_vms_sdcard_path = "/home/{USER}/tizen_vms/sdcard" */
+char* get_tizen_vms_sdcard_path(void)
+{
+ char tizen_vms[] = "/tizen_vms/sdcard/";
+#ifndef _WIN32
+ char *homedir = (char*)g_getenv("HOME");
+#else
+ char *homedir = (char*)g_getenv("USERPROFILE");
+#endif
+ char *tizen_vms_path;
+
+ if(!homedir)
+ homedir = (char*)g_get_home_dir();
+
+ tizen_vms_path = malloc(strlen(homedir) + sizeof tizen_vms + 1);
+ assert(tizen_vms_path != NULL);
+ strcpy(tizen_vms_path, homedir);
+ strcat(tizen_vms_path, tizen_vms);
+
+ return tizen_vms_path;
+}
+
static void* run_guest_server( void* args ) {
INFO( "start guest server thread.\n" );
@@ -140,7 +164,41 @@ static void* run_guest_server( void* args ) {
TRACE( "command:%s\n", command );
notify_sdb_daemon_start();
notify_sensor_daemon_start();
- } else {
+ }
+ else if ( strcmp( command, "4\n" ) == 0 ) {
+ /* sdcard mount/umount msg recv from emuld */
+ INFO( "command:%s\n", command );
+ char token[] = "\n";
+ char* ret = NULL;
+ ret = strtok(readbuf, token);
+ INFO( "%s\n", ret);
+
+ ret = strtok(NULL, token);
+ INFO( "%s\n", ret);
+
+ /* umount sdcard */
+ if ( atoi(ret) == 0 ) {
+ mloop_evcmd_usbdisk( NULL );
+
+ } else if( atoi(ret) == 1 ) {
+ /* mount sdcard */
+ char sdcard_path[256];
+ char* vms_path = get_tizen_vms_sdcard_path();
+ memset(sdcard_path, '\0', sizeof(sdcard_path));
+
+ strcpy(sdcard_path, vms_path);
+
+ /* tizen_vms_sdcard_path + sdcard img name */
+ ret = strtok(NULL, token);
+ strcat(sdcard_path, ret);
+ INFO( "%s\n", sdcard_path);
+
+ mloop_evcmd_usbdisk(sdcard_path);
+ free(vms_path);
+ } else {
+ ERR( "!!! unknown command : %s\n", ret );
+ }
+ } else {
ERR( "!!! unknown command : %s\n", command );
}
TRACE( "========================================\n" );