Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!feeder.erje.net!us.feeder.erje.net!news.linkpendium.com!news.linkpendium.com!panix!not-for-mail From: Grant Edwards Newsgroups: comp.arch.embedded Subject: Re: Simple protocol analyzer? Date: Wed, 7 Aug 2013 15:15:45 +0000 (UTC) Organization: PANIX Public Access Internet and UNIX, NYC Lines: 37 Message-ID: References: NNTP-Posting-Host: dsl.comtrol.com X-Trace: reader1.panix.com 1375888545 11285 64.122.56.22 (7 Aug 2013 15:15:45 GMT) X-Complaints-To: abuse@panix.com NNTP-Posting-Date: Wed, 7 Aug 2013 15:15:45 +0000 (UTC) User-Agent: slrn/1.0.1 (Linux) Xref: csiph.com comp.arch.embedded:13030 On 2013-08-07, Grant Edwards wrote: > On 2013-08-07, Clifford Heath wrote: >> On 07/08/13 04:48, Grant Edwards wrote: >>> If you want the timestamp for the start of the line, it's a bit more >>> complicated: >>> #!/usr/bin/python >>> import serial,time >>> p = serial.Serial('/dev/ttyS1', 9600) >>> while 1: >>> first = p.read(1) >>> stamp = time.time() >>> rest = p.readline() >>> print stamp, first+rest >> >> Does Python's serial object put the line into raw mode so you can get >> the first character before the linefeed is sent? or did you miss that? >> Just curious, not nit-picking. > > Yes. The port defaults to raw mode (8,none,1). The author of > pyserial is an embedded systems developer who (I believe) wrote it to > support a set of tools used for downloading/testing/debugging > microcontroller-based widgets that had serial ports. Since that's > mainly what I use it for, I find pyserial pretty much always defaults > to doing the "right" thing. I forgot to post a link to the pyserial project: http://pyserial.sourceforge.net/ Pyserial isn't part of the Python standard library, but I think most Linux distros have a package for it -- even if they don't, installing only requires a couple commands. -- Grant Edwards grant.b.edwards Yow! PARDON me, am I at speaking ENGLISH? gmail.com