Skip to content
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

fix out of memory crush, when there are no data to read on unix systems #175

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Kiliar
Copy link

@Kiliar Kiliar commented Aug 23, 2024

You can improve pulling logic on unix systems, by changing recursion to endless loop with some delay.

@skadisch
Copy link

This will unfortunately not solve my problem, which is USB serial port disconnect. In this case, read will return 0, not an error. So this loop will run endlessly.

@Kiliar
Copy link
Author

Kiliar commented Aug 23, 2024

Oh.... so you have an issue when serial connection is up, but no data can be send or received using this lib? I had a similar issue and found a workaround by calling simple python script that will initialize serial port & send some data. It helps me most of the time, maybe it will help you to find proper solution.

import sys
import serial
import crc8

serial = serial.Serial()
serial.port = sys.argv[1]
serial.baudrate = int(sys.argv[2])

serial.open()

msg = bytearray.fromhex("0101")

hash = crc8.crc8()
hash.update(msg)
c = hash.digest()
serial.write(msg)
serial.write(c)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants