title: Communication with usb device using pyusb
body: <p>I am using a module called <a href="http://bleyer.org/pyusb/" rel="nofollow noreferrer">pyUSB</a> version 1.6 and am trying to communicate with a sensor. </p>
  
  <p>I have set up the connection and can read from the ROM on the sensor. The sensor, when connected, has a master/slave relationship so I need to send a message to the sensor to receive the data I need. </p>
  
  <p>Now, the <code>write</code> function can only accept a string or read-only buffer. I need to send the USB device the hexadecimal bytes <code>0xFE</code>, <code>0x04</code>, <code>0x00</code>, <code>0x03</code>, <code>0x00</code>, <code>0x01</code>, <code>0xD5</code>, <code>0xC5</code>. <br>I'm unsure how to encode that as a string or read-only buffer.</p>
  
  <p>Here is how one calls the write method. This is the sample code they provide.</p>
  
  <pre><code># write bytes (serial mode)
  
  print h.write('Hello world!\r\n")
  </code></pre>
  
  <p>How would I transfer the hexadecimal bytes?</p>