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,ASCII-7-bit Path: g2news1.google.com!news3.google.com!feeder.news-service.com!85.214.198.2.MISMATCH!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Simon Clubley Newsgroups: comp.lang.ada Subject: Re: GNAT.Serial_Communications Date: Thu, 21 Apr 2011 11:56:59 +0000 (UTC) Organization: A noiseless patient Spider Message-ID: References: <9af0087d-9637-40d9-8c30-2e06c2d1e4f4@o26g2000vby.googlegroups.com> <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> Injection-Date: Thu, 21 Apr 2011 11:56:59 +0000 (UTC) Injection-Info: mx01.eternal-september.org; posting-host="4pjzwDT2MPp9AkNxUo/C4Q"; logging-data="5773"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/u67aJIyVTDj3khfjuTc+3ZYI/9Mf7b8o=" User-Agent: slrn/0.9.8.1 (VMS/Multinet) Cancel-Lock: sha1:NiHSuKhzZpCyP1PY3ahaPA5tE/4= Xref: g2news1.google.com comp.lang.ada:18948 Date: 2011-04-21T11:56:59+00:00 List-Id: On 2011-04-20, Brian Drummond wrote: > On Tue, 19 Apr 2011 13:32:34 +0000, Simon Clubley wrote: > >> On 2011-04-19, tonyg wrote: >>> >>> 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 > ... >>> 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 >> >> Interesting. I would not expect that; > > Having just read g-sercom-linux.adb, this is now exactly what I would > expect. > I tend to not use the GNAT.* specific packages and my comment was based on the OP's statement that the GNAT serial port package does not present a method for changing the flow control settings. Given that, I would have been very surprised if the package imposed it's own flow control settings without the programmer been able to override them when there are several equally viable options to choose from. However, as you mention, that is clearly what is happening, and IMHO, is unjustified arrogance on the part of the package designer that they know better than the programmer. As well as RTS/CTS flow control based devices, I routinely come across devices without flow control (such as some GPS modules or the DBGU port on some Atmel microcontrollers) and devices with Xon/Xoff flow control (such as DEC based hardware). In my opinion, if you have several options to choose from, you either expose the options via a API so the end programmer can choose the one best suited to their environment, or you preserve the current settings and let the programmer alter them in some other way (say via stty in this case). > The "Set" procedure in Gnat.Serial_Communications uses "tcsetattr" and > "tcgetattr" C syscalls to do the job of setting baud rate ... "man > tcsetattr" should give you the relevant information. > > Unfortunately it uses the pseudo-code > tcgetattr(current settings); > overwrite baud rate and other things you want to set; > overwrite control settings inc. ctsrts for good measure > tcsetattr(current settings); > to do the job. > I hope the rest of the GNAT.* packages are written to a higher standard than that. :-) Simon. -- Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP Microsoft: Bringing you 1980s technology to a 21st century world