Re: Problem with tcgetattr

From: Laurent H. (l.huge_at_nospam.wanadoo.fr)
Date: 09/06/03


Date: Sat, 06 Sep 2003 11:27:07 +0200

Peter T. Breuer a écrit :

> That makes no difference. Which module registers the char device?
I'm not. I've only implemented a line discipline for the serial port,
but all the rest is the serial driver.
> That's the one whose ioctl functions are used.
>> $ strace stty < /dev/ttyS0
>> ...
>> ioctl(0, SNDCTL_TMR_TIMEBASE, 0xbffff7f0) = -1 EINVAL
>> (Invalid argument)
> There you are. You are intercepting the ioctl or else replacing the
> serial drivers ioctl. And not doing it right.
I've got not ioctl in my module, so what's doing it ?
>> ioctl (wrong flag !). Do I have to implement an ioctl inside my
>> module ?
> If you are the one regisitering the functions for that major/minor,
> yes, of course. Show us what cat /proc/devices shows. That'll tell
> us who has registered for the char device with major 4. Are you
> replacing the ioctl?
        $ cat /proc/devices
        Character devices:
          1 mem
          2 pty
          3 ttyp
          4 ttyS
          5 cua
          ...
        226 drm
        231 ccsds
        245 pcmcia
        Block devices:
        ...
The char device ccsds is a simple rw device in which I derivate the
CCSDS flow (spatial standard) ; it has nothing to do with serial
port, and I'm sure it doesn't interact with it.
So the only thing I do against serial module is the line discipline :
        struct tty_ldisc sport_ldisc = {
                magic : TTY_LDISC_MAGIC,
                name : "ccsds_sport_ldisc",
                flags : 0,
                open : sport_open,
                close : sport_close,
                receive_buf : sport_receive,
                receive_room : sport_room,
        };
which I register with tty_register_ldisc(N_TTY, &sport_ldisc) during
the module initialization.
Does that mean I replace the serial duty on ioctl ?

-- 
Laurent H. (pour m'écrire, enlever nospam de l'adresse de réponse)


Relevant Pages

  • Re: How to access Serial ports Line Control Register
    ... If you can't find an ioctl call to use with the serial driver fo your ... The concept of memory vs. io writes is not present ... seem to be a sysOutbyte function or equivalent to access I/O address ... Nor does the function ioctl seem to have this functionality. ...
    (comp.os.vxworks)
  • Re: Recent TTYDEF_LFLAG default change
    ... In message, Andrey Chernov writes: ... >> Because if you open a serial port and it defaults to echo, ... >> ioctl and disable echoing. ...
    (freebsd-current)
  • Re: Problem with tcgetattr
    ... You are intercepting the ioctl or else replacing the ... These are the methods of the driver object. ... it looks like the serial driver to me. ... * is not handled by the tty layer or the low-level tty driver. ...
    (comp.os.linux.development.system)
  • Re: rs485 on SBC84500
    ... > data to a serial port. ... If a sufficient driver was never created, you end up using ioctl ... to control the devices registers directly from user space. ...
    (comp.os.linux.embedded)
  • Re: Recent TTYDEF_LFLAG default change
    ... >> Because if you open a serial port and it defaults to echo, ... >> ioctl and disable echoing. ...
    (freebsd-current)