trying to impement a smart_rx function
having difficulties implementing smart receive function which will use O_NONBLOCK on the serial port, then try to read from it several times before timing out, rather than having O_NONBLOCK cleared and risk hanging the process