felHR85 / UsbSerial

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

CDC Device not writing and reading data #227

Closed dsuresh-ap closed 5 years ago

dsuresh-ap commented 5 years ago

We just updated our code to 6.0.4 and now we are unable to read or write data from a CDCSerialDevice. Reverting back to 5.0.1 works but none of the 6.0.x versions work. The logs show that data is being pushed to the write buffer.

It looks like the WorkerThread is getting stuck on UsbRequest request = connection.requestWait(); Once the device is closed the read callback gets called.

Might be related to https://github.com/felHR85/UsbSerial/issues/214.

felHR85 commented 5 years ago

@dsuresh-ap Thank you for this report. I will check it out asap

ScottiSws commented 5 years ago

I'm having the same issue with 6.0.4 and fixed it by changing CDC_CONTROL_LINE_OFF to _ON in CDCSerialDevice.java:openCDC().

    // Default Setup
    setControlCommand(CDC_SET_LINE_CODING, 0, getInitialLineCoding());
    setControlCommand(CDC_SET_CONTROL_LINE_STATE, CDC_CONTROL_LINE_ON, null);
felHR85 commented 5 years ago

@Scotti6666 @dsuresh-ap Thank you guys. I will release this weekend with this change.

felHR85 commented 5 years ago

@dsuresh-ap @Scotti6666 I just released 6.0.5 with that line changed. It would be great if you could give it a try. Thanks!

ScottiSws commented 5 years ago

I pulled and checked out 6.0.5 and it's working. Thanks!

dsuresh-ap commented 5 years ago

@felHR85 Looks like the fix works and I am able to communicate properly. Thank you!