Re: Sparc classic serial ports ttya vs cuaa

2010-03-22 Thread Alex Carver

Alexander Carver wrote:

Miod Vallat wrote:

Hi all,

I've been working on getting gpsd working on one of my old Sun IPXes 
but I've run into a problem with ldattach needing the /dev/cuaa 
device.  The serial port /dev/ttya is working with gpsd directly but 
ldattach requires /dev/cuaa.  However, according to the system logs, 
ldattach issues the error (ldattach is run as root):


ldattach: can't open /dev/cuaa: Device not configured


Oops. Big oops. cua support for zstty was removed about 7.5 years ago,
it was intended to be brought back, but I had completely forgotten about
this.

Does the following diff help? It should apply cleanly to 4.6 too (apply
in sys/arch/sparc/dev).

Miod


I just patched the sources and am now compiling (but slowly since it's 
an IPX).  I'll let you know as soon as the compile finishes and I reboot 
the new kernel.


Compile is complete (finally) and the patch seemed to work for partially 
enabling the /dev/cua* devices.  I was able to open one with minicom and 
read data from the port.


However, when I'm using ldattach it just sits there.  Running the following:

ldattach -d -p -s 19200 nmea /dev/cuaa

just sits, it never returns a PTY but it never errors out, either.  It 
just sits and sits until I terminate it.


If I change the device to ttya:

ldattach -d -p -s 19200 nmea /dev/ttya

then ldattach returns the PTY and opens the port at the proper speed and 
data does pass through from the port to the PTY.


So I don't understand why ldattach is having an issue with /dev/cua* but 
appears to work wtih /dev/tty*.


I say appears to work because the handshake lines aren't being reported 
by ldattach either.  I want to use the DCD line for sending PPS data 
from the gps on that port but those transitions aren't being conveyed by 
ldattach at all.  I am suspecting it has to do with having opened 
/dev/ttya instead of /dev/cuaa which means I need to still resolve the 
ttya/cuaa issue.


Any suggestions would be greatly appreciated.



Re: Sparc classic serial ports ttya vs cuaa

2010-03-21 Thread Alexander Carver

Miod Vallat wrote:

Hi all,

I've been working on getting gpsd working on one of my old Sun IPXes but 
I've run into a problem with ldattach needing the /dev/cuaa device.  The 
serial port /dev/ttya is working with gpsd directly but ldattach requires 
/dev/cuaa.  However, according to the system logs, ldattach issues the 
error (ldattach is run as root):


ldattach: can't open /dev/cuaa: Device not configured


Oops. Big oops. cua support for zstty was removed about 7.5 years ago,
it was intended to be brought back, but I had completely forgotten about
this.

Does the following diff help? It should apply cleanly to 4.6 too (apply
in sys/arch/sparc/dev).


The patch did enable the /dev/cua* devices.  I was able to use minicom 
to connect to /dev/cuaa and see the data streaming back from my GPS 
receiver.


However, ldattach still doesn't seem to know what to do with the device. 
 I started up ldattach as:


ldattach -d -p -t dcd nmea /dev/cuaa

But it just sits there and does nothing.



Re: Sparc classic serial ports ttya vs cuaa

2010-03-21 Thread Alex Carver

Miod Vallat wrote:

Hi all,

I've been working on getting gpsd working on one of my old Sun IPXes but 
I've run into a problem with ldattach needing the /dev/cuaa device.  The 
serial port /dev/ttya is working with gpsd directly but ldattach requires 
/dev/cuaa.  However, according to the system logs, ldattach issues the 
error (ldattach is run as root):


ldattach: can't open /dev/cuaa: Device not configured


Oops. Big oops. cua support for zstty was removed about 7.5 years ago,
it was intended to be brought back, but I had completely forgotten about
this.

Does the following diff help? It should apply cleanly to 4.6 too (apply
in sys/arch/sparc/dev).

Miod



The patch did enable the /dev/cua* devices.  I was able to use minicom 
to connect to /dev/cuaa and see the data streaming back from my GPS 
receiver.


However, ldattach still doesn't seem to know what to do with the device. 
 I started up ldattach as:


ldattach -d -p -t dcd nmea /dev/cuaa

But it just sits there and does nothing.



Re: Sparc classic serial ports ttya vs cuaa

2010-02-26 Thread Miod Vallat
 Hi all,

 I've been working on getting gpsd working on one of my old Sun IPXes but 
 I've run into a problem with ldattach needing the /dev/cuaa device.  The 
 serial port /dev/ttya is working with gpsd directly but ldattach requires 
 /dev/cuaa.  However, according to the system logs, ldattach issues the 
 error (ldattach is run as root):

 ldattach: can't open /dev/cuaa: Device not configured

Oops. Big oops. cua support for zstty was removed about 7.5 years ago,
it was intended to be brought back, but I had completely forgotten about
this.

Does the following diff help? It should apply cleanly to 4.6 too (apply
in sys/arch/sparc/dev).

Miod

Index: z8530sc.h
===
RCS file: /cvs/src/sys/arch/sparc/dev/z8530sc.h,v
retrieving revision 1.2
diff -u -p -r1.2 z8530sc.h
--- z8530sc.h   2 Jun 2003 23:27:54 -   1.2
+++ z8530sc.h   26 Feb 2010 11:33:33 -
@@ -109,7 +109,7 @@ struct zs_chanstate {
/* the above is set only while CRTSCTS is enabled. */
 
charcs_softreq; /* need soft interrupt call */
-   charcs_spare1;  /* (for skippy :) */
+   charcs_cua; /* CUA mode flag */
 
/* power management hooks */
int (*enable)(struct zs_chanstate *);
Index: z8530tty.c
===
RCS file: /cvs/src/sys/arch/sparc/dev/z8530tty.c,v
retrieving revision 1.13
diff -u -p -r1.13 z8530tty.c
--- z8530tty.c  9 Nov 2009 17:53:39 -   1.13
+++ z8530tty.c  26 Feb 2010 11:33:33 -
@@ -230,8 +230,8 @@ void zstty_txint(struct zs_chanstate *);
 void zstty_softint(struct zs_chanstate *);
 void zstty_diag(void *);
 
-#define ZSUNIT(x)   (minor(x)  0x7)
-#define ZSDIALOUT(x)(minor(x)  0x8)
+#define ZSUNIT(x)   (minor(x)  0x7f)
+#define ZSDIALOUT(x)(minor(x)  0x80)
 
 /*
  * zstty_match: how is this zs channel configured?
@@ -421,7 +421,7 @@ zstty(dev)
dev_t dev;
 {
struct zstty_softc *zst;
-   int unit = minor(dev);
+   int unit = ZSUNIT(dev);
 
 #ifdef DIAGNOSTIC
if (unit = zstty_cd.cd_ndevs)
@@ -456,8 +456,9 @@ zs_shutdown(zst)
 * Hang up if necessary.  Wait a bit, so the other side has time to
 * notice even if we immediately open the port again.
 */
-   if (ISSET(tp-t_cflag, HUPCL)) {
+   if (ISSET(tp-t_cflag, HUPCL) || ISSET(tp-t_state, TS_WOPEN)) {
zs_modem(zst, 0);
+   /* hold low for 1 second */
(void) tsleep(cs, TTIPRI, ttclos, hz);
}
 
@@ -496,7 +497,7 @@ zsopen(dev, flags, mode, p)
int s, s2;
int error, unit;
 
-   unit = minor(dev);
+   unit = ZSUNIT(dev);
if (unit = zstty_cd.cd_ndevs)
return (ENXIO);
zst = zstty_cd.cd_devs[unit];
@@ -584,16 +585,12 @@ zsopen(dev, flags, mode, p)
ttychars(tp);
ttsetwater(tp);
 
-   s2 = splzs();
+   if (ZSDIALOUT(dev))
+   SET(tp-t_state, TS_CARR_ON);
+   else
+   CLR(tp-t_state, TS_CARR_ON);
 
-   /*
-* Turn on DTR.  We must always do this, even if carrier is not
-* present, because otherwise we'd have to use TIOCSDTR
-* immediately after setting CLOCAL, which applications do not
-* expect.  We always assert DTR while the device is open
-* unless explicitly requested to deassert it.
-*/
-   zs_modem(zst, 1);
+   s2 = splzs();
 
/* Clear the input ring, and unblock. */
zst-zst_rbget = zst-zst_rbput = zst-zst_rbuf;
@@ -605,9 +602,83 @@ zsopen(dev, flags, mode, p)
splx(s2);
}
 
+   if (ZSDIALOUT(dev)) {
+   if (ISSET(tp-t_state, TS_ISOPEN)) {
+   /* someone already is dialed in... */
+   splx(s);
+   return EBUSY;
+   }
+   cs-cs_cua = 1;
+   }
+
+   error = 0;
+   /* wait for carrier if necessary */
+   if (ISSET(flags, O_NONBLOCK)) {
+   if (!ZSDIALOUT(dev)  cs-cs_cua) {
+   /* Opening TTY non-blocking... but the CUA is busy */
+   error = EBUSY;
+   }
+   } else
+ while (cs-cs_cua ||
+   (!ISSET(tp-t_cflag, CLOCAL)  !ISSET(tp-t_state, TS_CARR_ON))) {
+   int rr0;
+
+   error = 0;
+   SET(tp-t_state, TS_WOPEN);
+
+   if (!ZSDIALOUT(dev)  !cs-cs_cua) {
+   /*
+* Turn on DTR.  We must always do this on non-CUA
+* devices, even if carrier is not present, because
+* otherwise we'd have to use TIOCSDTR immediately
+* after setting CLOCAL, 

Re: Sparc classic serial ports ttya vs cuaa

2010-02-23 Thread Henning Brauer
* Alex Carver agcarver+open...@acarver.net [2010-02-23 05:53]:
 I've been working on getting gpsd working on one of my old Sun IPXes
 but I've run into a problem with ldattach needing the /dev/cuaa
 device.  The serial port /dev/ttya is working with gpsd directly but
 ldattach requires /dev/cuaa.  However, according to the system logs,
 ldattach issues the error (ldattach is run as root):
 
 ldattach: can't open /dev/cuaa: Device not configured

if memory serves the serial driver for the sparcs doesn't implement
the cua devices. you omitted a dmesg and i don't remember which serial
driver the onboard cereals use tho. the manpage would have a note.

 However, the device does exist in the /dev tree:

of course. that doesn't mean anything.

-- 
Henning Brauer, h...@bsws.de, henn...@openbsd.org
BS Web Services, http://bsws.de
Full-Service ISP - Secure Hosting, Mail and DNS Services
Dedicated Servers, Rootservers, Application Hosting



Re: Sparc classic serial ports ttya vs cuaa

2010-02-23 Thread Mattieu Baptiste
On Tue, Feb 23, 2010 at 5:20 PM, Henning Brauer lists-open...@bsws.de
wrote:
 * Alex Carver agcarver+open...@acarver.net [2010-02-23 05:53]:
 I've been working on getting gpsd working on one of my old Sun IPXes
 but I've run into a problem with ldattach needing the /dev/cuaa
 device.  The serial port /dev/ttya is working with gpsd directly but
 ldattach requires /dev/cuaa.  However, according to the system logs,
 ldattach issues the error (ldattach is run as root):

 ldattach: can't open /dev/cuaa: Device not configured

 if memory serves the serial driver for the sparcs doesn't implement
 the cua devices. you omitted a dmesg and i don't remember which serial
 driver the onboard cereals use tho. the manpage would have a note.


On my SPARCclassic, this is /dev/zstty0 and /dev/zstty1.


--
Mattieu Baptiste
/earth is 102% full ... please delete anyone you can.



Re: Sparc classic serial ports ttya vs cuaa

2010-02-23 Thread Alexander Carver

Henning Brauer wrote:

* Alex Carver agcarver+open...@acarver.net [2010-02-23 05:53]:

I've been working on getting gpsd working on one of my old Sun IPXes
but I've run into a problem with ldattach needing the /dev/cuaa
device.  The serial port /dev/ttya is working with gpsd directly but
ldattach requires /dev/cuaa.  However, according to the system logs,
ldattach issues the error (ldattach is run as root):

ldattach: can't open /dev/cuaa: Device not configured


if memory serves the serial driver for the sparcs doesn't implement
the cua devices. you omitted a dmesg and i don't remember which serial
driver the onboard cereals use tho. the manpage would have a note.


However, the device does exist in the /dev tree:


of course. that doesn't mean anything.



I'll get a dmesg posted when I can return to the machine but the ports 
are using the zs drivers.




Re: Sparc classic serial ports ttya vs cuaa

2010-02-23 Thread Alexander Carver

Mattieu Baptiste wrote:

On Tue, Feb 23, 2010 at 5:20 PM, Henning Brauer lists-open...@bsws.de
wrote:

* Alex Carver agcarver+open...@acarver.net [2010-02-23 05:53]:

I've been working on getting gpsd working on one of my old Sun IPXes
but I've run into a problem with ldattach needing the /dev/cuaa
device.  The serial port /dev/ttya is working with gpsd directly but
ldattach requires /dev/cuaa.  However, according to the system logs,
ldattach issues the error (ldattach is run as root):

ldattach: can't open /dev/cuaa: Device not configured

if memory serves the serial driver for the sparcs doesn't implement
the cua devices. you omitted a dmesg and i don't remember which serial
driver the onboard cereals use tho. the manpage would have a note.



On my SPARCclassic, this is /dev/zstty0 and /dev/zstty1.


I don't have any /dev/zstty* devices at all on the system.  MAKEDEV 
created /dev/tty[a-d], /dev/cua0[0-3], and /dev/cua[a-d] but no zstty.




Re: Sparc classic serial ports ttya vs cuaa

2010-02-23 Thread Alexander Carver

Mattieu Baptiste wrote:

On Tue, Feb 23, 2010 at 5:20 PM, Henning Brauer lists-open...@bsws.de
wrote:

* Alex Carver agcarver+open...@acarver.net [2010-02-23 05:53]:

I've been working on getting gpsd working on one of my old Sun IPXes
but I've run into a problem with ldattach needing the /dev/cuaa
device.  The serial port /dev/ttya is working with gpsd directly but
ldattach requires /dev/cuaa.  However, according to the system logs,
ldattach issues the error (ldattach is run as root):

ldattach: can't open /dev/cuaa: Device not configured

if memory serves the serial driver for the sparcs doesn't implement
the cua devices. you omitted a dmesg and i don't remember which serial
driver the onboard cereals use tho. the manpage would have a note.



On my SPARCclassic, this is /dev/zstty0 and /dev/zstty1.


The output of dmesg is below.  It shows zstty0 and zstty1 but /dev does 
not have those devices.  If it's possible to create them what do I need 
to do?  The MAKEDEV script does not contain anything for zstty devices, 
either.


OpenBSD 4.6 (GENERIC) #27: Thu Jul  9 23:37:56 MDT 2009
dera...@sparc.openbsd.org:/usr/src/sys/arch/sparc/compile/GENERIC
real mem = 33443840 (31MB)
avail mem = 26951680 (25MB)
mainbus0 at root: SUNW,Sun 4/50
cpu0 at mainbus0: W8601/8701 or MB86903 @ 40 MHz, on-chip FPU; cache 
chip bug - trap page uncached

cpu0: 64K byte write-through, 32 bytes/line, hw flush cache enabled
memreg0 at mainbus0 ioaddr 0xf400
clock0 at mainbus0 ioaddr 0xf200: mk48t02 (eeprom)
timer0 at mainbus0 ioaddr 0xf300 delay constant 17
auxreg0 at mainbus0 ioaddr 0xf743
zs0 at mainbus0 ioaddr 0xf100 pri 12, softpri 6
zstty0 at zs0 channel 0
zstty1 at zs0 channel 1
zs1 at mainbus0 ioaddr 0xf000 pri 12, softpri 6
zskbd0 at zs1 channel 0: keyboard, type 4, layout 0x0
wskbd0 at zskbd0: console keyboard
zsms0 at zs1 channel 1
wsmouse0 at zsms0 mux 0
audioamd0 at mainbus0 ioaddr 0xf7201000 pri 13, softpri 4
audio0 at audioamd0
sbus0 at mainbus0 ioaddr 0xf800: clock = 20 MHz
dma0 at sbus0 slot 0 offset 0x40: rev 1+
esp0 at sbus0 slot 0 offset 0x80 pri 3: ESP100A, 25MHz
scsibus0 at esp0: 8 targets, initiator 7
sd0 at scsibus0 targ 3 lun 0: SGI, SEAGATE ST31200N, 8640 SCSI2 
0/direct fixed

sd0: 1014MB, 512 bytes/sec, 2077833 sec total
sd1 at scsibus0 targ 4 lun 0: SEAGATE, ST32430N SUN2.1G, 0444 SCSI2 
0/direct fixed

sd1: 2049MB, 512 bytes/sec, 4197405 sec total
cd0 at scsibus0 targ 6 lun 0: TOSHIBA, XM-4101TASUNSLCD, 0494 SCSI2 
5/cdrom removable

le0 at sbus0 slot 0 offset 0xc0 pri 5: address 08:00:20:a4:b6:47



Re: Sparc classic serial ports ttya vs cuaa

2010-02-23 Thread Henning Brauer
* Alexander Carver agcar...@acarver.net [2010-02-24 04:01]:
 Mattieu Baptiste wrote:
 On Tue, Feb 23, 2010 at 5:20 PM, Henning Brauer lists-open...@bsws.de
 wrote:
 * Alex Carver agcarver+open...@acarver.net [2010-02-23 05:53]:
 I've been working on getting gpsd working on one of my old Sun IPXes
 but I've run into a problem with ldattach needing the /dev/cuaa
 device.  The serial port /dev/ttya is working with gpsd directly but
 ldattach requires /dev/cuaa.  However, according to the system logs,
 ldattach issues the error (ldattach is run as root):
 
 ldattach: can't open /dev/cuaa: Device not configured
 if memory serves the serial driver for the sparcs doesn't implement
 the cua devices. you omitted a dmesg and i don't remember which serial
 driver the onboard cereals use tho. the manpage would have a note.
 
 
 On my SPARCclassic, this is /dev/zstty0 and /dev/zstty1.
 
 The output of dmesg is below.  It shows zstty0 and zstty1 but /dev
 does not have those devices.  If it's possible to create them what
 do I need to do?  The MAKEDEV script does not contain anything for
 zstty devices, either.

man zstty
(the manpage doesn't mention the dev nodes, bug)
you use the regular device nodes, i think /dev/ttya and /dev/cuaa in
this case - zs DOES support cua, with a limitation mentioned in the
manpage.

the device i had in mind that doesn't support cua on sparc(64) was
spif.

-- 
Henning Brauer, h...@bsws.de, henn...@openbsd.org
BS Web Services, http://bsws.de
Full-Service ISP - Secure Hosting, Mail and DNS Services
Dedicated Servers, Rootservers, Application Hosting



Sparc classic serial ports ttya vs cuaa

2010-02-22 Thread Alex Carver

Hi all,

I've been working on getting gpsd working on one of my old Sun IPXes but 
I've run into a problem with ldattach needing the /dev/cuaa device.  The 
serial port /dev/ttya is working with gpsd directly but ldattach 
requires /dev/cuaa.  However, according to the system logs, ldattach 
issues the error (ldattach is run as root):


ldattach: can't open /dev/cuaa: Device not configured

However, the device does exist in the /dev tree:

# ls -l /dev/cuaa
crw-rw  1 uucp  dialer   12, 128 Feb 21 18:52 /dev/cuaa

THe matching tty also exists

# ls -l /dev/ttya
crw-rw  1 uucp  dialer   12,   0 Feb 21 18:52 /dev/ttya

I'm at a loss to understand what's going on.

Straight use of /dev/ttya and gpsd works fine, gpsd is able to detect 
the GPS receiver plugged into the port.  However, I need ldattach for 
the PPS discipline that I'm feeding through the DCD line.


The system is being booted with a keyboard and display plugged in so, as 
far as I know, no gettys are attaching to the serial ports.


Thanks