make connect/disconnect work properly for serial.
This did include some refactoring, sorry if that interfers with someone
else's work! Should be too hard to merge tho (and I couldn't find
Edouard online, and I'll be gone the rest of the weekend :) ).
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1512 ebee16cc-31ac-478f-84a7-5cbb03baadba