VirtualBox

Changeset 27394 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
Mar 16, 2010 12:32:40 PM (15 years ago)
Author:
vboxsync
Message:

Devices/Serial: add code to handle arbitrary baudrates on linux host. Contributed by Mariusz Bialonczyk.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Serial/DrvHostSerial.cpp

    r26173 r27394  
    22/** @file
    33 * VBox stream I/O devices: Host serial driver
    4  *
    5  * Contributed by: Alexander Eichner
    64 */
    75
    86/*
    9  * Copyright (C) 2006-2007 Sun Microsystems, Inc.
     7 * Copyright (C) 2006-2010 Sun Microsystems, Inc.
    108 *
    119 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    6765#   define TIOCM_LOOP 0x8000
    6866#  endif
     67/* For linux custom baudrate code we also need serial_struct */
     68#  include <linux/serial.h>
    6969# endif /* linux */
    7070
     
    306306            break;
    307307        default:
     308#ifdef RT_OS_LINUX
     309            struct serial_struct serialStruct;
     310            if (ioctl(pThis->DeviceFile, TIOCGSERIAL, &serialStruct) != -1)
     311            {
     312                serialStruct.custom_divisor = serialStruct.baud_base / Bps;
     313                if (!serialStruct.custom_divisor)
     314                    serialStruct.custom_divisor = 1;
     315                serialStruct.flags &= ~ASYNC_SPD_MASK;
     316                serialStruct.flags |= ASYNC_SPD_CUST;
     317                ioctl(pThis->DeviceFile, TIOCSSERIAL, &serialStruct);
     318                baud_rate = B38400;
     319            }
     320            else
     321                baud_rate = B9600;
     322#else /* !RT_OS_LINUX */
    308323            baud_rate = B9600;
     324#endif /* !RT_OS_LINUX */
    309325    }
    310326
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette