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
Error in braille display driver when changing timeout of a serial connection #6035
Comments
I'd say your former guess is correct; i.e. the port doesn't like being
reconfigured at that point. The timeout is constant, so if it were too
short, it would fail for every read (as opposed to just sometimes).
We use pyserial's code to reset the timeout, but it seems pyserial
reconfigures all port settings when you do that instead of just the
timeout. It's failing after the timeout is changed. Therefore, we should
just set the timeouts directly ourselves using SetCommTimeouts.
Annoying, but such is life.
|
Or maybe a way to only set the timeout could be added to pyserial? The current behavior has quite a bit of overhead if only the timeout changed. |
Hmm, seems a local tweak is much less fuss indeed. But while we're at it, would it be worth it to update to the latest pyserial? NVDA is a little behind. |
I vaguely recall the newest pyserial was a lot heavier or was a big API
change or something, but I could also be dreaming. If it isn't a huge
change, we can certainly update. I don't really want to fork it for the
timeout thing, though; I'd rather just make the change locally.
|
Local change sounds good, provided we have access to the port’s handle. From: James Teh [mailto:notifications@github.com] I vaguely recall the newest pyserial was a lot heavier or was a big API — |
There is one API change that is relevant to hwIo.Serial in pyserial/pyserial@3ad62fb. This renames hComPort to _port_handle. |
Well, I've been running with pyserial 3.1 and the proposed fix for this issue for a while and it seems stable. I'll build and run this on the PC that gives me the most errors soon. |
Looking briefly, it seems pyserial 3.0 also changed inWaiting to a
property instead of a function, among other things. That's going to
break quite a few drivers. Because of that (and because we don't have
access to most of these displays), I think I'd rather drop updating
unless there's a really solid advantage to doing so.
|
I tried to work around the inWaiting change by adding a method that returns the property. However, there is no real reason to upgrade to pyserial 3.1. But looking at the changelog, maybe we can update to 2.7 which is the latest in the 2.x range, brings a number of bug fixes and should be backwards compatible. The changelog even mentions the error I’m getting, though in another context I think. From: James Teh [mailto:notifications@github.com] Looking briefly, it seems pyserial 3.0 also changed inWaiting to a — |
Note that most drivers don't yet use hwIo, so adding a method would have
to be done via monkey patching. There's actually no good reason to use
inWaiting if you're using hwIo anyway.
I'd be happy to upgrade to 2.7 if it doesn't break anything. If the
pyserial repo isn't too big, we should consider adding it as its own
submodule. (I believe we didn't previously because they weren't using Git.)
|
Huh, I thought the old behavior already was for inWaiting to be a method. E.g. in the BrailleNote driver:
The difference is that now it is an alias of a pyserial method, whereas with pyserial 3.0+ it would be an explicit method returning a property. But I agree upgrading to 3.x isn't worth it considering that there are no known issues. I feel good about upgrading to 2.7, though! My clone of pyserial is just over 2MB, so a submodule should be fine. There are a few more Python files besides the ones NVDA already ships with, a matter of a few kilobytes. Should I go over to BitBucket and open an issue on nvda-misc-deps? |
It is. But if we upgraded to pyserial 3, how were you going to make
inWaiting a method instead of a property? Surely we'd have to monkey
patch pyserial? Most drivers still use serial.Serial directly.
|
Yeah, if they use serial.Serial directly that does ruin the nice abstraction we've got going on. |
Yeah. As I said, if they use hwIo.Serial, there's no reason to use inWaiting anyway. However, several drivers haven't yet been ported to hwIo.
|
Yep yep. By the way, any chance misc-deps is making its way to GitHub? :) |
Oh, forgot to answer that question. I will deal with miscDeps myself.
As for moving it to GitHub, I never really saw a need, since it's basically just a file stash and even if we had pull requests, etc., it'd be hard to keep things in sync. That said, I guess you could just submit a PR and cross-reference if it was on GitHub. Something we might think about in future.
|
…erything else too. re nvaccess#6035
…patible and HumanWare Brailliant B braille displays. (#6035)
Fixed in 9d78cdb |
For the Brailliant BI, this line in brailleDisplayDrivers\brailliantB.py now sometimes triggers:
In turn this throws an error because there is no attribute But more worrying is that this debug warning is triggered at all. I can't think of how this GitHub issue relates to it. Could the Windows 10 Anniversary Update be blamed? I upgraded a few days ago and can't recall this warning showing up before that. Nor did I get it when I ran this patch for a week before submitting it. And even now I can't reliably reproduce it. |
The actual traceback:
|
Actually, only a
The Brailliant sometimes refuses connections, particularly if you try to connect too quickly via Bluetooth. It is probably highly time sensitive. There's already a hack to try again if this gets thrown on the first attempt. Is this not working for you?
It doesn't.
Maybe. It's possible it affected timing. |
…braille display driver. serial.Serial has a port attribute and a log message in the brailliantB driver relied on this. hwIo.Serial should have this attribute as well. Originally reported here: #6035 (comment)
It is working, but I don't recall seeing the error before. The display is always activated even after this error, so the second try appears to work. |
…braille display driver. (#6257) serial.Serial has a port attribute and a log message in the brailliantB driver relied on this. hwIo.Serial should have this attribute as well. Originally reported here: #6035 (comment)
This error usually occurs when using the HumanWare Brailliant BI, firmware v2.0.15 on USB (Serial), while the computer is under some load. Reproduced on Windows 7 and 10, and first reported in #5195.
It happens either when setting or clearing the timeout in hwIo.Serial._notifyReceive:
So either on the second or the forth line of that code fragment. My initial guess is that either the display has more to send and doesn't like the reconfiguration, or the communication timeout is too short. I haven't investigated further. This may also apply to Bluetooth and/or to other displays.
The text was updated successfully, but these errors were encountered: