public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* Re: Re: [ECOS] Problems with tcgetattr()
@ 2006-08-22 15:42 Andre-John Mas
  2006-08-22 15:48 ` Gary Thomas
  0 siblings, 1 reply; 9+ messages in thread
From: Andre-John Mas @ 2006-08-22 15:42 UTC (permalink / raw)
  To: Andre-John Mas, Andrew Lunn; +Cc: ecos-discuss

Just wanted to add a small correction, based on further tests:

If you set the 'Default console device' to be '/dev/termios0',
or any other termios compatible device, then your code can quite happily do tcgetattr() on 'STDIN_FILENO', since it is now mapped to the termios device. At least, this is how it is working for me :)

Andre

Andre-John Mas wrote:
> 
> I got it working finally :)
> 
> For the benefit of others, the following posting helped:
> 
> http://ecos.sourceware.org/ml/ecos-discuss/2002-07/msg00092.html
> 
> to quote the relavent instructions:
> 
> 1) In the "Serial device drivers" section, I enabled the "TTY-mode serial device drivers" subsection (CYGPKG_IO_SERIAL_TTY = 1).
> 2) In the "TTY-mode serial device drivers" subsection, I enabled the "TTY-mode channel #0" subsection (CYGPKG_IO_SERIAL_TTY_TTY0 = 1).
> 3) In the "TTY-mode channel #0" subsection, I specified "TTY-mode device channel #0 device" as "/dev/ser0" (CYGDAT_IO_SERIAL_TTY_TTY0_DEV = "/dev/ser0")
> 4) I also did 2 and 3 for "TTY-mode channel #1" subsection, but this may not be necessary
> 5) Check the "Hardware serial device drivers" sections thoroughly to make sure they are what you want for /dev/ser0 (and /dev/ser1 maybe)
> 6) In the "ISO C Library" section, "ISO C Library standard input/output functions" subsection, I specified "Default console device" to be "/dev/tty0" (CYGDAT_LIBC_STDIO_DEFAULT_CONSOLE = "/dev/tty0")
> 
> in addition to this I activated the value
> 
> CYGDAT_IO_SERIAL_POWERPC_QUICC_SMC_SMC1
> 
> and set the device name to
> 
> "/dev/ser0"
> 
> Step 6 above I used '/dev/termios0', instead of '/dev/tty0'. I then in my source code referred to '/dev/termios0' as suggested by Andrew.
> 
> Andre
> 


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 9+ messages in thread
* Re: Re: [ECOS] Problems with tcgetattr()
@ 2006-08-21 20:06 Andre-John Mas
  0 siblings, 0 replies; 9+ messages in thread
From: Andre-John Mas @ 2006-08-21 20:06 UTC (permalink / raw)
  To: Andre-John Mas, Andrew Lunn; +Cc: ecos-discuss

I got it working finally :)

For the benefit of others, the following posting helped:

http://ecos.sourceware.org/ml/ecos-discuss/2002-07/msg00092.html

to quote the relavent instructions:

1) In the "Serial device drivers" section, I enabled the "TTY-mode serial device drivers" subsection (CYGPKG_IO_SERIAL_TTY = 1).
2) In the "TTY-mode serial device drivers" subsection, I enabled the "TTY-mode channel #0" subsection (CYGPKG_IO_SERIAL_TTY_TTY0 = 1).
3) In the "TTY-mode channel #0" subsection, I specified "TTY-mode device channel #0 device" as "/dev/ser0" (CYGDAT_IO_SERIAL_TTY_TTY0_DEV = "/dev/ser0")
4) I also did 2 and 3 for "TTY-mode channel #1" subsection, but this may not be necessary
5) Check the "Hardware serial device drivers" sections thoroughly to make sure they are what you want for /dev/ser0 (and /dev/ser1 maybe)
6) In the "ISO C Library" section, "ISO C Library standard input/output functions" subsection, I specified "Default console device" to be "/dev/tty0" (CYGDAT_LIBC_STDIO_DEFAULT_CONSOLE = "/dev/tty0")

in addition to this I activated the value

CYGDAT_IO_SERIAL_POWERPC_QUICC_SMC_SMC1

and set the device name to

"/dev/ser0"

Step 6 above I used '/dev/termios0', instead of '/dev/tty0'. I then in my source code referred to '/dev/termios0' as suggested by Andrew.

Andre

 
> Andrew Lunn <andrew@lunn.ch> wrote:
> > 
> > On Thu, Aug 17, 2006 at 06:47:21PM -0400, Andre-John Mas wrote:
> > > Hi,
> > > 
> > 
> > > I am in the process of writing a simple authentication module for
> > >  the administration of our card. For this we need to be able to hide
> > >  the password when it is inputed. From what I can tell using
> > >  tcgetattr() and tcsetattr() are the calls that I need. The problem
> > >  is that when I try using tcgetattr() I get the error:
> > 
> > What device are you trying this on? I think it needs to be /dev/termiosX
> > 
> >      Andrew
> > 


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 9+ messages in thread
* Re: Re: [ECOS] Problems with tcgetattr()
@ 2006-08-21 16:19 Andre-John Mas
  0 siblings, 0 replies; 9+ messages in thread
From: Andre-John Mas @ 2006-08-21 16:19 UTC (permalink / raw)
  To: Andrew Lunn; +Cc: ecos-discuss

The header for the serial device drivers, as generated by ecos config looks as follows:

#define CYGINT_IO_SERIAL_BLOCK_TRANSFER 0
#define CYGINT_IO_SERIAL_BLOCK_TRANSFER_0
#define CYGINT_IO_SERIAL_LINE_STATUS_HW 0
#define CYGINT_IO_SERIAL_LINE_STATUS_HW_0
#define CYGPKG_IO_SERIAL_TTY 1
#define CYGPKG_IO_SERIAL_HALDIAG 1
#define CYGDAT_IO_SERIAL_TTY_CONSOLE "/dev/ttydiag"
#define CYGPKG_IO_SERIAL_TTY_TTYDIAG 1
#define CYGPKG_IO_SERIAL_TERMIOS 1
#define CYGINT_IO_SERIAL_TERMIOS_TERMIOS_TTY 0
#define CYGINT_IO_SERIAL_TERMIOS_TERMIOS_TTY_0
#define CYGPKG_IO_SERIAL_DEVICES 1
#define CYGPKG_IO_SERIAL_OPTIONS 1
#define CYGPKG_IO_SERIAL_SELECT_SUPPORT 1
#define CYGINT_IO_SERIAL_TEST_SKIP_9600 0
#define CYGINT_IO_SERIAL_TEST_SKIP_9600_0
#define CYGINT_IO_SERIAL_TEST_SKIP_14400 0
#define CYGINT_IO_SERIAL_TEST_SKIP_14400_0
#define CYGINT_IO_SERIAL_TEST_SKIP_19200 0
#define CYGINT_IO_SERIAL_TEST_SKIP_19200_0
#define CYGINT_IO_SERIAL_TEST_SKIP_38400 0
#define CYGINT_IO_SERIAL_TEST_SKIP_38400_0
#define CYGINT_IO_SERIAL_TEST_SKIP_57600 0
#define CYGINT_IO_SERIAL_TEST_SKIP_57600_0
#define CYGINT_IO_SERIAL_TEST_SKIP_115200 0
#define CYGINT_IO_SERIAL_TEST_SKIP_115200_0
#define CYGINT_IO_SERIAL_TEST_SKIP_PARITY_EVEN 0
#define CYGINT_IO_SERIAL_TEST_SKIP_PARITY_EVEN_0
#define CYGINT_IO_SERIAL_TEST_SKIP_PARITY_ODD 0
#define CYGINT_IO_SERIAL_TEST_SKIP_PARITY_ODD_0
#define CYGINT_IO_SERIAL_TEST_SKIP_STOP_2 0
#define CYGINT_IO_SERIAL_TEST_SKIP_STOP_2_0

Anything I should be changing for getting a termios compatiablle tty
for my serial port?

Andre

Andrew Lunn <andrew@lunn.ch> wrote:
> 
> On Thu, Aug 17, 2006 at 06:47:21PM -0400, Andre-John Mas wrote:
> > Hi,
> > 
> 
> > I am in the process of writing a simple authentication module for
> >  the administration of our card. For this we need to be able to hide
> >  the password when it is inputed. From what I can tell using
> >  tcgetattr() and tcsetattr() are the calls that I need. The problem
> >  is that when I try using tcgetattr() I get the error:
> 
> What device are you trying this on? I think it needs to be /dev/termiosX
> 
>      Andrew
> 
> -- 
> Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
> and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
> 


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 9+ messages in thread
* Re: Re: [ECOS] Problems with tcgetattr()
@ 2006-08-18 18:17 Andre-John Mas
  0 siblings, 0 replies; 9+ messages in thread
From: Andre-John Mas @ 2006-08-18 18:17 UTC (permalink / raw)
  To: Andre-John Mas, Andrew Lunn; +Cc: ecos-discuss

I updated the variable to match the values in CVS and everything now
compiles. Though I am still stuck as what I need to do to get
tcgetattr() with our Adder II based board.

Andre

Andre-John Mas <ajmas@sympatico.ca> wrote:
> 
> Trying to see if I can get things working myself, I have activated
> the option in the ECC file for "Termios TTY channel #0", but when
> I compile I get the error:
> 
> packages/io/serial/v2_0_51/src/common/termiostty.c:189: error: `B5000000' undeclared here (not in a function)
> 
> Searching the packages I have I find no defintion for 'B5000000' or
> any of the values defined in the variable defined at that line:
> 
>   static speed_t ecosbaud2posixbaud[]
> 
> Any ideas?
> 
> Andre
> 
> 
> Andre-John Mas <ajmas@sympatico.ca> wrote:
> > 
> > Fair enough. I have added the following code:
> > 
> >    char*  deviceName =  "/dev/termiosX";
> >       
> >    fd =  open(deviceName, O_RDWR | O_NOCTTY); 
> > 
> > but this fails at the 'isatty(fd)' test. Changing the device name
> > to to the value specified by 'console device name',in the ECC file:
> > 
> >   "/dev/ttydiag"
> > 
> > gives me the same error as when I used STDIN_FILENO:
> > 
> >  tcgetattr: Invalid argument
> > 
> > Any ideas?
> > 
> > Andre
> > 
> > Andrew Lunn <andrew@lunn.ch> wrote:
> > > 
> > > On Fri, Aug 18, 2006 at 10:20:30AM -0400, Andre-John Mas wrote:
> > > 
> > > > I am trying this on STDIN_FILENO, based on examples I have seen
> > > >  posted on the net. Currently I am connecting via the serial port,
> > > >  but later on it is likely to be via a telnet or ssh connection. I
> > > >  thought STDIN_FILENO was meant to be mapped to the current device?
> > > 
> > > You are thinking in Unix way, not the eCos way. termio controls only
> > > work on the termios devices and no other devices.
> > > 
> > > However, there is currently no ssh or telnet daemon for eCos, so when
> > > you implement these things, you can add support for this in however
> > > you implement telnet or ssh.
> > > 
> > > Also, not there is no concept of a per thread STDIN. It is one STDIN
> > > for the whole system.
> > > 
> > >     Andrew
> > >  
> > >  
> > >  
> > > 
> > 
> > 
> > -- 
> > Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
> > and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
> > 
> 
> 
> -- 
> Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
> and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
> 


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 9+ messages in thread
* Re: Re: [ECOS] Problems with tcgetattr()
@ 2006-08-18 15:57 Andre-John Mas
  0 siblings, 0 replies; 9+ messages in thread
From: Andre-John Mas @ 2006-08-18 15:57 UTC (permalink / raw)
  To: Andre-John Mas, Andrew Lunn; +Cc: ecos-discuss

Trying to see if I can get things working myself, I have activated
the option in the ECC file for "Termios TTY channel #0", but when
I compile I get the error:

packages/io/serial/v2_0_51/src/common/termiostty.c:189: error: `B5000000' undeclared here (not in a function)

Searching the packages I have I find no defintion for 'B5000000' or
any of the values defined in the variable defined at that line:

  static speed_t ecosbaud2posixbaud[]

Any ideas?

Andre


Andre-John Mas <ajmas@sympatico.ca> wrote:
> 
> Fair enough. I have added the following code:
> 
>    char*  deviceName =  "/dev/termiosX";
>       
>    fd =  open(deviceName, O_RDWR | O_NOCTTY); 
> 
> but this fails at the 'isatty(fd)' test. Changing the device name
> to to the value specified by 'console device name',in the ECC file:
> 
>   "/dev/ttydiag"
> 
> gives me the same error as when I used STDIN_FILENO:
> 
>  tcgetattr: Invalid argument
> 
> Any ideas?
> 
> Andre
> 
> Andrew Lunn <andrew@lunn.ch> wrote:
> > 
> > On Fri, Aug 18, 2006 at 10:20:30AM -0400, Andre-John Mas wrote:
> > 
> > > I am trying this on STDIN_FILENO, based on examples I have seen
> > >  posted on the net. Currently I am connecting via the serial port,
> > >  but later on it is likely to be via a telnet or ssh connection. I
> > >  thought STDIN_FILENO was meant to be mapped to the current device?
> > 
> > You are thinking in Unix way, not the eCos way. termio controls only
> > work on the termios devices and no other devices.
> > 
> > However, there is currently no ssh or telnet daemon for eCos, so when
> > you implement these things, you can add support for this in however
> > you implement telnet or ssh.
> > 
> > Also, not there is no concept of a per thread STDIN. It is one STDIN
> > for the whole system.
> > 
> >     Andrew
> >  
> >  
> >  
> > 
> 
> 
> -- 
> Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
> and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
> 


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 9+ messages in thread
* Re: Re: [ECOS] Problems with tcgetattr()
@ 2006-08-18 15:26 Andre-John Mas
  0 siblings, 0 replies; 9+ messages in thread
From: Andre-John Mas @ 2006-08-18 15:26 UTC (permalink / raw)
  To: Andrew Lunn; +Cc: ecos-discuss

Fair enough. I have added the following code:

   char*  deviceName =  "/dev/termiosX";
      
   fd =  open(deviceName, O_RDWR | O_NOCTTY); 

but this fails at the 'isatty(fd)' test. Changing the device name
to to the value specified by 'console device name',in the ECC file:

  "/dev/ttydiag"

gives me the same error as when I used STDIN_FILENO:

 tcgetattr: Invalid argument

Any ideas?

Andre

Andrew Lunn <andrew@lunn.ch> wrote:
> 
> On Fri, Aug 18, 2006 at 10:20:30AM -0400, Andre-John Mas wrote:
> 
> > I am trying this on STDIN_FILENO, based on examples I have seen
> >  posted on the net. Currently I am connecting via the serial port,
> >  but later on it is likely to be via a telnet or ssh connection. I
> >  thought STDIN_FILENO was meant to be mapped to the current device?
> 
> You are thinking in Unix way, not the eCos way. termio controls only
> work on the termios devices and no other devices.
> 
> However, there is currently no ssh or telnet daemon for eCos, so when
> you implement these things, you can add support for this in however
> you implement telnet or ssh.
> 
> Also, not there is no concept of a per thread STDIN. It is one STDIN
> for the whole system.
> 
>     Andrew
>  
>  
>  
> 


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 9+ messages in thread
* Re: Re: [ECOS] Problems with tcgetattr()
@ 2006-08-18 14:20 Andre-John Mas
  2006-08-18 14:40 ` Andrew Lunn
  0 siblings, 1 reply; 9+ messages in thread
From: Andre-John Mas @ 2006-08-18 14:20 UTC (permalink / raw)
  To: Andrew Lunn; +Cc: ecos-discuss

I am trying this on STDIN_FILENO, based on examples I have seen posted on the net. Currently I am connecting via the serial port, but later on it is likely to be via a telnet or ssh connection. I thought STDIN_FILENO was meant to be mapped to the current device?

Andre

Andrew Lunn <andrew@lunn.ch> wrote:
> 
> On Thu, Aug 17, 2006 at 06:47:21PM -0400, Andre-John Mas wrote:
> > Hi,
> > 
> 
> > I am in the process of writing a simple authentication module for
> >  the administration of our card. For this we need to be able to hide
> >  the password when it is inputed. From what I can tell using
> >  tcgetattr() and tcsetattr() are the calls that I need. The problem
> >  is that when I try using tcgetattr() I get the error:
> 
> What device are you trying this on? I think it needs to be /dev/termiosX
> 
>      Andrew
> 


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2006-08-22 15:48 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-08-22 15:42 Re: [ECOS] Problems with tcgetattr() Andre-John Mas
2006-08-22 15:48 ` Gary Thomas
  -- strict thread matches above, loose matches on Subject: below --
2006-08-21 20:06 Andre-John Mas
2006-08-21 16:19 Andre-John Mas
2006-08-18 18:17 Andre-John Mas
2006-08-18 15:57 Andre-John Mas
2006-08-18 15:26 Andre-John Mas
2006-08-18 14:20 Andre-John Mas
2006-08-18 14:40 ` Andrew Lunn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).