From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 49D67C4363A for ; Tue, 20 Oct 2020 18:40:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DD8FD21D7B for ; Tue, 20 Oct 2020 18:40:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2437560AbgJTSk5 (ORCPT ); Tue, 20 Oct 2020 14:40:57 -0400 Received: from jabberwock.ucw.cz ([46.255.230.98]:42022 "EHLO jabberwock.ucw.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2437559AbgJTSk5 (ORCPT ); Tue, 20 Oct 2020 14:40:57 -0400 Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id 7F5EB1C0B7F; Tue, 20 Oct 2020 20:40:55 +0200 (CEST) Date: Tue, 20 Oct 2020 20:40:54 +0200 From: Pavel Machek To: "Bollinger, Seth" Cc: "linux-leds@vger.kernel.org" , Dan Murphy , Seth Bollinger Subject: Re: Strange timer LED behavior Message-ID: <20201020184054.GC25906@duo.ucw.cz> References: <20201019140617.GA25480@duo.ucw.cz> <3D108EE8-F4B6-490B-9B97-59B8E008F63B@digi.com> <2A80CF0E-1022-4673-86E8-12BF0696708E@digi.com> <20201020122149.GA19856@duo.ucw.cz> <20201020180813.GA25906@duo.ucw.cz> <20201020183300.GB25906@duo.ucw.cz> <78785807-3DB7-4A70-B135-2B20A260EA57@digi.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="5QAgd0e35j3NYeGe" Content-Disposition: inline In-Reply-To: <78785807-3DB7-4A70-B135-2B20A260EA57@digi.com> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-leds@vger.kernel.org --5QAgd0e35j3NYeGe Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue 2020-10-20 18:35:13, Bollinger, Seth wrote: >=20 > >>=20 > >> In this case we=E2=80=99re switching from on:86400, off:0 -> on:0, off= :86400. We write off first, then on using fwrite() to a file. From the tr= ace, it looks like on is always stored first. So, the first store is on:0,= off:0 for a brief period (enough to trigger the default), and then off is = stored. We=E2=80=99re already trying to not have them not both be zero at = the same time. I tried putting fflush() between them, but that didn=E2=80= =99t help. I suppose we could try to sleep some period of time, but this s= eems bad as well. Maybe write and read to verify the value is correctly st= ored? > >>=20 > >=20 > > I don't understand. Why would you use blink with on:86400, off:0? >=20 > In this case we=E2=80=99re using the api to turn the LED on and off, with= out blinking (in this case only). > Yeah. Don't do that! :-). For solid on/solid off, just turn the trigger off. For blinking, use timer trigger. Best regards, Pavel --=20 http://www.livejournal.com/~pavelmachek --5QAgd0e35j3NYeGe Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABECAB0WIQRPfPO7r0eAhk010v0w5/Bqldv68gUCX48vNgAKCRAw5/Bqldv6 8i4kAJ93118XI58Ffw364k1fv/4aZ98nQgCguXsvRwmdHdiT/Fk/NNL67Ge8M3c= =Mty2 -----END PGP SIGNATURE----- --5QAgd0e35j3NYeGe--