-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
read throws exception when sp_nonblocking_read returns negative number in case of error #83
Comments
I can confirm having this issue too. A workaround is to check for // Check for bytes available before calling read.
if (serialPort.bytesAvailable > 0) {
var bytes = serialPort.read(amountToRead);
// Do something with the read bytes
} However this is definitely not ideal and removing the root cause, as suggested by @cabbi would be better. |
In my case checking for bytesAvailable is not working. The first read once data is available returns me an empty list and on a second read attempt I get this exception:
|
I think I'm hitting this as well:
|
This piece of code in
util.dart
does not handle error code in case sp_nonblocking_read failsThis will fix the error:
The text was updated successfully, but these errors were encountered: