Leveraging the Android Accessory Protocol



Similar documents
PART I: WELCOME TO THE WONDERFUL WORLD OF ACCESSORIES CHAPTER 1: INTRODUCTION TO ANDROID OPEN ACCESSORY 3

Example Connection between USB Host and Android

Home Automation & Security System Using Arduino Android ADK

Board also Supports MicroBridge

Useful USB Gadgets on Linux

User s Manual of Board Microcontroller ET-MEGA2560-ADK ET-MEGA2560-ADK

01. Introduction of Android

White Paper WP_001. Connecting Peripherals to an Android Platform

Android, Bluetooth and MIAC

i.mx USB loader A white paper by Tristan Lelong

How To Use An Atmel Atmel Avr32848 Demo For Android (32Bit) With A Microcontroller (32B) And An Android Accessory (32D) On A Microcontroller (32Gb) On An Android Phone Or

Running a Program on an AVD

An introduction to nxpusblib. March 2012

GETTING STARTED WITH ANDROID DEVELOPMENT FOR EMBEDDED SYSTEMS

Cisco Stadiumvision Mobile Software Development Kit

Now SMS/MMS Android Modem Quick Start Guide

Introducing the Adafruit Bluefruit LE Sniffer

THE UT880. Desktop Telephone. Empowering the Smart Enterprise.

A-307. Mobile Data Terminal. Android OS Platform Datasheet

IRON-HID: Create your own bad USB. Seunghun Han

Application Note AN_243. FT312D USB Host to UART Cable Application

Graduate presentation for CSCI By Janakiram Vantipalli ( Janakiram.vantipalli@colorado.edu )

Android Auto PoC. October Oct-15. Maxim Ovchinnikov Architect Harman

Android on i.mx Applications Processors

The Android Breathalyzer is not a professional Breathalyzer and should be used for Amusement Purposes Only. Drive Safely!

TUTORIAL FOR INITIALIZING BLUETOOTH COMMUNICATION BETWEEN ANDROID AND ARDUINO

Ways to Use USB in Embedded Systems

RPLIDAR. Low Cost 360 degree 2D Laser Scanner (LIDAR) System Development Kit User Manual Rev.1

New Technology Introduction: Android Studio with PushBot

Specialized Android APP Development Program with Java (SAADPJ) Duration 2 months

Android Basics. Xin Yang

Bluetooth Solutions for Apple ios Devices 2/14/2013 1

1. Click and select to enter the Device Management interface. 2. Click to add a new device.

Intro to Intel Galileo - IoT Apps GERARDO CARMONA

MOVEIRO BT-200 Technical Information for Application Developer

Bluetooth HID Profile

Android Architecture. Alexandra Harrison & Jake Saxton

Technical Note. TN_132 Adding FTDI Devices VCP Driver Support to Android

Discovering Computers

Fall 2011 SYSTEM ARCHITECTURE DESIGN TEAM MEMBERS: PROJECT OWNERS: AMIR 15 ECTS) EKAMBAR

Lab 0 (Setting up your Development Environment) Week 1

An Analysis of Wireless Device Implementations on Universal Serial Bus

Android Application Development and Bluetooth Technology

I vantaggi dell?utilizzo di JAVA nella strategia M2M

Practice Fusion API Client Installation Guide for Windows

How To Develop Android On Your Computer Or Tablet Or Phone

PrinterOn Embedded Application For Samsung Printers and MFPs

SNAPPIN.IO. FWR is a Hardware & Software Factory, which designs and develops digital platforms.

Bridging Sensors to Mobile Phones. Stephen Okay February 22nd 2012 The Abdus Salam Int l Center for Theoretical Physics Trieste, Italy

ARM Processors and the Internet of Things. Joseph Yiu Senior Embedded Technology Specialist, ARM

ANDROID LEVERED DATA MONITORING ROBOT

Workshop on Android and Applications Development

A-317. Mobile Data Terminal. Android Platform Datasheet

OpenCV on Android Platforms

MediaQ M310. Quick Start HUAWEI TECHNOLOGIES CO., LTD.

Developing for MSI Android Devices

Introduction to FileWave

What is Android? originally purchased from Android, Inc. in 2005

AdRadionet to IBM Bluemix Connectivity Quickstart User Guide

ivms-4500 HD (Android) Mobile Client Software User Manual (V3.4)

Software Installation Manual

Reverse engineering smart cards

Title: Appium Automation for Mac OS X. Created By: Prithivirajan M. Abstract. Introduction

Health Monitoring Demo for ice40 Ultra Wearable Development Platform User Guide. UG103 Version 1.0, September 2015

Chord Limited. Mojo Dac Headphone Amplifier OPERATING INSTRUCTIONS

Modern Robotics, Inc Core Device Discovery Utility. Modern Robotics Inc, 2015

About Us. Technology Solutions & Services Company. Turn Innovative Ideas into Real Products & Software, Efficiently

Spontania User Setup Guide

Embedded Software Development: Spottbillige Hardware + OSS = Zum Spielen zu Schade!

Configuring PROFINET

Creating and Using Databases for Android Applications

Vmed QUICKSTART PC-DISPLAY INSTALLATION & PC-Display and Bluetooth Instructions

White Paper WP_003. Android Peripheral Options

Adding WiFi to Your Embedded System. WPG Americas & Gainspan Titus Wandinger (WPG) & Su Li (Gainspan) April 23, 2013

Professional Tizen Application Development

Table of Contents. Adding Build Targets to the SDK 8 The Android Developer Tools (ADT) Plug-in for Eclipse 9

CPSC 226 Lab Nine Fall 2015

Chapter 1 Hardware and Software Introductions of pcduino

Prototyping Connected-Devices for the Internet of Things. Angus Wong

Embedded Display Module EDM6070

file://d:\webs\touch-base.com\htdocs\documentation\androidplatformnotes52.htm

Introducing BEEKS Proximity Solutions. Developer Kit Gets You Started

DeviceAnywhere Enterprise. ios Device Onboarding Guide

FREQUENTLY ASKED QUESTIONS

GS-SL2X00 Series. GS-WTX00 Series. Enterprise Android Barcode Device. User Manual

Building a Basic Communication Network using XBee DigiMesh. Keywords: XBee, Networking, Zigbee, Digimesh, Mesh, Python, Smart Home

Smartphone Quick-Jack Solution FASTER TO PRODUCT FASTER TO MARKET

Developing Mobile Applications

For the Future IT Convergence Vehicle Connected & Downloadable Infotainment Platform. Pusik Park. Korea Electronics Technology Institute

TECHNICAL BULLETIN. Checking the products and their versions that we have confirmed the operation on Windows 8 and Windows 8.1.

KURA M2M/IoT Gateway. reducing the distance between embedded and enterprise technologies. Tiziano Modotti, October 28 th, 2014

Development Techniques for Native/Hybrid Tizen Apps. Presenter Matti Pakarinen

ZigBee Technology Overview

Guarding Expert (Android Tablet) Mobile Client Software User Manual (V3.1)

5100 SERIES 32-CHANNEL SWITCHBOX NVR

Eldorado Research Institute. Photo: Halo, Aug 2008 Campinas sky in the first working day at new Eldorado building

Important Bluetooth. and Software Considerations for Wireless Barcode Scanner Deployments

Bluetooth Pairing with CUE - Android TM

SMARTDEVICELINK CONNECTIVITY FROM THE CAR S POINT OF VIEW

rs-ba1 remote control software quick reference guide

Transcription:

Leveraging the Android Accessory Protocol Gary Bisson Adeneo Embedded gbisson@adeneo-embedded.com Android Builders Summit 2013 1

Session Overview Introduction to Android Open Accessory Protocol specifications Accessory Development Kit Software implementation Demonstrations 2

Who am I? Software engineer at Adeneo Embedded (Bellevue, WA) Linux, Android Main activities: BSP adaptation Driver development System integration 3

Introduction to AOA Allows USB hardware to interact with an Android-powered device No need for the Android device to act as USB Host Standard API Introduced in Android 3.1 (API level 12) Backported to Android 2.3.4 (API level 10) Version 2.0 released with Android 4.1 4

Introduction to AOA USB Device USB Host USB Connection USB Accessory Android Device ADK Hardware 5

AOA 1.0 Protocol Android Open Accessory 1.0 is a protocol that allows an Android device to interact with an Android USB accessory in a special accessory mode. Basically there are four steps to initiate the communication. 6

AOA 1.0 Protocol 1. Wait for and detect connected devices USB Enumeration Accessory Android Device Vendor ID Product ID 7

AOA 1.0 Protocol 2. Determine the device s accessory mode support AOA 1.0/2.0 Accessory Android Device Get Protocol #51 8

AOA 1.0 Protocol The accessory must check the Vendor & Product ID s of the connected device Possibility to target some devices Detection of devices already in Accessory mode If it is already in accessory mode then: Vendor ID = 0x18D1 (Google) Product ID = 0x2D00 0x2D01 9

AOA 1.0 Protocol Accessory mode product IDs 0x2D00 Supports Accessory Mode 1 interface with 2 bulk endpoints 0x2D01 Supports Accessory Mode + ADB 2 interfaces with 2 bulk endpoints each If it is not in accessory mode then Accessory mode support can be asked: Send a Get Protocol request (51) on endpoint 0 AOA Version (1.0 or 2.0) is returned by Android device 10

AOA 1.0 Protocol 3. Attempt to start the device in accessory mode Accessory Android Device Identity Strings #52 Start Accessory #53 11

AOA 1.0 Protocol If the AOA Version # is okay, then send string s identifying our ADK to the device Send Identity request (52) for each identifier: Manufacturer Model Name Description Version URL Serial Number Send Start Accessory request (53) to request the Android device re-introduce itself on the bus in accessory mode 12

AOA 1.0 Protocol 4. Establish communications CMD / RESPONSE Accessory Android Device 13

AOA 1.0 Protocol The accessory must obtain the Bulk endpoints and be prepared to initiate communication with the device. From this point the communication is defined by the ADK Developer 14

AOA 2.0 Protocol AOA 2.0 was released at Google I/O end of June 2012 alongside Jelly Bean Two new features: Audio Output Accessory as HID 15

AOA Protocol version 2.0 Audio output: From an Android device to an accessory Standard USB audio class interface (ISO) Only supports 2 Channel, 16-bit PCM @ 44100KHz To enable the audio support, the accessory must send a new USB control request: Audio Support request (58) 16

AOA Protocol version 2.0 HID support: Registers one or more USB HID with to the Android device. Reverses the direction of communication for typical USB HID (Host <-> Device). Uses USB control requests: ACCESSORY_REGISTER_HID ACCESSORY_UNREGISTER_HID ACCESSORY_SET_HID_REPORT_DESC ACCESSORY_SEND_HID_EVENT 17

AOA Protocol version 2.0 Compatible with original AOA 1.0 protocol Also adds Bluetooth support Not the focus of this presentation Example available in ADK source code 18

AOA 2.0 Protocol New Product ID s 0x2D02 Supports Audio 2 Audio interfaces (control + streaming) 0x2D03 Supports Audio + ADB 3 interfaces: 2 Audio + 1 Bulk 0x2D04 Supports AOA 1.0 + Audio 3 interfaces: 2 Audio + 1 Bulk 0x2D05 Supports AOA 1.0 + Audio + ADB 4 interfaces: 2 Audio + 2 Bulk 19

Accessory Development Kit Hardware for ADK 2011 is based on a Arduino Mega2560 Hardware for the ADK 2012 is based on an ARM Cortex M3 ADK 2012 Guide 20

What part of AOA do you Control? ADK SW Developer controls what runs on the ADK HW and what runs on the Android device ADK HW? Yes! Just requires a USB Host capable device that can provide power to the Android device This is what makes it easy to port the ADK SW to any ARM-based board 21

ADK Software Google provides sample software for both sides: Source code repo: http://android.googlesource.com/accessories/manifest Android device application can apply on any device with API level > 10 Android Application presents UI for control, and communication Accessory code is Arduino-specific Need for a libusb-based Accessory sample code 22

Software implementation 1. Software on the ADK HW Handles communication with Android device Controls sensors, displays, etc. on the ADK HW 2. Software on the Android device Can be installed automatically via pop-up URL on connection Handles communication with ADK HW Presents a GUI for control, data input/output from ADK 23

Software implementation In case the software is not already installed: 24

Software implementation Otherwise the user must authorize the execution of the Accessory app: 25

Application on the Android Device Must discover the accessory when it is attached Communicate with the accessory via ADK Developer defined commands over USB Utilizes the USB API in Android 26

Application on the Android Device Android contains two different packages to support AOA protocol: android.hardware.usb Works with no add-on library for Android 3.1 or higher com.android.future.usb From Google API add-on library for Android 2.3.4 or higher Wrapper around android.hardware.usb Better choice to support the widest range of devices 27

Discovering the Accessory First add an intent-filter to the application s manifest (AndroidManifest.xml) 28

Discovering the Accessory Then define a resource file that details which USB Accessory this Application communicates with (accessory_filter.xml) 29

Communication with the Accessory Grab the UsbAccessory handle from the Intent received Open up input/output file streams with the Accessory (myactivity.java) 30

Demonstrations Android Device: Stock Nexus 7 Tablet running Android Jellybean (v4.2.1) Custom ARM-based accessory Raspberry Pi model B Running Linux 31

Demonstrations Why were these particular platforms chosen? Raspberry Pi is a very cheap & popular board nowadays Wanted to show ease of using libusb-based code Nexus 7 is a recent stock device that needs no modification Any Jellybean device would work the same 32

Demonstration #1 Create an accessory device that: Displays pictures Allows control of the slideshow from Android Shows AOA v1.0 capabilities Application on both sides 33

Demonstration #2 Create an accessory device that: Plays audio Adds 1 Human Interface Device Shows AOA v2.0 capabilities No application required on Android device 34

Conclusion Interesting standard Great flexibility Compatibility v2.0 / v1.0 Limitations Audio format Full code sources soon available at: http://github.com/gibsson 35

Questions? 36

References Based on Jesse Dannenbring s presentation: https://speakerdeck.com/jdannenbring/ad- 2002slides-dannenbring https://github.com/jdannenbring/android-armaccessory https://github.com/jdannenbring/android-armaccessory-app Android Developers. http://developer.android.com/index.html. 1 February 2013. 37

References Di Cerbo, Manuel. Turn your Linux computer into a huge Android USB Accessory Using Android in Industrial Automation. 5-13-2011. http://android.serverbox.ch/?p=262 libusb. http://www.libusb.org/. 1 February 2013. monaka / libusb-android / overview. https://bitbucket.org/monaka/libusb-android/. 1 February 2013. Portions of these slides are reproduced from work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License. 38

39