vncv: some fixes to work with intel amt kvm
This commit is contained in:
parent
1a4e03cf93
commit
90a08cf1fd
4 changed files with 40 additions and 9 deletions
|
@ -35,6 +35,8 @@ vnchandshake(Vnc *v)
|
||||||
v->vers = 38;
|
v->vers = 38;
|
||||||
else if(strncmp(msg, "RFB 003.889\n", VerLen) == 0)
|
else if(strncmp(msg, "RFB 003.889\n", VerLen) == 0)
|
||||||
v->vers = 38; /* Darwin */
|
v->vers = 38; /* Darwin */
|
||||||
|
else if(strncmp(msg, "RFB 004.000\n", VerLen) == 0)
|
||||||
|
v->vers = 38;
|
||||||
else /* RFC6143: Any other should be treated as 3.3. */
|
else /* RFC6143: Any other should be treated as 3.3. */
|
||||||
v->vers = 33;
|
v->vers = 33;
|
||||||
|
|
||||||
|
|
|
@ -108,18 +108,42 @@ cvtbgr332tocmap8(uchar *dst, uchar *src, int npixel)
|
||||||
*dst++ = bgr8[*src++];
|
*dst++ = bgr8[*src++];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
cvt16to32(uchar *dst, uchar *src, int npixel)
|
||||||
|
{
|
||||||
|
uchar *ed;
|
||||||
|
int w, r, g, b;
|
||||||
|
|
||||||
|
ed = dst+npixel*4;
|
||||||
|
while(dst < ed){
|
||||||
|
w = src[1]<<8 | src[0];
|
||||||
|
b = (w >> 11) & 0x1F;
|
||||||
|
g = (w >> 5) & 0x3F;
|
||||||
|
r = (w >> 0) & 0x1F;
|
||||||
|
dst[0] = b<<(8-5);
|
||||||
|
dst[1] = g<<(8-6);
|
||||||
|
dst[2] = r<<(8-5);
|
||||||
|
dst += 4;
|
||||||
|
src += 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
choosecolor(Vnc *v)
|
choosecolor(Vnc *v)
|
||||||
{
|
{
|
||||||
int bpp, depth;
|
int bpp, depth;
|
||||||
ulong chan;
|
ulong chan;
|
||||||
|
|
||||||
bpp = screen->depth;
|
chan = screen->chan;
|
||||||
|
depth = screen->depth;
|
||||||
|
bpp = depth;
|
||||||
if((bpp / 8) * 8 != bpp)
|
if((bpp / 8) * 8 != bpp)
|
||||||
sysfatal("screen not supported");
|
sysfatal("screen not supported");
|
||||||
|
|
||||||
depth = screen->depth;
|
if(bpp == 32 && v->Pixfmt.bpp == 16){
|
||||||
chan = screen->chan;
|
cvtpixels = cvt16to32;
|
||||||
|
goto Done;
|
||||||
|
}
|
||||||
|
|
||||||
if(bpp == 24){
|
if(bpp == 24){
|
||||||
if(verbose)
|
if(verbose)
|
||||||
|
@ -156,6 +180,7 @@ choosecolor(Vnc *v)
|
||||||
if(v->red.max == 0 || v->green.max == 0 || v->blue.max == 0)
|
if(v->red.max == 0 || v->green.max == 0 || v->blue.max == 0)
|
||||||
sysfatal("screen not supported");
|
sysfatal("screen not supported");
|
||||||
|
|
||||||
|
Done:
|
||||||
if(verbose)
|
if(verbose)
|
||||||
fprint(2, "%d bpp, %d depth, 0x%lx chan, %d truecolor, %d bigendian\n",
|
fprint(2, "%d bpp, %d depth, 0x%lx chan, %d truecolor, %d bigendian\n",
|
||||||
v->bpp, v->depth, screen->chan, v->truecolor, v->bigendian);
|
v->bpp, v->depth, screen->chan, v->truecolor, v->bigendian);
|
||||||
|
|
|
@ -171,17 +171,17 @@ loadbuf(Vnc *v, Rectangle r, int stride)
|
||||||
|
|
||||||
if(cvtpixels){
|
if(cvtpixels){
|
||||||
y = r.min.y;
|
y = r.min.y;
|
||||||
off = y * stride;
|
off = y * stride + r.min.x * pixb;
|
||||||
for(; y < r.max.y; y++){
|
for(; y < r.max.y; y++){
|
||||||
vncrdbytes(v, linebuf, Dx(r) * vpixb);
|
vncrdbytes(v, linebuf, Dx(r) * vpixb);
|
||||||
(*cvtpixels)(&pixbuf[off + r.min.x * pixb], linebuf, Dx(r));
|
(*cvtpixels)(&pixbuf[off], linebuf, Dx(r));
|
||||||
off += stride;
|
off += stride;
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
y = r.min.y;
|
y = r.min.y;
|
||||||
off = y * stride;
|
off = y * stride + r.min.x * pixb;
|
||||||
for(; y < r.max.y; y++){
|
for(; y < r.max.y; y++){
|
||||||
vncrdbytes(v, &pixbuf[off + r.min.x * pixb], Dx(r) * pixb);
|
vncrdbytes(v, &pixbuf[off], Dx(r) * pixb);
|
||||||
off += stride;
|
off += stride;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -396,7 +396,7 @@ readfromserver(Vnc *v)
|
||||||
type = vncrdchar(v);
|
type = vncrdchar(v);
|
||||||
switch(type){
|
switch(type){
|
||||||
default:
|
default:
|
||||||
sysfatal("bad message from server");
|
sysfatal("bad message from server: %x", type);
|
||||||
break;
|
break;
|
||||||
case MFrameUpdate:
|
case MFrameUpdate:
|
||||||
vncrdchar(v);
|
vncrdchar(v);
|
||||||
|
|
|
@ -48,6 +48,10 @@ netmkvncaddr(char *server)
|
||||||
char *p, portstr[NETPATHLEN];
|
char *p, portstr[NETPATHLEN];
|
||||||
int port;
|
int port;
|
||||||
|
|
||||||
|
/* leave execnet dial strings alone */
|
||||||
|
if(strncmp(server, "exec!", 5) == 0)
|
||||||
|
return server;
|
||||||
|
|
||||||
port = 5900;
|
port = 5900;
|
||||||
if(tls)
|
if(tls)
|
||||||
port = 35729;
|
port = 35729;
|
||||||
|
@ -96,7 +100,7 @@ main(int argc, char **argv)
|
||||||
tls = 1;
|
tls = 1;
|
||||||
break;
|
break;
|
||||||
case 'v':
|
case 'v':
|
||||||
verbose = 1;
|
verbose++;
|
||||||
break;
|
break;
|
||||||
case 'k':
|
case 'k':
|
||||||
keypattern = EARGF(usage());
|
keypattern = EARGF(usage());
|
||||||
|
|
Loading…
Reference in a new issue