altera2015 / usbserial

Flutter Android USB Serial plugin
BSD 3-Clause "New" or "Revised" License
128 stars 103 forks source link

Break #105

Closed HernandoSergio closed 4 months ago

HernandoSergio commented 8 months ago

I need to send a break through the serial line to awaken the device (i.e. lower the TX line for more than one byte time). Is it possible to do it somehow?

tommie commented 6 months ago

No, unfortunately not. And it's not even implemented in the underlying Android library: https://github.com/felHR85/UsbSerial/blob/7ad6c9f6880e93a29498e479d3e871d5b03d188b/usbserial/src/main/java/com/felhr/usbserial/CDCSerialDevice.java#L251

Trescode-repos commented 3 weeks ago

in your code: await _port!.setBreak(false); // when you set DTR and RTS

to usb_serial.dart line 112: bool _breakState=false; line 176: /// Sets or clears the break port to value [breakState]. Future setBreak(bool breakState) async { _breakState = breakState; return await _channel.invokeMethod("setBreak", {"breakState": breakState}); } // you may want to add _breakState.toString() to line 305

to UsbSerialPortAdapter.java line 138: case "setBreak":{ boolean v = call.argument("breakState"); m_SerialDevice.setBreak(v); result.success(null); break; }

tommie commented 3 weeks ago

Note that only the FTDI and CP2102 drivers have setBreak implemented. All the others will silently do nothing.