From: Angel P. <ang...@ya...> - 2009-09-30 06:13:15
|
Work like a charm. I could not resist to post a real session too: [14]> (format com "AT~%") NIL [15]> (loop for x = (read-char-no-hang com nil nil) :while x :collect x) [e=0 fCtsHold=0 fDsrHold=0 fRlsdHold=0 fXoffHold=0 fXoffSent=0 fEof=0 fTxim=0 cbInQue=9 cbOutQue=0] [e=0 fCtsHold=0 fDsrHold=0 fRlsdHold=0 fXoffHold=0 fXoffSent=0 fEof=0 fTxim=0 cbInQue=8 cbOutQue=0] [e=0 fCtsHold=0 fDsrHold=0 fRlsdHold=0 fXoffHold=0 fXoffSent=0 fEof=0 fTxim=0 cbInQue=7 cbOutQue=0] [e=0 fCtsHold=0 fDsrHold=0 fRlsdHold=0 fXoffHold=0 fXoffSent=0 fEof=0 fTxim=0 cbInQue=6 cbOutQue=0] [e=0 fCtsHold=0 fDsrHold=0 fRlsdHold=0 fXoffHold=0 fXoffSent=0 fEof=0 fTxim=0 cbInQue=5 cbOutQue=0] [e=0 fCtsHold=0 fDsrHold=0 fRlsdHold=0 fXoffHold=0 fXoffSent=0 fEof=0 fTxim=0 cbInQue=4 cbOutQue=0] [e=0 fCtsHold=0 fDsrHold=0 fRlsdHold=0 fXoffHold=0 fXoffSent=0 fEof=0 fTxim=0 cbInQue=3 cbOutQue=0] [e=0 fCtsHold=0 fDsrHold=0 fRlsdHold=0 fXoffHold=0 fXoffSent=0 fEof=0 fTxim=0 cbInQue=2 cbOutQue=0] [e=0 fCtsHold=0 fDsrHold=0 fRlsdHold=0 fXoffHold=0 fXoffSent=0 fEof=0 fTxim=0 cbInQue=1 cbOutQue=0] [e=0 fCtsHold=0 fDsrHold=0 fRlsdHold=0 fXoffHold=0 fXoffSent=0 fEof=0 fTxim=0 cbInQue=0 cbOutQue=0] (#\A #\T #\Newline #\Newline #\O #\K #\Newline) Thanks a lot! Regards, AngelP --- On Wed, 9/30/09, Angel Popov <ang...@ya...> wrote: > From: Angel Popov <ang...@ya...> > Subject: Re: [clisp-list] read-char-no-hang-p hangs on com port > To: "Vladimir Tzankov" <vtz...@gm...>, "clisp-list" <cli...@li...> > Cc: cli...@li... > Date: Wednesday, September 30, 2009, 8:38 AM > It does not hang now and the output > is: > > [e=0 fCtsHold=1 fDsrHold=0 fRlsdHold=0 fXoffHold=0 > fXoffSent=0 fEof=0 fTxim=0 cbInQue=0 cbOutQue=0] > > Thanks, AngelP > --- On Tue, 9/29/09, Sam Steingold <sd...@gn...> > wrote: > > > From: Sam Steingold <sd...@gn...> > > Subject: Re: read-char-no-hang-p hangs on com port > > To: "Vladimir Tzankov" <vtz...@gm...> > > Cc: cli...@li..., > ang...@ya... > > Date: Tuesday, September 29, 2009, 7:18 PM > > Vladimir Tzankov wrote: > > > > > > For checking whether there are characters to be > read > > - > > > ClearCommError() may be used > > > (http://msdn.microsoft.com/en-us/library/aa363180(VS.85).aspx). > > In > > > order to use it we should have explicit knowledge > that > > this is serial > > > port handle or just try it an handle the error in > case > > it's not > > > (probably ERROR_INVALID_HANDLE). > > > > right, something like this: > > > > --- win32aux.d.~1.59.~ 2009-09-29 > > 12:00:52.000000000 -0400 > > +++ win32aux.d 2009-09-29 > > 12:16:45.001480000 -0400 > > @@ -484,6 +484,19 @@ global int fd_read_wont_hang_p > (HANDLE > > f > > return 0; > > } else if > > (!(GetLastError()==ERROR_INVALID_HANDLE)) > > OS_error(); > > + var DWORD errors; > > + var COMSTAT stat; > > + if > > (ClearCommError(fd,&errors,&stat)) { /* it's > a > > serial comm dev */ > > + printf("[e=%d fCtsHold=%d > > fDsrHold=%d fRlsdHold=%d fXoffHold=%d fXoffSent=%d > fEof=%d > > fTxim=%d cbInQue=%d cbOutQue=%d]\n", > > + > > > errors,stat.fCtsHold,stat.fDsrHold,stat.fRlsdHold, > > + > > > stat.fXoffHold,stat.fXoffSent,stat.fEof,stat.fTxim, > > + > > stat.cbInQue,stat.cbOutQue); > > + if (errors) return -1; > > /* errors > > */ > > + if (stat.fEof) return 2; > > + if (stat.cbInQue) return 3; > > + return 0; > > + } else if > > (!(GetLastError()==ERROR_INVALID_HANDLE)) > > + OS_error(); > > /* Not a console. */ > > switch > > (WaitForSingleObject(fd,0)) { > > case > > WAIT_OBJECT_0: /* a byte is > > available, or EOF */ > > > > > > Angel, could you please try this patch (against cvs > head) > > and report the debug output? > > > > thanks! > > > > Sam. > > > > > > > > > > > ------------------------------------------------------------------------------ > Come build with us! The BlackBerry® Developer > Conference in SF, CA > is the only developer event you need to attend this year. > Jumpstart your > developing skills, take BlackBerry mobile applications to > market and stay > ahead of the curve. Join us from November 9-12, 2009. > Register now! > http://p.sf.net/sfu/devconf > _______________________________________________ > clisp-list mailing list > cli...@li... > https://lists.sourceforge.net/lists/listinfo/clisp-list > |