Klaus Espenlaub wrote:
Manio wrote:
Hello again.
I just want to ask - if there is a chance to commit my patch - was it reviewed and is it ok?

It breaks OSX. OSX and Linux are using the same code, and OSX doesn't have linux headers. So it needs to be cleaned up a bit.

The basic code seems ok from a first look.

Klaus


Hello
Sorry for very long delay. I am attaching fixed patch (made on trunk) - i hope it is ok now (patch license: MIT).

regards,
Mariusz Bialonczyk
Index: src/VBox/Devices/Serial/DrvHostSerial.cpp
===================================================================
--- DrvHostSerial.cpp	(revision 27334)
+++ DrvHostSerial.cpp	(working copy)
@@ -66,6 +66,8 @@
 #  ifndef TIOCM_LOOP
 #   define TIOCM_LOOP 0x8000
 #  endif
+/* For linux custom baudrate code we also need the serial_struct */
+#  include <linux/serial.h>
 # endif /* linux */
 
 #elif defined(RT_OS_WINDOWS)
@@ -239,6 +241,9 @@
     PDRVHOSTSERIAL pThis = PDMICHAR_2_DRVHOSTSERIAL(pInterface);
 #if defined(RT_OS_LINUX) || defined(RT_OS_DARWIN) || defined(RT_OS_SOLARIS) || defined(RT_OS_FREEBSD)
     struct termios *termiosSetup;
+# ifdef RT_OS_LINUX
+    struct serial_struct *serialStruct;
+# endif
     int baud_rate;
 #elif defined(RT_OS_WINDOWS)
     LPDCB comSetup;
@@ -305,7 +310,21 @@
             baud_rate = B115200;
             break;
         default:
+#ifdef RT_OS_LINUX
+            /* non-standard baud rate handling (currently for linux only) */
+            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;
+#else
             baud_rate = B9600;
+#endif
     }
 
     cfsetispeed(termiosSetup, baud_rate);
_______________________________________________
vbox-dev mailing list
[email protected]
http://vbox.innotek.de/mailman/listinfo/vbox-dev

Reply via email to