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;
|
||||
else if(strncmp(msg, "RFB 003.889\n", VerLen) == 0)
|
||||
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. */
|
||||
v->vers = 33;
|
||||
|
||||
|
|
|
@ -108,18 +108,42 @@ cvtbgr332tocmap8(uchar *dst, uchar *src, int npixel)
|
|||
*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
|
||||
choosecolor(Vnc *v)
|
||||
{
|
||||
int bpp, depth;
|
||||
ulong chan;
|
||||
|
||||
bpp = screen->depth;
|
||||
chan = screen->chan;
|
||||
depth = screen->depth;
|
||||
bpp = depth;
|
||||
if((bpp / 8) * 8 != bpp)
|
||||
sysfatal("screen not supported");
|
||||
|
||||
depth = screen->depth;
|
||||
chan = screen->chan;
|
||||
if(bpp == 32 && v->Pixfmt.bpp == 16){
|
||||
cvtpixels = cvt16to32;
|
||||
goto Done;
|
||||
}
|
||||
|
||||
if(bpp == 24){
|
||||
if(verbose)
|
||||
|
@ -156,6 +180,7 @@ choosecolor(Vnc *v)
|
|||
if(v->red.max == 0 || v->green.max == 0 || v->blue.max == 0)
|
||||
sysfatal("screen not supported");
|
||||
|
||||
Done:
|
||||
if(verbose)
|
||||
fprint(2, "%d bpp, %d depth, 0x%lx chan, %d truecolor, %d bigendian\n",
|
||||
v->bpp, v->depth, screen->chan, v->truecolor, v->bigendian);
|
||||
|
|
|
@ -171,17 +171,17 @@ loadbuf(Vnc *v, Rectangle r, int stride)
|
|||
|
||||
if(cvtpixels){
|
||||
y = r.min.y;
|
||||
off = y * stride;
|
||||
off = y * stride + r.min.x * pixb;
|
||||
for(; y < r.max.y; y++){
|
||||
vncrdbytes(v, linebuf, Dx(r) * vpixb);
|
||||
(*cvtpixels)(&pixbuf[off + r.min.x * pixb], linebuf, Dx(r));
|
||||
(*cvtpixels)(&pixbuf[off], linebuf, Dx(r));
|
||||
off += stride;
|
||||
}
|
||||
}else{
|
||||
y = r.min.y;
|
||||
off = y * stride;
|
||||
off = y * stride + r.min.x * pixb;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -396,7 +396,7 @@ readfromserver(Vnc *v)
|
|||
type = vncrdchar(v);
|
||||
switch(type){
|
||||
default:
|
||||
sysfatal("bad message from server");
|
||||
sysfatal("bad message from server: %x", type);
|
||||
break;
|
||||
case MFrameUpdate:
|
||||
vncrdchar(v);
|
||||
|
|
|
@ -48,6 +48,10 @@ netmkvncaddr(char *server)
|
|||
char *p, portstr[NETPATHLEN];
|
||||
int port;
|
||||
|
||||
/* leave execnet dial strings alone */
|
||||
if(strncmp(server, "exec!", 5) == 0)
|
||||
return server;
|
||||
|
||||
port = 5900;
|
||||
if(tls)
|
||||
port = 35729;
|
||||
|
@ -96,7 +100,7 @@ main(int argc, char **argv)
|
|||
tls = 1;
|
||||
break;
|
||||
case 'v':
|
||||
verbose = 1;
|
||||
verbose++;
|
||||
break;
|
||||
case 'k':
|
||||
keypattern = EARGF(usage());
|
||||
|
|
Loading…
Reference in a new issue