fix(unix): handle unsupported modem-control ioctls on Linux#235
Open
dcodeIO wants to merge 1 commit intoserialport:mainfrom
Open
fix(unix): handle unsupported modem-control ioctls on Linux#235dcodeIO wants to merge 1 commit intoserialport:mainfrom
dcodeIO wants to merge 1 commit intoserialport:mainfrom
Conversation
Improve Linux modem-control compatibility by handling unsupported ioctl cases in set() without failing valid RTS/DTR updates (e.g. WSL with usbipd-attached devices).
Author
|
Potentially related: #229 (similar "Operation not supported" symptoms) |
This was referenced Feb 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ran into this while attempting to flash an ESP32 from WSL with the device attached via usbipd, where serialport set() returned "Operation not supported" when toggling modem-control lines used to reset into bootloader. With this change, rebooting into bootloader via DTR/RTS works as expected.
Used pyserial (which works in the same setup) as a reference:
Ignores unsupported ioctl errors (EINVAL, ENOTTY) when applying initial modem state:
https://github.com/pyserial/pyserial/blob/911a0b8c110f3d3513bab67e64d95d1310517454/serial/serialposix.py#L347-L355
Uses per-bit modem control (TIOCMBIS / TIOCMBIC) for RTS and DTR:
https://github.com/pyserial/pyserial/blob/911a0b8c110f3d3513bab67e64d95d1310517454/serial/serialposix.py#L751-L763