From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,cc65ab136f46904d X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,UTF8 Path: g2news2.google.com!news3.google.com!feeder.news-service.com!feeder.news-service.com!85.214.198.2.MISMATCH!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Ludovic Brenta Newsgroups: comp.lang.ada Subject: Re: GNAT.Serial_Communications Date: Tue, 19 Apr 2011 21:06:23 +0200 Organization: A noiseless patient Spider Message-ID: <874o5uawnk.fsf@ludovic-brenta.org> References: <31dd80b2-3fd3-4078-8774-c396a52c94a0@r6g2000vbz.googlegroups.com> <0d509f1c-4ca7-4595-a026-65c108558d76@bl1g2000vbb.googlegroups.com> <35515c03-f565-4fc4-ac1c-e9b7268123b3@dn9g2000vbb.googlegroups.com> <1144e8e4-4193-4ffd-a8d2-145c38993eb2@p16g2000vbi.googlegroups.com> <6301289c-f450-4d7f-8391-01e17d2555b9@z27g2000prz.googlegroups.com> <3671b2c4-6ed9-4a61-badc-bb7f889433f1@r19g2000prm.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: mx01.eternal-september.org; posting-host="miSzlE6PKEE137ra8ZrHKA"; logging-data="26181"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/+KiXDZN21E+n9WwjBAuOT" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) Cancel-Lock: sha1:qkMCrfx1sXGkqo6aEMW25dTgqek= sha1:W0b1w1kWB0iBUtrgM4CM0hTaTEo= Xref: g2news2.google.com comp.lang.ada:19875 Date: 2011-04-19T21:06:23+02:00 List-Id: tonyg writes on comp.lang.ada: > On Apr 19, 1:09 pm, Ludovic Brenta wrote: >> tonyg wrote on comp.lang.ada: >>>> Looking at the gnat sercom package it has a total lack of options for >>>> flow control. I am going to look at posix packages now and its options >>>> with serial interfaces. Does anyone know if Adacore are planning to >>>> add some more functionality to this package? >> >>> Just to let you all know ( I'm sure the world was waiting with baited >>> breath!) that thanks to the help received, its now all working. I'll >>> document what the problem was with some additional stuff to let future >>> people know. >> >>> It was the flow control setting and it can be fixed by opening another >>> terminal window and using the command >> >>> stty --file=/dev/ttyUSB0 -crtscts >> >>> However - any ada program compiled with the gnat serial communications >>> package if run again will reset the port to add flow control so this >>> needs it will need to be done again. Which is unfortunate for me and >>> anyone with non flow control electronics. I expect this will occur >>> everytime the port is opened. Out of interest do all you serial port >>> tinkerers out there use flow control? >> >> I think you'll have to create a task-specific binding to ioctl(2) to >> set the flow control options before writing to the port.  The fact >> that ioctl(2) is variadic, non-portable and non-standard may explain >> why there is nothing in GNAT.Serial_Communications related to flow >> control. >> >> If you're not sure what arguments to pass to ioctl, maybe you can try: >> >> strace stty --file=/dev/ttyUSB0 -crtscts > > HHhhmm a task specific binding? is that a c interface just for one > task? I ask because I know I want to do this but just not sure how to, > and I 've not heard of that phrase before. By "task" I meant "the task at hand", not the Ada keyword task as in multitasking. Basically, this means creating a different binding for ioctl for each thing you want to achieve with it. For more details, you can peruse the thread "The black magic of ioctl" on comp.lang.ada from October 2010. -- Ludovic Brenta.