[Bug 59290] New: Serial baud rates above 115200 not supported due to bug in serial.c
http://bugs.winehq.org/show_bug.cgi?id=59290 Bug ID: 59290 Summary: Serial baud rates above 115200 not supported due to bug in serial.c Product: Wine Version: 11.0 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: serial Assignee: wine-bugs@list.winehq.org Reporter: winehq.x4aeq@simplelogin.com Distribution: --- Hi, I have been attempting to move my simulator from Windows to Linux and have had great success with the exception of certain USB-over-serial devices. I found some references to this bug in the past, but it seems it was never opened formally and bad advice was given: https://forum.winehq.org/viewtopic.php?p=139497#p139497 This bug will affect all applications that interact with devices that run at bauds >115200 (specifically, in my case, 250000), 3d printers, GPS receivers, OBD interfaces, etc. Through much troubleshooting and fact-finding I narrowed it down to these two lines in `serial.c`: https://gitlab.winehq.org/wine/wine/-/blob/master/dlls/ntdll/unix/serial.c#L... https://gitlab.winehq.org/wine/wine/-/blob/master/dlls/ntdll/unix/serial.c#L... An application that is affected: https://github.com/tronicgr/AMC-AASD15A-Firmware/blob/master/Thanos-utility/... sha1: 0ded8cf5b1595a984144b5d5c8dcdaced0020b1e AMC_Config.exe Another application affected: https://www.simhubdash.com/ The applications (AMC_Config.exe is an example of one, SimHub is another) are non-functional when trying to access these USB devices, as they use the API `SerialPort.Open()` which in turn calls `GetCommProperties()` which calls this `IOCTL_SERIAL_GET_PROPERTIES` function, we see these items in the debug log: ```sh 0a48:trace:comm:serial_DeviceIoControl 0x3cc IOCTL_SERIAL_GET_PROPERTIES (nil) 0 0x6acf6b0 64 0x7ffffe7ff4f0 0a48:trace:comm:serial_DeviceIoControl 0x3cc IOCTL_SERIAL_GET_MODEMSTATUS (nil) 0 0x6acf768 4 0x7ffffe7ff4f0 0a48:trace:comm:get_modem_status 0006 -> ``` They applications are expecting to be presented back the actual maximum baud rate - but are erroring out with: "Max baud supported by device 131072" - this correlates to `BAUD_115200` hex value of `0x00020000`. I created a patch as below, instead using the actual max baud supported by Microsoft which is `BAUD_USER` / `0x10000000`, I also added the other supported baud `BAUD_128K` as a SettableBaud for those devices. https://learn.microsoft.com/en-us/windows/win32/api/winbase/ns-winbase-commp... Patch: ``` diff --git a/dlls/ntdll/unix/serial.c b/dlls/ntdll/unix/serial.c index 7a79dd0ac6a..a8585bbced9 100644 --- a/dlls/ntdll/unix/serial.c +++ b/dlls/ntdll/unix/serial.c @@ -376,14 +376,14 @@ static NTSTATUS get_properties(int fd, SERIAL_COMMPROP *prop) prop->ServiceMask = SP_SERIALCOMM; prop->MaxTxQueue = 4096; prop->MaxRxQueue = 4096; - prop->MaxBaud = BAUD_115200; + prop->MaxBaud = BAUD_USER; prop->ProvSubType = PST_RS232; prop->ProvCapabilities = PCF_DTRDSR | PCF_PARITY_CHECK | PCF_RTSCTS | PCF_TOTALTIMEOUTS | PCF_INTTIMEOUTS; prop->SettableParams = SP_BAUD | SP_DATABITS | SP_HANDSHAKING | SP_PARITY | SP_PARITY_CHECK | SP_STOPBITS ; prop->SettableBaud = BAUD_075 | BAUD_110 | BAUD_134_5 | BAUD_150 | BAUD_300 | BAUD_600 | BAUD_1200 | BAUD_1800 | BAUD_2400 | BAUD_4800 | - BAUD_9600 | BAUD_19200 | BAUD_38400 | BAUD_57600 | BAUD_115200 ; + BAUD_9600 | BAUD_19200 | BAUD_38400 | BAUD_57600 | BAUD_115200 | BAUD_128K | BAUD_USER ; prop->SettableData = DATABITS_5 | DATABITS_6 | DATABITS_7 | DATABITS_8 ; prop->SettableStopParity = STOPBITS_10 | STOPBITS_15 | STOPBITS_20 | PARITY_NONE | PARITY_ODD |PARITY_EVEN | PARITY_MARK | PARITY_SPACE; ``` I am unsure how to go about contributing such a small change - I have read the contributor documentation and have the code to fix it, but I am more than a little intimidated. Appreciate any eyes on this, Myles -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=59290 --- Comment #1 from M Gray <winehq.x4aeq@simplelogin.com> --- Created attachment 80224 --> http://bugs.winehq.org/attachment.cgi?id=80224 Proposed fix for serial.c -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=59290 M Gray <winehq.x4aeq@simplelogin.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Distribution|--- |ArchLinux Keywords| |hardware, patch -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=59290 Austin English <austinenglish@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |download --- Comment #2 from Austin English <austinenglish@gmail.com> --- (In reply to M Gray from comment #0)
I am unsure how to go about contributing such a small change - I have read the contributor documentation and have the code to fix it, but I am more than a little intimidated.
See https://gitlab.winehq.org/wine/wine/-/wikis/Submitting-Patches#Wine_patch_su... In short, you'll need to fork the project on gitlab, then send a pull request. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=59290 --- Comment #3 from M Gray <winehq.x4aeq@simplelogin.com> --- Thanks Austin, MR opened: https://gitlab.winehq.org/wine/wine/-/merge_requests/9968 I assigned you, but feel free to remove if inappropriate. Myles -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=59290 Alex Henrie <alexhenrie24@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Fixed by SHA1| |0937ce211330dc1406e0e9b5a28 | |fc35ed9078338 CC| |alexhenrie24@gmail.com Resolution|--- |FIXED --- Comment #4 from Alex Henrie <alexhenrie24@gmail.com> --- Fixed by https://gitlab.winehq.org/wine/wine/-/commit/0937ce211330dc1406e0e9b5a28fc35... -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=59290 Alexandre Julliard <julliard@winehq.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED --- Comment #5 from Alexandre Julliard <julliard@winehq.org> --- Closing bugs fixed in 11.2. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
participants (1)
-
WineHQ Bugzilla