felHR85 / UsbSerial

Usb serial controller for Android
MIT License
1.8k stars 585 forks source link

FTDI device syncRead not return data #241

Closed t2t-sonbui closed 5 years ago

t2t-sonbui commented 5 years ago

I run examplesync with FT232RL chip, but can not get anything received. syncRead(byte[] buffer, int timeout) with timeout value is 0 will make the ReadThread unable to stop.

arabine commented 5 years ago

Same here. Must have a problem in the current implementation...

atholbro commented 5 years ago

It's working with Release 6.0.3, anything newer and syncRead returns 0. This is with a 1000ms timeout.

felHR85 commented 5 years ago

@t2t-sonbui @arabine @atholbro You are totally right. It is confirmed that a bug was introduced. This bug only affects FTDI devices using synchronous api or Streams. I will release a new version this weekend. In the meantime I recommend using the asynchronous api. Sorry guys for the inconvenience.

atholbro commented 5 years ago

I'm just using 6.03 for now.

I'm also having an issue with larger reads failing. It seems to read about 230 bytes then cuts off. Still looking into it as it might be something on my end.

felHR85 commented 5 years ago

@t2t-sonbui @arabine @atholbro Hey guys. Could you give this branch ftdi_sync_fix a try? Thank you very much

felHR85 commented 5 years ago

I'm just using 6.03 for now.

I'm also having an issue with larger reads failing. It seems to read about 230 bytes then cuts off. Still looking into it as it might be something on my end. Maybe could you increment the buffer?

arabine commented 5 years ago

Ok I will try it.

Edit: it works, thank you!

felHR85 commented 5 years ago

Solved in 6.1.0 release