return tizen_base_port;
}
-void sdb_setup(void)
+void sdb_setup(int port)
{
+ int tries = 10;
+ const char *base_port = "26100";
+ int success = 0;
int s;
+ uint32_t guest_ip;
+ const char *p;
+ char buf[64] = {0,};
+
+ inet_strtoip("10.0.2.16", &guest_ip);
+
+ for ( ; tries > 0; tries--, port += 10 ) {
+ // redir form [tcp:26100:10.0.2.16:26101]
+ sprintf(buf, "tcp:%d:10.0.2.16:26101", port+1);
+ if(net_slirp_redir((char*)buf) < 0)
+ continue;
+
+ fprintf(stdout,"SDBD established on port %d\n", port+1);
+ success = 1;
+ break;
+ }
+
+ INFO("redirect [%s] success\n", buf);
+ if (!success) {
+ ERR( "it seems too many emulator instances are running on this machine. Aborting\n" );
+ exit(1);
+ }
+
+// if( tizen_base_port != port ){
+// ERR( "sdb port is miss match. Aborting\n" );
+// exit(1);
+// }
+
+ /* Save base port. */
+ INFO( "Port(%d/tcp) listen for SDB \n", port + 1);
+
+ /* for sensort */
+ sprintf(buf, "tcp:%d:10.0.2.16:3577", port + SDB_TCP_EMULD_INDEX );
+ if(net_slirp_redir((char*)buf) < 0){
+ ERR( "redirect [%s] fail \n", buf);
+ }else{
+ INFO("redirect [%s] success\n", buf);
+ }
+
/* send a simple message to the SDB host server to tell it we just started.
* it should be listening on port 26099. if we can't reach it, don't bother
*/
}
/* length is hex: 0x13 = 19 */
- sprintf(tmp,"0013host:emulator:%d", tizen_base_port + 1);
- INFO("sent %s to sdb server", tmp);
+ sprintf(tmp,"0013host:emulator:%d",port+1);
socket_send(s, tmp, 30);
}
#define SDB_TCP_EMULD_INDEX 3 /* emulator daemon port */
#define SDB_TCP_OPENGL_INDEX 4 /* opengl server port */
-
-#define SDB_UDP_SENSOR_INDEX 3 /* sensor server port */
extern int tizen_base_port;
-void sdb_setup(void);
+#define SDB_UDP_SENSOR_INDEX 3 /* sensor server port */
+void sdb_setup(int port);
int get_sdb_base_port(void);
int inet_strtoip(const char* str, uint32_t *ip);
int socket_send(int fd, const void* buf, int buflen);
#ifdef CONFIG_MARU
#include "tizen/src/maru_sdl.h"
#include "tizen/src/option.h"
+#include "tizen/src/sdb.h"
#endif
//#define DEBUG_NET
#define MAX_VIRTIO_CONSOLES 1
+#ifdef CONFIG_MARU
#define VIRTIOGL_DEV_NAME "virtio-gl-pci"
+extern int tizen_base_port;
extern int gl_acceleration_capability_check (void);
+#endif
+
static const char *data_dir;
const char *bios_name = NULL;
enum vga_retrace_method vga_retrace_method = VGA_RETRACE_DUMB;
vm_start();
}
+#ifdef CONFIG_MARU
+ /* call sdb setup function */
+ sdb_setup(tizen_base_port);
+#endif
+
os_setup_post();
resume_all_vcpus();