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.2 required=5.0 tests=BAYES_00,FREEMAIL_FROM, FROM_STARTS_WITH_NUMS autolearn=no autolearn_force=no version=3.4.4 X-Received: by 2002:a05:620a:12c4:: with SMTP id e4mr2026318qkl.359.1580335018284; Wed, 29 Jan 2020 13:56:58 -0800 (PST) X-Received: by 2002:a9d:6e02:: with SMTP id e2mr1154524otr.194.1580335016943; Wed, 29 Jan 2020 13:56:56 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!news.unit0.net!feeder1.cambriumusenet.nl!feed.tweak.nl!209.85.160.216.MISMATCH!g89no758291qtd.0!news-out.google.com!w29ni988qtc.0!nntp.google.com!g89no758247qtd.0!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Wed, 29 Jan 2020 13:56:56 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: google-groups.googlegroups.com; posting-host=2001:8b0:ca:2:0:0:0:fd; posting-account=TiHetgoAAACluCgYkPc8-TWs6dBNgSne NNTP-Posting-Host: 2001:8b0:ca:2:0:0:0:fd References: <6a365294-65bb-4bd5-82d1-69d7b5aac04b@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: GNATCOLL-Mmap example From: Bob Goddard <1963bib@googlemail.com> Injection-Date: Wed, 29 Jan 2020 21:56:57 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader01.eternal-september.org comp.lang.ada:57982 Date: 2020-01-29T13:56:56-08:00 List-Id: On Wednesday, 29 January 2020 08:19:11 UTC, Dmitry A. Kazakov wrote: [...] > >>> This was the way I started, but could not get it to read anything. It just blocks trying to read a single character. My c code works fine using the wiringPi libs. > >> > >> If I correctly remember you should rewind the file after each reading. > > > > It did not get that far. It blocks right at the start. > > What about this > > use GNAT.OS_Lib; > > FD : File_Descriptor; > Buffer : aliased char; > begin > FD := Open_Read ("/sys/class/gpio/gpio/XXX/value", Binary); > Lseek (FD, 0, Seek_Set); > if 1 = Read (FD, Buffer'Address, 1) then > if Buffer = '1' then > ... Well... the call does not block, but I get spurious info back. It fires 1000 in around 1/4s, when it should be about 50Hz, that being the mains line frequency here. On read, it should be reset. I tried making it RW, but the write fails. Ho hum, that dent in the wall is getting bigger. B