-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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 crash at port open #1772
fix crash at port open #1772
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can confirm that this patch fixed my issue with espruino/EspruinoTools#89
@zbjornson mind taking a look? |
Thank you for this, I haven't had time to dig too deeply. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix makes sense. Odd that that didn't crash for me. Sorry for the mistake!
It would probably be simpler to keep the struct as it was, and change the call signature of setBaudRate
to something like
int setBaudRate(const int fd, const int baudRate, char** errorString)
thereby avoiding the need to create a new instance of the baton at all.
Actually, I'm not sure why a copy of the connection options needs to be created in the first place. Is there a reason we can't just use data
? I'm not super familiar with this code yet.
I think it used the struct to communicate the error, no reason why it couldn't have the string passed in or a different way to do it |
Just looked more closely -- I was proposing passing a char* by reference for the error data (although I forgot a size parameter earlier). I think that, or changing the hierarchy so that there's a base struct with I also see now why this didn't crash for me -- there's no equivalent error in serialport_win.cpp. |
Alternative fix for serialport#1771 to serialport#1772
I have tested this with some hardware, we're good! thank you so much @nowakpl |
Fix for #1771