Linux-Hams archive - September 1997: Re: kissattach: TIOCSETD problem: a suggestion

Re: kissattach: TIOCSETD problem: a suggestion

Tomi Manninen (fvw.rqouqv@afl-uk.com)
Tue, 2 Sep 1997 13:17:20 +0300 (EETDST)


On Mon, 1 Sep 1997, John P. Beale wrote:

> and I get kissattach: TIOCSETD: Invalid argument.
>
> This seems like a pretty obscure error message. What does the TIOCSETD
> operation do, and what argument is invalid? I wasn't very enlightened by
> reading the tty_io.c source from the kernel.

As far as I know: TIOCSETD == Tty IO Control, SET line Discipline. And the
invalid argument was the N_AX25 line discipline that kissattach was trying
to set the serial line in question to.

The code in kissattach.c that produces the error is very simple:

int disc = N_AX25;

if (ioctl(fd, TIOCSETD, &disc) == -1) {
perror("kissattach: TIOCSETD");
return 1;
}

... meaning that this kind of error message is what the kernel and libc
easily supports. And it actually is quite accurate if you know what you
are doing.

However it is not very clear for someone without linux ax.25
programming experience so maybe we should try to catch the most obvious
cases and modify the code to be more descriptive. Like in the above case
something like this:

if (ioctl(fd, TIOCSETD, &disc) == -1) {
perror("kissattach: TIOCSETD");
if (errno == EINVAL)
fputs("(possibly MKISS support is not in the
kernel or module not loaded?)\n", stderr);
return 1;
}

The message would be just as cryptic in case of any other error but at
least the "Invalid argument" error would get some enlightment. How
about it Terry?

-- 
---Tomi Manninen   /   rpsn.veyhbz@osborneusa.com   /   OH2BNS @ OH2RBI.FIN.EU---