Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2007-02

Flushing serial inque on Linux

4 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Bernd Mueller

Hello,

I am trying to flush the serial inque on Linux with no success. So far I have:

procedure FlushInQue(lHandle: Longint);
var
    QueSelector: Longint;
begin
    QueSelector:= TCIFLUSH;
    Fpioctl(lHandle, TCFLSH, @QueSelector);
end;

I can read incoming characters, so the connection is ok and lHandle is valid. I tried TCIOFLUSH as another QueSelector and tried also ioctl instead of Fpioctl.

BTW, I am new to Linux (Ubuntu 6.06) and not really sure, which units I have to include: baseunix, oldlinux unix. I tried several combinations.

Thanks, Bernd.

Marco van de Voort
to Bernd Mueller
I can read incoming characters, so the connection is ok and lHandle is valid. I tried TCIOFLUSH as another QueSelector and tried also ioctl instead of Fpioctl.

termio.tcflush but that does

fpioctl(fd,TCIOflush,pointer(qsel));
BTW, I am new to Linux (Ubuntu 6.06) and not really sure, which units I have to include: baseunix, oldlinux unix. I tried several combinations.

baseunix, but there is some terminal stuff abstracted from exact *nix version in termio.

Bernd Mueller
to Marco van de Voort
Show quoted text 7 lines
> I can read incoming characters, so the connection is ok and lHandle is > valid. I tried TCIOFLUSH as another QueSelector and tried also ioctl > instead of Fpioctl. termio.tcflush but that does fpioctl(fd,TCIOflush,pointer(qsel));

TCFlush is working now. Thank you.

Regards, Bernd.

Bernd Mueller
to Bernd Mueller
Show quoted text 8 lines
>> I can read incoming characters, so the connection is ok and lHandle >> is valid. I tried TCIOFLUSH as another QueSelector and tried also >> ioctl instead of Fpioctl. > > termio.tcflush but that does > fpioctl(fd,TCIOflush,pointer(qsel)); TCFlush is working now. Thank you.

my problem with fpioctl was the third parameter qsel. In my first attempts I tried something like

   fpioctl(fd,TCIOflush,@qsel);

which does compile with no warning but does not work.

the pointer type cast is the correct way:
   fpioctl(fd,TCIOflush,pointer(qsel));

Regards, Bernd.