Improved handling of attaching and detaching device
Gateway now runs a rudimentary web interface for diagnosis (belongs to #242)