libserialport.dart icon indicating copy to clipboard operation
libserialport.dart copied to clipboard

read with timeout always is blocking

Open wrjcs opened this issue 4 years ago • 8 comments

Hello, I use buffer = sp.read(1, timeout: 5000); But I can't continue when time is out of 5000

wrjcs avatar Dec 19 '20 16:12 wrjcs

Hi, which platform?

jpnurmi avatar Dec 19 '20 17:12 jpnurmi

@jpnurmi ,Android.

wrjcs avatar Dec 21 '20 08:12 wrjcs

this is the code: try{ sp = SerialPort('/dev/ttyS3'); sp.config.baudRate = 9600; var o = sp.openReadWrite() var r = sp.read(1, timeout: 2000); sp.close(); }catch(ex){ if (sp != null && sp.isOpen) { sp.close(); } print(ex); }

I didn't connect the device to serial port. so normal, the read will be failed. but it can't continu after sp.read(1,timeout:2000) I didn't catched error.

wrjcs avatar Dec 21 '20 15:12 wrjcs

Interesting, on Linux it throws immediately:

SerialPortError: Input/output error, errno = 5

jpnurmi avatar Dec 21 '20 15:12 jpnurmi

did you tested on android?

wrjcs avatar Dec 21 '20 15:12 wrjcs

Hello, Do you have any suggestion?

wrjcs avatar Dec 22 '20 11:12 wrjcs

Hi, I don't have a suitable Android device to test right now, but I'll try to find time to build an Android image for Raspberry Pi for testing.

jpnurmi avatar Dec 22 '20 11:12 jpnurmi

Interesting, on Linux it throws immediately:

SerialPortError: Input/output error, errno = 5

What is solution for this error in Raspberrypi?

AndroidDesigner avatar Jun 25 '24 08:06 AndroidDesigner