Hello
As regards to comment on the trac i am sending you the problem description
and a patch. I am providing the code under GPL v2 (same as VirtualBox OSE).

Problem description:
When a guest opens a port using non-standard baud rate the virtualbox is falling back to default 9600 - i think this is not good due there are a programs which need
to use the non-standard baudrates. In my case a windows application cannot
communicate with device. So i made a modification (which works for me) - and
i hope it could be commited. ps. similar problem was on wine project:
http://www.winehq.org/pipermail/wine-patches/2002-February/001895.html

regards,
Mariusz Bialonczyk

--- VirtualBox-2.1.0/src/VBox/Devices/Serial/DrvHostSerial.cpp.original 
2008-12-13 22:59:56.000000000 +0100
+++ VirtualBox-2.1.0/src/VBox/Devices/Serial/DrvHostSerial.cpp  2009-02-13 
07:22:43.000000000 +0100
@@ -40,6 +40,7 @@
 #if defined(RT_OS_LINUX) || defined(RT_OS_DARWIN)
 # include <errno.h>
 # include <termios.h>
+# include <linux/serial.h>
 # include <sys/types.h>
 # include <fcntl.h>
 # include <string.h>
@@ -242,6 +243,7 @@
     PDRVHOSTSERIAL pThis = PDMICHAR_2_DRVHOSTSERIAL(pInterface);
 #if defined(RT_OS_LINUX) || defined(RT_OS_DARWIN)
     struct termios *termiosSetup;
+    struct serial_struct *serialStruct;
     int baud_rate;
 #elif defined(RT_OS_WINDOWS)
     LPDCB comSetup;
@@ -308,7 +310,17 @@
             baud_rate = B115200;
             break;
         default:
-            baud_rate = B9600;
+            /* non-standard baud rate handling */
+            serialStruct = (struct serial_struct 
*)RTMemTmpAllocZ(sizeof(struct serial_struct));
+            ioctl(pThis->DeviceFile, TIOCGSERIAL, serialStruct);
+            serialStruct->custom_divisor = serialStruct->baud_base / Bps;
+            if (!(serialStruct->custom_divisor))
+                serialStruct->custom_divisor = 1;
+            serialStruct->flags &= ~ASYNC_SPD_MASK;
+            serialStruct->flags |= ASYNC_SPD_CUST;
+            ioctl(pThis->DeviceFile, TIOCSSERIAL, serialStruct);
+            RTMemTmpFree(serialStruct);
+            baud_rate = B38400;
     }
 
     cfsetispeed(termiosSetup, baud_rate);

_______________________________________________
vbox-dev mailing list
[email protected]
http://vbox.innotek.de/mailman/listinfo/vbox-dev

Reply via email to