libftdi Archives

Subject: Re: ftdi_poll_modem_status() results in upper byte of status being to to 0xFF

From: Uwe Bonnes <bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Tue, 3 May 2011 15:17:25 +0200
>>>>> "Tom" == Tom Saunders <trsaunders@xxxxxxxxx> writes:

    Tom> --002354332cb6826d4a04a25d647d Content-Type: text/plain;
    Tom> charset=ISO-8859-1

    Tom> Hi,

    Tom> I've been experimenting with libftdi 0.18 on my Mac OS X 10.6.7
    Tom> machine with gcc 4.2.1.

    Tom> I've been finding that the upper byte of the unsigned short filled
    Tom> by ftdi_poll_modem_status is allways 0xFF. E.g, when the status
    Tom> should be 0x00b0 it comes out as 0xffb0.

    Tom> By changing the final line of ftdi_poll_modem_status from:

    Tom> *status = (usb_val[1] << 8) | usb_val[0];

    Tom> to: *status = (usb_val[1] << 8) | (usb_val[0] & 0xFF);

    Tom> I've found the problem to be fixed. Is this something wrong with my
    Tom> environment or a bug in the library?

You fix seems right and the bug seems in the library. Good spotting!

    Tom> -- libftdi - see http://www.intra2net.com/en/developer/libftdi for
    Tom> details.  To unsubscribe send a mail to
    Tom> libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx
    Tom> --002354332cb6826d4a04a25d647d Content-Type: text/html;
    Tom> charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable

    Tom> Hi,<div><br></div><div>I&#39;ve been experimenting with libftdi
Please, no HTML in mail to mailinglists.

Bye
-- 
Uwe Bonnes                bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------

--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx   

Current Thread