Re: Serial Port Configuration does not work

2011-09-12 Thread Ed Schouten
* Boris Samorodov b...@ipt.ru, 20110912 07:33:
 Thanks Jilles! That did it:

Thanks for reporting/testing. Fixed in r225506!

-- 
 Ed Schouten e...@80386.nl
 WWW: http://80386.nl/


pgp9eg7BIlocP.pgp
Description: PGP signature


Re: Serial Port Configuration does not work

2011-09-12 Thread Boris Samorodov
On Mon, 12 Sep 2011 12:07:56 +0200 Ed Schouten wrote:

 * Boris Samorodov b...@ipt.ru, 20110912 07:33:
  Thanks Jilles! That did it:

 Thanks for reporting/testing. Fixed in r225506!

Confirmed, r225506 works fine. Thanks!

-- 
WBR, Boris Samorodov (bsam)
Research Engineer, http://www.ipt.ru Telephone  Internet SP
FreeBSD Committer, http://www.FreeBSD.org The Power To Serve
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Re: Serial Port Configuration does not work

2011-09-11 Thread Gary Jennejohn
On Sat, 10 Sep 2011 21:10:44 +0400
Boris Samorodov b...@ipt.ru wrote:

 On Sat, 10 Sep 2011 16:08:21 +0200 Gary Jennejohn wrote:
   On Tue, 06 Sep 2011 16:29:51 +0400 Boris Samorodov wrote:
   
the port does not work as expected (at least as per The Handbook,
26.2.5 Serial Port Configuration). Nether init nor lock
devices can be used:
 
  Seems that the handbook is out of date.
 
 OK, how can I configure a serial port then?
 

Just don't use the init and lock devices.

-- 
Gary Jennejohn
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Re: Serial Port Configuration does not work

2011-09-11 Thread Jilles Tjoelker
On Tue, Sep 06, 2011 at 04:29:51PM +0400, Boris Samorodov wrote:
 the port does not work as expected (at least as per The Handbook,
 26.2.5 Serial Port Configuration). Nether init nor lock
 devices can be used:
 -
 # uname -a
 FreeBSD host1.ipt.ru 9.0-BETA2 FreeBSD 9.0-BETA2 #14 r225395: Mon Sep  5 
 18:10:43 MSK 2011 b...@bb.ipt.ru:/usr/obj/usr/src/sys/HOSTS  i386
 # ls -l /dev/ttyu5*
 crw---  1 root  wheel0,  56 Sep  5 18:50 /dev/ttyu5
 crw---  1 root  wheel0,  57 Sep  5 18:50 /dev/ttyu5.init
 crw---  1 root  wheel0,  58 Sep  5 18:50 /dev/ttyu5.lock
 # stty -f /dev/ttyu5.init 57600
 stty: /dev/ttyu5.lock isn't a terminal
 # stty -f /dev/ttyu5.lock cs7
 stty: /dev/ttyu5.lock isn't a terminal
 -

It looks like r223722, while introducing the ability to issue
device-specific ioctls on init and lock devices, broke the ability to
issue generic ioctls, with the exception of TIOCSETA. (However, stty
will not do much if it cannot do TIOCGETA.)

Try this patch and report if it works:

diff --git a/sys/kern/tty.c b/sys/kern/tty.c
index ce49f97..3721888 100644
--- a/sys/kern/tty.c
+++ b/sys/kern/tty.c
@@ -777,6 +777,7 @@ ttyil_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int 
fflag,
error = ttydevsw_cioctl(tp, dev2unit(dev), cmd, data, td);
if (error != ENOIOCTL)
goto done;
+   error = 0;
 
switch (cmd) {
case TIOCGETA:

-- 
Jilles Tjoelker
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Re: Serial Port Configuration does not work

2011-09-11 Thread Boris Samorodov
On Sun, 11 Sep 2011 10:33:18 +0200 Gary Jennejohn wrote:
 On Sat, 10 Sep 2011 21:10:44 +0400
 Boris Samorodov b...@ipt.ru wrote:
  On Sat, 10 Sep 2011 16:08:21 +0200 Gary Jennejohn wrote:
On Tue, 06 Sep 2011 16:29:51 +0400 Boris Samorodov wrote:

 the port does not work as expected (at least as per The Handbook,
 26.2.5 Serial Port Configuration). Nether init nor lock
 devices can be used:
  
   Seems that the handbook is out of date.
  
  OK, how can I configure a serial port then?
  

 Just don't use the init and lock devices.

Well, I've read the Handbook because I can't do it with
a serial port:
-
% uname -a
FreeBSD host.ipt.ru 9.0-BETA2 FreeBSD 9.0-BETA2 #14 r225395: Mon Sep  5 
18:10:43 MSK 2011 b...@host.ipt.ru:/usr/obj/usr/src/sys/HOST  i386

% sudo stty -f /dev/ttyu4 56400

% echo $?
0

% sudo stty -f /dev/ttyu4
speed 9600 baud;
lflags: echoe echoke echoctl
oflags: tab0
cflags: cs8 -parenb
-

-- 
WBR, Boris Samorodov (bsam)
Research Engineer, http://www.ipt.ru Telephone  Internet SP
FreeBSD Committer, http://www.FreeBSD.org The Power To Serve
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Re: Serial Port Configuration does not work

2011-09-11 Thread David Cornejo
On Sep 11, 2011 6:54 PM, Boris Samorodov b...@ipt.ru wrote:

 On Sun, 11 Sep 2011 10:33:18 +0200 Gary Jennejohn wrote:
  On Sat, 10 Sep 2011 21:10:44 +0400
  Boris Samorodov b...@ipt.ru wrote:
   On Sat, 10 Sep 2011 16:08:21 +0200 Gary Jennejohn wrote:
 On Tue, 06 Sep 2011 16:29:51 +0400 Boris Samorodov wrote:

  the port does not work as expected (at least as per The
Handbook,
  26.2.5 Serial Port Configuration). Nether init nor lock
  devices can be used:
  
Seems that the handbook is out of date.
  
   OK, how can I configure a serial port then?
  

  Just don't use the init and lock devices.

 Well, I've read the Handbook because I can't do it with
 a serial port:
 -
 % uname -a
 FreeBSD host.ipt.ru 9.0-BETA2 FreeBSD 9.0-BETA2 #14 r225395: Mon Sep  5
18:10:43 MSK 2011 b...@host.ipt.ru:/usr/obj/usr/src/sys/HOST  i386

 % sudo stty -f /dev/ttyu4 56400

 % echo $?
 0

 % sudo stty -f /dev/ttyu4
 speed 9600 baud;
 lflags: echoe echoke echoctl
 oflags: tab0
 cflags: cs8 -parenb
 -

 --
 WBR, Boris Samorodov (bsam)
 Research Engineer, http://www.ipt.ru Telephone  Internet SP
 FreeBSD Committer, http://www.FreeBSD.org The Power To Serve
 ___
 freebsd-current@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-current
 To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org

It's been a long time, but I seem to recall that you need to have the device
open before you can configure it and that when the device closes it gets
reset to defaults. (or maybe the open resets it).  The way I remember
configuring it from the command line was to tip or cu to port, suspend tip,
reconfigure, and foreground tip.
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Re: Serial Port Configuration does not work

2011-09-11 Thread Boris Samorodov
On Sun, 11 Sep 2011 13:02:58 +0200 Jilles Tjoelker wrote:
 On Tue, Sep 06, 2011 at 04:29:51PM +0400, Boris Samorodov wrote:

  the port does not work as expected (at least as per The Handbook,
  26.2.5 Serial Port Configuration). Nether init nor lock
  devices can be used:
  -
  # uname -a
  FreeBSD host1.ipt.ru 9.0-BETA2 FreeBSD 9.0-BETA2 #14 r225395: Mon
  Sep 5 18:10:43 MSK 2011 b...@bb.ipt.ru:/usr/obj/usr/src/sys/HOSTS
  i386
  # ls -l /dev/ttyu5*
  crw---  1 root  wheel0,  56 Sep  5 18:50 /dev/ttyu5
  crw---  1 root  wheel0,  57 Sep  5 18:50 /dev/ttyu5.init
  crw---  1 root  wheel0,  58 Sep  5 18:50 /dev/ttyu5.lock
  # stty -f /dev/ttyu5.init 57600
  stty: /dev/ttyu5.lock isn't a terminal
  # stty -f /dev/ttyu5.lock cs7
  stty: /dev/ttyu5.lock isn't a terminal
  -

 It looks like r223722, while introducing the ability to issue
 device-specific ioctls on init and lock devices, broke the ability to
 issue generic ioctls, with the exception of TIOCSETA. (However, stty
 will not do much if it cannot do TIOCGETA.)

 Try this patch and report if it works:

 diff --git a/sys/kern/tty.c b/sys/kern/tty.c
 index ce49f97..3721888 100644
 --- a/sys/kern/tty.c
 +++ b/sys/kern/tty.c
 @@ -777,6 +777,7 @@ ttyil_ioctl(struct cdev *dev, u_long cmd, caddr_t data, 
 int fflag,
   error = ttydevsw_cioctl(tp, dev2unit(dev), cmd, data, td);
   if (error != ENOIOCTL)
   goto done;
 + error = 0;
  
   switch (cmd) {
   case TIOCGETA:

Thanks Jilles! That did it:
-
% sudo stty -f /dev/ttyu4
speed 9600 baud;
lflags: echoe echoke echoctl
oflags: tab0
cflags: cs8 -parenb

% sudo stty -f /dev/ttyu4.init 1200 cs7

% sudo stty -f /dev/ttyu4
speed 1200 baud;
lflags: echoe echoke echoctl
oflags: tab0
cflags: cs7 -parenb
-

-- 
WBR, Boris Samorodov (bsam)
Research Engineer, http://www.ipt.ru Telephone  Internet SP
FreeBSD Committer, http://www.FreeBSD.org The Power To Serve
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Re: Serial Port Configuration does not work

2011-09-11 Thread Boris Samorodov
On Sun, 11 Sep 2011 19:31:33 -1000 David Cornejo wrote:

 It's been a long time, 

It worked at 8.2-PRERELEASE for me (and seemed to be a bug
at 9.0-BETA2):
-
% uname -a
FreeBSD hht.ipt.ru 8.2-PRERELEASE FreeBSD 8.2-PRERELEASE #0 r216685: Fri Dec 24 
10:16:47 MSK 2010 b...@hht.ipt.ru:/z/obj/z/src/sys/HHT  amd64

% sudo stty -f /dev/cuau1
speed 57600 baud;
lflags: echoe echoke echoctl
oflags: tab0
cflags: cs8 -parenb

% sudo stty -f /dev/cuau1.init 1200 cs7

% sudo stty -f /dev/cuau1
speed 1200 baud;
lflags: echoe echoke echoctl
oflags: tab0
cflags: cs7 -parenb
-

 but I seem to recall that you need to have the device
 open before you can configure it and that when the device closes it gets
 reset to defaults. (or maybe the open resets it).  The way I remember
 configuring it from the command line was to tip or cu to port, suspend tip,
 reconfigure, and foreground tip.

Yea, I recall doing something like this until I discovered *.init
and *.lock devices. And they proved to be very useful.

Anyway Jilles Tjoelker offered a patch that fixed the case.

-- 
WBR, Boris Samorodov (bsam)
Research Engineer, http://www.ipt.ru Telephone  Internet SP
FreeBSD Committer, http://www.FreeBSD.org The Power To Serve
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Re: Serial Port Configuration does not work

2011-09-10 Thread Boris Samorodov
On Tue, 06 Sep 2011 16:29:51 +0400 Boris Samorodov wrote:

 the port does not work as expected (at least as per The Handbook,
 26.2.5 Serial Port Configuration). Nether init nor lock
 devices can be used:
 -
 # uname -a
 FreeBSD host1.ipt.ru 9.0-BETA2 FreeBSD 9.0-BETA2 #14 r225395: Mon Sep
 5 18:10:43 MSK 2011 b...@bb.ipt.ru:/usr/obj/usr/src/sys/HOSTS i386
 # ls -l /dev/ttyu5*
 crw---  1 root  wheel0,  56 Sep  5 18:50 /dev/ttyu5
 crw---  1 root  wheel0,  57 Sep  5 18:50 /dev/ttyu5.init
 crw---  1 root  wheel0,  58 Sep  5 18:50 /dev/ttyu5.lock
 # stty -f /dev/ttyu5.init 57600
 stty: /dev/ttyu5.lock isn't a terminal
 # stty -f /dev/ttyu5.lock cs7
 stty: /dev/ttyu5.lock isn't a terminal
 -

Ping!

-- 
WBR, Boris Samorodov (bsam)
Research Engineer, http://www.ipt.ru Telephone  Internet SP
FreeBSD Committer, http://www.FreeBSD.org The Power To Serve
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Re: Serial Port Configuration does not work

2011-09-10 Thread Gary Jennejohn
On Sat, 10 Sep 2011 15:57:25 +0400
Boris Samorodov b...@ipt.ru wrote:

 On Tue, 06 Sep 2011 16:29:51 +0400 Boris Samorodov wrote:
 
  the port does not work as expected (at least as per The Handbook,
  26.2.5 Serial Port Configuration). Nether init nor lock
  devices can be used:
  -
  # uname -a
  FreeBSD host1.ipt.ru 9.0-BETA2 FreeBSD 9.0-BETA2 #14 r225395: Mon Sep
  5 18:10:43 MSK 2011 b...@bb.ipt.ru:/usr/obj/usr/src/sys/HOSTS i386
  # ls -l /dev/ttyu5*
  crw---  1 root  wheel0,  56 Sep  5 18:50 /dev/ttyu5
  crw---  1 root  wheel0,  57 Sep  5 18:50 /dev/ttyu5.init
  crw---  1 root  wheel0,  58 Sep  5 18:50 /dev/ttyu5.lock
  # stty -f /dev/ttyu5.init 57600
  stty: /dev/ttyu5.lock isn't a terminal
  # stty -f /dev/ttyu5.lock cs7
  stty: /dev/ttyu5.lock isn't a terminal
  -
 
 Ping!
 

Seems that the handbook is out of date.

Looking at /sys/kern/tty.c the init and lock devices are only used
internally and are not real open-able/close-able devices.

Thye're created in tty_makedev() as required using make_dev_cred(),
which is probably why they appear under /dev.

The init device is initialized in tty_init_termios() and _never_
changed after that. It's only used to initialize real ttys.

The lock device seems to only be used in tty_ioctl().  I wasn't
able to figure out where it gets initialized.

-- 
Gary Jennejohn
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Re: Serial Port Configuration does not work

2011-09-10 Thread Boris Samorodov
On Sat, 10 Sep 2011 16:08:21 +0200 Gary Jennejohn wrote:
  On Tue, 06 Sep 2011 16:29:51 +0400 Boris Samorodov wrote:
  
   the port does not work as expected (at least as per The Handbook,
   26.2.5 Serial Port Configuration). Nether init nor lock
   devices can be used:

 Seems that the handbook is out of date.

OK, how can I configure a serial port then?

-- 
WBR, bsam
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Serial Port Configuration does not work

2011-09-06 Thread Boris Samorodov
Hi List,

the port does not work as expected (at least as per The Handbook,
26.2.5 Serial Port Configuration). Nether init nor lock
devices can be used:
-
# uname -a
FreeBSD host1.ipt.ru 9.0-BETA2 FreeBSD 9.0-BETA2 #14 r225395: Mon Sep  5 
18:10:43 MSK 2011 b...@bb.ipt.ru:/usr/obj/usr/src/sys/HOSTS  i386
# ls -l /dev/ttyu5*
crw---  1 root  wheel0,  56 Sep  5 18:50 /dev/ttyu5
crw---  1 root  wheel0,  57 Sep  5 18:50 /dev/ttyu5.init
crw---  1 root  wheel0,  58 Sep  5 18:50 /dev/ttyu5.lock
# stty -f /dev/ttyu5.init 57600
stty: /dev/ttyu5.lock isn't a terminal
# stty -f /dev/ttyu5.lock cs7
stty: /dev/ttyu5.lock isn't a terminal
-

-- 
WBR, Boris Samorodov (bsam)
Research Engineer, http://www.ipt.ru Telephone  Internet SP
FreeBSD Committer, http://www.FreeBSD.org The Power To Serve
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org