Re: [Spice-devel] [PATCH v3 vdagent-linux] vdagentd: support fake uinput

2013-09-03 Thread Hans de Goede

ACK.

On 09/02/2013 11:09 PM, Alon Levy wrote:

This is used with Xspice. Fake means we open a pipe for write only, and
don't do any ioctls on it. Specifically it means the axis and buttons
have to be coordinated for now with Xspice (xf86-video-qxl).

Signed-off-by: Alon Levy al...@redhat.com
---
  src/vdagentd-uinput.c | 11 +--
  src/vdagentd-uinput.h |  2 +-
  src/vdagentd.c| 14 +++---
  3 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/src/vdagentd-uinput.c b/src/vdagentd-uinput.c
index a415f9c..47e1b45 100644
--- a/src/vdagentd-uinput.c
+++ b/src/vdagentd-uinput.c
@@ -42,12 +42,13 @@ struct vdagentd_uinput {
  struct vdagentd_guest_xorg_resolution *screen_info;
  int screen_count;
  VDAgentMouseState last;
+int fake;
  };

  struct vdagentd_uinput *vdagentd_uinput_create(const char *devname,
  int width, int height,
  struct vdagentd_guest_xorg_resolution *screen_info, int screen_count,
-int debug)
+int debug, int fake)
  {
  struct vdagentd_uinput *uinput;

@@ -58,6 +59,7 @@ struct vdagentd_uinput *vdagentd_uinput_create(const char 
*devname,
  uinput-devname = devname;
  uinput-fd  = -1; /* Gets opened by vdagentd_uinput_update_size() */
  uinput-debug   = debug;
+uinput-fake= fake;

  vdagentd_uinput_update_size(uinput, width, height,
  screen_info, screen_count);
@@ -119,13 +121,18 @@ void vdagentd_uinput_update_size(struct vdagentd_uinput 
**uinputp,
  return;
  #endif

-uinput-fd = open(uinput-devname, O_RDWR);
+uinput-fd = open(uinput-devname, uinput-fake ? O_WRONLY : O_RDWR);
  if (uinput-fd == -1) {
  syslog(LOG_ERR, open %s: %m, uinput-devname);
  vdagentd_uinput_destroy(uinputp);
  return;
  }

+if (uinput-fake) {
+/* fake device doesn't understand any ioctls and only writes events */
+return;
+}
+
  rc = write(uinput-fd, device, sizeof(device));
  if (rc != sizeof(device)) {
  syslog(LOG_ERR, write %s: %m, uinput-devname);
diff --git a/src/vdagentd-uinput.h b/src/vdagentd-uinput.h
index 81f0376..b9bd9f1 100644
--- a/src/vdagentd-uinput.h
+++ b/src/vdagentd-uinput.h
@@ -30,7 +30,7 @@ struct vdagentd_uinput;
  struct vdagentd_uinput *vdagentd_uinput_create(const char *devname,
  int width, int height,
  struct vdagentd_guest_xorg_resolution *screen_info, int screen_count,
-int debug);
+int debug, int fake);
  void vdagentd_uinput_destroy(struct vdagentd_uinput **uinputp);

  void vdagentd_uinput_do_mouse(struct vdagentd_uinput **uinputp,
diff --git a/src/vdagentd.c b/src/vdagentd.c
index 2288671..cfb7acc 100644
--- a/src/vdagentd.c
+++ b/src/vdagentd.c
@@ -58,6 +58,7 @@ static const char *portdev = 
/dev/virtio-ports/com.redhat.spice.0;
  static const char *vdagentd_socket = VDAGENTD_SOCKET;
  static const char *uinput_device = /dev/uinput;
  static int debug = 0;
+static int uinput_fake = 0;
  static struct udscs_server *server = NULL;
  static struct vdagent_virtio_port *virtio_port = NULL;
  static GHashTable *active_xfers = NULL;
@@ -317,7 +318,8 @@ int virtio_port_read_complete(
  agent_data-height,
  agent_data-screen_info,
  agent_data-screen_count,
-debug  1);
+debug  1,
+uinput_fake);
  if (!uinput) {
  syslog(LOG_CRIT, Fatal uinput error);
  retval = 1;
@@ -488,7 +490,8 @@ static void check_xorg_resolution(void)
  agent_data-height,
  agent_data-screen_info,
  agent_data-screen_count,
-debug  1);
+debug  1,
+uinput_fake);
  else
  vdagentd_uinput_update_size(uinput,
  agent_data-width,
@@ -867,6 +870,11 @@ int main(int argc, char *argv[])
  }
  }

+if (strncmp(uinput_device, /dev, 4) != 0) {
+syslog(LOG_INFO, using fake uinput);
+uinput_fake = 1;
+}
+
  memset(act, 0, sizeof(act));
  act.sa_flags = SA_RESTART;
  act.sa_handler = quit_handler;
@@ -899,7 +907,7 @@ int main(int argc, char *argv[])

  #ifdef WITH_STATIC_UINPUT
  uinput = vdagentd_uinput_create(uinput_device, 1024, 768, NULL, 0,
-debug  1);
+debug  1, uinput_fake);
  if (!uinput) {
  udscs_destroy_server(server);
  return 1;


___
Spice-devel mailing list

Re: [Spice-devel] multi monitor setup ?

2013-09-03 Thread Brad Campbell

On 30/08/13 21:36, Alexandre DERUMIER wrote:

Hi,

I'm looking for documentation about multi monitor setup, and I can't find it.

How do it work ?


Here's how I do it.

#!/bin/sh
qemu -enable-kvm\
 -m 24576\
 -rtc base=localtime\
 -vga qxl\
 -device qxl\
 -net nic,model=virtio\
 -net tap,ifname=tap0,script=/etc/qemu-ifup\
 -usbdevice tablet\
 -spice port=5930,disable-ticketing\
 -drive 
file=/dev/disk/by-id/ata-FM-25S2S-60GBP2_GS07103208060019,if=virtio,cache=unsafe 
-boot c\

 -device virtio-serial\
 -chardev spicevmc,id=vdagent,name=vdagent\
 -device virtserialport,chardev=vdagent,name=com.redhat.spice.0\
 -smp 4,maxcpus=4,cores=4\
 -cpu host

This gives me 2 heads in a Windows server 2003 Guest. I believe the 
important part is making sure you have a spice channel enabled, and the 
extra -device qxl to let it know you want two devices.


I've not needed triple head yet, but I assume it'll work just the same.


___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [KEYVAL PATCH v1] add KEYVAL enums to protocol header definitions

2013-09-03 Thread Dietmar Maurer

Signed-off-by: Dietmar Maurer diet...@proxmox.com
---
 spice/enums.h|8 
 spice/protocol.h |1 +
 2 files changed, 9 insertions(+)

diff --git a/spice/enums.h b/spice/enums.h
index 8c731e9..e6adb5a 100644
--- a/spice/enums.h
+++ b/spice/enums.h
@@ -301,6 +301,13 @@ typedef enum SpiceMouseButtonMask {
 SPICE_MOUSE_BUTTON_MASK_MASK = 0x7
 } SpiceMouseButtonMask;
 
+typedef enum SpiceKeyboardKeyvalFlags {
+SPICE_KEYBOARD_KEYVAL_FLAG_DOWN = (1  0),
+SPICE_KEYBOARD_KEYVAL_FLAG_UP = (1  1),
+
+SPICE_KEYBOARD_KEYVAL_FLAGS_MASK = 0x3
+} SpiceKeyboardKeyvalFlags;
+
 typedef enum SpiceCursorType {
 SPICE_CURSOR_TYPE_ALPHA,
 SPICE_CURSOR_TYPE_MONO,
@@ -495,6 +502,7 @@ enum {
 SPICE_MSGC_INPUTS_KEY_UP,
 SPICE_MSGC_INPUTS_KEY_MODIFIERS,
 SPICE_MSGC_INPUTS_KEY_SCANCODE,
+SPICE_MSGC_INPUTS_KEY_KEYVAL,
 SPICE_MSGC_INPUTS_MOUSE_MOTION = 111,
 SPICE_MSGC_INPUTS_MOUSE_POSITION,
 SPICE_MSGC_INPUTS_MOUSE_PRESS,
diff --git a/spice/protocol.h b/spice/protocol.h
index e11f384..4f48293 100644
--- a/spice/protocol.h
+++ b/spice/protocol.h
@@ -135,6 +135,7 @@ enum {
 
 enum {
 SPICE_INPUTS_CAP_KEY_SCANCODE,
+SPICE_INPUTS_CAP_KEY_KEYVAL,
 };
 
 enum {
-- 
1.7.10.4

___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [KEYVAL PATCH v1] add push_keyval callback to SpiceKbdInterface

2013-09-03 Thread Dietmar Maurer

Signed-off-by: Dietmar Maurer diet...@proxmox.com
---
 server/inputs_channel.c |   20 
 server/spice.h  |1 +
 2 files changed, 21 insertions(+)

diff --git a/server/inputs_channel.c b/server/inputs_channel.c
index 931dac1..248ecae 100644
--- a/server/inputs_channel.c
+++ b/server/inputs_channel.c
@@ -224,6 +224,20 @@ static void kbd_push_scan(SpiceKbdInstance *sin, uint8_t 
scan)
 sif-push_scan_freg(sin, scan);
 }
 
+static void kbd_push_keyval(SpiceKbdInstance *sin, uint32_t keyval, int flags)
+{
+SpiceKbdInterface *sif;
+
+if (!sin) {
+return;
+}
+sif = SPICE_CONTAINEROF(sin-base.sif, SpiceKbdInterface, base);
+
+if (sif-push_keyval) {
+sif-push_keyval(sin, keyval, flags);
+}
+}
+
 static uint8_t kbd_get_leds(SpiceKbdInstance *sin)
 {
 SpiceKbdInterface *sif;
@@ -339,6 +353,11 @@ static int inputs_channel_handle_parsed(RedChannelClient 
*rcc, uint32_t size, ui
 }
 break;
 }
+case SPICE_MSGC_INPUTS_KEY_KEYVAL: {
+SpiceMsgcKeyKeyval *key_keyval = (SpiceMsgcKeyKeyval *)buf;
+kbd_push_keyval(keyboard, key_keyval-keyval, key_keyval-flags);
+break;
+}
 case SPICE_MSGC_INPUTS_MOUSE_MOTION: {
 SpiceMsgcMouseMotion *mouse_motion = (SpiceMsgcMouseMotion *)buf;
 
@@ -637,6 +656,7 @@ void inputs_init(void)
 red_channel_register_client_cbs(g_inputs_channel-base, client_cbs);
 
 red_channel_set_cap(g_inputs_channel-base, 
SPICE_INPUTS_CAP_KEY_SCANCODE);
+red_channel_set_cap(g_inputs_channel-base, SPICE_INPUTS_CAP_KEY_KEYVAL);
 reds_register_channel(g_inputs_channel-base);
 
 if (!(key_modifiers_timer = core-timer_add(key_modifiers_sender, NULL))) {
diff --git a/server/spice.h b/server/spice.h
index 6fbb7b2..a211575 100644
--- a/server/spice.h
+++ b/server/spice.h
@@ -270,6 +270,7 @@ typedef struct SpiceKbdState SpiceKbdState;
 struct SpiceKbdInterface {
 SpiceBaseInterface base;
 
+void (*push_keyval)(SpiceKbdInstance *sin, uint32_t keyval, int flags);
 void (*push_scan_freg)(SpiceKbdInstance *sin, uint8_t frag);
 uint8_t (*get_leds)(SpiceKbdInstance *sin);
 };
-- 
1.7.10.4

___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [KEYVAL PATCH v1] protocol extension for UTF/KEYVAL input

2013-09-03 Thread Dietmar Maurer
Some SPICE applications want to use the keymap from the client side, and 
works directly with UTF input characters (for examply a terminal emulator). 
The current scancode values cannot be used for those applications.

Unfortunately, UTF character set miss all special keyboard keys like
function-keys. So this patch uses X11/gdk keyboard symbols (keysyms) 
instead (VNC clients also use that, so this makes it easy to move from
VNC to SPICE).

The current patch defines a new protocol message:

 message {
   uint32 keyval;
   keyboard_keyval_flags flags; # DOWN/UP/DOWN_AND_UP
} @ctype(SpiceMsgcKeyKeyval) key_keyval;

A further extension could be to add the scancode, so that this
message can replace all previous keyboard messages:

 message {
   uint32 keyval;
   uint32 scancode;
   keyboard_keyval_flags flags;
} @ctype(SpiceMsgcKeyKeyval) key_keyval;



___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [KEYVAL PATCH v1] add SpiceMsgcKeyKeyval protocol message definition

2013-09-03 Thread Dietmar Maurer

Signed-off-by: Dietmar Maurer diet...@proxmox.com
---
 common/client_marshallers.h |1 +
 common/messages.h   |5 +
 spice.proto |   10 ++
 3 files changed, 16 insertions(+)

diff --git a/common/client_marshallers.h b/common/client_marshallers.h
index 85051a0..bbd114d 100644
--- a/common/client_marshallers.h
+++ b/common/client_marshallers.h
@@ -48,6 +48,7 @@ typedef struct {
 void (*msgc_inputs_key_down)(SpiceMarshaller *m, SpiceMsgcKeyDown *msg);
 void (*msgc_inputs_key_up)(SpiceMarshaller *m, SpiceMsgcKeyUp *msg);
 void (*msgc_inputs_key_modifiers)(SpiceMarshaller *m, 
SpiceMsgcKeyModifiers *msg);
+void (*msgc_inputs_key_keyval)(SpiceMarshaller *m, SpiceMsgcKeyKeyval 
*msg);
 void (*msgc_inputs_mouse_motion)(SpiceMarshaller *m, SpiceMsgcMouseMotion 
*msg);
 void (*msgc_inputs_mouse_position)(SpiceMarshaller *m, 
SpiceMsgcMousePosition *msg);
 void (*msgc_inputs_mouse_press)(SpiceMarshaller *m, SpiceMsgcMousePress 
*msg);
diff --git a/common/messages.h b/common/messages.h
index a8a0eee..5550cae 100644
--- a/common/messages.h
+++ b/common/messages.h
@@ -417,6 +417,11 @@ typedef struct SpiceMsgcKeyModifiers {
 uint32_t modifiers;
 } SpiceMsgcKeyModifiers;
 
+typedef struct SpiceMsgcKeyKeyval {
+uint32_t keyval;
+uint32_t flags;
+} SpiceMsgcKeyKeyval;
+
 typedef struct SpiceMsgcMouseMotion {
 int32_t dx;
 int32_t dy;
diff --git a/spice.proto b/spice.proto
index 5eede6b..139abaf 100644
--- a/spice.proto
+++ b/spice.proto
@@ -938,6 +938,11 @@ flags16 mouse_button_mask {
 RIGHT
 };
 
+flags32 keyboard_keyval_flags {
+DOWN,
+UP,
+} @prefix(SPICE_KEYBOARD_KEYVAL_FLAG_);
+
 channel InputsChannel : BaseChannel {
  client:
 message {
@@ -955,6 +960,11 @@ channel InputsChannel : BaseChannel {
 Data key_scancode;
 
 message {
+   uint32 keyval;
+   keyboard_keyval_flags flags;
+} @ctype(SpiceMsgcKeyKeyval) key_keyval;
+
+message {
int32 dx;
int32 dy;
mouse_button_mask buttons_state;
-- 
1.7.10.4

___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [PATCH vdagent-linux 3/4] vdagentd: support virtio as uds for Xspice usage

2013-09-03 Thread Uri Lublin



Hi Alon,

The socket should be closed if connect() fails.
Please see  below.

Looks good otherwise.

Thanks,
Uri.


Signed-off-by: Alon Levy al...@redhat.com
---
  src/vdagent-virtio-port.c | 53 +--
  1 file changed, 47 insertions(+), 6 deletions(-)

diff --git a/src/vdagent-virtio-port.c b/src/vdagent-virtio-port.c
index 05bd344..bdd22d9 100644
--- a/src/vdagent-virtio-port.c
+++ b/src/vdagent-virtio-port.c

@@ -85,16 +91,33 @@ struct vdagent_virtio_port 
*vdagent_virtio_port_create(const char *portname,
  
  vport-fd = open(portname, O_RDWR);

  if (vport-fd == -1) {
-syslog(LOG_ERR, open %s: %m, portname);
-free(vport);
-return NULL;
-}
+syslog(LOG_INFO, open %s: %m; trying as socket, portname);
+vport-fd = socket(PF_UNIX, SOCK_STREAM, 0);
+if (vport-fd == -1) {
+goto error;
+}
+address.sun_family = AF_UNIX;
+snprintf(address.sun_path, sizeof(address.sun_path), %s, portname);
+c = connect(vport-fd, (struct sockaddr *)address, sizeof(address));
+if (c == 0) {
+vport-is_uds = 1;
+} else {
+goto error;
+}
+} else {
+vport-is_uds = 0;
+}
  vport-opening = 1;
  
  vport-read_callback = read_callback;

  vport-disconnect_callback = disconnect_callback;
  
  return vport;

+
+error:
+syslog(LOG_ERR, open %s: %m, portname);


if (vport-fd != -1) {
close(vport-fd);
}


+free(vport);
+return NULL;
  }
  
  void vdagent_virtio_port_destroy(struct vdagent_virtio_port **vportp)




___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] FOSDEM'14

2013-09-03 Thread Fedor Lyakhov
Hello Spice developers,

I'm planning to visit FOSDEM this year, hope to meet you in 'real
life'. As I'm a newbie, there are few questions which bother me:

1. Do you know whether Virtualization devroom will be hosted at this
FOSDEM as it was in 2013? Will any Spice-related topics be discussed
there?
2. Red Hat was cornerstone sponsor of the event in 2013, but now it
isn't even listed... I cannot find any clarification in the Internet.
Any news?
3. Right now I'm working on a media redirection idea for VoIP
applications for Spice, there is a chance I'd have something to show
and discuss with you at that time - so how should I arrange this talk?
As part of Virtualization devroom, when it is confirmed? Or lightning
talk? Right now FOSDEM calls for main tracks and devrooms, no info
about other talk forms is published - guess I just need to wait? Don't
want to miss the opportunity...

-- 
Best regards,
Fedor

P.S. I continue working on Bug 62033, just came back from vacation -
will send my current ideas later this week.
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [PATCH vdagent-linux] vdagent-virtio-port: close socket on error

2013-09-03 Thread Alon Levy
Signed-off-by: Alon Levy al...@redhat.com
---
 src/vdagent-virtio-port.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/vdagent-virtio-port.c b/src/vdagent-virtio-port.c
index bdd22d9..bacfa42 100644
--- a/src/vdagent-virtio-port.c
+++ b/src/vdagent-virtio-port.c
@@ -116,6 +116,9 @@ struct vdagent_virtio_port 
*vdagent_virtio_port_create(const char *portname,
 
 error:
 syslog(LOG_ERR, open %s: %m, portname);
+if (vport-fd != -1) {
+close(vport-fd);
+}
 free(vport);
 return NULL;
 }
-- 
1.8.3.1

___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [PATCH vdagent-linux] vdagent-virtio-port: close socket on error

2013-09-03 Thread Hans de Goede

ACK.

On 09/03/2013 12:07 PM, Alon Levy wrote:

Signed-off-by: Alon Levy al...@redhat.com
---
  src/vdagent-virtio-port.c | 3 +++
  1 file changed, 3 insertions(+)

diff --git a/src/vdagent-virtio-port.c b/src/vdagent-virtio-port.c
index bdd22d9..bacfa42 100644
--- a/src/vdagent-virtio-port.c
+++ b/src/vdagent-virtio-port.c
@@ -116,6 +116,9 @@ struct vdagent_virtio_port 
*vdagent_virtio_port_create(const char *portname,

  error:
  syslog(LOG_ERR, open %s: %m, portname);
+if (vport-fd != -1) {
+close(vport-fd);
+}
  free(vport);
  return NULL;
  }


___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] FOSDEM'14

2013-09-03 Thread Alon Levy
 Hello Spice developers,
 
 I'm planning to visit FOSDEM this year, hope to meet you in 'real
 life'. As I'm a newbie, there are few questions which bother me:
 
 1. Do you know whether Virtualization devroom will be hosted at this
 FOSDEM as it was in 2013? Will any Spice-related topics be discussed
 there?

No idea about a room. I didn't submit a talk, maybe we could have a state-of 
talk, it would fit such a room. fosdem.org says until 15th of September request 
should be submitted to devro...@fosdem.org , but I haven't found any archive of 
it.

 2. Red Hat was cornerstone sponsor of the event in 2013, but now it
 isn't even listed... I cannot find any clarification in the Internet.
 Any news?

I'm sure there will be plenty of Red Hatters in the venue. No idea about the 
sponsorship state of things.

 3. Right now I'm working on a media redirection idea for VoIP
 applications for Spice, there is a chance I'd have something to show
 and discuss with you at that time - so how should I arrange this talk?
 As part of Virtualization devroom, when it is confirmed? Or lightning
 talk? Right now FOSDEM calls for main tracks and devrooms, no info
 about other talk forms is published - guess I just need to wait? Don't
 want to miss the opportunity...

This sounds very interesting. I don't know what to do either - perhaps you 
could email devro...@fosdem.org and ask if there has been a proposed 
virtualizatoin room.

 
 --
 Best regards,
 Fedor
 
 P.S. I continue working on Bug 62033, just came back from vacation -
 will send my current ideas later this week.
 ___
 Spice-devel mailing list
 Spice-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/spice-devel
 
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [PATCH] server: bitmap_consistent: replace spice_error with spice_warning

2013-09-03 Thread Daniel P. Berrange
On Sun, Sep 01, 2013 at 09:43:17PM +0300, Uri Lublin wrote:
 bitmap_consistent should return true or false.
 Currently it aborts instead of returning false, due to spice_error.
 Replacing spice_error with spice_warning, provides information and returns
 false, as expected.
 
 This fixes Fedora bz#997932

The issue being fixed here is a security flaw, since it allows an
unprivileged users in the guest OS to crash the entire QEMU process
in the host. It is really bad practice to do security fixes without
the commit message explicitly saying that it is a security fix. People
using spice need to know so that they can apply it to any old branches
they may have.

Regards,
Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel