[Gambas-user] Serial Port Change Events Not Working after Upgrade to Karmic

Benoît Minisini gambas at ...1...
Sat Dec 5 18:38:39 CET 2009


> Benoît Minisini schreef:
> >> Benoît Minisini schreef:
> >>> It should be ok with revision #2456!
> >>>
> >>> If it really works, can you check that changing the flow control
> >>> between None and something else actually has an effect on CPU
> >>> consumption?
> >>
> >> Benoît,
> >>
> >> no segfaults, but the system load when running my project with the patch
> >> is alot higher than before.
> >>
> >> Before it was 0.2-0.3
> >> Now it's 1.0-1.10
> >>
> >> I'm not using flowcontrol.
> >>
> >> $ grep FlowControl *
> >> CCTX35.class:    .FlowControl = 0
> >> CGPS.class:    .FlowControl = 0
> >> CPlugwise.class:    .FlowControl = 0
> >> CRFXComRX.class:    .FlowControl = 0
> >> CRFXComTX.class:    .FlowControl = 0
> >> CSMS.class:    .FlowControl = 0
> >> CVISCA.class:    .FlowControl = 0
> >> CWeeder.class:    .FlowControl = 0
> >> CZWave.class:    .FlowControl = 0
> >>
> >> Six of these serialports are active.
> >> And I presume 0 is the same as None.
> >>
> >> Regards,
> >> Ron_2nd.
> >
> > That would mean that the Read callback is called endlessly, as if there
> > are always bytes to read on the serial port.
> >
> > Do you use the read event? Can you check that by implementing a Read
> > event handler, check how much time it is called, and check what can be
> > read on the serial port?
> >
> > If there is something to read on the serial port, if there are data to
> > read, and if you don't read it, the Read callback will be called again
> > and again.
> >
> > Regards,
> 
> Benoit,
> 
> runned valgrind tool for a while.
> 
> And I got a rather strange winner, I got 3 milion calls of _add_char in
> gb_error.c
> 
> Some debug code hanging around or something like that?
> 
> See attached valgrind file.
> 
> Regards,
> Ron_2nd.
> 

The reason is a lot of one-byte reading that raises the EOF error. This should 
be logical if the read event handler is called whereas there is nothing to 
read, and then you read one byte.

But why Linux tells me (the interpreter actually) that there is something to 
read on the serial port file descriptor, whereas there is nothing?

Regards,

-- 
Benoît Minisini




More information about the User mailing list