From owner-freebsd-hackers@freebsd.org Tue Jan 2 23:06:00 2018 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AB03DEBE0FC for ; Tue, 2 Jan 2018 23:06:00 +0000 (UTC) (envelope-from zbeeble@gmail.com) Received: from mail-wm0-x236.google.com (mail-wm0-x236.google.com [IPv6:2a00:1450:400c:c09::236]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4219C779AE for ; Tue, 2 Jan 2018 23:06:00 +0000 (UTC) (envelope-from zbeeble@gmail.com) Received: by mail-wm0-x236.google.com with SMTP id g75so496636wme.0 for ; Tue, 02 Jan 2018 15:06:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=xThPWWuiTEAgYFejqMLen/eOBaYx3FaK+7VwIcl35Gs=; b=XKmWC0RUlV0cTFD0dIz16YsC/fhaRKeGaq0OwiiBYjQ6uc9vMGDa2kCuZQBCOjOzMm lBueMUtjnaZY8M0wd2L8OKf+y7PYIJ2N2sAf5itZpfifYRFhjyH3aC9ECvuxoY5vnQx4 DRQHgyeTLjG0mosmZjzr6HoT3y3g5ESnbzedCIqkheVORrKgbe7myKwaQXFP66f2sF/D agQRh8DJWjr18cHEUIfBAuaD0rxp0gaGbXTOZwZ9AvLkTatpmXwCWLk0bgF72UEIaY8h ht3+td01b5OVtretdMF6LAe/DcfZt2RV0LRv0D2XQMBaWqTRdkpe9QJYpKWDaXdtvM3I Fdyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=xThPWWuiTEAgYFejqMLen/eOBaYx3FaK+7VwIcl35Gs=; b=GG4tpcgq5qiIsAf7VCE0BYQlDjnISLOWTdxAsgcVOKPVVmpo7PJWgGtvUnpfXbvcNG 74e5dF2ChP95SZMo4sdWf63KdWDkw6M3N9r9IlYZSDX0IgyJbDGVsYRtNpe5DWqYfZJY d+w6UUEW9Eg+7EHYR8I0HQWD1/hRptK+OpGmEwrkpPTN+ws8LHAcErcMGtvWDvCwsj/K 1D1ma/q0yk1jetL511Oat/SNRC8bVZ19Cw8xzPLuVdtYD6YJcjx7oHHt/bUykwzy5/8n ha05doZc65rF4lySpbiyvfOqOJtQupK1VEddarH/AamnvNLArj/p4Gv1GEhlke/Ymg5b l+Ug== X-Gm-Message-State: AKGB3mLjN4+5OjDZsOq43WCO8TYOFRUbDQeHuzWBZUNEkCTDetr5FB27 09ElSbnGyLafiDCb+i7AS1vn/Y07WfjS0coIxA== X-Google-Smtp-Source: ACJfBouSrjPcvHZDoe9FSnTJz+oUFEnOciyzRAqPGAVdT6kbLWxmfbcVbO7uILLhg8GqpeCCfiUJ+Wvj9N4x2YMVxGU= X-Received: by 10.80.176.70 with SMTP id i64mr64646886edd.187.1514934357629; Tue, 02 Jan 2018 15:05:57 -0800 (PST) MIME-Version: 1.0 Received: by 10.80.181.59 with HTTP; Tue, 2 Jan 2018 15:05:57 -0800 (PST) In-Reply-To: References: From: Zaphod Beeblebrox Date: Tue, 2 Jan 2018 18:05:57 -0500 Message-ID: Subject: Re: We do serial differently. To: Kyle Evans Cc: FreeBSD Hackers Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Jan 2018 23:06:00 -0000 To summarize, the app "arduino" that controls arduinos works, but the app "pronterface" that controls an arduino with a specific application loaded, do not. Further this seems to be something to do with the handling of the DTR and/or the actual handling of the DTR signal... and what this all means to the arduino in question. To confound things, this all works (of course) on linux. If this were a purely work thing, I'd eat my bile and just run linux. Even now, I have a R-pi attached to it running linux to "get things done" ... but I want FreeBSD to work. So... if I'm charged to fix this, what are my tools? Is ktrace sufficient to indicate all the calls to the serial? How do I interpret it so that I can make sense of this. Do I potentially need DTrace or is that overkill? Some help and pointers would be appreciated. On Sat, Oct 28, 2017 at 6:01 PM, Zaphod Beeblebrox wrote: > I've tried hacking at directly. I can't send it a file (as in that > script) because the printer isn't setup yet. I'm still working on it. > > ... I have poked on the .send() method (with M105) ... and that doesn't > seem to have effect. Also ... if I ctrl-C the python process, it doesn't > exit. I'm not patient... but so far I've only been able to exit with > CTRL-\ ... (core dump). > > On 27/10/2017 07:59, Kyle Evans wrote: > > What happens if you just invoke printcore directly, like the example > script in the printrun readme? > > Pronterface has got to be doing something not-entirely-sane here. The > reset should always coincide with the port being open()d, and it should > behave like the Arduino IDE and cu(1) do. The mega doesn't really have any > crazy requirements just to function properly. > > > On Oct 26, 2017 11:46 PM, "Zaphod Beeblebrox" wrote: > > OK. I played with this all again ... a bit. > > Firstly, when I run "arduino" (the IDE) ... the arduino board resets > immediately (I can tell this because it has an LCD screen attached). > > But when I run pronterface, it doesn't reset until 5 seconds (roughly) > after pronterface exits. > > I tried adding a hardcoded setDTR(0) or setDTR(1) near this code ... but > it doesn't seem to make any palpable difference. > > On Wed, Oct 25, 2017 at 1:11 PM, Kyle Evans wrote: > >> On Wed, Oct 25, 2017 at 11:43 AM, Kyle Evans wrote: >> >>> On Wed, Oct 25, 2017 at 11:34 AM, Zaphod Beeblebrox >>> wrote: >>> >>>> On Mon, Oct 23, 2017 at 9:45 AM, Kyle Evans wrote: >>>> >>>>> Hi, >>>>> >>>>> Are you able to connect to it otherwise (w/ cu or friends) and issue, >>>>> say, an M105 manually? >>>>> >>>> >>>> yes. With CU I can connect, it resets, then I can issue an "M105" >>>> and it parrots back some status. >>>> >>> >>> Ok, cool, that's expected and sounds like Pronterface is doing something >>> it shouldn't be. >>> >>> I'll poke at it a little bit more- last I checked, it didn't look like >>> it was doing anything too crazy with pyserial and I've got a working >>> OctoPrint (w/ pyserial) setup, so I know that works to some extent. >>> >>> >> For the sake of argument, can you try applying the following patch [1] to >> printrun? I don't see a need to be toggling DTR here, and that might narrow >> things down a little bit. >> >> [1] >> diff --git a/printrun/printcore.py b/printrun/printcore.py >> index b54e750..fd531c3 100644 >> --- a/printrun/printcore.py >> +++ b/printrun/printcore.py >> @@ -218,11 +218,6 @@ class printcore(): >> parity = PARITY_ODD) >> self.printer.close() >> self.printer.parity = PARITY_NONE >> - try: #this appears not to work on many platforms, >> so we're going to call it but not care if it fails >> - self.printer.setDTR(dtr); >> - except: >> - #self.logError(_("Could not set DTR on this >> platform")) #not sure whether to output an error message >> - pass >> self.printer.open() >> except SerialException as e: >> self.logError(_("Could not connect to %s at baudrate >> %s:") % (self.port, self.baud) + >> >> >> > > >