title: Cannot get Android Open Accessory to work on Samsung Galaxy devices
body: <p>I'm playing around with Google Open Accessory.<br/>
  I've tested with a simple implementation on the Arduino Mega ADK and<br/>
  an implementation on a .NET MF chip (c#).</p>
  
  <p>When I connect either device to a cheap tablet, for example the ONDA V712 
  <br/>(<a href="http://www.onda-sale.com/onda-v712-dual-core-7-inch-16gb.html" rel="nofollow">http://www.onda-sale.com/onda-v712-dual-core-7-inch-16gb.html</a>),<br/>
  the tablet detects the accessory and asks me to install the required APK.
  <br/>If however I connect either device to a Samsung Galaxy S3, Note II or Note 8 it doesn't work. <br/>
  The Galaxy simply says: "Connected as USB media device".</p>
  
  <p><br/>I find it hard to believe the Galaxy range of devices are not compatible with #android open accessory so perhaps those devices need a configuration tweak of some kind? To give an idea, the code for the Arduino Mega ADK is taken from a sample from WROX:</p>
  
  <pre><code>#include &lt;AndroidAccessory.h&gt;
  #include &lt;ch9.h&gt;
  #include &lt;Max3421e.h&gt;
  #include &lt;Max3421e_constants.h&gt;
  #include &lt;UsbHost.h&gt;
  
  char application [] = "wrox_temperature_sensor";
  char accessory [] = "wrox_temperature_sensor";
  char company [] = "Wiley";
  char versionNbr[] = "1.0";
  char serialNbr[] = "1";
  char url[] = "http://media.wiley.com/product_ancillary/66/11184547/DOWNLOAD/t.apk";
  int sensorPin = 0;
  long timer = millis();
  AndroidAccessory usb(company, application, accessory, versionNbr, url,serialNbr);
  
  
  void setup() 
  {
      usb.begin();
  
  }
  
  void loop() 
  {
    if (usb.isConnected()) 
    {
      if( millis() - timer &gt; 10 ) 
      {
        int val = analogRead( sensorPin );
        float voltage = (val * 5.0) / 1024.0;
        float tempCelcius = voltage * 100;
        float tempKelvin = tempCelcius + 273.15;
        byte * b = (byte *) &amp;tempKelvin;
        usb.write(b, 4);
        timer = millis();
      }
    }
  }
  </code></pre>
  
  <p>But I'm thinking the Arduino/NetMF devices are not the problem.<br/></p>
  
  <p>I've also powered the Arduino with a 12v adapter so that it has 
  <br/>enough juice to power/charge the Galaxy devices.</p>
  
  <p>Arduino output when connected to a Galaxy device:</p>
  
  <blockquote>
    <p>Device addressed... Requesting device descriptor. found possible<br/>
    device. swithcing to serial mode could not read device protocol<br/>
    version<br/></p>
  </blockquote>
  
  <p>Arduino output when connected to the Onda device:</p>
  
  <blockquote>
    <p>Device addressed... <br/>Requesting device descriptor. found android<br/>
    acessory device<br/> config desc interface desc<br/> 1<br/> 2</p>
  </blockquote>
  
  <p>I also checked if there is a file on each of the Galaxy devices
  indicating AOA support, and there is: '<em>/etc/permissions/android.hardware.usb.accessory.xml</em>'</p>
  
  <pre><code>&lt;permissions&gt;
      &lt;feature name="android.hardware.usb.accessory" /&gt;
      &lt;library name="com.android.future.usb.accessory"
             file="/system/framework/com.android.future.usb.accessory.jar" /&gt;
  &lt;/permissions&gt;
  </code></pre>
  
  <p>Notes:</p>
  
  <p>On the Arduino side, I'm using the <code>UsbHost</code> library from <code>ArduinoADK-beta-001.zip</code> <br/>
  which I donwloaded from the ADK site. That archive contains two versions, version 1 and version 2, but using version 2 the code and samples don't even compile.</p>
  
  <p>Each of the Galaxy devices use Android 4.1.1 or higher.</p>