# Get fb header size
if fbver == 16:
hdrsize = 3
elif fbver == 1:
hdrsize = 12
else:
hdrsize = 0;
if DEBUG:
print 'fb header size: %d' % hdrsize
# read the header
header = s.recv(hdrsize * 4)
if len(header) < (hdrsize * 4):
continue
if DEBUG:
hexdump(bytearray(header))
readHeader(myfb, fbver, header)
if DEBUG:
print 'bpp: %d' % myfb.fb_bpp
print 'size: %d' % myfb.fb_size
print 'width: %d' % myfb.fb_width
print 'height: %d' % myfb.fb_height
print 'red_offset: %d' % myfb.red_offset
print 'red_length: %d' % myfb.red_length
print 'blue_offset: %d' % myfb.blue_offset
print 'blue_length: %d' % myfb.blue_length
print 'green_offset: %d' % myfb.green_offset
print 'green_length: %d' % myfb.green_length
print 'alpha_offset: %d' % myfb.alpha_offset
print 'alpha_length: %d' % myfb.alpha_length
# read fb buffer
rcvcnt = 0
readbyte = 0
imagebuff = []
while True:
if (rcvcnt < myfb.fb_size):
readbyte = myfb.fb_size - rcvcnt
else:
break
resp = s.recv(readbyte)
if DEBUG:
print 'read byte: %d' % len(resp)
rcvcnt = rcvcnt + len(resp);
imagebuff.extend(resp)
if len(resp) == 0:
break