My app is echoing every char that getchar() receives.  I don't want them to be echoed, how can I avoid this?  I've tried ioctl() but can't get it to make any difference.  Any sample code would be appreciated.  I'm using:
	SerialClose( 0 );                 // close UART 0 
	fdSerial = OpenSerial( 0, 115200, 1, 8, eParityNone );
	ReplaceStdio( 0, fdSerial );      // stdin 
	ReplaceStdio( 1, fdSerial );      // stdout
	ReplaceStdio( 2, fdSerial );      // stderr 
I've tried:
     ioctl(fdSerial,8); //IOCTL_RX_ECHO (8)  When set echo chars received to tx
Of ioctl() the manual says: "The ioctl command consists of IOCTL_SET or IOCTL_CLR and the bit of the associated options. "
but I don't know how to use IOCTL_SET or IOCTL_CLR.
Thanks,
Sam
			
			
									
						
										
						How do you control echoing of chars with getchar() etc?
Re: How do you control echoing of chars with getchar() etc?
How about using read() instead?
			
			
									
						
										
						Re: How do you control echoing of chars with getchar() etc?
read() echoes too.  I don't think getchar() echoed until I tried using ioctl() to control LF and CR being appended to output.  Could ioctl() have changed something?
			
			
									
						
										
						Re: How do you control echoing of chars with getchar() etc?
I think something is going on with your app or the serial terminal you are using. read() should not echo, it just fills the buffer you pass as a parameter.
			
			
									
						
										
						- 
				ahbushnell
- Posts: 25
- Joined: Thu Apr 24, 2008 7:45 pm
Re: How do you control echoing of chars with getchar() etc?
Are you sure your terminal software doesn't have echo turned on?
			
			
									
						
										
						Re: How do you control echoing of chars with getchar() etc?
Neither my terminal program (uCon) nor my application were explicitly echoing.  As I expected, the call to gets() was echoing.
This is what I needed to do:
ioctl(2,IOCTL_CLR|IOCTL_RX_ECHO);
Of the second parameter for ioctl, the NetBurnerRuntimeLibraries.pdf says
"The ioctl command consists of IOCTL_SET or IOCTL_CLR and the bit of the associated options. "
so I was trying IOCTL_CLR&IOCTL_RX_ECHO, based on the "and". When I looked into ioctl.h I saw my mistake.
Sam
			
			
									
						
										
						This is what I needed to do:
ioctl(2,IOCTL_CLR|IOCTL_RX_ECHO);
Of the second parameter for ioctl, the NetBurnerRuntimeLibraries.pdf says
"The ioctl command consists of IOCTL_SET or IOCTL_CLR and the bit of the associated options. "
so I was trying IOCTL_CLR&IOCTL_RX_ECHO, based on the "and". When I looked into ioctl.h I saw my mistake.
Sam