Commit 1db6fd83 authored by Alexander Clouter's avatar Alexander Clouter Committed by Solly Ross

added aten-ikvm support

parent 729508a2
......@@ -128,7 +128,7 @@ use a WebSockets to TCP socket proxy. There is a python proxy included
* UI and Icons : Chris Gordon
* Original Logo : Michael Sersen
* tight encoding : Michael Tinglof (Mercuri.ca)
* pixel format conversion : [Alexander Clouter](http://www.digriz.org.uk/)
* pixel format conversion and ATEN iKVM support : [Alexander Clouter](http://www.digriz.org.uk/)
* Included libraries:
* web-socket-js : Hiroshi Ichikawa (github.com/gimite/web-socket-js)
......
......@@ -376,3 +376,80 @@ XK_udiaeresis = 0x00fc, /* U+00FC LATIN SMALL LETTER U WITH DIA
XK_yacute = 0x00fd, /* U+00FD LATIN SMALL LETTER Y WITH ACUTE */
XK_thorn = 0x00fe, /* U+00FE LATIN SMALL LETTER THORN */
XK_ydiaeresis = 0x00ff; /* U+00FF LATIN SMALL LETTER Y WITH DIAERESIS */
var XK2HID = {};
// F{1..12}
for (var i = XK_F1; i <= XK_F12; i++) {
XK2HID[i] = 0x3a + (i - XK_F1);
}
// A-Za-z
for (var i = XK_A; i <= XK_Z; i++) {
XK2HID[i] = 0x04 + (i - XK_A);
XK2HID[i + (XK_a - XK_A)] = 0x04 + (i - XK_A);
}
// 1-9
for (var i = XK_1; i <= XK_9; i++) {
XK2HID[i] = 0x1e + (i - XK_1);
}
XK2HID[XK_0] = 0x27;
XK2HID[XK_Return] = 0x28;
XK2HID[XK_Escape] = 0x29;
XK2HID[XK_BackSpace] = 0x2a;
XK2HID[XK_Tab] = 0x2b;
XK2HID[XK_space] = 0x2c;
XK2HID[XK_minus] = 0x2d;
XK2HID[XK_equal] = 0x2e;
XK2HID[XK_bracketleft] = 0x2f;
XK2HID[XK_bracketright] = 0x30;
XK2HID[XK_backslash] = 0x31;
XK2HID[XK_semicolon] = 0x33;
XK2HID[XK_apostrophe] = 0x34;
XK2HID[XK_grave] = 0x35;
XK2HID[XK_comma] = 0x36;
XK2HID[XK_period] = 0x37;
XK2HID[XK_slash] = 0x38;
XK2HID[XK_Print] = 0x46;
XK2HID[XK_Scroll_Lock] = 0x47;
XK2HID[XK_Pause] = 0x48;
XK2HID[XK_Insert] = 0x49;
XK2HID[XK_Home] = 0x4a;
XK2HID[XK_Page_Up] = 0x4b;
XK2HID[XK_Delete] = 0x4c;
XK2HID[XK_End] = 0x4d;
XK2HID[XK_Page_Down] = 0x4e;
XK2HID[XK_Right] = 0x4f;
XK2HID[XK_Left] = 0x50;
XK2HID[XK_Down] = 0x51;
XK2HID[XK_Up] = 0x52;
XK2HID[XK_Control_L] = 0xe0;
XK2HID[XK_Control_R] = XK2HID[XK_Control_L];
XK2HID[XK_Shift_L] = 0xe1;
XK2HID[XK_Shift_R] = XK2HID[XK_Shift_L];
XK2HID[XK_Alt_L] = 0xe2;
XK2HID[XK_Alt_R] = XK2HID[XK_Alt_L];
XK2HID[XK_Super_L] = 0xe3;
XK2HID[XK_Super_R] = XK2HID[XK_Super_L];
XK2HID[XK_Caps_Lock] = 0x39;
// locale hardcoded hack
XK2HID[XK_less] = XK2HID[XK_comma];
XK2HID[XK_greater] = XK2HID[XK_period];
XK2HID[XK_exclam] = XK2HID[XK_1];
XK2HID[XK_at] = XK2HID[XK_2];
XK2HID[XK_numbersign] = XK2HID[XK_3];
XK2HID[XK_dollar] = XK2HID[XK_4];
XK2HID[XK_percent] = XK2HID[XK_5];
XK2HID[XK_asciicircum] = XK2HID[XK_6];
XK2HID[XK_ampersand] = XK2HID[XK_7];
XK2HID[XK_asterisk] = XK2HID[XK_8];
XK2HID[XK_parenleft] = XK2HID[XK_9];
XK2HID[XK_parenright] = XK2HID[XK_0];
XK2HID[XK_underscore] = XK2HID[XK_minus];
XK2HID[XK_bar] = XK2HID[XK_backslash];
XK2HID[XK_quotedbl] = XK2HID[XK_apostrophe];
XK2HID[XK_asciitilde] = XK2HID[XK_grave];
This diff is collapsed.
......@@ -789,6 +789,51 @@ describe('Remote Frame Buffer Protocol Client', function() {
expect(client._rfb_state).to.equal('failed');
});
});
describe('ATEN iKVM Authentication Handler', function () {
var client;
beforeEach(function () {
client = make_rfb();
client.connect('host', 8675);
client._sock._websocket._open();
client._rfb_state = 'Security';
client._rfb_version = 3.8;
send_security(16, client);
client._sock._websocket._get_sent_data(); // skip the security reply
client._rfb_password = 'test1:test2';
});
var auth = [
116, 101, 115, 116, 49, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
116, 101, 115, 116, 50, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0];
it('via old style method', function () {
client._sock._websocket._receive_data(new Uint8Array([
0xaf, 0xf9, 0x0f, 0xb0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0]));
expect(client._rfb_tightvnc).to.be.false;
expect(client._rfb_atenikvm).to.be.true;
expect(client._sock).to.have.sent(auth);
});
it('via new style method', function () {
client._sock._websocket._receive_data(new Uint8Array([
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0]));
expect(client._rfb_tightvnc).to.be.false;
expect(client._rfb_atenikvm).to.be.true;
expect(client._sock).to.have.sent(auth);
});
});
});
describe('SecurityResult', function () {
......@@ -936,6 +981,23 @@ describe('Remote Frame Buffer Protocol Client', function() {
expect(client._rfb_state).to.equal('normal');
});
it('should handle an ATEN iKVM server initialization', function () {
client._rfb_atenikvm = true;
send_server_init({ true_color: 1, bpp: 32 }, client);
client._sock._websocket._receive_data(new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]));
expect(client._pixelFormat.bpp).to.equal(16);
expect(client._pixelFormat.depth).to.equal(15);
expect(client._pixelFormat.red_max).to.equal(31);
expect(client._pixelFormat.green_max).to.equal(31);
expect(client._pixelFormat.blue_max).to.equal(31);
expect(client._pixelFormat.red_shift).to.equal(10);
expect(client._pixelFormat.green_shift).to.equal(5);
expect(client._pixelFormat.blue_shift).to.equal(0);
expect(client._pixelFormat.Bpp).to.equal(2);
expect(client._pixelFormat.Bdepth).to.equal(2);
expect(client._rfb_state).to.equal('normal');
});
it('should call the resize callback and resize the display', function () {
client.set_onFBResize(sinon.spy());
sinon.spy(client._display, 'resize');
......@@ -1477,6 +1539,96 @@ describe('Remote Frame Buffer Protocol Client', function() {
// TODO(directxman12): test this
});
describe('the ATEN encoding handler', function () {
var client;
beforeEach(function () {
client = make_rfb();
client.connect('host', 8675);
client._sock._websocket._open();
client._rfb_state = 'normal';
client._fb_name = 'some device';
client._rfb_atenikvm = true;
// start large, then go small
client._fb_width = 10000;
client._fb_height = 10000;
client._display._fb_width = 10000;
client._display._fb_height = 10000;
client._display._viewportLoc.w = 10000;
client._display._viewportLoc.h = 10000;
client._convertColor = true;
client._pixelFormat.Bpp = 2;
client._pixelFormat.big_endian = false;
client._pixelFormat.red_shift = 10;
client._pixelFormat.red_max = 31;
client._pixelFormat.green_shift = 5;
client._pixelFormat.green_max = 31;
client._pixelFormat.blue_shift = 0;
client._pixelFormat.blue_max = 31;
});
var aten_target_data_arr = [0xa8, 0xe8, 0xf8, 0xff];
var aten_target_data;
before(function () {
for (var i = 0; i < 10; i++) {
aten_target_data_arr = aten_target_data_arr.concat(aten_target_data_arr);
}
aten_target_data = new Uint8Array(aten_target_data_arr);
});
it('should handle subtype subrect encoding', function () {
var info = [{ x: 0, y: 0, width: 32, height: 32, encoding: 0x59 }];
var rect = [];
rect.push32(0); // padding
rect.push32(2082); // 10 + 32x32x2Bpp + 6*(num of subrects)
rect.push8(0); // type
rect.push8(0); // padding
rect.push32(4); // num of subrects (32/16)*(32/16)
rect.push32(2082); // length (again)
for (var y = 0; y < 2; y++) {
for (var x = 0; x < 2; x++) {
rect.push16(0); // a
rect.push16(0); // b
rect.push8(y);
rect.push8(x);
for (var i = 0; i < 16*16; i++) {
rect.push16(0xbf57);
}
}
}
send_fbu_msg(info, [rect], client);
expect(client._display).to.have.displayed(aten_target_data);
});
it('should handle subtype RAW encoding', function () {
// do not use encoding=0x59 here, as rfb.js should override it
var info = [{ x: 0, y: 0, width: 32, height: 32, encoding: 0x00 }];
var rect = [];
rect.push32(0); // padding
rect.push32(2058); // 10 + 32x32x2Bpp
rect.push8(1); // type
rect.push8(0); // padding
rect.push32(0); // padding
rect.push32(2058); // length (again)
for (var i = 0; i < 32*32; i++) {
rect.push16(0xbf57);
}
send_fbu_msg(info, [rect], client);
expect(client._display).to.have.displayed(aten_target_data);
});
});
it('should handle the DesktopSize pseduo-encoding', function () {
client.set_onFBResize(sinon.spy());
sinon.spy(client._display, 'resize');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment