From bffb5235ac726cbb011818b78e621e36e246ed9d Mon Sep 17 00:00:00 2001
From: Robert Ly We expect more hardware distributers to create a variety of kits, so please stay tuned for
@@ -380,14 +383,11 @@ page.title=Android Open Accessory Development Kit
accessories communicate with Android-powered devices describe much of what you should be doing in
your own accessory. When you connect an accessory to an Android-powered device, the accessory's firmware must
- carry out some standard steps to set up communication with the Android-powered device. If you are
- building an accessory along with an application, this section goes over some general steps that
- your firmware should carry out. In general, an accessory should carry out the following steps: An Android USB accessory must adhere to Android Accessory Protocol, which defines how
+ an accessory detects and sets up communication with an Android-powered device. In general, an
+ accessory should carry out the following steps: The following sections go into depth about how to implement these steps. Your accessory should have logic to continuously check
@@ -476,12 +478,12 @@ data zero terminated UTF8 string sent from accessory to device
The following string IDs are supported, with a maximum size of 256 bytes for each string
(must be zero terminated with \0).
See also
@@ -64,7 +62,7 @@ page.title=Android Open Accessory Development Kit
Where to buy
@@ -78,6 +76,9 @@ page.title=Android Open Accessory Development Kit
@@ -86,7 +87,7 @@ page.title=Android Open Accessory Development Kit
support, which allows external USB hardware (an Android USB accessory) to interact with an
Android-powered device in a special "accessory" mode. When an Android-powered powered device is
in accessory mode, the connected accessory acts as the USB host (powers the bus and enumerates
- devices) and the Android-powered device acts as the device. Android USB accessories are
+ devices) and the Android-powered device acts as the USB device. Android USB accessories are
specifically designed to attach to Android-powered devices and adhere to a simple protocol
(Android accessory protocol) that allows them to detect Android-powered devices that support
accessory mode. Accessories must also provide 500mA at 5V for charging power. Many previously
@@ -112,6 +113,8 @@ page.title=Android Open Accessory Development Kit
How an Accessory Communicates with an Android-powered Device in Accessory Mode
+ Implementing the Android Accessory Protocol
-
+ Wait for and detect connected devices
-manufacturer name: 1
-model name: 2
-description: 3
-version: 4
-URI: 5
-serial number: 6
+manufacturer name: 0
+model name: 1
+description: 2
+version: 3
+URI: 4
+serial number: 5
@@ -520,12 +522,11 @@ data: none
device's configuration to a value of 1 with a SET_CONFIGURATION (0x09) device request, then
communicate using the endpoints.
If you have access to the ADK board and shield, the following sections describe the firmware code that you installed onto the ADK board. The firmware demonstrates a practical example of how - to communicate with an Android-powered device. Even if you do not have the ADK board and shield, + to implement the Android Accessory protocol. Even if you do not have the ADK board and shield, reading through how the hardware detects and interacts with devices in accessory mode is still useful if you want to port the code over for your own accessories.
@@ -540,8 +541,7 @@ data: none sections.The following sections describe the firmware code in the context of the algorithm described in - How an Accessory Communicates with an Android-powered Device in Accessory - Mode.
+ Implementing the Android Accessory Protocol.
-int AndroidAccessory::read(void *buff, int len, unsigned int nakLimit) {
- return usb.newInTransfer(1, in, len, (char *)buff, nakLimit); }
-
-int AndroidAccessory::write(void *buff, int len) {
- usb.outTransfer(1, out, len, (char *)buff);
+int AndroidAccessory::read(void *buff, int len, unsigned int nakLimit) {
+ return usb.newInTransfer(1, in, len, (char *)buff, nakLimit); }
+
+int AndroidAccessory::write(void *buff, int len) {
+ usb.outTransfer(1, out, len, (char *)buff);
return len; }
-
+
See the firmware/demokit/demokit.pde file for information about how the ADK board