system-independent serial port handling