code: def devop_write(self, args, bustype):
          '''write to a device'''
          usage = "Usage: devop write <spi|i2c> name bus address regstart count <bytes>"
          if len(args) < 5:
              print(usage)
              return
          name = args[0]
          bus = int(args[1],base=0)
          address = int(args[2],base=0)
          reg = int(args[3],base=0)
          count = int(args[4],base=0)
          args = args[5:]
          if len(args) < count:
              print(usage)
              return
          bytes = [0]*128
          for i in range(count):
              bytes[i] = int(args[i],base=0)
          self.master.mav.device_op_write_send(self.target_system,
                                               self.target_component,
                                               self.request_id,
                                               bustype,
                                               bus,
                                               address,
                                               name,
                                               reg,
                                               count,
                                               bytes)
          self.request_id += f devop_write(self, args, bustype):
          '''write to a device'''
          usage = "Usage: devop write <spi|i2c> name bus address regstart count <bytes>"
          if len(args) < 5:
              print(usage)
              return
          name = args[0]
          bus = int(args[1],base=0)
          address = int(args[2],base=0)
          reg = int(args[3],base=0)
          count = int(args[4],base=0)
          args = args[5:]
          if len(args) < count:
              print(usage)
              return
          bytes = [0]*128
          for i in range(count):
              bytes[i] = int(args[i],base=0)
          self.master.mav.device_op_write_send(self.target_system,
                                               self.target_component,
                                               self.request_id,
                                               bustype,
                                               bus,
                                               address,
                                               name,
                                               reg,
                                               count,
                                               bytes)
          self.request_id += 1
docs: write to a device