Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

Minitel comme console série sous OpenBSD

2 réponses
Avatar
TeXitoi
Bonjour,

j'essaie d'utiliser un minitel comme console série sous OpenBSD.

Quand je fais :

-----8<---------8<---------8<---------8<---------8<---------8<---------8<----
texitoi@epiano:~$ sudo sh -c '(stty 4800 cs7 parenb -parodd; stty) < /dev/tty00 > /dev/tty00'
-----8<---------8<---------8<---------8<---------8<---------8<---------8<----

J'ai sur mon minitel

-----8<---------8<---------8<---------8<---------8<---------8<---------8<----
speed 4800 baud;
lflags: echoe echoke echoctl
cflags: cs7 parenb
-----8<---------8<---------8<---------8<---------8<---------8<---------8<----

qui s'affiche.

Mon minitel marche donc en 7 bits avec "even parity" à 4800 baud.

Mais je n'arrive pas à créer une entrée dans /etc/gettytab
correspondant.

J'ai essayé :

-----8<---------8<---------8<---------8<---------8<---------8<---------8<----
minitel:mini-4800:\
:ep:sp#4800:
-----8<---------8<---------8<---------8<---------8<---------8<---------8<----

avec dans /etc/ttys

-----8<---------8<---------8<---------8<---------8<---------8<---------8<----
tty00 "/usr/libexec/getty minitel" vt220 on secure
-----8<---------8<---------8<---------8<---------8<---------8<---------8<----

Mais dans ce cas-là, j'obtiens

-----8<---------8<---------8<---------8<---------8<---------8<---------8<----
texitoi@epiano:~$ sudo sh -c 'stty < /dev/tty00 '
speed 4800 baud;
lflags: -icanon -isig -iexten -echo
iflags: -icrnl -ixon -ixany -imaxbel -brkint
oflags: -opost
cflags: cs8 -parenb
-----8<---------8<---------8<---------8<---------8<---------8<---------8<----

Ce qui empêche l'affichage de tout les caractères possédant un nombre
impaire de bit à 1.

Je ne trouve pas l'entrée de gettytab permettant d'avoir "cflags: cs7
parenb". J'ai essayé np, op, ap à la place de ep dans l'entrée de gettytab
sans plus de résultats.

Merci de votre aide.

--
Guillaume Pinot http://www.irccyn.ec-nantes.fr/~pinot/

« Ne désespérez jamais. Laissez infuser d'avantage. » -- Henri Michaux

() Campagne du ruban ascii -- contre les mails en html
/\ Contre les pièces jointes Microsoft

2 réponses

Avatar
Truc Muche
Bonjour,

j'essaie d'utiliser un minitel comme console série sous OpenBSD.


-----8<---------8<---------8<---------8<---------8<---------8<---------8<----

:~$ sudo sh -c 'stty < /dev/tty00 '
speed 4800 baud;
lflags: -icanon -isig -iexten -echo
iflags: -icrnl -ixon -ixany -imaxbel -brkint
oflags: -opost
cflags: cs8 -parenb
AMHA, il faut laisser faire le paramétrage du système qui

devrait être, pour des raisons historiques even-7bits-1stop (donc
en format minitel) par défaut. sous freebsd, pour balancer un getty
sur un minitel2 en 9600-7e1 j'utilise :
/etc/ttys => ttyd0 "/usr/libexec/getty std.9600" dialup on
et je ne crois pas me souvenir d'avoir un truc a changer dans gettytab.
par contre, refaire un fnct-P-9 pour passer le minitel en 9600).

attention:
- un minitel 1B monte que jusqu'a 4800bps (e71)
2 9600 (e71)
- un magis (la derniere génération avec lecteur de carte a puce
intégré) peut faire du 8bits sans parité, mais je n'ai jamais
testé..


P.

Avatar
TeXitoi
Truc Muche writes:

Bonjour,

j'essaie d'utiliser un minitel comme console série sous OpenBSD.


-----8<---------8<---------8<---------8<---------8<---------8<---------8<----
:~$ sudo sh -c 'stty < /dev/tty00 '
speed 4800 baud;
lflags: -icanon -isig -iexten -echo
iflags: -icrnl -ixon -ixany -imaxbel -brkint
oflags: -opost
cflags: cs8 -parenb


AMHA, il faut laisser faire le paramétrage du système qui
devrait être, pour des raisons historiques even-7bits-1stop (donc
en format minitel) par défaut.


Il semblerait que non (c'est bien sur la première chose que j'ai
essayé) :

/etc/gettytab :
-----8<---------8<---------8<---------8<---------8<---------8<---------8<----
[...]
default:
:np:im=rn%s/%m (%h) (%t)rnrn:sp#1200:
[...]
-----8<---------8<---------8<---------8<---------8<---------8<---------8<----

On remarque bien dans l'entrée par défaut le "np" signifiant, d'après
le man :

-----8<---------8<---------8<---------8<---------8<---------8<---------8<----
np bool false Terminal uses no parity (i.e., 8-bit
characters).
-----8<---------8<---------8<---------8<---------8<---------8<---------8<----

sous freebsd, pour balancer un getty
sur un minitel2 en 9600-7e1 j'utilise :
/etc/ttys => ttyd0 "/usr/libexec/getty std.9600" dialup on
et je ne crois pas me souvenir d'avoir un truc a changer dans gettytab.
par contre, refaire un fnct-P-9 pour passer le minitel en 9600).


La configuration par défaut d'OpenBSD doit pas être la même que sous
FreeBSD, alors. Sous linux, il se met en 8bits et autodétecte lors du
login la console.

attention:
- un minitel 1B monte que jusqu'a 4800bps (e71)


C'est bien ca que j'ai.

J'arrive en ce moment à le faire marcher, mais je trouve la méthode
"bidouille et crade" :

/etc/ttys :
-----8<---------8<---------8<---------8<---------8<---------8<---------8<----
[...]
tty00 "/usr/local/libexec/minigetty minitel" vt220 on secure
[...]
-----8<---------8<---------8<---------8<---------8<---------8<---------8<----

le minigetty étant un hack configurant la console à coup de
system("stty").

Le dialup dans ta conf peut-elle changer quelque chose ?

Le deuxième truc qui me gène, c'est que la console de boot semble elle
aussi être en 8 bits, et je ne trouve rien pour la configurer en 7e1
dans le man boot.conf. C'est genant, car je vais être obligé de
brancher un écran et un clavier à chaque mise à jour.

Pour info, le minigetty.c (Licence BSD, vu que dérivé de
libexec/getty/main.c d'OpenBSD 3.9):
-----8<---------8<---------8<---------8<---------8<---------8<---------8<----
/*-
* Copyright (c) 1980, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/

#include <signal.h>
#include <fcntl.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <syslog.h>
#include <stdarg.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
#include <stdio.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <termios.h>
#include <util.h>

int
main(int argc, char *argv[])
{
char ttyn[32];
int repcnt = 0, failopenlogged = 0;

openlog("minigetty", LOG_ODELAY|LOG_CONS|LOG_PID, LOG_AUTH);

/*
* The following is a work around for vhangup interactions
* which cause great problems getting window systems started.
* If the tty line is "-", we do the old style getty presuming
* that the file descriptors are already set up for us.
* J. Gettys - MIT Project Athena.
*/
if (argc <= 2 || strcmp(argv[2], "-") == 0)
{
snprintf(ttyn, sizeof ttyn, "%s", ttyname(0));
}
else
{
int i;

snprintf(ttyn, sizeof ttyn, "%s%s", "/dev/", argv[2]);
if (strcmp(argv[0], "+") != 0)
{
chown(ttyn, 0, 0);
chmod(ttyn, 0600);
revoke(ttyn);
/*
* Delay the open so DTR stays down long enough to be detected.
*/
sleep(2);
while ((i = open(ttyn, O_RDWR)) == -1)
{
if ((repcnt % 10 == 0) &&
(errno != ENXIO || !failopenlogged))
{
syslog(LOG_ERR, "%s: %m", ttyn);
closelog();
failopenlogged = 1;
}
repcnt++;
sleep(60);
}
login_tty(i);
}
}

system("/bin/stty 4800 istrip cs7 parenb -parodd brkint ignpar icrnl "
"ixon ixany opost onlcr cread hupcl isig icanon echo echoe echok");

execl("/usr/bin/login", "login", "-p", (char *)0);
syslog(LOG_ERR, "%s: %m", "/usr/bin/login");
return 1;
}
-----8<---------8<---------8<---------8<---------8<---------8<---------8<----

--
Guillaume Pinot http://www.irccyn.ec-nantes.fr/~pinot/

``Computers are good at following instructions, but not at reading your
mind.'' -- Donald E. Knuth, the TeXbook

() Campagne du ruban ascii -- contre les mails en html
/ Contre les pièces jointes Microsoft