View topic - Using Windows Hyperterminal as QNX terminal

Page 1 of 1

Using Windows Hyperterminal as QNX terminal

PostPosted: Fri Dec 07, 2012 6:43 pm
by summerluv
Hi,
Sorry if my title does not make sense. I'm fairly new to all this and just took over some legacy code.
We have a QNX machine, which has a serial port on it. Instead of using the QNX terminal locally, we:
1) use a serial cable to connect the serial port from QNX to a Windows machine.
2) Launch Hyperterminal on the Windows machine.
3) On QNX, in terminal window, type in the command "on on -t /dev/ser1 sh (I was told this command is what allows Windows terminal to act like QNX terminal. However I couldn't find any documentation on it)
4) Start Hyperterminal on windows machine.

Now, on Hyperterminal, the following settings are OFF: a) echo typed characters locally b) Send line ends with line feeds.

With the following setup, hyperterminal is able to like QNX's terminal. I can type in various commands like "cd", "ls"...etc. Even though the two settings mentioned above are OFF, things work and I can see what I typed.
Now I wrote an application that resides on QNX. It is extremely simple:

Code: Select all
int main( int argc, char *argv[] )
{
   string cmd;
   cout << "Please enter command: \n";
   getline (cin, cmd);
   cout << "The command you entered is " << cmd << "\n";
   return 0;
}


When running this app on QNX terminal, it works fine. But when running this app on Hyperterminal, not so much. As soon as I start the app, anything I type locally is NOT shown. And hitting Enter does not make whatever I typed in read. Instead, I have to turn ON the "a) echo typed characters locally b) Send line ends with line feeds" options.

However, leaving those two options on, if I exit my program and go back to normal shell on Hyperterminal, anything I type is now echoed twice. e.g "llss" instead of "ls".

Can someone please help me? i just don't understand why those two options behave differently in normal shell vs my own app.
We also have other legacy codes that use the "curses.h" library to do input/output instead (mvprintw,wgetnstr) . Those seem to work fine. But I'd really like to get away from that and use cin/cout instead.

Thanks!!

Re: Using Windows Hyperterminal as QNX terminal

PostPosted: Sun Dec 09, 2012 11:15 pm
by maschoen
First a minor note. It's possible to setup the QNX serial port (or rather setup a monitor program) so that you don't need to execute the ON command. Instead you would typically type CTRL-Z and bring up a login.

The reason you are having the problem seems fairly straight forward. You have configured Hyper Terminal so that it sends characters transparently. It does not print them locally just because you type them. The shell command that you started must be echoing the characters back. I'm not sure if it is doing it itself or if it turns on echo locally. You can check by doing an stty on the serial line by running stty.

The reason you do not see the characters echoed when running your program, is because your program is not echoing them.

Re: Using Windows Hyperterminal as QNX terminal

PostPosted: Mon Dec 10, 2012 5:33 pm
by Tim
Summerluv,

I would suggest using Putty instead of Windows Hyperterminal. It's a free app to download and it's much more robust than Hyperterminal.

Tim

Re: Using Windows Hyperterminal as QNX terminal

PostPosted: Thu Dec 13, 2012 6:12 pm
by summerluv
We switched to another terminal tool and now all is well. Thank you for your help maschoen and tim. As a newbie this website has been very helpful.