# HG changeset patch # User Tom Sutcliffe # Date 1281440026 -3600 # Node ID 17e35ffe449bbc05115b415a9380aa958ca3ffa7 # Parent 5d370dafea69b3d44623add8bde62eeb32cffbb4 Improved debugging in vt100 consoles. * Added 'debug' option to vt100cons and vt100busdevcons --console-title configs so you can get debug out of console creation without recompiling vt100.dll * Rejigged FSHELL_AUTOSTART macro so it supports textshell mode via an eshell autoexec.bat * Fixed some issues with FSHELL_NO_BLUETOOTH_SUPPORT diff -r 5d370dafea69 -r 17e35ffe449b core/group/bld.inf --- a/core/group/bld.inf Fri Aug 06 17:00:19 2010 +0100 +++ b/core/group/bld.inf Tue Aug 10 12:33:46 2010 +0100 @@ -98,6 +98,7 @@ .\autostart.script z:\system\console\scripts\autostart.script .\comm.script z:\system\console\scripts\comm.script +.\fshell_autoexec.bat z:\fshell_autoexec.bat PRJ_MMPFILES gnumakefile .\fshell_version.mk diff -r 5d370dafea69 -r 17e35ffe449b core/group/fshell_autoexec.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/core/group/fshell_autoexec.bat Tue Aug 10 12:33:46 2010 +0100 @@ -0,0 +1,1 @@ +fshell autostart diff -r 5d370dafea69 -r 17e35ffe449b core/group/fshell_core.iby --- a/core/group/fshell_core.iby Fri Aug 06 17:00:19 2010 +0100 +++ b/core/group/fshell_core.iby Tue Aug 10 12:33:46 2010 +0100 @@ -69,9 +69,6 @@ #endif // FSHELL_CORE_SUPPORT_SERIAL_ICON FSHELL_DATA_FILE(ZSYSTEM\console\scripts\comm.script, system\console\scripts\comm.script) -#ifdef FSHELL_AUTOEXEC -FSHELL_DATA_FILE(DATAZ_\autoexec.bat.comm, autoexec.bat) -#endif FSHELL_EXECUTABLE_FILE(iosrv.exe) FSHELL_EXECUTABLE_FILE(iocli.dll) @@ -81,11 +78,21 @@ FSHELL_ECOM_PLUGIN(sbrec.dll, sbrec.rsc) FSHELL_DATA_FILE(ZPRIVATE\10003a3f\apps\sbapp_reg.RSC, Private\10003a3f\import\Apps\sbapp_reg.RSC) FSHELL_DATA_FILE(ZRESOURCE\Apps\sbapp_loc.rsc, Resource\Apps\sbapp_loc.rsc) +#endif + #ifdef FSHELL_AUTOSTART -patchdata sbrec.dll@KAutoStartFshell 1 FSHELL_DATA_FILE(ZSYSTEM\console\scripts\autostart.script, system\console\scripts\autostart.script) +#if defined(FSHELL_CORE_SUPPORT_SHEBANG) +patchdata sbrec.dll@KAutoStartFshell 1 +#elif !defined(FSHELL_WSERV_SUPPORT) +// Do it the eshell way +FSHELL_DATA_FILE(DATAZ_\fshell_autoexec.bat, autoexec.bat) +#else +// If we don't support a recogniser but aren't textshell, we're not a configuration worth worrying about #endif -#endif +#endif // FSHELL_AUTOSTART + + #ifdef FSHELL_CORE_SUPPORT_PIPSRUN FSHELL_EXECUTABLE_FILE(pipsrun.exe) #endif diff -r 5d370dafea69 -r 17e35ffe449b libraries/btserial/group/bld.inf --- a/libraries/btserial/group/bld.inf Fri Aug 06 17:00:19 2010 +0100 +++ b/libraries/btserial/group/bld.inf Tue Aug 10 12:33:46 2010 +0100 @@ -17,11 +17,11 @@ PRJ_EXPORTS FSHELL_ROM_INCLUDE(btincomingserial.iby) -#ifdef FSHELL_COMMS_SUPPORT +#ifdef FSHELL_BLUETOOTH_SUPPORT ..\inc\btincomingserial.h +\include\fshell\btincomingserial.h ..\inc\btserialclient.h +\include\fshell\btserialclient.h PRJ_MMPFILES -BtSerial +BtSerial.mmp #endif diff -r 5d370dafea69 -r 17e35ffe449b libraries/btserial/group/btincomingserial.iby --- a/libraries/btserial/group/btincomingserial.iby Fri Aug 06 17:00:19 2010 +0100 +++ b/libraries/btserial/group/btincomingserial.iby Tue Aug 10 12:33:46 2010 +0100 @@ -16,7 +16,7 @@ #include #include -#ifdef FSHELL_COMMS_SUPPORT +#ifdef FSHELL_BLUETOOTH_SUPPORT FSHELL_EXECUTABLE_FILE(btincomingserial.dll) #endif diff -r 5d370dafea69 -r 17e35ffe449b plugins/consoles/vt100cons/doc/vt100cons.pod --- a/plugins/consoles/vt100cons/doc/vt100cons.pod Fri Aug 06 17:00:19 2010 +0100 +++ b/plugins/consoles/vt100cons/doc/vt100cons.pod Tue Aug 10 12:33:46 2010 +0100 @@ -78,6 +78,10 @@ If present, set the baud rate of the serial port. Allowed values are: 115200, 57600, 19200, 9600. If specified, the port is configured with the following settings: rate as specified; data bits 8; stop bits 1; parity none; handshake 0, terminator count 0. For virtual serial ports (eg USB ACMs or Bluetooth serial ports) it is generally not necessary to configure hardware attributes so the rate parameter should not be specified. +=item * C + +If present, the console will print out some debugging diagnostics to the underlying console during construction. + =back Each keyword and value must be separated by an equals ('=') character. There may be whitespace either side of this. Each keword / value pair must be separated by a comma (',') character. Again, there may be whitespace either side of this. The name values may not contain either equals or comma characters as no form of escaping is currently supported. @@ -264,7 +268,7 @@ fshell --console vt100busdevcons.dll --console-title port=2 -If an option isn't specified, the following are assumed: pdd=euart, ldd=ecomm, rate=115200. +If an option isn't specified, the following are assumed: pdd=euart (ecdrv on emulator), ldd=ecomm, rate=EBpsAutobaud. =head1 Copyright diff -r 5d370dafea69 -r 17e35ffe449b plugins/consoles/vt100cons/group/bld.inf --- a/plugins/consoles/vt100cons/group/bld.inf Fri Aug 06 17:00:19 2010 +0100 +++ b/plugins/consoles/vt100cons/group/bld.inf Tue Aug 10 12:33:46 2010 +0100 @@ -29,7 +29,9 @@ #ifdef FSHELL_COMMS_SUPPORT .\vt100serial.mmp .\vt100cons.mmp +#ifdef FSHELL_BLUETOOTH_SUPPORT .\vt100btcons.mmp +#endif .\vt100tcpcons.mmp .\vt100usbcons.mmp #endif diff -r 5d370dafea69 -r 17e35ffe449b plugins/consoles/vt100cons/group/vt100cons.iby --- a/plugins/consoles/vt100cons/group/vt100cons.iby Fri Aug 06 17:00:19 2010 +0100 +++ b/plugins/consoles/vt100cons/group/vt100cons.iby Tue Aug 10 12:33:46 2010 +0100 @@ -21,7 +21,9 @@ #ifdef FSHELL_COMMS_SUPPORT FSHELL_EXECUTABLE_FILE(vt100serial.dll) FSHELL_EXECUTABLE_FILE(vt100cons.dll) +#ifdef FSHELL_BLUETOOTH_SUPPORT FSHELL_EXECUTABLE_FILE(vt100btcons.dll) +#endif FSHELL_EXECUTABLE_FILE(vt100tcpcons.dll) FSHELL_EXECUTABLE_FILE(vt100usbcons.dll) #endif @@ -30,12 +32,4 @@ FSHELL_EXECUTABLE_FILE(vt100debugport.dll) #endif -// Note, not #including loopback.iby because its doesn't use the -// tool-kit's .iby file macros, and so breaks SIS file generation -// via .iby files. -//#ifndef __LOOPBACK_IBY__ -//#define __LOOPBACK_IBY__ -//FSHELL_EXECUTABLE_FILE(LOOPBACK.CSY) -//#endif - #endif diff -r 5d370dafea69 -r 17e35ffe449b plugins/consoles/vt100cons/inc/vtc_serial.h --- a/plugins/consoles/vt100cons/inc/vtc_serial.h Fri Aug 06 17:00:19 2010 +0100 +++ b/plugins/consoles/vt100cons/inc/vtc_serial.h Tue Aug 10 12:33:46 2010 +0100 @@ -24,13 +24,14 @@ class TPortConfig { public: - TPortConfig() : iRate(EBpsAutobaud) {} + TPortConfig() : iRate(EBpsAutobaud), iDebug(EFalse) {} TPtrC iPdd; TPtrC iLdd; TPtrC iCsy; TPtrC iPort; TBps iRate; + TBool iDebug; }; diff -r 5d370dafea69 -r 17e35ffe449b plugins/consoles/vt100cons/src/serial/vtc_serial.cpp --- a/plugins/consoles/vt100cons/src/serial/vtc_serial.cpp Fri Aug 06 17:00:19 2010 +0100 +++ b/plugins/consoles/vt100cons/src/serial/vtc_serial.cpp Tue Aug 10 12:33:46 2010 +0100 @@ -15,7 +15,7 @@ const TInt KMaxWriteLength = 2 * 1024; // Some serial drivers fail with KErrNoMemory if writes are too big, so they have to be broken up. -#define LEAVE_IF_ERROR_ALLOW_ALREADY_EXISTS(_x) { TInt _err = _x; if ((_err < 0) && (_err != KErrAlreadyExists)) { User::Leave(_err); } } +#define ErrOrDebug(err) (((err) < 0 && (err) != KErrAlreadyExists) ? EError : EDebug) EXPORT_C CVtcSerialConsole::CVtcSerialConsole() { @@ -34,6 +34,7 @@ _LIT(KKeywordCsy, "csy"); _LIT(KKeywordPort, "port"); _LIT(KKeywordRate, "rate"); + _LIT(KKeywordDebug, "debug"); TBool keywordFound(EFalse); TLex lex(aConfigDes); @@ -89,6 +90,11 @@ } keywordFound = ETrue; } + else if (keyword == KKeywordDebug) + { + aConfig.iDebug = ETrue; + keywordFound = ETrue; + } } if (!keywordFound) @@ -103,18 +109,29 @@ EXPORT_C void CVtcSerialConsole::ConstructL(const TDesC& aTitle) { TPortConfig portConfig; - User::LeaveIfError(ReadConfig(aTitle, portConfig)); + TInt err = ReadConfig(aTitle, portConfig); + if (err) + { + Message(EError, _L("Error reading config: %d"), err); + User::LeaveIfError(err); + } + if (portConfig.iPort.Length() == 0) { User::Leave(KErrArgument); } + + if (portConfig.iDebug) SetDebug(ETrue); + if (portConfig.iPdd.Length()) { - LEAVE_IF_ERROR_ALLOW_ALREADY_EXISTS(User::LoadPhysicalDevice(portConfig.iPdd)); + err = User::LoadPhysicalDevice(portConfig.iPdd); + Message(ErrOrDebug(err), _L("Loading PDD %S returned %d"), &portConfig.iPdd, err); + if (err != KErrAlreadyExists) User::LeaveIfError(err); } else { - // If not specified, assume they probably intended the standard ones (but don't error if they fail, since the user might actually know what they're doing + // If not specified, assume they probably intended the standard ones (but don't error if they fail, since the user might actually know what they're doing) #ifdef __WINS__ User::LoadPhysicalDevice(_L("ecdrv")); #else @@ -124,23 +141,31 @@ if (portConfig.iLdd.Length()) { - LEAVE_IF_ERROR_ALLOW_ALREADY_EXISTS(User::LoadLogicalDevice(portConfig.iLdd)); + err = User::LoadLogicalDevice(portConfig.iLdd); + Message(ErrOrDebug(err), _L("Loading LDD %S returned %d"), &portConfig.iLdd, err); + if (err != KErrAlreadyExists) User::LeaveIfError(err); } else { User::LoadLogicalDevice(_L("ecomm")); } - User::LeaveIfError(iCommServ.Connect()); + err = iCommServ.Connect(); + Message(ErrOrDebug(err), _L("Connecting to RCommServ returned %d"), err); + User::LeaveIfError(err); if (portConfig.iCsy.Length()) { - LEAVE_IF_ERROR_ALLOW_ALREADY_EXISTS(iCommServ.LoadCommModule(portConfig.iCsy)); + err = iCommServ.LoadCommModule(portConfig.iCsy); + Message(ErrOrDebug(err), _L("Loading CSY %S returned %d"), &portConfig.iCsy, err); + if (err != KErrAlreadyExists) User::LeaveIfError(err); } else { iCommServ.LoadCommModule(_L("ecuart")); } - User::LeaveIfError(iCommPort.Open(iCommServ, portConfig.iPort, ECommExclusive)); + err = iCommPort.Open(iCommServ, portConfig.iPort, ECommExclusive); + Message(ErrOrDebug(err), _L("Opening port %S returned %d"), &portConfig.iPort, err); + User::LeaveIfError(err); #ifdef __WINS__ // For BC reasons, we always set rate on WINS @@ -160,7 +185,9 @@ cfg().iSpecialRate = 0; cfg().iTerminatorCount = 0; cfg().iSIREnable = ESIRDisable; - User::LeaveIfError(iCommPort.SetConfig(cfg)); + err = iCommPort.SetConfig(cfg); + Message(ErrOrDebug(err), _L("Setting port config returned %d"), err); + User::LeaveIfError(err); } User::LeaveIfError(iCommPort.ResetBuffers()); diff -r 5d370dafea69 -r 17e35ffe449b plugins/consoles/vt100cons/src/vt100/vtc_base.cpp --- a/plugins/consoles/vt100cons/src/vt100/vtc_base.cpp Fri Aug 06 17:00:19 2010 +0100 +++ b/plugins/consoles/vt100cons/src/vt100/vtc_base.cpp Tue Aug 10 12:33:46 2010 +0100 @@ -27,7 +27,6 @@ EXPORT_C CVtcConsoleBase::CVtcConsoleBase() { - //SetDebug(ETrue); // debug } EXPORT_C CVtcConsoleBase::~CVtcConsoleBase() @@ -128,7 +127,9 @@ } else { + // Cover all the bases User::InfoPrint(buf); + RDebug::Print(buf); } } } diff -r 5d370dafea69 -r 17e35ffe449b plugins/consoles/vt100cons/src/vtc_busdevcons.cpp --- a/plugins/consoles/vt100cons/src/vtc_busdevcons.cpp Fri Aug 06 17:00:19 2010 +0100 +++ b/plugins/consoles/vt100cons/src/vtc_busdevcons.cpp Tue Aug 10 12:33:46 2010 +0100 @@ -23,8 +23,10 @@ TPtrC iLdd; TInt iPort; TBps iRate; + TBool iDebug; }; +#define ErrOrDebug(err) (((err) < 0 && (err) != KErrAlreadyExists) ? EError : EDebug) NONSHARABLE_CLASS(CVtcBusDevCommConsole) : public CVtcConsoleBase { @@ -67,7 +69,7 @@ _LIT(KLdd, "ecomm"); TPortConfig::TPortConfig() - :iPdd(KNullDesC), iLdd(KNullDesC), iPort(-1), iRate(EBpsAutobaud) + :iPdd(KNullDesC), iLdd(KNullDesC), iPort(-1), iRate(EBpsAutobaud), iDebug(EFalse) { } @@ -77,6 +79,7 @@ _LIT(KKeywordLdd, "ldd"); _LIT(KKeywordPort, "port"); _LIT(KKeywordRate, "rate"); + _LIT(KKeywordDebug, "debug"); TBool keywordFound(EFalse); TLex lex(aConfigDes); @@ -128,6 +131,11 @@ } keywordFound = ETrue; } + else if (keyword == KKeywordDebug) + { + aConfig.iDebug = ETrue; + keywordFound = ETrue; + } } if (!keywordFound) @@ -146,20 +154,22 @@ User::LeaveIfError(ReadConfig(aTitle, portConfig)); if (portConfig.iPort < 0) User::Leave(KErrArgument); + if (portConfig.iDebug) SetDebug(ETrue); + TPtrC pdd(portConfig.iPdd); if (pdd.Length() == 0) pdd.Set(KPdd()); TPtrC ldd(portConfig.iLdd); if (ldd.Length() == 0) ldd.Set(KLdd()); TInt err = User::LoadPhysicalDevice(pdd); - Message(EDebug, _L("Loading %S returned %d"), &pdd, err); + Message(ErrOrDebug(err), _L("Loading PDD %S returned %d"), &pdd, err); if (err != KErrAlreadyExists && portConfig.iPdd.Length()) User::LeaveIfError(err); // Don't error if we failed to load the default PDD err = User::LoadLogicalDevice(ldd); - Message(EDebug, _L("Loading %S returned %d"), &ldd, err); + Message(ErrOrDebug(err), _L("Loading LDD %S returned %d"), &ldd, err); if (err != KErrAlreadyExists && portConfig.iLdd.Length()) User::LeaveIfError(err); // Don't error if we failed to load the default LDD err = iComm.Open(portConfig.iPort); - Message(EDebug, _L("Opening port %d returned %d"), portConfig.iPort, err); + Message(ErrOrDebug(err), _L("Opening port %d returned %d"), portConfig.iPort, err); User::LeaveIfError(err); if (portConfig.iRate != EBpsAutobaud) @@ -176,7 +186,7 @@ cfg().iTerminatorCount = 0; cfg().iSIREnable = ESIRDisable; err = iComm.SetConfig(cfg); - Message(EDebug, _L("RBusDevComm::SetConfig returned %d"), err); + Message(ErrOrDebug(err), _L("RBusDevComm::SetConfig returned %d"), err); User::LeaveIfError(err); } iComm.ResetBuffers();