merged handler.go from serial_plug
merged serial.go from serial_plug