Re: Cannot set stty parameters and read from /dev/ttyU0

2014-01-11 Thread Jurjen Oskam
Stuart Henderson spacehopper.org> writes: > > On 2014-01-10, Jurjen Oskam osk.am> wrote: > > Philip Guenther gmail.com> writes: > > > >> Oh, you're running 5.4-stable? I thought you were running -current > >> and was worried there was another hang in there. I'm now 99% sure > >> you're hitti

Re: Cannot set stty parameters and read from /dev/ttyU0

2014-01-10 Thread Stuart Henderson
On 2014-01-10, Jurjen Oskam wrote: > Philip Guenther gmail.com> writes: > >> Oh, you're running 5.4-stable? I thought you were running -current >> and was worried there was another hang in there. I'm now 99% sure >> you're hitting the one I fixed back in October. > > > I'm sorry, but I don't kn

Re: Cannot set stty parameters and read from /dev/ttyU0

2014-01-10 Thread Jurjen Oskam
Philip Guenther gmail.com> writes: > Oh, you're running 5.4-stable? I thought you were running -current > and was worried there was another hang in there. I'm now 99% sure > you're hitting the one I fixed back in October. I did some more experimenting, and I found that the issue does not happ

Re: Cannot set stty parameters and read from /dev/ttyU0

2014-01-10 Thread Philip Guenther
On Fri, Jan 10, 2014 at 7:33 AM, Jurjen Oskam wrote: > (Running 5.4-stable, so that's why procflags isn't recognized. I'll try a > snapshot to see what happens.) Oh, you're running 5.4-stable? I thought you were running -current and was worried there was another hang in there. I'm now 99% sure

Re: Cannot set stty parameters and read from /dev/ttyU0

2014-01-10 Thread Jurjen Oskam
Philip Guenther gmail.com> writes: > > On Thu, Jan 9, 2014 at 8:20 AM, Jurjen Oskam osk.am> wrote: > > OK, I've got it to work using a /dev/cua* device. I still have problems > > with processes not exiting though. Since this machine has real com > > ports, I also made a cable that is attached

Re: Cannot set stty parameters and read from /dev/ttyU0

2014-01-09 Thread Philip Guenther
On Thu, Jan 9, 2014 at 8:20 AM, Jurjen Oskam wrote: > OK, I've got it to work using a /dev/cua* device. I still have problems with > processes not exiting though. Since this machine has real com ports, I also > made a cable that is attached to cua01 (no USB involved). ... > Then when I kill it, I

Re: Cannot set stty parameters and read from /dev/ttyU0

2014-01-09 Thread Jurjen Oskam
Philip Guenther gmail.com> writes: > This is where Remco's response comes into play. As described on the > tty(4)/cua(4) manpage, /dev/ttyU* blocks on open until the external > device signals that it's active via some hardware signal (DTR, iirc). > If you want to initiate an outgoing connection

Re: Cannot set stty parameters and read from /dev/ttyU0

2014-01-08 Thread Stuart Henderson
On 2014-01-07, Jurjen Oskam wrote: > open(METER,"/dev/ttyUSB0") or die; > while() { > # do stuff > done http://www.jibble.org/currentcost/ uses Device::SerialPort (p5-Device-SerialPort-1.04p0v0 in packages) to setup the serial port from perl. This might be easier than wrapping your perl script

Re: Cannot set stty parameters and read from /dev/ttyU0

2014-01-07 Thread Daniel Bolgheroni
On Tue, Jan 07, 2014 at 03:05:39PM +, Jurjen Oskam wrote: > Hi everybody, > > Earlier I had a Linux machine (well, a Raspberry Pi actually) which > I used to read out my energy meter. The energy meter was connected > to a USB port with a custom FTDI cable. The energy meter only > supports read

Re: Cannot set stty parameters and read from /dev/ttyU0

2014-01-07 Thread Alexander Hall
On 01/07/14 21:17, Jurjen Oskam wrote: Philip Guenther gmail.com> writes: On Tue, Jan 7, 2014 at 8:23 AM, Theo de Raadt cvs.openbsd.org> wrote: What you need to instead is wrap all this in a way which keeps the tty open ( stty 9600 sane parenb -parodd crtscts cs7 igncr

Re: Cannot set stty parameters and read from /dev/ttyU0

2014-01-07 Thread Philip Guenther
On Tue, Jan 7, 2014 at 12:17 PM, Jurjen Oskam wrote: > Thank you for the responses. I sort of figured out that the stty settings > are set to default each time the device is opened, but now that's confirmed > I ran into the problem that open() does not seem to be returning. > > I created the follo

Re: Cannot set stty parameters and read from /dev/ttyU0

2014-01-07 Thread Jurjen Oskam
Philip Guenther gmail.com> writes: > On Tue, Jan 7, 2014 at 8:23 AM, Theo de Raadt cvs.openbsd.org> wrote: > > What you need to instead is wrap all this in a way which keeps the > > tty open > > > > ( > > stty 9600 sane parenb -parodd crtscts cs7 igncr > > do your IO loop > >

Re: Cannot set stty parameters and read from /dev/ttyU0

2014-01-07 Thread Remco
Jurjen Oskam wrote: > uftdi0 at uhub3 port 6 "FTDI P1 Converter Cable" rev 2.00/6.00 addr 3 > ucom0 at uftdi0 portno 1 > > > But now I can't figure out how to read from /dev/ttyU0. > I usually use /dev/cuaU0 when reading from serial-to-USB converters. Unless your cable is different in some wa

Re: Cannot set stty parameters and read from /dev/ttyU0

2014-01-07 Thread Philip Guenther
On Tue, Jan 7, 2014 at 8:23 AM, Theo de Raadt wrote: > What you need to instead is wrap all this in a way which keeps the > tty open > > ( > stty 9600 sane parenb -parodd crtscts cs7 igncr > do your IO loop > ) &1 0>&2 > > Something like that. I think the desired redirecti

Re: Cannot set stty parameters and read from /dev/ttyU0

2014-01-07 Thread Theo de Raadt
> /bin/stty -F /dev/ttyUSB0 9600 sane evenp crtscts cs7 igncr ^^ --- no a standard stty option > The first problem I'm having is that the stty setting doesn't seem to > stick: > > $ stty -f /dev/ttyU0 > ispeed 0 baud; ospeed 9600 baud; > lflags: echoe echoke echoctl > cflags: cs8 -pare

Cannot set stty parameters and read from /dev/ttyU0

2014-01-07 Thread Jurjen Oskam
Hi everybody, Earlier I had a Linux machine (well, a Raspberry Pi actually) which I used to read out my energy meter. The energy meter was connected to a USB port with a custom FTDI cable. The energy meter only supports reading from it, writing to it is not possible. On Linux, I set the necessary