<div dir="ltr">Forget this one. Missing one file.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Oct 3, 2016 at 2:02 PM, Oliver Gutierrez <span dir="ltr"><<a href="mailto:ogutierrez@redhat.com" target="_blank">ogutierrez@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">---<br>
enums.js | 9 +++++++++<br>
main.js | 3 +++<br>
spice.html | 13 +++++++++++++<br>
spice_auto.html | 13 +++++++++++++<br>
spicemsg.js | 18 ++++++++++++++++++<br>
utils.js | 7 +++++++<br>
6 files changed, 63 insertions(+)<br>
<br>
diff --git a/enums.js b/enums.js<br>
index 301fea0..b6e013c 100644<br>
--- a/enums.js<br>
+++ b/enums.js<br>
@@ -166,6 +166,15 @@ var SPICE_MSG_PLAYBACK_VOLUME = 105;<br>
var SPICE_MSG_PLAYBACK_MUTE = 106;<br>
var SPICE_MSG_PLAYBACK_LATENCY = 107;<br>
<br>
+var SPICE_MSG_SPICEVMC_DATA = 101;<br>
+var SPICE_MSG_PORT_INIT = 201;<br>
+var SPICE_MSG_PORT_EVENT = 202;<br>
+var SPICE_MSG_END_PORT = 203;<br>
+<br>
+var SPICE_MSGC_SPICEVMC_DATA = 101;<br>
+var SPICE_MSGC_PORT_EVENT = 201;<br>
+var SPICE_MSGC_END_PORT = 202;<br>
+<br>
var SPICE_PLAYBACK_CAP_CELT_0_5_1 = 0;<br>
var SPICE_PLAYBACK_CAP_VOLUME = 1;<br>
var SPICE_PLAYBACK_CAP_LATENCY = 2;<br>
diff --git a/main.js b/main.js<br>
index 874a038..2d8a1ff 100644<br>
--- a/main.js<br>
+++ b/main.js<br>
@@ -59,6 +59,7 @@ function SpiceMainConn()<br>
this.file_xfer_tasks = {};<br>
this.file_xfer_task_id = 0;<br>
this.file_xfer_read_queue = [];<br>
+ this.ports = [];<br>
}<br>
<br>
SpiceMainConn.prototype = Object.create(SpiceConn.<wbr>prototype);<br>
@@ -154,6 +155,8 @@ SpiceMainConn.prototype.<wbr>process_channel_message = function(msg)<br>
this.cursor = new SpiceCursorConn(conn);<br>
else if (chans.channels[i].type == SPICE_CHANNEL_PLAYBACK)<br>
this.cursor = new SpicePlaybackConn(conn);<br>
+ else if (chans.channels[i].type == SPICE_CHANNEL_PORT)<br>
+ this.ports.push(new SpicePortConn(conn));<br>
else<br>
{<br>
if (! ("extra_channels" in this))<br>
diff --git a/spice.html b/spice.html<br>
index c473678..d4c9962 100644<br>
--- a/spice.html<br>
+++ b/spice.html<br>
@@ -42,6 +42,7 @@<br>
<script src="wire.js"></script><br>
<script src="spiceconn.js"></script><br>
<script src="display.js"></script><br>
+ <script src="port.js"></script><br>
<script src="main.js"></script><br>
<script src="inputs.js"></script><br>
<script src="webm.js"></script><br>
@@ -142,6 +143,18 @@<br>
}<br>
}<br>
<br>
+ /* SPICE port event listeners<br>
+ window.addEventListener('<wbr>spice-port-data', function(event) {<br>
+ // Here we convert data to text, but really we can obtain binary data also<br>
+ var msg_text = arraybuffer_to_str(new Uint8Array(event.detail.data))<wbr>;<br>
+ DEBUG > 0 && console.log('SPICE port', event.detail.channel.portName, 'message text:', msg_text);<br>
+ });<br>
+<br>
+ window.addEventListener('<wbr>spice-port-event', function(event) {<br>
+ DEBUG > 0 && console.log('SPICE port', event.detail.channel.portName, 'event data:', event.detail.spiceEvent);<br>
+ });<br>
+ */<br>
+<br>
</script><br>
<br>
</head><br>
diff --git a/spice_auto.html b/spice_auto.html<br>
index 1179ebe..2f04fc9 100644<br>
--- a/spice_auto.html<br>
+++ b/spice_auto.html<br>
@@ -42,6 +42,7 @@<br>
<script src="wire.js"></script><br>
<script src="spiceconn.js"></script><br>
<script src="display.js"></script><br>
+ <script src="port.js"></script><br>
<script src="main.js"></script><br>
<script src="inputs.js"></script><br>
<script src="webm.js"></script><br>
@@ -182,6 +183,18 @@<br>
}<br>
}<br>
<br>
+ /* SPICE port event listeners<br>
+ window.addEventListener('<wbr>spice-port-data', function(event) {<br>
+ // Here we convert data to text, but really we can obtain binary data also<br>
+ var msg_text = arraybuffer_to_str(new Uint8Array(event.detail.data))<wbr>;<br>
+ DEBUG > 0 && console.log('SPICE port', event.detail.channel.portName, 'message text:', msg_text);<br>
+ });<br>
+<br>
+ window.addEventListener('<wbr>spice-port-event', function(event) {<br>
+ DEBUG > 0 && console.log('SPICE port', event.detail.channel.portName, 'event data:', event.detail.spiceEvent);<br>
+ });<br>
+ */<br>
+<br>
connect();<br>
</script><br>
<br>
diff --git a/spicemsg.js b/spicemsg.js<br>
index 0321cc7..3619996 100644<br>
--- a/spicemsg.js<br>
+++ b/spicemsg.js<br>
@@ -1278,3 +1278,21 @@ SpiceMsgDisplayInvalList.<wbr>prototype =<br>
}<br>
},<br>
}<br>
+<br>
+function SpiceMsgPortInit(a, at)<br>
+{<br>
+ this.from_buffer(a,at);<br>
+};<br>
+<br>
+SpiceMsgPortInit.prototype =<br>
+{<br>
+ from_buffer: function (a, at)<br>
+ {<br>
+ at = at || 0;<br>
+ var dv = new SpiceDataView(a);<br>
+ var namesize = dv.getUint32(at, true); at += 4;<br>
+ var offset = dv.getUint32(at, true); at += 4;<br>
+ this.opened = dv.getUint8(at, true); at += 1;<br>
+ <a href="http://this.name" rel="noreferrer" target="_blank">this.name</a> = a.slice(offset, offset + namesize - 1);<br>
+ }<br>
+}<br>
diff --git a/utils.js b/utils.js<br>
index 9093a24..a22d0ae 100644<br>
--- a/utils.js<br>
+++ b/utils.js<br>
@@ -100,6 +100,13 @@ function hexdump_buffer(a)<br>
}<br>
<br>
/*----------------------------<wbr>------------------------------<wbr>------------------<br>
+** Convert arraybuffer to string<br>
+**---------------------------<wbr>------------------------------<wbr>-----------------*/<br>
+function arraybuffer_to_str(buf) {<br>
+ return String.fromCharCode.apply(<wbr>null, new Uint16Array(buf));<br>
+}<br>
+<br>
+/*---------------------------<wbr>------------------------------<wbr>-------------------<br>
** Converting keycodes to AT scancodes is very hard.<br>
** luckly there are some resources on the web and in the Xorg driver that help<br>
** us figure out what browser dependent keycodes match to what scancodes.<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.9.3<br>
<br>
</font></span></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><span>Oliver Gutierrez<br>Associate Software Engineer - Desktop Management tools<br>Red Hat</span></div></div>
</div>