Remove sendbuf and use cmdbuf from main loop directly, thus removing one unnecessary buffer.
Fix using timeout correctly even when switch state is already as requested.