libftdi Archives

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

From: Tom Saunders <trsaunders@xxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Tue, 3 May 2011 12:25:08 +0100
Hi,

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

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

By changing the final line of ftdi_poll_modem_status from:

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

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

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

Tom


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


Current Thread