Page 1 of 1

MTTY Behavior on module disconnect

Posted: Tue Feb 03, 2015 5:29 pm
by ecasey
This is a minor gripe, but it would be nice if MTTY would shut down nicely when the USB cable is disconnected.
Under Release 2.7.0 on a MOD5282 running MTTY in WIN7, if the board powers down for any reason, MTTY gives me a modal dialog box that says
Error 22: WaitCommEvent.
The device does not recognize the command.
On selecting "OK", the box just pops back up, no matter how many times I press "OK" or "X" to close the dialog. I have to open the Task Manager and end the program to get it to go away.
I think it has always been doing this; I also only recall this happening on the MOD5282. I work on other MODs (5270, 5441x, nano) and I don't remember this behavior with them. I have 5282s on all my dev boards right now or I would test them.

If anyone knows of a work around to get MTTY to go quietly into the night, please let me know.

Re: MTTY Behavior on module disconnect

Posted: Wed Feb 04, 2015 12:01 am
by sblair
It's always done that on occasion at least for me. Happens to me with 5270 and 5441x.

My solution is just always to open the Windows Task Manager and kill the process.

It's not as much a solution for getting it to go quietly into the night as it is snuffing it out with a pillow....but it gets the job done.

Re: MTTY Behavior on module disconnect

Posted: Thu Feb 05, 2015 3:53 pm
by ecasey
I looked at the source code for MTTTY with a view to fixing it myself if I could find a simple and thread safe way to do it.
The best I could do without a lot of re-writing was to simply change the timeout value in the BreakDownCommPort function from 20 seconds to 2 seconds.

Now, if power is lost or USB cable is disconnected, it will exit after I click a few dialog boxes. I have attached a copy that you can put in the /nburn/pcbin file to replace the original MTTTY.exe.
...at your own risk of course.