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

Add a wrapper around pySerial to monkey patch support for custom baudrates #712

Merged
merged 4 commits into from
May 29, 2016

Conversation

kakaroto
Copy link
Contributor

@kakaroto kakaroto commented Jan 4, 2016

This is only useful if the pyserial version installed is lower than 2.7 since that doesn't support custom baudrates on linux.

The monkey patch will replace the set_special_baudrates function in the serial module with the version of the function from pyserial 2.7 which allows the use of 250000 baudrates on Linux. If pyserial is 2.7 or newer, it won't do anything.

@eldir
Copy link
Collaborator

eldir commented Feb 23, 2016

Wouldn't changing the requirements.txt to pyserial>=2.7 be the way forward here?

@kakaroto
Copy link
Contributor Author

I hadn't noticed there's a requirements.txt file, but yes, changing the requirements there would be good, but this patch is meant to make printrun work with pyserial 2.6, not change its requirements to 2.7.
The purpose being for it to work on machines that can't simply have pyserial 2.7 installed. More specifically, for debian jessie (current stable debian release) which only has 2.6 in its repositories : https://packages.debian.org/source/jessie/pyserial

@kliment
Copy link
Owner

kliment commented Apr 21, 2016

The license on this is problematic - Printrun is GPLv3 whereas this is AGPLv3. @kakaroto, if you're the author of this, would you be willing to change the license? Essentially all the code appears to be a straight copy from pyserial anyway.

kakaroto added 4 commits May 26, 2016 12:19
…rates

This is only useful if the pyserial version installed is lower than 2.7
since that doesn't support custom baudrates such as 250000.
POSIX includes OS X, which does not need to use this patch
@kakaroto
Copy link
Contributor Author

@kliment, thanks for looking into this. I've updated the code with a couple of fixes and changed the license to match the pyserial license.
The first fix is to prevent monkey patching for OSX which is not needed and already works, and the second one, is to make sure the monkey patch doesn't get executed if we're running pyserial > 2.7. While that last one is not necessary, is to safeguard in case things change in the future and a potential pyserial 4.0 doesn't have that TCGETS variable that the monkey patch checks for, which might make it think it needs to patch pyserial.

For your information, pyserial 2.7 was Python Software Foundation License, but pyserial 3.0 is using a 3-clause BSD license. Since the set_special_baudrate (the copied code) was not modified and is essentially identical between pyserial 2.7 and 3.0, I've chosen to use the updated license for that code and have changed the monkey patch code into 3-clause BSD license, which is compatible with the GPL.

Thanks!

@kliment kliment merged commit 8c04675 into kliment:master May 29, 2016
rockstorm101 added a commit to rockstorm101/Printrun that referenced this pull request Mar 3, 2018
This reverts commit 8c04675, reversing changes made to dfb8077.

The wrapper around pyserial is no longer needed since it was intended
only for pyserial versions under 2.7.
kliment added a commit that referenced this pull request Mar 5, 2018
Revert PR #712 "Add a wrapper around pySerial"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants