]> git.proxmox.com Git - spiceterm.git/commitdiff
add keyboard interface
authorDietmar Maurer <dietmar@proxmox.com>
Mon, 5 Aug 2013 10:57:43 +0000 (12:57 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Mon, 5 Aug 2013 10:57:43 +0000 (12:57 +0200)
test_display_base.c
test_display_base.h
test_display_no_ssl.c

index babad5ccf20328f952b397f4046f9ca02753bc10..61e364490a68050477d32922f207ffd015417dba 100644 (file)
@@ -11,6 +11,7 @@
 
 #include "glyphs.h"
 #include <spice.h>
+#include <spice/enums.h>
 #include <spice/macros.h>
 #include <spice/qxl_dev.h>
 
@@ -548,6 +549,36 @@ void test_add_agent_interface(SpiceServer *server)
     spice_server_add_interface(server, &vdagent_sin.base);
 }
 
+static void kbd_push_key(SpiceKbdInstance *sin, uint8_t frag)
+{
+    printf("KEYCODE %u\n", frag);
+}
+
+static uint8_t kbd_get_leds(SpiceKbdInstance *sin)
+{
+    return 0;
+}
+
+static SpiceKbdInterface keyboard_sif = {
+    .base.type          = SPICE_INTERFACE_KEYBOARD ,
+    .base.description   = "spiceterm keyboard device",
+    .base.major_version = SPICE_INTERFACE_KEYBOARD_MAJOR,
+    .base.minor_version = SPICE_INTERFACE_KEYBOARD_MINOR,
+    .push_scan_freg     = kbd_push_key,
+    .get_leds           = kbd_get_leds,
+};
+
+SpiceKbdInstance keyboard_sin = {
+    .base = {
+        .sif = &keyboard_sif.base,
+    },
+};
+
+void test_add_keyboard_interface(SpiceServer *server)
+{
+    spice_server_add_interface(server, &keyboard_sin.base);
+}
+
 void test_set_simple_command_list(Test *test, int *simple_commands, int num_commands)
 {
     int i;
index 25af40391e96ea7c90185f24dc59132a37bf3d53..3c568134d1ea54faa5a29e3514e5cf81b495f2bc 100644 (file)
@@ -121,6 +121,7 @@ void test_set_simple_command_list(Test *test, int *command, int num_commands);
 void test_set_command_list(Test *test, Command *command, int num_commands);
 void test_add_display_interface(Test *test);
 void test_add_agent_interface(SpiceServer *server); // TODO - Test *test
+void test_add_keyboard_interface(SpiceServer *server);
 Test* test_new(SpiceCoreInterface* core);
 
 uint32_t test_get_width(void);
index 778bbe5d637a8f464010a70c26d6f2cbfeebeb6d..62c13d8658de1de2cb5724aa62e5461d18715808 100644 (file)
@@ -34,9 +34,14 @@ int main(void)
     test = test_new(core);
     //spice_server_set_image_compression(server, SPICE_IMAGE_COMPRESS_OFF);
     test_add_display_interface(test);
     test_add_agent_interface(test->server);
+
+    test_add_keyboard_interface(test->server);
+    
     test_set_simple_command_list(test, simple_commands, COUNT(simple_commands));
 
+
     //ping_timer = core->timer_add(pinger, NULL);
     //core->timer_start(ping_timer, ping_ms);