-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Fix interpreting baud rate bitmask as decimal value #123348
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
base: main
Are you sure you want to change the base?
Fix interpreting baud rate bitmask as decimal value #123348
Conversation
…(obtained from user).
|
@dotnet-policy-service agree company="Microsoft" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request fixes an issue where baud rate bitmask values from Windows drivers were being incorrectly interpreted as decimal values, causing validation errors. Some device drivers (like Silicon Labs USB to UART converters) return a decimal baud rate value instead of a bitmask, while Windows documentation specifies bitmasks should be used.
Changes:
- Added a new helper method
ConvertMaxBaudBitMaskToBaudRateto intelligently interpret thedwMaxBaudfield as either a bitmask or decimal value - Updated the BaudRate property setter to use the converted value for validation
- Updated the SerialStream constructor to use the converted value for validation
src/libraries/System.IO.Ports/src/System/IO/Ports/SerialStream.Windows.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.IO.Ports/src/System/IO/Ports/SerialStream.Windows.cs
Show resolved
Hide resolved
src/libraries/System.IO.Ports/src/System/IO/Ports/SerialStream.Windows.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.IO.Ports/src/System/IO/Ports/SerialStream.Windows.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.IO.Ports/src/System/IO/Ports/SerialStream.Windows.cs
Outdated
Show resolved
Hide resolved
|
Tagging subscribers to this area: @dotnet/area-system-io-ports |
Intended to fix !119105.