From bdd5913945e4799bf68708beda502462437d82d2 Mon Sep 17 00:00:00 2001 From: Stefano Ceccherini Date: Wed, 10 Nov 2004 12:43:06 +0000 Subject: [PATCH] Small cleanup, added a comment to some obscure code git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9898 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/device/SerialPort.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/kits/device/SerialPort.cpp b/src/kits/device/SerialPort.cpp index b116d1cf3b..d39de1587e 100644 --- a/src/kits/device/SerialPort.cpp +++ b/src/kits/device/SerialPort.cpp @@ -22,8 +22,7 @@ #define SERIAL_DIR "/dev/ports" // Scans a directory and adds the entries it founds as strings to the -// given list. TODO: It should be moved to another place, since it could be -// used by BJoystick too. +// given list static int32 scan_directory(const char *directory, BList *list) { @@ -115,9 +114,11 @@ BSerialPort::Open(const char *portName) ffd = open(buf, O_RDWR | O_NONBLOCK | O_EXCL); if (ffd >= 0) { - //Setup the port - int ret = fcntl(ffd, F_GETFL); - fcntl(ffd, F_SETFL, ret & 0x7F); + // we used open() with O_NONBLOCK flag to let it return immediately, + // but we want read/write operations to block if needed, + // so we clear that bit here. + int flags = fcntl(ffd, F_GETFL); + fcntl(ffd, F_SETFL, flags & ~O_NONBLOCK); DriverControl(); }