summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEd Tanous <ed.tanous@intel.com>2018-12-20 23:30:45 +0300
committerEd Tanous <ed.tanous@intel.com>2019-02-21 04:45:55 +0300
commit3eb2f35f28249b9b5dc2159a44ca75a0fa7677a5 (patch)
treefdd26d7d50088bdef022f1d58de8e38458ef6552 /src
parent2f1ebcd18ca79f4bf19a0924a0b26a8436f24f6c (diff)
downloadbmcweb-3eb2f35f28249b9b5dc2159a44ca75a0fa7677a5.tar.xz
Implement KVM websocket proxy in bmcweb
This patchset implements a KVM websocket proxy designed to interoperate with phosphor-webui and KVM. in short, IP address 127.0.0.1:5900 is proxied to the websocket. This allows someone to connect from a browser session. Requires patchset here for the phosphor-webui side: https://gerrit.openbmc-project.xyz/#/c/openbmc/phosphor-webui/+/10268/ and requires the kvm patches here: https://gerrit.openbmc-project.xyz/#/c/openbmc/meta-phosphor/+/13536/ Tested By: Launched webui, observed KVM. Moved mouse, and typed on keyboard, changes appeared on host system. Change-Id: I407488f4b16be208b188a0abc19954a0243af173 Signed-off-by: Ed Tanous <ed.tanous@intel.com>
Diffstat (limited to 'src')
-rw-r--r--src/getvideo_main.cpp79
-rw-r--r--src/webserver_main.cpp4
2 files changed, 2 insertions, 81 deletions
diff --git a/src/getvideo_main.cpp b/src/getvideo_main.cpp
deleted file mode 100644
index 849c75d539..0000000000
--- a/src/getvideo_main.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-#include <fcntl.h>
-#include <unistd.h>
-
-#include <chrono>
-#include <cstdio>
-#include <cstdlib>
-#include <fstream>
-#include <iomanip>
-#include <iostream>
-#include <thread>
-#include <vector>
-
-//#define BUILD_CIMG
-#ifdef BUILD_CIMG
-#define cimg_display 0
-#include <CImg.h>
-#endif
-
-#include <ast_jpeg_decoder.hpp>
-#include <ast_video_puller.hpp>
-
-int main()
-{
- ast_video::RawVideoBuffer out;
- bool have_hardware = false;
- if (access("/dev/video", F_OK) != -1)
- {
- ast_video::SimpleVideoPuller p;
- p.initialize();
- out = p.readVideo();
- }
- else
- {
- FILE *fp = fopen("/home/ed/screendata.bin", "rb");
- if (fp != nullptr)
- {
- size_t newLen = fread(out.buffer.data(), sizeof(char),
- out.buffer.size() * sizeof(long), fp);
- if (ferror(fp) != 0)
- {
- fputs("Error reading file", stderr);
- }
- fclose(fp);
- out.buffer.resize(newLen);
- out.mode = ast_video::YuvMode::YUV444;
- out.width = 800;
- out.height = 600;
- out.ySelector = 0;
- out.uvSelector = 0;
- }
- }
-
- FILE *fp = fopen("/tmp/screendata.bin", "wb");
- fwrite(out.buffer.data(), sizeof(char), out.buffer.size(), fp);
- fclose(fp);
-
- ast_video::AstJpegDecoder d;
- d.decode(out.buffer, out.width, out.height, out.mode, out.ySelector,
- out.uvSelector);
-#ifdef BUILD_CIMG
- cimg_library::CImg<unsigned char> image(out.width, out.height, 1,
- 3 /*numchannels*/);
- for (int y = 0; y < out.height; y++)
- {
- for (int x = 0; x < out.width; x++)
- {
- auto pixel = d.outBuffer[x + (y * out.width)];
- image(x, y, 0) = pixel.r;
- image(x, y, 1) = pixel.g;
- image(x, y, 2) = pixel.b;
- }
- }
- image.save("/tmp/file2.bmp");
-#endif
-
- std::cout << "Done!\n";
-
- return 1;
-}
diff --git a/src/webserver_main.cpp b/src/webserver_main.cpp
index 7c64f4c748..b357b4e1de 100644
--- a/src/webserver_main.cpp
+++ b/src/webserver_main.cpp
@@ -5,6 +5,7 @@
#include <dbus_monitor.hpp>
#include <dbus_singleton.hpp>
#include <image_upload.hpp>
+#include <kvm_websocket.hpp>
#include <memory>
#include <obmc_console.hpp>
#include <openbmc_dbus_rest.hpp>
@@ -18,7 +19,6 @@
#include <ssl_key_handler.hpp>
#include <string>
#include <token_authorization_middleware.hpp>
-#include <web_kvm.hpp>
#include <webassets.hpp>
#include <webserver_common.hpp>
@@ -77,7 +77,7 @@ int main(int argc, char** argv)
#endif
#ifdef BMCWEB_ENABLE_KVM
- crow::kvm::requestRoutes(app);
+ crow::obmc_kvm::requestRoutes(app);
#endif
#ifdef BMCWEB_ENABLE_REDFISH