From f0cbfcafbe4740bb3e2cbb78094acc112c28406f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Tue, 31 Mar 2009 17:08:00 +0000 Subject: [PATCH] - make the form pass w3 validator, - add serial port output, available as a telnet: url, - add untested support for passing through a usb device like a webcam, - add disabled SMP option, - change port assignations - lower sleep time for applet git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29833 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- 3rdparty/mmu_man/onlinedemo/haiku.php | 191 ++++++++++++++++++++++---- 1 file changed, 161 insertions(+), 30 deletions(-) diff --git a/3rdparty/mmu_man/onlinedemo/haiku.php b/3rdparty/mmu_man/onlinedemo/haiku.php index 74eb6809ff..c497452998 100755 --- a/3rdparty/mmu_man/onlinedemo/haiku.php +++ b/3rdparty/mmu_man/onlinedemo/haiku.php @@ -37,7 +37,12 @@ define("APPLET_HEIGHT", "768"); define("VNCPORTBASE", 5900); // base port for audio streams -define("AUDIOPORTBASE", 8080); +//define("AUDIOPORTBASE", 8080); +define("AUDIOPORTBASE", (VNCPORTBASE + MAX_QEMUS)); + +// base port for serial output +//define("SERIALPORTBASE", 9000); +define("SERIALPORTBASE", (VNCPORTBASE + MAX_QEMUS * 2)); // timeout before the demo session is killed, as argument to /bin/sleep define("SESSION_TIMEOUT", "20m"); @@ -70,10 +75,19 @@ define("QEMU_PIDFILE_TMPL", "qemu-haiku-pid-"); // name of session variable holding the qemu slot; not yet used correctly define("QEMU_IDX_VAR", "QEMU_HAIKU_SESSION_VAR"); + +// uncomment if you want to pass your Sonix webcam device through +// migth need to update VID:PID +//define("QEMU_USB_PASSTHROUGH", "-usbdevice host:0c45:6005"); + + define("BGCOLOR", "#336698"); + $vnckeymap = "en-us"; +$cpucount = 1; + // statics $count = $_SESSION['compteur']; //$count = $GLOBALS['compteur']; @@ -99,9 +113,9 @@ session_start(); //echo "do_kill: " . $do_kill . "
\n"; ?> - + - + Haiku Online Demo - - + "; echo "\n"; + $keymaps = list_keymaps(); echo "\n\n\n\n"; + $modes = array("1024x768"/*, "800x600"*/); echo "\n\n\n"; + + $maxcpus = 8; + echo "\n"; + echo "\n\n\n"; + + + $enable_sound = 0; echo "\n"; echo "Check to enable sound:"; echo "\n\n\n"; + $enable_serial = 1; + echo "\n"; + echo "\n\n\n"; + + if (defined("QEMU_USB_PASSTHROUGH")) { + + $enable_webcam = 1; + echo "\n"; + echo "\n\n\n"; + } /* echo "\n
\n"; echo "Select your keymap:"; echo "\n"; echo ""; echo "
\n"; echo ""; echo "
\n"; + echo "Select cpu count:"; + echo "\n"; + echo ""; + echo "
\n"; - echo "Sound"; if ($enable_sound) echo ""; - echo ""; + //echo ""; echo "
\n"; + echo "Check to enable serial output:"; + echo "\n"; + echo "Serial"; + if ($enable_serial) + echo ""; + //echo ""; + echo "
\n"; + echo "Check to enable webcam:"; + echo "\n"; + echo "Webcam"; + if ($enable_webcam) + echo ""; + //echo ""; + echo "
\n"; //out("Click here to enable sound:"); @@ -423,17 +520,28 @@ function output_kill_form() function start_qemu() { global $vnckeymap; + global $cpucount; $idx = find_qemu_slot(); if ($idx < 0) { err("No available qemu slot, please try later."); return $idx; } $pidfile = make_qemu_pidfile_name($idx); - $cmd = QEMU_BIN . " " . QEMU_ARGS . - " -k " . $vnckeymap . - " -vnc " . QEMU_VNC_PREFIX . vnc_display() . - " -pidfile " . $pidfile . - " " . QEMU_IMAGE_PATH; + $cmd = QEMU_BIN . " " . QEMU_ARGS; + if ($cpucount > 1) + $cmd .= " -smp " . $cpucount; + if (isset($_GET['serial'])) { + $cmd .= " -serial telnet::"; + $cmd .= (SERIALPORTBASE + qemu_slot()); + $cmd .= ",server,nowait,nodelay"; + } + if (isset($_GET['webcam']) && defined("QEMU_USB_PASSTHROUGH")) { + $cmd .= " " . QEMU_USB_PASSTHROUGH; + } + $cmd .= " -k " . $vnckeymap . + " -vnc " . QEMU_VNC_PREFIX . vnc_display() . + " -pidfile " . $pidfile . + " " . QEMU_IMAGE_PATH; if (file_exists($pidfile)) unlink($pidfile); @@ -501,8 +609,8 @@ function output_vnc_info() "or enter " . vnc_addr_display() . " in your " . "VNC viewer.
"); - echo "
\n"; + ">VNC viewer."); + //echo "
\n"; } function output_audio_player_code($external_only=false) @@ -532,7 +640,7 @@ function output_applet_code($external_only=false) $class = VNCCLASS; if ($external_only) return; - echo ""; + echo ""; echo "
"; echo "Available displays: " . +function output_serial_output_code($external_only=false) +{ + if (!isset($_GET['serial'])) + return; + + $url = "telnet://" . $_SERVER['HTTP_HOST'] . ":"; + $url .= (SERIALPORTBASE + qemu_slot()) . "/"; + out("You can get serial output at $url"); + return; + + // not really http... + $url = "http://" . $_SERVER['HTTP_HOST'] . ":"; + $url .= (SERIALPORTBASE + qemu_slot()) . "/"; + echo "
"; + echo ""; + echo "
"; + +} + +out("
Available displays: " . available_qemu_slots() . "/" . total_qemu_slots() . "
"); probe_keymap(); - +probe_options_form(); dbg("Checking if session is running..."); @@ -587,15 +715,18 @@ if (is_my_session_valid()) { dbg("Need to start qemu."); $qemuidx = start_qemu(); - out("Waiting for vnc server..."); - sleep(5); + //out("Waiting for vnc server..."); + //sleep(5); } if ($qemuidx >= 0 && !$do_kill) { output_kill_form(); + output_serial_output_code(); output_audio_player_code(); output_vnc_info(); + out("Waiting for vnc server..."); + sleep(1); output_applet_code(); } else { output_options_form();