Oliviers-OSS / libmpsse

Automatically exported from code.google.com/p/libmpsse
0 stars 0 forks source link

WritePins always fails #38

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Any call to WritePins fails

What is the expected output? What do you see instead?
Get an MPSSE_FAIL for return value instead of MPSSE_OK

What version of the product are you using? On what operating system?
latest SVN version.

Please provide any additional information below.
I looked at this and found, much to my chagrin, that when I'd given you this 
function, I was only checking for ftdi_write_data to return 0.  The latest 
libftdi version doesn't do that.  It actually returns the number of bytes 
written, in which case the following:
if(ftdi_write_data(&mpsse->ftdi, &data, 1) == 0)

will always fail, even if there is a success.  It probably should read:
if(ftdi_write_data(&mpsse->ftdi, &data, 1) > 0)

I guess it could even read:
if(ftdi_write_data(&mpsse->ftdi, &data, 1) >= 0)

I would send a patch instead, but I made the change without creating a git 
repository.  Since it was a trivial change, it is no big deal.  I'm guessing 
not too many people use this function.  I don't know if, given some of the 
library additions, there is now a better, or different way to achieve what this 
achieved.

Thanks for taking a look.

Original issue reported on code.google.com by robokni...@gmail.com on 29 Nov 2013 at 4:05

GoogleCodeExporter commented 9 years ago
Oh, I suppose it could even check for the number of bytes returned, but then it 
wouldn't be backward compatible with older versions of libftdi, if you care 
about that.

Original comment by robokni...@gmail.com on 29 Nov 2013 at 4:07

GoogleCodeExporter commented 9 years ago
Thanks, will fix!

Original comment by heffne...@gmail.com on 2 Jan 2014 at 2:46