pseudoterminal port process

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

pseudoterminal port process

Daniel Goertzen-4
I have an application where I want to run an Erlang SSH server for some
highly customized authentication, and then just plumb the i/o to a C++
ncurses port program.  The problem I have is that the C++ program expects
to run under a terminal, and open_port/2 appears to have no pseudoterminal
support.  Before I run off and start writing a pseudoterminal wrapper port,
is anyone aware of an existing wrapper or some other solution for my
problem?

Thanks,
Dan.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20131011/f1697a40/attachment.html>

Reply | Threaded
Open this post in threaded view
|

pseudoterminal port process

Tony Rogvall-3
Not exactly sure what you want to do but ...
have a look at https://github.com/tonyrog/uart, it has got some support for pseduo terminals,
use "//pty" as the device name in uart:open, and then get the name of the selected slave
device by calling uart:getopts(Uart, [device])

There is an option {ptypkt, boolean()} that can be used to turn on pty packet mode (TIOCPKT)
this is handy for pseudo terminal flow control handling. Because of a little bug, this option
can not be given when opening the device but must be set with uart:setopts (there is a fix on its way)

/Tony


On 11 okt 2013, at 22:49, Daniel Goertzen <daniel.goertzen> wrote:

> I have an application where I want to run an Erlang SSH server for some highly customized authentication, and then just plumb the i/o to a C++ ncurses port program.  The problem I have is that the C++ program expects to run under a terminal, and open_port/2 appears to have no pseudoterminal support.  Before I run off and start writing a pseudoterminal wrapper port, is anyone aware of an existing wrapper or some other solution for my problem?
>
> Thanks,
> Dan.
> _______________________________________________
> erlang-questions mailing list
> erlang-questions
> http://erlang.org/mailman/listinfo/erlang-questions

"Installing applications can lead to corruption over time. Applications gradually write over each other's libraries, partial upgrades occur, user and system errors happen, and minute changes may be unnoticeable and difficult to fix"



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20131012/bcc30322/attachment.html>

Reply | Threaded
Open this post in threaded view
|

pseudoterminal port process

Anthony Ramine-2
Have you ever thought about making your uart:uart() type a #file_descriptor{} as defined in file.hrl? That would allow users to call file functions on a uart handle:

        https://github.com/erlang/otp/blob/maint/lib/kernel/src/file.erl#L492-493

Regards,

Le 12 oct. 2013 ? 02:23, Tony Rogvall <tony> a ?crit :

> Not exactly sure what you want to do but ...
> have a look at https://github.com/tonyrog/uart, it has got some support for pseduo terminals,
> use "//pty" as the device name in uart:open, and then get the name of the selected slave
> device by calling uart:getopts(Uart, [device])
>
> There is an option {ptypkt, boolean()} that can be used to turn on pty packet mode (TIOCPKT)
> this is handy for pseudo terminal flow control handling. Because of a little bug, this option
> can not be given when opening the device but must be set with uart:setopts (there is a fix on its way)
>
> /Tony


Reply | Threaded
Open this post in threaded view
|

pseudoterminal port process

Per Hedeland-4
In reply to this post by Daniel Goertzen-4
Daniel Goertzen <daniel.goertzen> wrote:
>
>  Before I run off and start writing a pseudoterminal wrapper port,
>is anyone aware of an existing wrapper or some other solution for my
>problem?

http://erlang.org/pipermail/erlang-questions/2013-January/072069.html

--Per Hedeland

Reply | Threaded
Open this post in threaded view
|

pseudoterminal port process

Daniel Goertzen-4
Thank you for all the responses.  runpty from lux is the direction that I
had in mind (https://github.com/hawk/lux/blob/master/c_src/runpty.c)

Tony seems curious as to what I'm trying to do, so here it is:

We have an embedded system that uses unix accounts, OpenSSH, and an C++
ncurses program for the user interface.  For a variety or reasons, we want
to get away from unix accounts and go with application-level accounts in
much the same way that a typical web app would do.  OpenSSH does not appear
to support that account model but Erlang SSH can, hence my need for full
pseudoterminal support.

Thanks again,
Dan.


On Sat, Oct 12, 2013 at 7:28 AM, Per Hedeland <per> wrote:

> Daniel Goertzen <daniel.goertzen> wrote:
> >
> >  Before I run off and start writing a pseudoterminal wrapper port,
> >is anyone aware of an existing wrapper or some other solution for my
> >problem?
>
> http://erlang.org/pipermail/erlang-questions/2013-January/072069.html
>
> --Per Hedeland
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20131015/3dabc909/attachment.html>