Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'HEAD' of git@github.com:xcore/sc_android_aap.git
- Loading branch information
Showing
8 changed files
with
114 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Android Accessory Protocol Using XMOS Draft | ||
=========================================== | ||
|
||
.. toctree:: | ||
|
||
01_overview | ||
02_aap | ||
03_demo | ||
04_phone_app | ||
05_todo | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
Introduction | ||
============ | ||
|
||
This document is the guide to Android Accessory Protocol Demo using XMOS. | ||
|
||
Objectives | ||
---------- | ||
|
||
This document aims to achieve the following goals: | ||
|
||
* Understand the Android Accessory Protocol | ||
* Explain whats happeneing in the demo | ||
* Provide pointers to resources used to build this demo | ||
* Summary and TODO list |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
Android Accessory Protocol | ||
========================== | ||
|
||
[1] http://developer.android.com/guide/topics/usb/adk.html | ||
|
||
Android Accessory Protocol defines how an accessory detects and sets up communication with an Android-powered device. | ||
|
||
External USB devices can communicate with Android-powered device (Version 2.3.4 and above - check!) in a special 'accessory' mode. Using this, the Android-powered device can act as a 'USB Device'. For simplicity, let's call the Android-powered device as 'APhone' and the connected USB accessory device as 'ADock'. | ||
|
||
When APhone is in 'accessory' mode: | ||
|
||
* ADock acts as USB host, powers the bus and enumerates devices | ||
* APhone acts as USB Device | ||
|
||
Please note that not all Android-powered devices support the 'accessory' mode and this must be checked while enumeration. | ||
|
||
Implementation | ||
-------------- | ||
|
||
[2] http://developer.android.com/guide/topics/usb/adk.html#accessory-protocol | ||
|
||
ADock must follow these steps before communicating with APhone: | ||
|
||
* Wait for and detect connected devices | ||
* Determine APhone mode support | ||
* Attmept to start APhone in special accessory mode | ||
* Establish communication if APhone supports mode | ||
|
||
Determine APhone mode support and start in accessory mode | ||
--------------------------------------------------------- | ||
If the Vendor ID is 0x18D1 and Product ID is (0x2D00 | 0x2D01), then APhone supports and is in accessory mode | ||
|
||
If VID and PID do not satisfy matches then attempt to start in accessory mode by: | ||
|
||
* Send a 51 control request ('Get Protocol') on EP0. A non-zero return value indicates mode supported. | ||
* Send ADock identification strings (Control request 52 on EP0) for appropriate application selection on APhone. | ||
* Request the device to start in accessory mode by sending control request 53 on EP0. | ||
|
||
After sending the last control request, ADock must restart the enumeration process for this device. If at any point these steps fail, indicates that APhone does not support accessory mode and ADock must start looking for newly connected devices. | ||
|
||
Establish communication with device | ||
----------------------------------- | ||
Once APhone is in accessory mode, set it's configuration (0x09) to 1 (one). ADock must also find the first bulk input and output endpoints in APhone's interface descriptor. These bulk endpoints can now be used for communication with the APhone. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
Demo | ||
==== | ||
|
||
The Demo required following items: | ||
|
||
* A Samsung Google Nexus S Phone (with Android Version 2.3.6) | ||
* An iPod Dock V2 board with XTAG and the firmware loaded | ||
* IR Remote (the one by Apple is used here) | ||
|
||
In this demo, the ADock waits and identifies an APhone and waits for an IR remote input. | ||
|
||
The processes for APhone is carried out in USBHostStackWrapper() thread. The application thread waits for IR remote input. Once a IR remote command is received it is processed and is sent to the APhone using USB Bulk transfer functions. | ||
|
||
In this demo the IR remote buttons are configured to toggle button objects in APhone application. This is the match: | ||
|
||
* >|| = B1 | ||
* + = B2 | ||
* - = B3 | ||
* >>| = Gyro Position | ||
* others = not configured to do anything | ||
|
||
Every time a configured button pressed on IR remote it will toggle corresponding object in APhone application. | ||
|
||
Note: | ||
|
||
* If the phone enters sleep mode while the demo is in progress then it would break the connection and the setup must be reconnected. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
APhone Application used in Demo | ||
=============================== | ||
|
||
[1] http://developer.android.com/guide/topics/usb/adk.html#running-demokit | ||
|
||
Note that there is no contribution (yet) from XMOS to the phone application. Please follow guidelines in the above link. This phone application is designed for Arduino boards and such baords can make full use of this application. Since, we are using the iPod Dock board our ability to use the entire phone application feature is limited (but not impossible). Samsung Google Nexus was selected as target platform while following these steps and the Android version was 2.3.x. | ||
|
||
Once the DemoKit application is installed on the phone, it's icon will appear along with other (installed) phone application icons. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
TODO | ||
==== | ||
|
||
* Make use of a Generic sc_usb_host for simplicity | ||
* Use channels to send command to USB device |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
all : xmospdf | ||
|
||
SPHINX_PROJECT_NAME=Android Accessory Protocol Using XMOS | ||
VERSION=0.1 | ||
XDOC_DIR =../../xdoc | ||
include $(XDOC_DIR)/Makefile.inc |
This file was deleted.
Oops, something went wrong.