kliment / Printrun

Pronterface, Pronsole, and Printcore - Pure Python 3d printing host software
GNU General Public License v3.0
2.35k stars 995 forks source link

enable parity workaround for Linux systems #1366

Open HendrikR opened 12 months ago

HendrikR commented 12 months ago

On some systems, the serial port needs to set odd/even parity on connecting, before reverting to no parity during operation. Otherwise, the connection is flaky and often stops working after the first command. This serial port parity workaround is not limited to Debian-based systems, but extends to other Linux distributions, too (e.g. Arch). Also, platform.system() is "Linux" on those systems, not "linux".

rockstorm101 commented 12 months ago

Hi @HendrikR, first thanks for you contribution, I'm happy to merge this really. However I would like to take the opportunity to discuss this "parity workaround".

I presume you run Arch and find a need for this parity workaround? I ask because I run Debian and never felt the need for it really. The fact that it was applied when system was "linux", which never happened, makes me think not many people are facing parity issues.

@kliment, do you know the history of this workaround? Why it was made for Debian-derivates only? @volconst, @hroncok, do your (Linux) systems need this parity hack?

HendrikR commented 12 months ago

Hi @rockstorm101 , I am running a current Archlinux (uname -a: Linux modi 6.4.2-arch1-1 #1 SMP PREEMPT_DYNAMIC Thu, 06 Jul 2023 18:35:54 +0000 x86_64 GNU/Linux) and access my printer (Monoprice Select Mini v2) via USB. The connection is flaky without the workaround, and works with no problems when enabling it. If this workaround would not cause trouble for anyone who does not need it, it could stay activated indiscriminately for every Linux system. On the other hand, it could be controlled by an option (.pronsolerc and/or CLI flag).

rockstorm101 commented 11 months ago

I've got a feeling that this isn't a platform-dependent issue but actually something to do with whether the serial driver supports parity or not. Maybe @kevans91 can shed some more light here? (Sorry to bring you into this so abruptly but I believe you introduced this check back in the day)

If it is indeed a driver-dependent issue, the platform check is not required and a configuration option would be the appropriate thing to do.

I'm surprised this makes any difference in the connection since, in theory, the parity is set to "NONE" in the end anyway regardless of the platform? I've been printing with and without the workaround and did not notice any difference. But I only have two computers and one printer to test anyway, not a huge sample :P

Friendly ping for @kliment, @hroncok and @volconst (Or anyone else who can comment on this :) )