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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Received: by 2002:a5e:c30b:: with SMTP id a11-v6mr14146918iok.38.1534921434984; Wed, 22 Aug 2018 00:03:54 -0700 (PDT) X-Received: by 2002:aca:f495:: with SMTP id s143-v6mr1179656oih.7.1534921434899; Wed, 22 Aug 2018 00:03:54 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!news.gegeweb.eu!gegeweb.org!usenet-fr.net!proxad.net!feeder1-2.proxad.net!209.85.166.215.MISMATCH!g24-v6no1499588iti.0!news-out.google.com!g5-v6ni2014iti.0!nntp.google.com!w19-v6no1491038itb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Wed, 22 Aug 2018 00:03:54 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=165.255.63.4; posting-account=orbgeAkAAADzWCTlruxuX_Ts4lIq8C5J NNTP-Posting-Host: 165.255.63.4 References: <_ZEeD.60176$4w.12143@fx44.am4> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: file descriptor of a serial port From: jan.de.kruyf@gmail.com Injection-Date: Wed, 22 Aug 2018 07:03:54 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: reader02.eternal-september.org comp.lang.ada:54209 Date: 2018-08-22T00:03:54-07:00 List-Id: On Tuesday, August 21, 2018 at 9:19:36 AM UTC+2, jan.de...@gmail.com wrote: > On Monday, August 20, 2018 at 9:52:28 PM UTC+2, Per Sandberg wrote: > > Why don't patch your own "GNAT.Serial_Communications" and put in your= =20 > > own projects sources. > > -------------------------------------------------------------------- > > package GNAT.Serial_Communications is > > ... > > type Data_Rate is > > (B75, B110, B150, B300, B600, B1200, B2400, B4800, B9600, > > B19200, B38400, B57600, B100000, B115200); > > ... > > private > > ... > > Data_Rate_Value : constant array (Data_Rate) of=20 > > Interfaces.C.unsigned ... > > B57600 =3D> 57_600, > > B100000 =3D> 100_000, > > B115200 =3D> 115_200); > >=20 > > end GNAT.Serial_Communications; > > -------------------------------------------------------------------- > > package body GNAT.Serial_Communications is > > ... > > C_Data_Rate : constant array (Data_Rate) of unsigned :=3D > > ... > > B57600 =3D> OSC.B57600, > > B100000 =3D> 0010010, --< > B115200 =3D> OSC.B115200); > > ... > > end GNAT.Serial_Communications; > > -------------------------------------------------------------------- > > project Serial_Mess is > > for Source_Dirs use ("src"); > > for Object_Dir use ".obj"; > > for Main use ("main.adb"); > >=20 > > package Compiler is > > for Switches ("g-sercom.adb") use ("-gnatg"); > > end Compiler; > > end Serial_Mess; > > -------------------------------------------------------------------- > > And you are done. > >=20 > > Did the same thing some years ago for B75 before it was implemented in= =20 > > the distributed Run-times. > > /P > >=20 > >=20 > >=20 > > On 08/20/18 15:56, jan.....com wrote: > > > Hallo, > > >=20 > > > I try to set up a custom baudrate on a serial port, which I believe i= s done with the C ioctl procedure. > > >=20 > > > However, for that I need the fd of the serial port which is hidden in= the private part of GNAT.Serial_Communications. > > >=20 > > > I tried to construct a child package of GNAT.Serial_Communications bu= t the compiler does not like that, since it does not actually compile that = package. > > >=20 > > > Has anybody any idea? > > >=20 > > > Thanks, > > >=20 > > > Jan de Kruijf. > > > >=20 > Per, > Yes, it is not as simple as you make it, but that I will do. The whole is= sue comes about because I need to read a serial port at 100kBaud which Linu= x does not handle by normal means. You need to give a custom divider (i.e. = not preset in the serial driver) with ioctl >=20 > See here: > stackoverflow.com/questions/3192478/specifying-non-standard-baud-rate-for= -ftdi-virtual-serial-port-under-linux# >=20 > Enjoy your day. >=20 > j. Rejoice with me, the stackoverflow.com recipe works. I get 100kBaud now.=20 The code is here for anybody who might ever need it. Thanks for all the help. j.