implement sending commands to the device

upstream implemented this in  442281e00b5fe03023f41ab6a3f1d452b048131a