Generalize serial device config getter function.
Add handling of CTRL+c signal.