diff --git a/ports/synergy_micro.hash b/ports/synergy_micro.hash deleted file mode 100644 index 68d9356..0000000 --- a/ports/synergy_micro.hash +++ /dev/null @@ -1 +0,0 @@ -403606ea514978342866dcc1522459da180d8d50 diff --git a/ports/synergy_micro.port b/ports/synergy_micro.port deleted file mode 100644 index 8ec2ea9..0000000 --- a/ports/synergy_micro.port +++ /dev/null @@ -1,9 +0,0 @@ -LICENSE := GPLv2 -VERSION := 1.8.6 -DOWNLOADS := synergy_micro.archive - -URL(synergy_micro) := https://github.com/symless/synergy/archive/v$(VERSION)-stable.tar.gz -SHA(synergy_micro) := a07bf95d0c3bf8a2be4044a7557fb13792ff1867 -DIR(synergy_micro) := src/lib/synergy_micro - -TAR_OPT(synergy_micro) := --strip-components 3 synergy-$(VERSION)-stable/src/micro diff --git a/run/synergy.inc b/run/synergy.inc deleted file mode 100644 index 94355ad..0000000 --- a/run/synergy.inc +++ /dev/null @@ -1,88 +0,0 @@ -if ![have_installed synergys] { - puts stderr "\nsynergy server not installed\n" - exit -1 -} - -if {[have_spec linux]} { - puts "\Synergy scenarios not supported on Linux.\n" - exit -} - -proc append_synergy_build_components { } { - global build_components - append build_components { drivers/nic server/synergy_input } -} - -proc append_synergy_config { } { - global config - - append config { - - - - - - - - - - - } -} - -proc append_synergy_boot_modules { } { - global boot_modules - append boot_modules { nic_drv libc.lib.so vfs.lib.solwip_legacy.lib.so synergy_input } -} - - -proc write_synergy_host_config { } { - set fh [ open "bin/synergy.conf" w] - puts $fh { -section: screens - localhost: - genode-up: - genode-left: - genode-right: - genode-down: -end - -section: links - - localhost: - up = genode-up - left = genode-left - right = genode-right - down = genode-down - - genode-up: - down = localhost - - genode-left: - up = localhost - right = localhost - down = localhost - - genode-right: - up = localhost - left = localhost - down = localhost - - genode-down: - up = localhost -end -} - close $fh -} - - -proc remove_synergy_host_config { } { - file delete "bin/synergy.conf" -} - - -proc start_synergy_host { } { - puts stderr "spawning synergys" - spawn synergys \ - -f -d DEBUG -n localhost -c bin/synergy.conf -} diff --git a/run/synergy.run b/run/synergy.run deleted file mode 100644 index 847ae55..0000000 --- a/run/synergy.run +++ /dev/null @@ -1,93 +0,0 @@ -source ${genode_dir}/repos/world/run/synergy.inc -source ${genode_dir}/repos/base/run/platform_drv.inc - -# -# Build -# - -set build_components { - core init - drivers/timer - test/input -} - -append_synergy_build_components - -append_platform_drv_build_components - -build $build_components - -create_boot_directory - -# -# Generate config -# - -append config { - - - - - - - - - - - - - - - - - } - -append_platform_drv_config - -append config { - - - - - - - - - } - -append_synergy_config - -append config { -} - -install_config $config - -# -# Boot modules -# - -# generic modules -set boot_modules { - core init ld.lib.so - timer - test-input -} - -append_synergy_boot_modules - -# platform-specific modules -append_platform_drv_boot_modules - -build_boot_image $boot_modules - -append qemu_args " -net user" - -append_if [have_spec x86] qemu_args " -net nic,model=e1000" -append_if [have_spec lan9118] qemu_args " -net nic,model=lan9118" - -write_synergy_host_config -start_synergy_host - -run_genode_until forever - -remove_synergy_host_config diff --git a/run/synergy_nitpicker.run b/run/synergy_nitpicker.run deleted file mode 100644 index 08a1122..0000000 --- a/run/synergy_nitpicker.run +++ /dev/null @@ -1,281 +0,0 @@ -# -# Instantiate two Synergy clients -# - -source ${genode_dir}/repos/world/run/synergy.inc -source ${genode_dir}/repos/base/run/platform_drv.inc - -# -# Build -# - -set build_components { - core init - drivers/timer - server/nic_bridge - drivers/framebuffer - drivers/input/dummy - server/nitpicker - server/nit_fb - test/nitpicker - app/pointer -} - -append_synergy_build_components - -append_platform_drv_build_components - -build $build_components - -create_boot_directory - -# -# Generate config -# - -append config { - - - - - - - - - - - - - - - - - - - - - } - -append_platform_drv_config - -append_if [have_spec sdl] config { - - - - - - - - } - -append_if [have_spec framebuffer] config { - - - - - } - -append config { - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -} - -install_config $config - -# -# Boot modules -# - -# generic modules -set boot_modules { - core init ld.lib.so - timer - fb_drv - dummy_input_drv - nitpicker - testnit - nic_bridge nit_fb - pointer -} - -append_synergy_boot_modules - -# platform-specific modules -append_platform_drv_boot_modules - -build_boot_image $boot_modules - -append qemu_args " -net user" - -append_if [have_spec x86] qemu_args " -net nic,model=e1000" -append_if [have_spec lan9118] qemu_args " -net nic,model=lan9118" - -write_synergy_host_config -start_synergy_host - -run_genode_until forever - -remove_synergy_host_config diff --git a/src/server/synergy_input/main.cc b/src/server/synergy_input/main.cc deleted file mode 100644 index b4fca7b..0000000 --- a/src/server/synergy_input/main.cc +++ /dev/null @@ -1,403 +0,0 @@ -/* - * \brief Synergy client - * \author Emery Hemingway - * \date 2015-06-14 - * - * http://synergy-project.org/ - */ - -/* - * Copyright (C) 2015 Genode Labs GmbH - * - * This file is part of the Genode OS framework, which is distributed - * under the terms of the GNU General Public License version 2. - */ - -/* Genode includes */ -#include -#include -#include -#include -#include -#include -#include -#include - -/* Synergy includes */ -#include - -/* socket API */ -extern "C" { -#include -#include -#include -#include -#include -#include -#include -} - -using namespace Genode; - - -Constructible config; -Constructible timer; - - -struct Session_component : Input::Session_component -{ - /* Array for tracking the current keyboard state */ - bool key_state[Input::KEY_MAX + 1]; - int socket_fd; - uSynergyBool button_left; - uSynergyBool button_right; - uSynergyBool button_middle; - - Session_component(Genode::Env &env) - : Input::Session_component(env, env.ram()), socket_fd(-1) { } - - ~Session_component() - { - ::close(socket_fd); - } - - void reset_keys() - { - for (int i = 0; i <= Input::KEY_MAX; i++) - key_state[i] = false; - button_left = USYNERGY_FALSE; - button_right = USYNERGY_FALSE; - button_right = USYNERGY_FALSE; - } - -}; - - -/*********************** - ** Synergy callbacks ** - ***********************/ - -static uSynergyBool connect(uSynergyCookie cookie) -{ - Session_component *session = (Session_component*)cookie; - - /****************** - ** Parse config ** - ******************/ - - char addr[INET_ADDRSTRLEN]; - unsigned long port = 24800; - - Xml_node config_node = config->xml(); - - try { - config_node.attribute("addr").value(addr, sizeof(addr)); - } catch (Xml_node::Nonexistent_attribute) { - Genode::error("server address not set in config"); - return USYNERGY_FALSE; - } - - try { - config_node.attribute("port").value(&port); - } catch (...) { } - - - /***************************** - ** Open and connect socket ** - *****************************/ - - sockaddr_in sockaddr; - sockaddr.sin_family = AF_INET; - sockaddr.sin_port = htons(port); - if (inet_pton(AF_INET, addr, &sockaddr.sin_addr.s_addr) == 0) { - Genode::error("bad IPv4 address ", Cstring(addr), " for server"); - return USYNERGY_FALSE; - } - - session->socket_fd = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP); - if (session->socket_fd == -1) - return USYNERGY_FALSE; - - if (::connect(session->socket_fd, (struct sockaddr*) &sockaddr, sizeof(sockaddr))) { - ::close(session->socket_fd); - return USYNERGY_FALSE; - } - return USYNERGY_TRUE; -} - -uSynergyBool send(uSynergyCookie cookie, const uint8_t *buffer, int length) -{ - Session_component *session = (Session_component*)cookie; - - return (length == ::write(session->socket_fd, buffer, length)) ? - USYNERGY_TRUE : USYNERGY_FALSE; -} - -uSynergyBool receive(uSynergyCookie cookie, uint8_t *buffer, int maxLength, int* outLength) -{ - Session_component *session = (Session_component*)cookie; - - *outLength = ::read(session->socket_fd, buffer, maxLength); - if (!*outLength) - return USYNERGY_FALSE; - - return USYNERGY_TRUE; -} - -void sleep(uSynergyCookie, int timeMs) { timer->msleep(timeMs); } - -uint32_t get_time() { return timer->elapsed_ms(); } - -void trace_callback(uSynergyCookie cookie, const char *text) { Genode::log(text); } - -void screen_active_callback(uSynergyCookie cookie, uSynergyBool active) -{ - if (!active) { - Session_component *session = (Session_component*)cookie; - Input::Event_queue &queue = session->event_queue(); - queue.reset(); - queue.add(Input::Event(Input::Event::LEAVE, 0, 0, 0, 0, 0)); - session->reset_keys(); - } -} - -void mouse_callback(uSynergyCookie cookie, - uint16_t x, uint16_t y, - int16_t wheelX, int16_t wheelY, - uSynergyBool buttonLeft, - uSynergyBool buttonRight, - uSynergyBool buttonMiddle) -{ - Session_component *session = (Session_component*)cookie; - Input::Event_queue &queue = session->event_queue(); - - if (queue.avail_capacity() < 5) - queue.reset(); - - /* Defer sending a signal until all conditions are processed */ - - queue.add(Input::Event(Input::Event::MOTION, 0, x, y, 0, 0), false); - queue.add(Input::Event(Input::Event::WHEEL, 0, wheelX, wheelY, 0, 0), false); - - if (buttonLeft != session->button_left) - queue.add(Input::Event((session->button_left = buttonLeft) ? - Input::Event::PRESS : Input::Event::RELEASE, - Input::BTN_LEFT, 0, 0, 0, 0), false); - - if (buttonRight != session->button_right) - queue.add(Input::Event((session->button_right = buttonRight) ? - Input::Event::PRESS : Input::Event::RELEASE, - Input::BTN_RIGHT, 0, 0, 0, 0), false); - - if (buttonMiddle != session->button_middle) - queue.add(Input::Event((session->button_middle = buttonMiddle) ? - Input::Event::PRESS : Input::Event::RELEASE, - Input::BTN_MIDDLE, 0, 0, 0, 0), false); - queue.submit_signal(); -} - -void keyboard_callback(uSynergyCookie cookie, - uint16_t key, uint16_t modifiers, - uSynergyBool down, uSynergyBool repeat) -{ - Session_component *session = (Session_component*)cookie; - Input::Event_queue &queue = session->event_queue(); - - if (!queue.avail_capacity()) queue.reset(); - - key -= 8; // TODO what is <8? - if (key > Input::KEY_MAX) return; - - queue.add(Input::Event(((session->key_state[key] = !session->key_state[key]) ? - Input::Event::PRESS : Input::Event::RELEASE), - key, 0, 0, 0, 0)); -} - -/* - * void joystick_callback(uSynergyCookie cookie, - * uint8_t joyNum, - * uint16_t buttons, - * int8_t leftStickX, int8_t leftStickY, - * int8_t rightStickX, int8_t rightStickY); - */ - - -/******************************* - ** Network processing thread ** - *******************************/ - -struct Synergy_thread : Thread -{ - - enum { - MAX_NAME_LEN = 256, - STACK_SIZE = 1024*sizeof(long) - }; - - Genode::Env &env; - - char screen_name[MAX_NAME_LEN]; - uSynergyContext context; - Signal_receiver config_rec; - Signal_context config_ctx; - - Synergy_thread(Genode::Env &env, Session_component &session) - : Thread(env, "uSynergy", STACK_SIZE), env(env) - { - *screen_name = 0; - uSynergyInit(&context); - - context.m_connectFunc = &connect; /* Connect function */ - context.m_sendFunc = &send; /* Send data function */ - context.m_receiveFunc = &receive; /* Receive data function */ - context.m_sleepFunc = &sleep; /* Thread sleep function */ - context.m_getTimeFunc = &get_time; /* Get current time function */ - context.m_clientName = screen_name; /* Name of Synergy Screen */ - - context.m_cookie = (uSynergyCookie)&session; /* Cookie pointer passed to callback functions (can be NULL) */ - context.m_traceFunc = &trace_callback; /* Function for tracing status (can be NULL) */ - context.m_screenActiveCallback = &screen_active_callback; /* Callback for entering and leaving screen */ - context.m_mouseCallback = &mouse_callback; /* Callback for mouse events */ - context.m_keyboardCallback = &keyboard_callback; /* Callback for keyboard events */ - - config->sigh(config_rec.manage(&config_ctx)); - } - - ~Synergy_thread() - { - config_rec.dissolve(&config_ctx); - } - - /** - * Update configuration; return success state - */ - bool update_config() - { - /* - * TODO: detect changes to network config - * and trigger a reconnect if appropriate. - */ - Xml_node config_node = config->xml(); - - try { - config_node.attribute("addr");; - } catch (Xml_node::Nonexistent_attribute) { - Genode::error("server address not set in config"); - return false; - } - - try { - config_node.attribute("name").value(screen_name, sizeof(screen_name)); - } catch (Xml_node::Nonexistent_attribute) { - Genode::error("client screen name not set in config, waiting for update"); - return false; - } - - /* - * TODO: just get the capability for framebuffer or nitpicker, - * then make a simple resolution client that wraps that. - */ - - Genode::log("probing Nitpicker service"); - try { - Nitpicker::Connection conn { env, "dimension" }; - Framebuffer::Mode mode = conn.mode(); - - context.m_clientWidth = mode.width(); - context.m_clientHeight = mode.height(); - return true; - } catch (...) { } - - Genode::log("probing Framebuffer service"); - try { - Framebuffer::Connection conn { env, Framebuffer::Mode() }; - Framebuffer::Mode mode = conn.mode(); - - context.m_clientWidth = mode.width(); - context.m_clientHeight = mode.height(); - return true; - } catch (...) { } - - /* - * No real pointer space, but give the server a small holding area. - * - * XXX: drop pointer events without a screen? - */ - Genode::log("using a virtual screen area"); - context.m_clientWidth = context.m_clientHeight = 64; - return true; - } - - /** - * Parse the config, then spin on the Synergy update function. - * - * If the config is not valid, block until it is updated. - */ - void entry() - { - while (!update_config()) { - config_rec.wait_for_signal(); - config->update(); - } - - for (;;) { - uSynergyUpdate(&context); - if (config_rec.pending()) { - while (!update_config()) - config_rec.wait_for_signal(); - config->update(); - } - } - } -}; - - -/****************** - ** Main program ** - ******************/ - -using namespace Genode; - -struct Main -{ - Genode::Env &env; - - /* - * Input session provided to our client - */ - Session_component session_component { env }; - - /* - * Attach root interface to the entry point - */ - Static_root input_root { env.ep().manage(session_component) }; - - /* - * Additional thread for processing incoming events. - */ - Synergy_thread synergy_thread { env, session_component }; - - /** - * Constructor - */ - Main(Genode::Env &env) : env(env) - { - session_component.event_queue().enabled(true); - - env.parent().announce(env.ep().manage(input_root)); - - synergy_thread.start(); - } -}; - - -/*************** - ** Component ** - ***************/ - -void Libc::Component::construct(Libc::Env &env) -{ - config.construct(env, "config"); - timer.construct(env, "uSynergy"); - static Main inst(env); -} diff --git a/src/server/synergy_input/target.mk b/src/server/synergy_input/target.mk deleted file mode 100644 index 2bdcebd..0000000 --- a/src/server/synergy_input/target.mk +++ /dev/null @@ -1,12 +0,0 @@ -SYNERGY_SRC_DIR = $(call select_from_ports,synergy_micro)/src/lib/synergy_micro - -TARGET = synergy_input -INC_DIR += $(SYNERGY_SRC_DIR) -SRC_C = uSynergy.c -SRC_CC = main.cc -LIBS = libc libc_lwip_nic_dhcp - -vpath uSynergy.c $(SYNERGY_SRC_DIR) -vpath main.cc $(PRG_DIR) - -CC_CXX_WARN_STRICT =