Re: hd44780-serial.c

Stephen Crane <[email protected]> Tue, 10 Jul 2012 09:36:40 +0100
Newsgroups gmane.comp.sysutils.lcdproc
Message-ID <CAMhwZi4yMRgoaOGnbQJUSnkjrXsU_6=UHqfPMN-Mob7sjEYwKg@mail.gmail.com>
Hi Markus,
It looks like my problem was with the transmitting XBee because handling
EAGAIN correctly didn't fix it, only power-cycling the XBee.

However when I run the system at 57600 baud the display doesn't get messed
up.

Regards,
Steve

On 22 June 2012 18:13, Markus Dolze <[email protected]> wrote:

> -------- Original-Nachricht --------
> > Datum: Fri, 22 Jun 2012 15:52:52 +0100
> > Von: Stephen Crane <[email protected]>
> > An: [email protected]
> > Betreff: [Lcdproc] hd44780-serial.c
>
> > Hello all,
> > I have a rather unusual setup with an XBee on /dev/ttyUSB0 connected to a
> > remote display which uses hd44780-serial.c as the driver.
> >
> > I have noticed that the display gets messed up from time to time, as if
> > characters are being dropped or lost in transmission. Browsing the
> driver,
> > I notice that the return value from write is ignored, so I replaced all
> > calls to write with a do_write function like this:
> >
> > static void do_write(int fd, const unsigned char *c, int n)
> >  {
> >   while (n > 0) {
> >   int wrote = write(fd, c, n);
> >   if (wrote > 0)
> >   n -= wrote;
> >   else {
> >   perror("write");
> >   break;
> >   }
> >   }
> > }
> >
> > With this in place, I see a ton of EAGAIN errors which would certainly
> > account for the dropped characters, right?
> >
> > Would the list accept a patch for this file? (I note that most drivers
> > have
> > the same problem...)
> >
> > Steve
>
> 'most drivers have the same problem' is true. Most drivers just
> sent-and-forget which is IMHO not the baddest thing. As for the hd44780
> driver, there are some options to mitigate corrupted screens
> (RefreshDisplay, KeepAliveDisplay).
>
> I have never experienced any problems using hd44780-serial, even with 20x4
> displays on slow (9600 baud) devices. If your device is larger - like 40x4
> - this may be a problem. But I have seen displays (e.g. pyramid driver)
> which controller could not cope with fast screen updates.
>
> As screens are updated every 125 ms, too many retries can make screen
> changes choppy as LCDd may skip screen updates.
>
> If adding a small retry loop (say 10 retries) fixes your problem, then I
> will give it a try.
>
> Note that using char* and n (which seems to be the number of bytes to
> write) is useless within the hd44780-serial as it always sends one
> character at a time.
>
> Regards,
> Markus
>

_______________________________________________
LCDproc mailing list
[email protected]
http://lists.omnipotent.net/mailman/listinfo/lcdproc