[Lcdproc] Crystalfontz 633/635 Packet Driver Endianness Issue

Peter Marschall peter@adpm.de
Sat Sep 9 20:21:02 2006


Hi Russell,

On Saturday, 9. September 2006 17:10, Russell Krayer wrote:
> I stumbled onto an issue with endianness running LCDproc 0.5.0 on a ppc box
> (a big endian machine).  The problem is in CFontz633io.c when working with
> the CRC.  I have a fix that is working for me and should still work with
> little endian machines.  Should I send a patch somewhere?  Note, the bug is
> also in the Crystalfontz example program from Crystalfontz vendor.

Thanks for the patch you sent in your other post.

I looked at it and the existing code and finally found that the idea of
using a union for this conversion was a flawed concept.

So I changed the code in CVS to convert manually between the
CRC and the 2 bytes comprising it.
This should fix the endiannes issue as the code now always expects / sends
the LCB before the MSB.

As a side note: unfortunately CF uses little-endian word order here.
With big-endian, a simple htons() had been sufficient.

The changes should be in tonight's nightly tar balls at 
http://lcdproc.sourceforge.net/nightly/lcdproc-CVS-current.tar.gz

Please test if the changes work for you

Peter

-- 
Peter Marschall
peter@adpm.de