/** Open port for read access. */
SP_MODE_READ = 1,
/** Open port for write access. */
- SP_MODE_WRITE = 2
+ SP_MODE_WRITE = 2,
+ /** Open port for read and write access. */
+ SP_MODE_READ_WRITE = 3
};
/** Port events. */
CHECK_PORT();
- if (flags > (SP_MODE_READ | SP_MODE_WRITE))
+ if (flags > SP_MODE_READ_WRITE)
RETURN_ERROR(SP_ERR_ARG, "Invalid flags");
DEBUG_FMT("Opening port %s", port->name);
int flags_local = O_NONBLOCK | O_NOCTTY;
/* Map 'flags' to the OS-specific settings. */
- if (flags & (SP_MODE_READ | SP_MODE_WRITE))
+ if ((flags & SP_MODE_READ_WRITE) == SP_MODE_READ_WRITE)
flags_local |= O_RDWR;
else if (flags & SP_MODE_READ)
flags_local |= O_RDONLY;