pyserial-asyncio icon indicating copy to clipboard operation
pyserial-asyncio copied to clipboard

socket:// support on Windows

Open alterscape opened this issue 4 years ago • 1 comments

I've made a small change to a local checkout to support socket:// connections (for the purpose of building a fake for testing when hardware is not available/connected):

in _poll_write() (line 304 in master as of 25 AUG 2021), the attempt to read self.serial.out_waiting fails with an AttributeError because the Socket transport does not implement out_waiting.

I wrapped the call as follows:

try:
  if serial.out_waiting < self.max_out_waiting:
    self._write_ready()
except AttributeError:
   self.write_ready()

This seems to fix the issue with socket:// connections and doesn't break other usage, because if out_waiting exists the check runs as implemented.

If this is acceptable I can submit a pull request -- I'd like to get this upstream so my team doesn't need to maintain a fork!

alterscape avatar Aug 25 '21 16:08 alterscape

If this is acceptable I can submit a pull request -- I'd like to get this upstream so my team doesn't need to maintain a fork!

Suggest that you submit a pull request for this and just wait for feedback and easier to comment on code in a PR than an issue.

Hedda avatar Nov 12 '21 11:11 Hedda