os/kernelhwsrv/kernel/eka/drivers/edisp/epoc/generic/wd_vt100.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/kernel/eka/drivers/edisp/epoc/generic/wd_vt100.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,534 @@
     1.4 +// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of the License "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// e32\drivers\edisp\epoc\generic\wd_vt100.cpp
    1.18 +// Display/Keyboard driver using VT100 terminal
    1.19 +// 
    1.20 +//
    1.21 +
    1.22 +#include "ws_std.h"
    1.23 +#include <d32comm.h>
    1.24 +#include <e32svr.h>
    1.25 +
    1.26 +/**
    1.27 + * Define a comms driver and port to use.
    1.28 + */
    1.29 +
    1.30 +//#define __USE_RDEBUG_OUTPUT
    1.31 +#define __USE_SERIAL_INPUT
    1.32 +const TInt KPortNumber=1;
    1.33 +
    1.34 +#if defined(__USE_SERIAL_INPUT) || !defined(__USE_RDEBUG_OUTPUT)
    1.35 +#define __COMMS_DRIVER_NEEDED
    1.36 +_LIT(KPddName,"EUART");
    1.37 +_LIT(KLddName,"ECOMM");
    1.38 +#endif
    1.39 +
    1.40 +class CSerialKeyboard : public CActive
    1.41 +	{
    1.42 +public:
    1.43 +	static CSerialKeyboard* NewL();
    1.44 +	~CSerialKeyboard();
    1.45 +	void GetKey();
    1.46 +public:
    1.47 +	CSerialKeyboard();
    1.48 +	void ConstructL();
    1.49 +	void RunL();
    1.50 +	void DoCancel();
    1.51 +	TInt KeyCode();
    1.52 +public:
    1.53 +#ifdef __COMMS_DRIVER_NEEDED
    1.54 +	RBusDevComm iDevComm;
    1.55 +	TBuf8<1> iBuf;
    1.56 +#endif
    1.57 +	};
    1.58 +
    1.59 +#define SHIFTED(x)   (0x8000|(x))
    1.60 +#define ISSHIFTED(x) (0x8000&(x))
    1.61 +#define FUNCED(x)    (0x4000|(x))
    1.62 +#define ISFUNCED(x)  (0x4000&(x))
    1.63 +#define CTRLED(x)    (0x2000|(x))
    1.64 +#define ISCTRLED(x)  (0x2000&(x))
    1.65 +#define STDKEY(x)    (0x1FFF&(x))
    1.66 +
    1.67 +const TUint16 convertCode[] =
    1.68 +	{
    1.69 +/*00 NUL*/  EStdKeyNull,
    1.70 +/*01 SOH*/  CTRLED('A'),	// ^A
    1.71 +/*02 STX*/  CTRLED('B'),	// ^B
    1.72 +/*03 ETX*/  CTRLED('C'),	// ^C
    1.73 +/*04 EOT*/  CTRLED('D'),	// ^D
    1.74 +/*05 ENQ*/  CTRLED('E'),	// ^E
    1.75 +/*06 ACK*/  CTRLED('F'),	// ^F
    1.76 +/*07 BEL*/  CTRLED('G'),	// ^G
    1.77 +/*08 BS */  EStdKeyBackspace,
    1.78 +/*09 TAB*/  CTRLED(FUNCED('5')),
    1.79 +/*0a LF */  CTRLED('J'),	// ^J
    1.80 +/*0b VT */  CTRLED('K'),	// ^K
    1.81 +/*0c FF */  CTRLED('L'),	// ^L
    1.82 +/*0d CR */  EStdKeyEnter,
    1.83 +/*0e SO */  CTRLED('N'),	// ^N
    1.84 +/*0f SI */  CTRLED('O'),	// ^O
    1.85 +/*10 DLE*/  CTRLED('P'),	// ^P
    1.86 +/*11 DC1*/  CTRLED('Q'),	// ^Q
    1.87 +/*12 DC2*/  CTRLED('R'),	// ^R
    1.88 +/*13 DC3*/  CTRLED('S'),	// ^S
    1.89 +/*14 DC4*/  CTRLED('T'),	// ^T
    1.90 +/*15 NAK*/  CTRLED('U'),	// ^U
    1.91 +/*16 SYN*/  CTRLED('V'),	// ^V
    1.92 +/*17 ETB*/  CTRLED('W'),	// ^W
    1.93 +/*18 CAN*/  CTRLED('X'),	// ^X
    1.94 +/*19 EM */  CTRLED('Y'),	// ^Y
    1.95 +/*1a SUB*/  CTRLED('Z'),	// ^Z
    1.96 +/*1b ESC*/  EStdKeyEscape,
    1.97 +/*1c FS */  EStdKeyNull,	// ^backslash -> ignored
    1.98 +/*1d GS */  EStdKeyNull,	// ^] -> ignored
    1.99 +/*1e RS */  EStdKeyNull,	// ^^ -> ignored
   1.100 +/*1f US */  EStdKeyNull,	// ^_ -> ignored
   1.101 +/*20*/  EStdKeySpace,
   1.102 +/*21*/  SHIFTED('1'),       // !
   1.103 +/*22*/  SHIFTED('2'),       // "
   1.104 +/*23*/  EStdKeyHash,        // #
   1.105 +/*24*/  SHIFTED('4'),       // $
   1.106 +/*25*/  SHIFTED('5'),       // %
   1.107 +/*26*/  SHIFTED('7'),       // &
   1.108 +/*27*/  EStdKeySingleQuote,
   1.109 +/*28*/  SHIFTED('9'),       // (
   1.110 +/*29*/  SHIFTED('0'),       // )
   1.111 +/*2a*/  SHIFTED('8'),       // *
   1.112 +/*2b*/  SHIFTED(EStdKeyEquals), // +
   1.113 +/*2c*/  EStdKeyComma,       // ,
   1.114 +/*2d*/  EStdKeyMinus,       // -
   1.115 +/*2e*/  EStdKeyFullStop,    // .
   1.116 +/*2f*/  EStdKeyForwardSlash,// forward slash
   1.117 +/*30*/  '0',
   1.118 +/*31*/  '1',
   1.119 +/*32*/  '2',
   1.120 +/*33*/  '3',
   1.121 +/*34*/  '4',
   1.122 +/*35*/  '5',
   1.123 +/*36*/  '6',
   1.124 +/*37*/  '7',
   1.125 +/*38*/  '8',
   1.126 +/*39*/  '9',
   1.127 +/*3a*/  SHIFTED(EStdKeySemiColon),  // :
   1.128 +/*3b*/  EStdKeySemiColon,           // ;
   1.129 +/*3c*/  SHIFTED(EStdKeyComma),      // <
   1.130 +/*3d*/  EStdKeyEquals,              // =
   1.131 +/*3e*/  SHIFTED(EStdKeyFullStop),   // >
   1.132 +/*3f*/  SHIFTED(EStdKeyForwardSlash), // ?
   1.133 +/*40*/  SHIFTED(EStdKeySingleQuote),  // @
   1.134 +/*41*/  SHIFTED('A'),
   1.135 +/*42*/  SHIFTED('B'),
   1.136 +/*43*/  SHIFTED('C'),
   1.137 +/*44*/  SHIFTED('D'),
   1.138 +/*45*/  SHIFTED('E'),
   1.139 +/*46*/  SHIFTED('F'),
   1.140 +/*47*/  SHIFTED('G'),
   1.141 +/*48*/  SHIFTED('H'),
   1.142 +/*49*/  SHIFTED('I'),
   1.143 +/*4a*/  SHIFTED('J'),
   1.144 +/*4b*/  SHIFTED('K'),
   1.145 +/*4c*/  SHIFTED('L'),
   1.146 +/*4d*/  SHIFTED('M'),
   1.147 +/*4e*/  SHIFTED('N'),
   1.148 +/*4f*/  SHIFTED('O'),
   1.149 +/*50*/  SHIFTED('P'),
   1.150 +/*51*/  SHIFTED('Q'),
   1.151 +/*52*/  SHIFTED('R'),
   1.152 +/*53*/  SHIFTED('S'),
   1.153 +/*54*/  SHIFTED('T'),
   1.154 +/*55*/  SHIFTED('U'),
   1.155 +/*56*/  SHIFTED('V'),
   1.156 +/*57*/  SHIFTED('W'),
   1.157 +/*58*/  SHIFTED('X'),
   1.158 +/*59*/  SHIFTED('Y'),
   1.159 +/*5a*/  SHIFTED('Z'),
   1.160 +/*5b*/  EStdKeySquareBracketLeft,   // [
   1.161 +/*5c*/  EStdKeyBackSlash,           // backslash
   1.162 +/*5d*/  EStdKeySquareBracketRight,  // ]
   1.163 +/*5e*/  SHIFTED('6'),               // ^
   1.164 +/*5f*/  SHIFTED(EStdKeyMinus),      // _
   1.165 +/*60*/  EStdKeyXXX,					// Actually `
   1.166 +/*61*/  'A',
   1.167 +/*62*/  'B',
   1.168 +/*63*/  'C',
   1.169 +/*64*/  'D',
   1.170 +/*65*/  'E',
   1.171 +/*66*/  'F',
   1.172 +/*67*/  'G',
   1.173 +/*68*/  'H',
   1.174 +/*69*/  'I',
   1.175 +/*6a*/  'J',
   1.176 +/*6b*/  'K',
   1.177 +/*6c*/  'L',
   1.178 +/*6d*/  'M',
   1.179 +/*6e*/  'N',
   1.180 +/*6f*/  'O',
   1.181 +/*70*/  'P',
   1.182 +/*71*/  'Q',
   1.183 +/*72*/  'R',
   1.184 +/*73*/  'S',
   1.185 +/*74*/  'T',
   1.186 +/*75*/  'U',
   1.187 +/*76*/  'V',
   1.188 +/*77*/  'W',
   1.189 +/*78*/  'X',
   1.190 +/*79*/  'Y',
   1.191 +/*7a*/  'Z',
   1.192 +/*7b*/  SHIFTED(EStdKeySquareBracketLeft),  // {
   1.193 +/*7c*/  SHIFTED(EStdKeyBackSlash),          // |
   1.194 +/*7d*/  SHIFTED(EStdKeySquareBracketRight),	// }
   1.195 +/*7e*/  SHIFTED(EStdKeyHash),				// ~
   1.196 +/*7f*/  EKeyDelete
   1.197 +	};
   1.198 +
   1.199 +CSerialKeyboard* CSerialKeyboard::NewL()
   1.200 +	{
   1.201 +	CSerialKeyboard* self = new(ELeave) CSerialKeyboard;
   1.202 +	self->ConstructL();
   1.203 +	return self;
   1.204 +	}
   1.205 +
   1.206 +CSerialKeyboard::CSerialKeyboard()
   1.207 +	:	CActive(0)
   1.208 +	{
   1.209 +	}
   1.210 +
   1.211 +void CSerialKeyboard::ConstructL()
   1.212 +	{
   1.213 +#ifdef __COMMS_DRIVER_NEEDED
   1.214 +	// load and connect to serial port
   1.215 +	TInt r=User::LoadPhysicalDevice(KPddName);
   1.216 +	if (r!=KErrNone && r!=KErrAlreadyExists)
   1.217 +		User::Leave(r);
   1.218 +	r=User::LoadLogicalDevice (KLddName);
   1.219 +	if (r!=KErrNone && r!=KErrAlreadyExists)
   1.220 +		User::Leave(r);
   1.221 +
   1.222 +	r=iDevComm.Open(KPortNumber);
   1.223 +	User::LeaveIfError(r);
   1.224 +
   1.225 +	TCommConfig cfgBuf;
   1.226 +	TCommConfigV01& cfg=cfgBuf();
   1.227 +	iDevComm.Config(cfgBuf);
   1.228 +	cfg.iRate=EBps115200;
   1.229 +	cfg.iDataBits=EData8;
   1.230 +	cfg.iStopBits=EStop1;
   1.231 +	cfg.iParity=EParityNone;
   1.232 +	cfg.iHandshake=0;//KConfigObeyXoff|KConfigSendXoff;
   1.233 +	cfg.iFifo=EFifoEnable;
   1.234 +	cfg.iTerminatorCount=0;
   1.235 +	cfg.iSIREnable=ESIRDisable;
   1.236 +	User::LeaveIfError(iDevComm.SetConfig(cfgBuf));
   1.237 +#endif
   1.238 +
   1.239 +	CActiveScheduler::Add(this);
   1.240 +	}
   1.241 +
   1.242 +CSerialKeyboard::~CSerialKeyboard()
   1.243 +	{
   1.244 +	Cancel();
   1.245 +	}
   1.246 +
   1.247 +void CSerialKeyboard::GetKey()
   1.248 +	{
   1.249 +	__ASSERT_ALWAYS(!IsActive(), User::Panic(_L("CSerialKeyboard"),1));
   1.250 +
   1.251 +	// wait for a key
   1.252 +#ifdef __USE_SERIAL_INPUT
   1.253 +	iDevComm.Read(iStatus,iBuf,1);
   1.254 +#endif
   1.255 +	SetActive();
   1.256 +	}
   1.257 +
   1.258 +TInt CSerialKeyboard::KeyCode()
   1.259 +	{
   1.260 +	TInt c=-1;
   1.261 +#ifdef __USE_SERIAL_INPUT
   1.262 +	if (iBuf.Length()>0)
   1.263 +		c=iBuf[0];
   1.264 +#endif
   1.265 +	return c;
   1.266 +	}
   1.267 +
   1.268 +void CSerialKeyboard::RunL()
   1.269 +	{
   1.270 +	TInt c=KeyCode();
   1.271 +	if (c>=0)
   1.272 +		{
   1.273 +		// convert character to keycode and shift, func, ctrl status
   1.274 +		TUint16 code = convertCode[c];
   1.275 +		TBool isShifted = ISSHIFTED(code);
   1.276 +		TBool isFunced = ISFUNCED(code);
   1.277 +		TBool isCtrled = ISCTRLED(code);
   1.278 +		TUint8 stdKey = STDKEY(code);
   1.279 +		TRawEvent e;
   1.280 +
   1.281 +		// post it as a sequence of events
   1.282 +		if (isShifted)
   1.283 +			{
   1.284 +			e.Set(TRawEvent::EKeyDown,EStdKeyRightShift,0);
   1.285 +			UserSvr::AddEvent(e);
   1.286 +			}
   1.287 +		if (isCtrled)
   1.288 +			{
   1.289 +			e.Set(TRawEvent::EKeyDown,EStdKeyLeftCtrl,0);
   1.290 +			UserSvr::AddEvent(e);
   1.291 +			}
   1.292 +		if (isFunced)
   1.293 +			{
   1.294 +			e.Set(TRawEvent::EKeyDown,EStdKeyLeftFunc,0);
   1.295 +			UserSvr::AddEvent(e);
   1.296 +			}
   1.297 +
   1.298 +		e.Set(TRawEvent::EKeyDown,stdKey,0);
   1.299 +		UserSvr::AddEvent(e);
   1.300 +
   1.301 +		e.Set(TRawEvent::EKeyUp,stdKey,0);
   1.302 +		UserSvr::AddEvent(e);
   1.303 +
   1.304 +		if (isFunced)
   1.305 +			{
   1.306 +			e.Set(TRawEvent::EKeyUp,EStdKeyLeftFunc,0);
   1.307 +			UserSvr::AddEvent(e);
   1.308 +			}
   1.309 +		if (isCtrled)
   1.310 +			{
   1.311 +			e.Set(TRawEvent::EKeyUp,EStdKeyLeftCtrl,0);
   1.312 +			UserSvr::AddEvent(e);
   1.313 +			}
   1.314 +		if (isShifted)
   1.315 +			{
   1.316 +			e.Set(TRawEvent::EKeyUp,EStdKeyRightShift,0);
   1.317 +			UserSvr::AddEvent(e);
   1.318 +			}
   1.319 +		}
   1.320 +
   1.321 +	// get another key
   1.322 +	GetKey();
   1.323 +	}
   1.324 +
   1.325 +void CSerialKeyboard::DoCancel()
   1.326 +	{
   1.327 +#ifdef __USE_SERIAL_INPUT
   1.328 +	iDevComm.ReadCancel();
   1.329 +#endif
   1.330 +	}
   1.331 +
   1.332 +
   1.333 +class CScreenDriverVT100 : public CScreenDriver
   1.334 +	{
   1.335 +public:
   1.336 +	CScreenDriverVT100();
   1.337 +	virtual void Init(TSize &aScreenSize,TSize &aFontSize);
   1.338 +	virtual void Blit(const TText *aBuffer,TInt aLength,const TPoint &aPosition);
   1.339 +	virtual TBool ScrollUp(const TRect& aRect);
   1.340 +	virtual void Clear(const TRect& aRect);
   1.341 +
   1.342 +	virtual void SetPixel(const TPoint& aPoint,TUint8 aColour);
   1.343 +	virtual TInt GetPixel(const TPoint& aPoint);
   1.344 +	virtual void SetWord(const TPoint& aPoint,TInt aWord);
   1.345 +	virtual TInt GetWord(const TPoint& aPoint);
   1.346 +	virtual void SetLine(const TPoint& aPoint,const TPixelLine& aPixelLine);
   1.347 +	virtual void GetLine(const TPoint& aPoint,TPixelLine& aPixelLine);
   1.348 +
   1.349 +	virtual TInt SetMode(TVideoMode aMode);
   1.350 +
   1.351 +	virtual void SetPaletteEntry(TColorIndex anIndex,TUint8 aRed,TUint8 aGreen,TUint8 aBlue) {}
   1.352 +	virtual void GetPaletteEntry(TColorIndex anIndex,TUint8 &aRed,TUint8 &aGreen,TUint8 &aBlue) {}
   1.353 +	virtual void SetForegroundColor(TColorIndex anIndex) {}
   1.354 +	virtual void SetBackgroundColor(TColorIndex anIndex) {}
   1.355 +	virtual void GetAttributeColors(TColorIndex* anArray) {}
   1.356 +
   1.357 +	//
   1.358 +	void Update(const TRect &aRect);
   1.359 +	void Print(const TDesC8& aDes);
   1.360 +	TUint8 *iScreenBuffer;
   1.361 +private:
   1.362 +	CSerialKeyboard *iSerialKeyboard;
   1.363 +	};
   1.364 +
   1.365 +const TInt KScreenWidth = 80;
   1.366 +const TInt KScreenHeight = 24;
   1.367 +
   1.368 +CScreenDriverVT100::CScreenDriverVT100()
   1.369 +//
   1.370 +// Constructor
   1.371 +//
   1.372 +	{
   1.373 +	}
   1.374 +
   1.375 +EXPORT_C CScreenDriver *CScreenDriver::New()
   1.376 +//
   1.377 +// Return the actual screen driver.
   1.378 +//
   1.379 +	{
   1.380 +
   1.381 +    CScreenDriverVT100 *pS=new CScreenDriverVT100;
   1.382 +	pS->iScreenBuffer=new TUint8 [KScreenWidth*KScreenHeight];
   1.383 +	return pS;
   1.384 +	}
   1.385 +
   1.386 +void CScreenDriverVT100::Init(TSize& aScreenSize, TSize& aFontSize)
   1.387 +	{
   1.388 +	// Report screen information
   1.389 +	aFontSize=TSize(8,10);
   1.390 +	aScreenSize=TSize(KScreenWidth,KScreenHeight);
   1.391 +
   1.392 +	// start keyboard
   1.393 +	TRAPD(r,iSerialKeyboard = CSerialKeyboard::NewL());
   1.394 +    // must panic if there are not enough resources to continue
   1.395 +    __ASSERT_ALWAYS(r==KErrNone, User::Panic(_L("CSerialKeyboard"),2));
   1.396 +
   1.397 +	iSerialKeyboard->GetKey();
   1.398 +	}
   1.399 +
   1.400 +TInt CScreenDriverVT100::SetMode(TVideoMode aMode)
   1.401 +//
   1.402 +// Set the screen mode
   1.403 +//
   1.404 +	{
   1.405 +	return(KErrNotSupported);
   1.406 +	}
   1.407 +
   1.408 +void CScreenDriverVT100::Update(const TRect &aRect)
   1.409 +	{
   1.410 +	TBuf8<0x100> buf;
   1.411 +	TInt i;
   1.412 +
   1.413 +	for (i=aRect.iTl.iY; i<=aRect.iBr.iY; i++)
   1.414 +		{
   1.415 +		buf.Format(_L8("\x1b[%02d;%02dH"), i+1, aRect.iTl.iX+1);
   1.416 +		TPtrC8 ptr(iScreenBuffer+(aRect.iTl.iX+i*KScreenWidth),aRect.iBr.iX-aRect.iTl.iX);
   1.417 +		buf.Append(ptr);
   1.418 +		Print(buf);
   1.419 +		}
   1.420 +	Print(_L8("\x1b[01;01H"));
   1.421 +	}
   1.422 +
   1.423 +void CScreenDriverVT100::Blit(const TText *aBuffer, TInt aLength, const TPoint &aPosition)
   1.424 +//
   1.425 +// Write contiguous block of characters to some segment of a line on the display
   1.426 +//
   1.427 +	{
   1.428 +	TUint8 *ptr=iScreenBuffer+(aPosition.iX+aPosition.iY*KScreenWidth);
   1.429 +	const TText* endBuf = aBuffer + aLength;
   1.430 +	while (aBuffer < endBuf)
   1.431 +		*ptr++ = (TUint8)*aBuffer++;
   1.432 +	Update(TRect(aPosition.iX, aPosition.iY, aPosition.iX+aLength, aPosition.iY));
   1.433 +	}
   1.434 +
   1.435 +TBool CScreenDriverVT100::ScrollUp(const TRect& aRect)
   1.436 +//
   1.437 +// Scroll a rectangle of the screen up one line, don't update bottom line
   1.438 +//
   1.439 +	{
   1.440 +	TInt j;
   1.441 +	for (j=aRect.iTl.iY; j<aRect.iBr.iY; j++)
   1.442 +		{
   1.443 +		TUint8 *ptr=iScreenBuffer+(aRect.iTl.iX+j*KScreenWidth);
   1.444 +		Mem::Copy(ptr, ptr+KScreenWidth, aRect.iBr.iX-aRect.iTl.iX);
   1.445 +		}
   1.446 +	if ((aRect.iTl.iX<=1) && (aRect.iBr.iX>=KScreenWidth-2))
   1.447 +		{
   1.448 +		// Optimisation: range of whole lines
   1.449 +		TBuf8<0x100> buf;
   1.450 +		// cursor pos
   1.451 +		buf.Format(_L8("\x1b[%02d;%02dH\xd\xa\xba\x1b[%02dC\xba"), aRect.iBr.iY, 1, aRect.iBr.iX);
   1.452 +		Print(buf);
   1.453 +		// set scroll region
   1.454 +		buf.Format(_L8("\x1b[%02d;%02dr\xd\xa"), aRect.iTl.iY+1, aRect.iBr.iY);
   1.455 +		Print(buf);
   1.456 +		Print(_L8("\x1b[01;01H"));
   1.457 +		}
   1.458 +	else
   1.459 +		Update(aRect);
   1.460 +
   1.461 +	return(ETrue);
   1.462 +	}
   1.463 +
   1.464 +void CScreenDriverVT100::Clear(const TRect& aRect)
   1.465 +//
   1.466 +// Clear a rectangle of the screen
   1.467 +//
   1.468 +	{
   1.469 +	TInt j;
   1.470 +	TBuf8<0x100> buf;
   1.471 +	for (j=aRect.iTl.iY; j<=aRect.iBr.iY; j++)
   1.472 +		{
   1.473 +		TUint8 *ptr=iScreenBuffer+(aRect.iTl.iX+j*KScreenWidth);
   1.474 +		Mem::FillZ(ptr, aRect.iBr.iX-aRect.iTl.iX);
   1.475 +		}
   1.476 +	if ((aRect.iTl.iY == aRect.iBr.iY) && (aRect.iTl.iX==0) && (aRect.iBr.iX==KScreenWidth-1))
   1.477 +		{
   1.478 +		// Optimisation: one whole line
   1.479 +		buf.Format(_L8("\x1b[%02d;%02dH"), aRect.iTl.iY, 1);
   1.480 +		Print(buf);
   1.481 +		// Erase line
   1.482 +		buf.Format(_L8("\x1b[2K"));
   1.483 +		Print(buf);
   1.484 +		Print(_L8("\x1b[01;01H"));
   1.485 +		}
   1.486 +	else if ((aRect.iTl.iY == 0) && (aRect.iBr.iY == KScreenHeight-1) &&
   1.487 +						(aRect.iTl.iX == 0) && (aRect.iBr.iX == KScreenWidth-1))
   1.488 +		{
   1.489 +		// Optimisation: whole screen
   1.490 +		buf.Format(_L8("\x1b[2J"));
   1.491 +		Print(buf);
   1.492 +		Print(_L8("\x1b[01;01H"));
   1.493 +		}
   1.494 +	else
   1.495 +		Update(aRect);
   1.496 +	}
   1.497 +
   1.498 +void CScreenDriverVT100::SetPixel(const TPoint& /*aPoint*/,TUint8 /*aColour*/)
   1.499 +	{
   1.500 +	}
   1.501 +
   1.502 +TInt CScreenDriverVT100::GetPixel(const TPoint& /*aPoint*/)
   1.503 +	{
   1.504 +	return 0;
   1.505 +	}
   1.506 +
   1.507 +void CScreenDriverVT100::SetWord(const TPoint& /*aPoint*/,TInt /*aWord*/)
   1.508 +	{
   1.509 +	}
   1.510 +
   1.511 +TInt CScreenDriverVT100::GetWord(const TPoint& /*aPoint*/)
   1.512 +	{
   1.513 +	return 0;
   1.514 +	}
   1.515 +
   1.516 +void CScreenDriverVT100::SetLine(const TPoint& /*aPoint*/,const TPixelLine& /*aPixelLine*/)
   1.517 +	{
   1.518 +	}
   1.519 +
   1.520 +void CScreenDriverVT100::GetLine(const TPoint& /*aPoint*/,TPixelLine& /*aPixelLine*/)
   1.521 +	{
   1.522 +	}
   1.523 +
   1.524 +void CScreenDriverVT100::Print(const TDesC8& aDes)
   1.525 +	{
   1.526 +#ifdef __USE_RDEBUG_OUTPUT
   1.527 +	TBuf<256> unicodeBuf;
   1.528 +	unicodeBuf.Copy(aDes);
   1.529 +	RDebug::RawPrint(unicodeBuf);
   1.530 +#else
   1.531 +	RBusDevComm c=iSerialKeyboard->iDevComm;
   1.532 +	TRequestStatus s;
   1.533 +	c.Write(s,aDes);
   1.534 +	User::WaitForRequest(s);
   1.535 +#endif
   1.536 +	}
   1.537 +