Scanmax0815 / usb-serial-for-android

Automatically exported from code.google.com/p/usb-serial-for-android
GNU Lesser General Public License v3.0
0 stars 0 forks source link

always uses default connection params with FTDI devices #11

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

when using an FTDI device (therefore FtdiSerialDriver),
call UsbSerialDriver.setParameters() with custom params, 
then call UsbSerialDriver.open()

------

What is the expected output? What do you see instead?

the code in FtdiSerialDriver.open() resets the params back to defaults, 
ignoring the custom params

------

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

v0.1.0

------

Please provide any additional information below.

suggest replacing the following line from FtdiSerialDriver.open():
   setParameters(DEFAULT_BAUD_RATE, DEFAULT_DATA_BITS, DEFAULT_STOP_BITS, DEFAULT_PARITY);

with this code:
   if (mBaudRate <= 0) mBaudRate = DEFAULT_BAUD_RATE;
   if (mDataBits <= 0) mDataBits = DEFAULT_DATA_BITS;
   if (mStopBits <= 0) mStopBits = DEFAULT_STOP_BITS;
   if (mParity <= 0) mParity = DEFAULT_PARITY;
   setParameters(mBaudRate, mDataBits, mStopBits, mParity);

Original issue reported on code.google.com by kristof...@devbutton.com on 11 Mar 2013 at 6:00

GoogleCodeExporter commented 9 years ago
edit - this was not v0.1.0 actually, it's in the current development source

Original comment by kristof...@devbutton.com on 18 Mar 2013 at 4:27

GoogleCodeExporter commented 9 years ago
Thanks for the report. This behavior is fixed in 
f73b485418be34e88399f5fb922f26d1a9e51f04 (by removing it entirely).

BTW, calling setParameters() (or other methods which need a device) on a 
non-open()ed device is undefined.  I'll probably explicitly prohibit this in a 
future change.

Original comment by mike.wak...@gmail.com on 8 Apr 2013 at 5:45

GoogleCodeExporter commented 9 years ago
Issue 15 has been merged into this issue.

Original comment by mike.wak...@gmail.com on 8 Apr 2013 at 5:58