title: How to send hid data to device using python / pywinusb?
body: <p>I'm trying to use pywinusb to send output report to a pic18f4550.  The device can receive data, and I've tested it with a C# application, which worked fine.  Also, I can read data from the device with pywinusb just fine, but I have a problem trying to send data.</p>
  
  <p>Here's the code I'm running:</p>
  
  <pre><code>from pywinusb import hid
  
  filter = hid.HidDeviceFilter(vendor_id = 0x0777, product_id = 0x0077)
  devices = filter.get_devices()
  
  if devices:
      device = devices[0]
      print "success"
  
  device.open()
  out_report = device.find_output_reports()[0]
  
  buffer= [0x00]*65
  buffer[0]=0x0
  buffer[1]=0x01
  buffer[2]=0x00
  buffer[3]=0x01
  
  out_report.set_raw_data(buffer)
  out_report.send()
  dev.close()
  </code></pre>
  
  <p>It produces this error:</p>
  
  <pre><code>success
  Traceback (most recent call last):
    File "C:\Users\7User\Desktop\USB PIC18\out.py", line 24, in &lt;module&gt;
      out_report.send()
    File "build\bdist.win32\egg\pywinusb\hid\core.py", line 1451, in send
      self.__prepare_raw_data()
    File "build\bdist.win32\egg\pywinusb\hid\core.py", line 1406, in __prepare_raw_data
      byref(self.__raw_data), self.__raw_report_size) )
    File "build\bdist.win32\egg\pywinusb\hid\winapi.py", line 382, in __init__
      raise helpers.HIDError("hidP error: %s" % self.error_message_dict[error_code])
  HIDError: hidP error: data index not found
  </code></pre>