From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22829 invoked by alias); 16 Feb 2012 14:21:26 -0000 Received: (qmail 22813 invoked by uid 22791); 16 Feb 2012 14:21:23 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from hagrid.ecoscentric.com (HELO mail.ecoscentric.com) (212.13.207.197) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 16 Feb 2012 14:20:43 +0000 Received: from localhost (hagrid.ecoscentric.com [127.0.0.1]) by mail.ecoscentric.com (Postfix) with ESMTP id F3B2F2F78001 for ; Thu, 16 Feb 2012 14:20:41 +0000 (GMT) Received: from mail.ecoscentric.com ([127.0.0.1]) by localhost (hagrid.ecoscentric.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id iMhMotY6Ivzh; Thu, 16 Feb 2012 14:20:36 +0000 (GMT) From: bugzilla-daemon@bugs.ecos.sourceware.org To: ecos-patches@ecos.sourceware.org Subject: [Bug 1001466] /dev/null serial driver X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: eCos X-Bugzilla-Component: Patches and contributions X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: bernard.fouche@kuantic.com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: low X-Bugzilla-Assigned-To: unassigned@bugs.ecos.sourceware.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: In-Reply-To: References: X-Bugzilla-URL: http://bugs.ecos.sourceware.org/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Date: Thu, 16 Feb 2012 14:21:00 -0000 Message-Id: <20120216142036.4A6212F78005@mail.ecoscentric.com> Mailing-List: contact ecos-patches-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: ecos-patches-owner@ecos.sourceware.org X-SW-Source: 2012-02/txt/msg00062.txt.bz2 Please do not reply to this email. Use the web interface provided at: http://bugs.ecos.sourceware.org/show_bug.cgi?id=3D1001466 --- Comment #6 from Bernard Fouch=C3=A9 2012-0= 2-16 14:20:30 GMT --- My issue is to keep in the app on the field things like fprintf(DebugStream,...) and be able to activate/deactivate the debug messa= ges without modifying the app, and without adding things like 'if(DebugOpened)' before each use of DebugStream. This way I can use a serial port for the app and when debug is needed, I disconnect the connected device on the serial port, connect instead a termi= nal emulator, activate debug, check the debug messages and then go back to full= app mode afterwards. If I use: if(DebugOpened) fprintf(DebugStream,...) Then I also need if(!DebugOpened) fprintf(NotADebugStream,...) While with this driver I can do: #if DEBUG fprintf(DebugStream,...) #endif fprintf(NotADebugStream,...) When I need to deactivate the messages, I fclose(DebugStream) and do DebugStream=3Dfopen("/dev/null"). When I need the debug messages back I do the same fclose() but fopen() to s= ome /dev/serX. In my mind it's like sending stderr to /dev/null or sending it to some output device, that's why I named this fake driver '/dev/null'. Performance isn't an issue here, it's convenience first during app tests (t= hat can last for months) on a target that uses all serial ports. I can't add enable/disable config keys to serial.c since this would complet= ely switch on or off the uart: I always need the uart but I need to select what stream is feeding it. Maybe the proper solution is in the stdio lib? Or rename the driver /dev/ser_void to avoid semantics confusion with /dev/null? --=20 Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=3Demail ------- You are receiving this mail because: ------- You are on the CC list for the bug.