SlideShare ist ein Scribd-Unternehmen logo
1 von 20
Downloaden Sie, um offline zu lesen
Android Open Accessory Protocol
Turn Your Linux machine as ADK
By
Rajesh Sola,
CDAC ACTS,Pune
`
OSI Days 2014,
Nimhans Convention
Centre, Bengaluru
Outline
● Need for AOA Protocol/ADK
● Introduction,History
● Available ADK hardware
● Initializing Android device
● Using driver skeleton
● Communication – ADK Side
● Sample Apps
● Developing your own apps
● Communication – Android Side
Need for AOA Protocol/ADK Host
● Peripheral support of typical android gadget
● Adding more peripherals like temperature
sensor,CANBus support,SPI,I2C,PWM etc?
● With/wthout rooting of android device
● Scope of Android USB Host capabilities
● USB device capabilities of android gadget
● Alternatives for USB – Bluetooth,WiFi etc.
● Designing rich UI for your hardware control.
● Lets talk about the solution for all...
ADK Host
● In this protocol android gadget is kept in device mode
and external hardware will be chosen in host mode
● Any hardware with USB host capabilities and capable
of supplying a power of 5V@500mA to the android
device can be chosen for this purpose,which is called
as Android Accessory Development Kit(ADK) or
Accessory Host
● Simple USB communication with two bulk end
points
History
● AOA v1.0
– Supported from Android 3.1(API Level 12) onwards
– With add on library from Android 2.3.4(API level 10)
– Announced in Google I/O 2011
– Demonstrated through Custom shield for Arduino
Mega board
● AOA v2.0
– Supported from Android 4.1(API Level 16) onwards
– Comes with additional features like audio,hid
support and bluetooth connectivity
– Announced in Google I/O 2012
– Demonstrated through Arduino Due based custom
board
Available Hardware for ADK
● Arduino Mega
● Arduino Due
● AOA kit from Embedded Artists
● FTDI Vinculum II
● Microchip PIC24F ADK
● Sparkfun IOIO
● BeagleBone powered with TI Starterware
Any Linux machine with USB Host support
Not limited to this hardware,any
board with USB Host support can
be designed as ADK with suitable
USB Host APIs. The only advantage
with this listing is availability of some
sample code and certain tested apps.
Initialization
Step1:-
● Send Control request 51(0x33) to get the protocol
version
● Returns 1 for AOA 1.0, 2 for AOA 2.0
bmRequestType TYPE_VENDOR|
DIR_DEVICE_TO_HOST
bRequest 51
wValue 0
wIndex 0
Data Address of two byte buffer
wLength 2
Initialization
Step2:-
● Send identity strings through control request 52
● Essentially one should send manufacturer, model,
version to communicate ADK with an app
● Rest all are optional
bmRequestTyp
e
TYPE_VENDOR|
DIR_HOST_TO_DEVICE
bRequest 52
wValue 0
wIndex String id
Data Address of string
wLength Length of the string
String IDs
Manufacturer 0
Model 1
Description 2
Version 3
Url 4
Serial id 5
Initialization
Step3:-
● Start in accessory mode through control request
53(0x35)
● Launch an app matched by essential identity strings
or start without app just for audio/hid support.
bmRequestType TYPE_VENDOR|
DIR_HOST_TO_DEVICE
bRequest 53
wValue 0
wIndex 0
Data NULL
wLength 0
Audio Support
● Send control request 0x58 for audio support with
value=1 for 2 channel 16 bit PCM @ 44100 Kh`z
● If you are requesting for audio support,this must be
done before starting in accessory mode
● If manufacturer,model identity strings are not
supplied device goes to audio only mode
bmRequestType TYPE_VENDOR|
DIR_HOST_TO_DEVICE
bRequest 53
wValue 1
wIndex 0
Data NULL
wLength 0
HID Support
● ADK can acts as HID event source or HID proxy to
your android device
● The following request codes are used for HID support
Register HID 54
Unregister HID 55
Set HID Report 56
Send HID Event 57
Configuration
0x18D1:0x2D00 Accessory only
0x18D1:0x2D01 Accessory+ADB
0x18D1:0x2D02 Audio only
0x18D1:0x2D03 Audio + ADB
0x18D1:0x2D04 Accessory + Audio
0x18D1:0x2D05 Accessory + Audio + ADB
● Upon initialization android device switches to
accessory mode from MTP/PTP mode and re-
enumerated by ADK Host with one of the following
vendor id,product id combinations and interface 0
with two bulk end points for communication
Using driver skeleton
● Hosted on github.com/rajeshsola/adk-driver-skeleton
based on Gary Bisson's libusb based linux-adk code
● Load the driver,optionally with module parameters
my_dev_vid, my_dev_pid
● Initialize using simple shell commands
cat /sys/kernel/adk_linux/aoa_init/version
echo “Manu=OSI Days” > /sys/kernel/adk_linux/aoa_init/identity
echo “Model=uisample” > /sys/kernel/adk_linux/aoa_init/identity
echo “version=1.0” > /sys/kernel/adk_linux/aoa_init/identity
echo “accessory” > /sys/kernel/adk_linux/aoa_init/start
● Alternatives for initialization
ioctl code
module parametet init_on_probe=1
Communication – ADK side
● Simple userspace file operations on linux(ADK) side to talk to
the app
● Start the communication
fd=open(“/dev/aoa-skel0”,O_RDWR);
● For output peripherals(Android to ADK), eg:- LEDs,Volume
read(fd,buf,len);
//process the buffer and control peripherals
● For input peripherals(ADK to Android), eg:- Sensors, RTC
//fill the buffer with state of peripherals
write(fd,str,len);
● Stop the communication
close(fd);
● can go for threaded design for Asynchronous transfer
Sample Apps
● From Google Playstore
– ADK 2012 from Google
– Basic Accessory Demo from Microchip
● From other repositories with source code
– SimpleAccessory Demo
– Examples for AOA Kit from Embedded Artists
– ADK Demo from rowboat project for beagle bone
– TinyAccessory Demo
– FTDI Android examples
Developing Your own Apps
● intent-filter section and other changes in Manifest file
● Getting the reference of USB service manager
● Getting the reference for connected accessory
● Checking/Obtaining permissions
● Getting references of file streams
● Steps to take care during Activity life cycle
– OnCreate
– OnPause
– OnResume
– OnDestroy
● A walk through of skeleton code ADKControl class
Communication – Android App side
● Add the skeleton class ADKControl to your project
● Create an instance of ADKControl in MainActivity
by passing the reference of same,if necessary pass the
reference of ADKControl to other activities or
fragments or retrieve through getInstance(null)
ADKControl adk=ADKControl.getInstance(this)
● Use sendCommand method for output activity,in
appropriate listeners
● Use readData method for input activity, preferably in
a different thread for asynchronous read
● Can obtain references for Input,Output references
using methods getInputStream,getOutputStream
An Example – App to ADK
Peripheral
Type
Peripheral
Id
Peripheral
State/Data
Peripheral
Data
Peripheral
Data
Byte buffer
0 1 2 3 4
--------------->
An Example – ADK to App
Input
Type
DataData DataData DataData --------------->
0x46 hours mins secs
Thank You
http://github.com/rajeshsola/adk-driver-skeleton
rajeshsola@gmail.com

Weitere ähnliche Inhalte

Was ist angesagt?

Trusted firmware deep_dive_v1.0_
Trusted firmware deep_dive_v1.0_Trusted firmware deep_dive_v1.0_
Trusted firmware deep_dive_v1.0_Linaro
 
LCU13: An Introduction to ARM Trusted Firmware
LCU13: An Introduction to ARM Trusted FirmwareLCU13: An Introduction to ARM Trusted Firmware
LCU13: An Introduction to ARM Trusted FirmwareLinaro
 
Embedded system (Chapter 2) part 2
Embedded system (Chapter 2) part 2Embedded system (Chapter 2) part 2
Embedded system (Chapter 2) part 2Ikhwan_Fakrudin
 
U boot porting guide for SoC
U boot porting guide for SoCU boot porting guide for SoC
U boot porting guide for SoCMacpaul Lin
 
embedded-systems-for-beginners
embedded-systems-for-beginnersembedded-systems-for-beginners
embedded-systems-for-beginnersmohamed gaber
 
Embedded Linux BSP Training (Intro)
Embedded Linux BSP Training (Intro)Embedded Linux BSP Training (Intro)
Embedded Linux BSP Training (Intro)RuggedBoardGroup
 
Introduction to ARM LPC2148
Introduction to ARM LPC2148Introduction to ARM LPC2148
Introduction to ARM LPC2148Veera Kumar
 
LCU14 500 ARM Trusted Firmware
LCU14 500 ARM Trusted FirmwareLCU14 500 ARM Trusted Firmware
LCU14 500 ARM Trusted FirmwareLinaro
 
Linux on ARM 64-bit Architecture
Linux on ARM 64-bit ArchitectureLinux on ARM 64-bit Architecture
Linux on ARM 64-bit ArchitectureRyo Jin
 
HKG15-107: ACPI Power Management on ARM64 Servers (v2)
HKG15-107: ACPI Power Management on ARM64 Servers (v2)HKG15-107: ACPI Power Management on ARM64 Servers (v2)
HKG15-107: ACPI Power Management on ARM64 Servers (v2)Linaro
 
Yocto - Embedded Linux Distribution Maker
Yocto - Embedded Linux Distribution MakerYocto - Embedded Linux Distribution Maker
Yocto - Embedded Linux Distribution MakerSherif Mousa
 
Linux 802.11 subsystem and brcmsmac WLAN driver
Linux 802.11 subsystem and brcmsmac WLAN driverLinux 802.11 subsystem and brcmsmac WLAN driver
Linux 802.11 subsystem and brcmsmac WLAN driverMidhun Lohidakshan
 

Was ist angesagt? (20)

Trusted firmware deep_dive_v1.0_
Trusted firmware deep_dive_v1.0_Trusted firmware deep_dive_v1.0_
Trusted firmware deep_dive_v1.0_
 
LCU13: An Introduction to ARM Trusted Firmware
LCU13: An Introduction to ARM Trusted FirmwareLCU13: An Introduction to ARM Trusted Firmware
LCU13: An Introduction to ARM Trusted Firmware
 
Embedded system (Chapter 2) part 2
Embedded system (Chapter 2) part 2Embedded system (Chapter 2) part 2
Embedded system (Chapter 2) part 2
 
Linux Audio Drivers. ALSA
Linux Audio Drivers. ALSALinux Audio Drivers. ALSA
Linux Audio Drivers. ALSA
 
Embedded Linux on ARM
Embedded Linux on ARMEmbedded Linux on ARM
Embedded Linux on ARM
 
U boot porting guide for SoC
U boot porting guide for SoCU boot porting guide for SoC
U boot porting guide for SoC
 
embedded-systems-for-beginners
embedded-systems-for-beginnersembedded-systems-for-beginners
embedded-systems-for-beginners
 
What is Bootloader???
What is Bootloader???What is Bootloader???
What is Bootloader???
 
Embedded Linux BSP Training (Intro)
Embedded Linux BSP Training (Intro)Embedded Linux BSP Training (Intro)
Embedded Linux BSP Training (Intro)
 
Introduction to ARM LPC2148
Introduction to ARM LPC2148Introduction to ARM LPC2148
Introduction to ARM LPC2148
 
Introduction to Embedded Systems
Introduction to Embedded Systems Introduction to Embedded Systems
Introduction to Embedded Systems
 
LCU14 500 ARM Trusted Firmware
LCU14 500 ARM Trusted FirmwareLCU14 500 ARM Trusted Firmware
LCU14 500 ARM Trusted Firmware
 
Linux on ARM 64-bit Architecture
Linux on ARM 64-bit ArchitectureLinux on ARM 64-bit Architecture
Linux on ARM 64-bit Architecture
 
Communication protocols - Embedded Systems
Communication protocols - Embedded SystemsCommunication protocols - Embedded Systems
Communication protocols - Embedded Systems
 
Linux Internals - Part II
Linux Internals - Part IILinux Internals - Part II
Linux Internals - Part II
 
HKG15-107: ACPI Power Management on ARM64 Servers (v2)
HKG15-107: ACPI Power Management on ARM64 Servers (v2)HKG15-107: ACPI Power Management on ARM64 Servers (v2)
HKG15-107: ACPI Power Management on ARM64 Servers (v2)
 
Linux Internals - Part I
Linux Internals - Part ILinux Internals - Part I
Linux Internals - Part I
 
Yocto - Embedded Linux Distribution Maker
Yocto - Embedded Linux Distribution MakerYocto - Embedded Linux Distribution Maker
Yocto - Embedded Linux Distribution Maker
 
I2C Drivers
I2C DriversI2C Drivers
I2C Drivers
 
Linux 802.11 subsystem and brcmsmac WLAN driver
Linux 802.11 subsystem and brcmsmac WLAN driverLinux 802.11 subsystem and brcmsmac WLAN driver
Linux 802.11 subsystem and brcmsmac WLAN driver
 

Andere mochten auch

Leveraging the Android Open Accessory Protocol
Leveraging the Android Open Accessory ProtocolLeveraging the Android Open Accessory Protocol
Leveraging the Android Open Accessory ProtocolGary Bisson
 
Development, debug and deploy hardware/software solutions based on Android an...
Development, debug and deploy hardware/software solutions based on Android an...Development, debug and deploy hardware/software solutions based on Android an...
Development, debug and deploy hardware/software solutions based on Android an...Илья Родин
 
Controlling and monitoring external embedded device using android frameworks ...
Controlling and monitoring external embedded device using android frameworks ...Controlling and monitoring external embedded device using android frameworks ...
Controlling and monitoring external embedded device using android frameworks ...Dhruvilkumar patel
 
Getting started with IOT Development using Fedora on ARM
Getting started with IOT Development using Fedora on ARMGetting started with IOT Development using Fedora on ARM
Getting started with IOT Development using Fedora on ARMRajesh Sola
 
aoa-adk-osidays-rajeshsola
aoa-adk-osidays-rajeshsolaaoa-adk-osidays-rajeshsola
aoa-adk-osidays-rajeshsolaRajesh Sola
 
Hands on with embedded linux using zero hardware
Hands on with embedded linux using zero hardwareHands on with embedded linux using zero hardware
Hands on with embedded linux using zero hardwareRajesh Sola
 
Kickstarting IOT using NodeRED
Kickstarting IOT using NodeREDKickstarting IOT using NodeRED
Kickstarting IOT using NodeREDRajesh Sola
 
Seminar on Android Auto
Seminar on Android AutoSeminar on Android Auto
Seminar on Android AutoKiran Krishna
 
AAME ARM Techcon2013 002v02 Advanced Features
AAME ARM Techcon2013 002v02 Advanced FeaturesAAME ARM Techcon2013 002v02 Advanced Features
AAME ARM Techcon2013 002v02 Advanced FeaturesAnh Dung NGUYEN
 
Experience protocol buffer on android
Experience protocol buffer on androidExperience protocol buffer on android
Experience protocol buffer on androidRichard Chang
 
fudcon-fedora-arm-iot-rajeshsola
fudcon-fedora-arm-iot-rajeshsolafudcon-fedora-arm-iot-rajeshsola
fudcon-fedora-arm-iot-rajeshsolaRajesh Sola
 
Vba Macros Interoperability
Vba Macros InteroperabilityVba Macros Interoperability
Vba Macros InteroperabilityRajesh Sola
 
Go Green - Save Power
Go Green - Save PowerGo Green - Save Power
Go Green - Save PowerRajesh Sola
 
Introduction of Android Auto
Introduction of Android AutoIntroduction of Android Auto
Introduction of Android AutoZaicheng Qi
 
[NEXT] Android Profiler 사용법
[NEXT] Android Profiler 사용법 [NEXT] Android Profiler 사용법
[NEXT] Android Profiler 사용법 YoungSu Son
 

Andere mochten auch (17)

Leveraging the Android Open Accessory Protocol
Leveraging the Android Open Accessory ProtocolLeveraging the Android Open Accessory Protocol
Leveraging the Android Open Accessory Protocol
 
Development, debug and deploy hardware/software solutions based on Android an...
Development, debug and deploy hardware/software solutions based on Android an...Development, debug and deploy hardware/software solutions based on Android an...
Development, debug and deploy hardware/software solutions based on Android an...
 
Controlling and monitoring external embedded device using android frameworks ...
Controlling and monitoring external embedded device using android frameworks ...Controlling and monitoring external embedded device using android frameworks ...
Controlling and monitoring external embedded device using android frameworks ...
 
Getting started with IOT Development using Fedora on ARM
Getting started with IOT Development using Fedora on ARMGetting started with IOT Development using Fedora on ARM
Getting started with IOT Development using Fedora on ARM
 
aoa-adk-osidays-rajeshsola
aoa-adk-osidays-rajeshsolaaoa-adk-osidays-rajeshsola
aoa-adk-osidays-rajeshsola
 
Hands on with embedded linux using zero hardware
Hands on with embedded linux using zero hardwareHands on with embedded linux using zero hardware
Hands on with embedded linux using zero hardware
 
Kickstarting IOT using NodeRED
Kickstarting IOT using NodeREDKickstarting IOT using NodeRED
Kickstarting IOT using NodeRED
 
Hacktime for adk
Hacktime for adkHacktime for adk
Hacktime for adk
 
Seminar on Android Auto
Seminar on Android AutoSeminar on Android Auto
Seminar on Android Auto
 
AAME ARM Techcon2013 002v02 Advanced Features
AAME ARM Techcon2013 002v02 Advanced FeaturesAAME ARM Techcon2013 002v02 Advanced Features
AAME ARM Techcon2013 002v02 Advanced Features
 
Experience protocol buffer on android
Experience protocol buffer on androidExperience protocol buffer on android
Experience protocol buffer on android
 
fudcon-fedora-arm-iot-rajeshsola
fudcon-fedora-arm-iot-rajeshsolafudcon-fedora-arm-iot-rajeshsola
fudcon-fedora-arm-iot-rajeshsola
 
Vba Macros Interoperability
Vba Macros InteroperabilityVba Macros Interoperability
Vba Macros Interoperability
 
Go Green - Save Power
Go Green - Save PowerGo Green - Save Power
Go Green - Save Power
 
Introduction of Android Auto
Introduction of Android AutoIntroduction of Android Auto
Introduction of Android Auto
 
[NEXT] Android Profiler 사용법
[NEXT] Android Profiler 사용법 [NEXT] Android Profiler 사용법
[NEXT] Android Profiler 사용법
 
Android - ADB
Android - ADBAndroid - ADB
Android - ADB
 

Ähnlich wie Android Open Accessory Protocol - Turn Your Linux machine as ADK

FTF2014 - Android Accessory Protocol
FTF2014 - Android Accessory ProtocolFTF2014 - Android Accessory Protocol
FTF2014 - Android Accessory ProtocolGary Bisson
 
Android Internals and Toolchain
Android Internals and ToolchainAndroid Internals and Toolchain
Android Internals and ToolchainVladimir Kotov
 
Programming objects with android
Programming objects with androidProgramming objects with android
Programming objects with androidfirenze-gtug
 
From Arduino to ADK
From Arduino to ADKFrom Arduino to ADK
From Arduino to ADKCoLab Athens
 
Android Things, Alexey Rybakov, Technical Evangelist, DataArt
Android Things, Alexey Rybakov, Technical Evangelist, DataArtAndroid Things, Alexey Rybakov, Technical Evangelist, DataArt
Android Things, Alexey Rybakov, Technical Evangelist, DataArtAlina Vilk
 
Smartphone++
Smartphone++Smartphone++
Smartphone++mharkus
 
Lab Handson: Power your Creations with Intel Edison!
Lab Handson: Power your Creations with Intel Edison!Lab Handson: Power your Creations with Intel Edison!
Lab Handson: Power your Creations with Intel Edison!Codemotion
 
AGILE software, devices and wider ecosystem
AGILE software, devices and wider ecosystemAGILE software, devices and wider ecosystem
AGILE software, devices and wider ecosystemAGILE IoT
 
Getting started with Intel IoT Developer Kit
Getting started with Intel IoT Developer KitGetting started with Intel IoT Developer Kit
Getting started with Intel IoT Developer KitSulamita Garcia
 
Controlling an Arduino with Android
Controlling an Arduino with AndroidControlling an Arduino with Android
Controlling an Arduino with AndroidA. Hernandez
 
Albin profile
Albin profileAlbin profile
Albin profileAlbin B
 
IoT Getting Started with Intel® IoT Devkit
IoT Getting Started with Intel® IoT DevkitIoT Getting Started with Intel® IoT Devkit
IoT Getting Started with Intel® IoT DevkitVasily Ryzhonkov
 
Android Things, from mobile apps to physical world - Stefano Sanna - Giovanni...
Android Things, from mobile apps to physical world - Stefano Sanna - Giovanni...Android Things, from mobile apps to physical world - Stefano Sanna - Giovanni...
Android Things, from mobile apps to physical world - Stefano Sanna - Giovanni...Codemotion
 
Android Things, from mobile apps to physical world by Giovanni Di Gialluca an...
Android Things, from mobile apps to physical world by Giovanni Di Gialluca an...Android Things, from mobile apps to physical world by Giovanni Di Gialluca an...
Android Things, from mobile apps to physical world by Giovanni Di Gialluca an...Codemotion
 
Linxu conj2016 96boards
Linxu conj2016 96boardsLinxu conj2016 96boards
Linxu conj2016 96boardsLF Events
 
Android Things, from mobile apps to physical world
Android Things, from mobile apps to physical worldAndroid Things, from mobile apps to physical world
Android Things, from mobile apps to physical worldStefano Sanna
 

Ähnlich wie Android Open Accessory Protocol - Turn Your Linux machine as ADK (20)

FTF2014 - Android Accessory Protocol
FTF2014 - Android Accessory ProtocolFTF2014 - Android Accessory Protocol
FTF2014 - Android Accessory Protocol
 
Android Internals and Toolchain
Android Internals and ToolchainAndroid Internals and Toolchain
Android Internals and Toolchain
 
Programming objects with android
Programming objects with androidProgramming objects with android
Programming objects with android
 
From Arduino to ADK
From Arduino to ADKFrom Arduino to ADK
From Arduino to ADK
 
Android Things, Alexey Rybakov, Technical Evangelist, DataArt
Android Things, Alexey Rybakov, Technical Evangelist, DataArtAndroid Things, Alexey Rybakov, Technical Evangelist, DataArt
Android Things, Alexey Rybakov, Technical Evangelist, DataArt
 
Smartphone++
Smartphone++Smartphone++
Smartphone++
 
Lab Handson: Power your Creations with Intel Edison!
Lab Handson: Power your Creations with Intel Edison!Lab Handson: Power your Creations with Intel Edison!
Lab Handson: Power your Creations with Intel Edison!
 
iRidium pro for HDL
iRidium pro for HDLiRidium pro for HDL
iRidium pro for HDL
 
Adk 101
Adk 101Adk 101
Adk 101
 
AGILE software, devices and wider ecosystem
AGILE software, devices and wider ecosystemAGILE software, devices and wider ecosystem
AGILE software, devices and wider ecosystem
 
Getting started with Intel IoT Developer Kit
Getting started with Intel IoT Developer KitGetting started with Intel IoT Developer Kit
Getting started with Intel IoT Developer Kit
 
Controlling an Arduino with Android
Controlling an Arduino with AndroidControlling an Arduino with Android
Controlling an Arduino with Android
 
Albin profile
Albin profileAlbin profile
Albin profile
 
IoT Getting Started with Intel® IoT Devkit
IoT Getting Started with Intel® IoT DevkitIoT Getting Started with Intel® IoT Devkit
IoT Getting Started with Intel® IoT Devkit
 
Android Things, from mobile apps to physical world - Stefano Sanna - Giovanni...
Android Things, from mobile apps to physical world - Stefano Sanna - Giovanni...Android Things, from mobile apps to physical world - Stefano Sanna - Giovanni...
Android Things, from mobile apps to physical world - Stefano Sanna - Giovanni...
 
Android Things, from mobile apps to physical world by Giovanni Di Gialluca an...
Android Things, from mobile apps to physical world by Giovanni Di Gialluca an...Android Things, from mobile apps to physical world by Giovanni Di Gialluca an...
Android Things, from mobile apps to physical world by Giovanni Di Gialluca an...
 
Linxu conj2016 96boards
Linxu conj2016 96boardsLinxu conj2016 96boards
Linxu conj2016 96boards
 
Android presentation
Android presentationAndroid presentation
Android presentation
 
Android Things, from mobile apps to physical world
Android Things, from mobile apps to physical worldAndroid Things, from mobile apps to physical world
Android Things, from mobile apps to physical world
 
Начало работы с Intel IoT Dev Kit
Начало работы с Intel IoT Dev KitНачало работы с Intel IoT Dev Kit
Начало работы с Intel IoT Dev Kit
 

Kürzlich hochgeladen

The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 

Kürzlich hochgeladen (20)

The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 

Android Open Accessory Protocol - Turn Your Linux machine as ADK

  • 1. Android Open Accessory Protocol Turn Your Linux machine as ADK By Rajesh Sola, CDAC ACTS,Pune ` OSI Days 2014, Nimhans Convention Centre, Bengaluru
  • 2. Outline ● Need for AOA Protocol/ADK ● Introduction,History ● Available ADK hardware ● Initializing Android device ● Using driver skeleton ● Communication – ADK Side ● Sample Apps ● Developing your own apps ● Communication – Android Side
  • 3. Need for AOA Protocol/ADK Host ● Peripheral support of typical android gadget ● Adding more peripherals like temperature sensor,CANBus support,SPI,I2C,PWM etc? ● With/wthout rooting of android device ● Scope of Android USB Host capabilities ● USB device capabilities of android gadget ● Alternatives for USB – Bluetooth,WiFi etc. ● Designing rich UI for your hardware control. ● Lets talk about the solution for all...
  • 4. ADK Host ● In this protocol android gadget is kept in device mode and external hardware will be chosen in host mode ● Any hardware with USB host capabilities and capable of supplying a power of 5V@500mA to the android device can be chosen for this purpose,which is called as Android Accessory Development Kit(ADK) or Accessory Host ● Simple USB communication with two bulk end points
  • 5. History ● AOA v1.0 – Supported from Android 3.1(API Level 12) onwards – With add on library from Android 2.3.4(API level 10) – Announced in Google I/O 2011 – Demonstrated through Custom shield for Arduino Mega board ● AOA v2.0 – Supported from Android 4.1(API Level 16) onwards – Comes with additional features like audio,hid support and bluetooth connectivity – Announced in Google I/O 2012 – Demonstrated through Arduino Due based custom board
  • 6. Available Hardware for ADK ● Arduino Mega ● Arduino Due ● AOA kit from Embedded Artists ● FTDI Vinculum II ● Microchip PIC24F ADK ● Sparkfun IOIO ● BeagleBone powered with TI Starterware Any Linux machine with USB Host support Not limited to this hardware,any board with USB Host support can be designed as ADK with suitable USB Host APIs. The only advantage with this listing is availability of some sample code and certain tested apps.
  • 7. Initialization Step1:- ● Send Control request 51(0x33) to get the protocol version ● Returns 1 for AOA 1.0, 2 for AOA 2.0 bmRequestType TYPE_VENDOR| DIR_DEVICE_TO_HOST bRequest 51 wValue 0 wIndex 0 Data Address of two byte buffer wLength 2
  • 8. Initialization Step2:- ● Send identity strings through control request 52 ● Essentially one should send manufacturer, model, version to communicate ADK with an app ● Rest all are optional bmRequestTyp e TYPE_VENDOR| DIR_HOST_TO_DEVICE bRequest 52 wValue 0 wIndex String id Data Address of string wLength Length of the string String IDs Manufacturer 0 Model 1 Description 2 Version 3 Url 4 Serial id 5
  • 9. Initialization Step3:- ● Start in accessory mode through control request 53(0x35) ● Launch an app matched by essential identity strings or start without app just for audio/hid support. bmRequestType TYPE_VENDOR| DIR_HOST_TO_DEVICE bRequest 53 wValue 0 wIndex 0 Data NULL wLength 0
  • 10. Audio Support ● Send control request 0x58 for audio support with value=1 for 2 channel 16 bit PCM @ 44100 Kh`z ● If you are requesting for audio support,this must be done before starting in accessory mode ● If manufacturer,model identity strings are not supplied device goes to audio only mode bmRequestType TYPE_VENDOR| DIR_HOST_TO_DEVICE bRequest 53 wValue 1 wIndex 0 Data NULL wLength 0
  • 11. HID Support ● ADK can acts as HID event source or HID proxy to your android device ● The following request codes are used for HID support Register HID 54 Unregister HID 55 Set HID Report 56 Send HID Event 57
  • 12. Configuration 0x18D1:0x2D00 Accessory only 0x18D1:0x2D01 Accessory+ADB 0x18D1:0x2D02 Audio only 0x18D1:0x2D03 Audio + ADB 0x18D1:0x2D04 Accessory + Audio 0x18D1:0x2D05 Accessory + Audio + ADB ● Upon initialization android device switches to accessory mode from MTP/PTP mode and re- enumerated by ADK Host with one of the following vendor id,product id combinations and interface 0 with two bulk end points for communication
  • 13. Using driver skeleton ● Hosted on github.com/rajeshsola/adk-driver-skeleton based on Gary Bisson's libusb based linux-adk code ● Load the driver,optionally with module parameters my_dev_vid, my_dev_pid ● Initialize using simple shell commands cat /sys/kernel/adk_linux/aoa_init/version echo “Manu=OSI Days” > /sys/kernel/adk_linux/aoa_init/identity echo “Model=uisample” > /sys/kernel/adk_linux/aoa_init/identity echo “version=1.0” > /sys/kernel/adk_linux/aoa_init/identity echo “accessory” > /sys/kernel/adk_linux/aoa_init/start ● Alternatives for initialization ioctl code module parametet init_on_probe=1
  • 14. Communication – ADK side ● Simple userspace file operations on linux(ADK) side to talk to the app ● Start the communication fd=open(“/dev/aoa-skel0”,O_RDWR); ● For output peripherals(Android to ADK), eg:- LEDs,Volume read(fd,buf,len); //process the buffer and control peripherals ● For input peripherals(ADK to Android), eg:- Sensors, RTC //fill the buffer with state of peripherals write(fd,str,len); ● Stop the communication close(fd); ● can go for threaded design for Asynchronous transfer
  • 15. Sample Apps ● From Google Playstore – ADK 2012 from Google – Basic Accessory Demo from Microchip ● From other repositories with source code – SimpleAccessory Demo – Examples for AOA Kit from Embedded Artists – ADK Demo from rowboat project for beagle bone – TinyAccessory Demo – FTDI Android examples
  • 16. Developing Your own Apps ● intent-filter section and other changes in Manifest file ● Getting the reference of USB service manager ● Getting the reference for connected accessory ● Checking/Obtaining permissions ● Getting references of file streams ● Steps to take care during Activity life cycle – OnCreate – OnPause – OnResume – OnDestroy ● A walk through of skeleton code ADKControl class
  • 17. Communication – Android App side ● Add the skeleton class ADKControl to your project ● Create an instance of ADKControl in MainActivity by passing the reference of same,if necessary pass the reference of ADKControl to other activities or fragments or retrieve through getInstance(null) ADKControl adk=ADKControl.getInstance(this) ● Use sendCommand method for output activity,in appropriate listeners ● Use readData method for input activity, preferably in a different thread for asynchronous read ● Can obtain references for Input,Output references using methods getInputStream,getOutputStream
  • 18. An Example – App to ADK Peripheral Type Peripheral Id Peripheral State/Data Peripheral Data Peripheral Data Byte buffer 0 1 2 3 4 --------------->
  • 19. An Example – ADK to App Input Type DataData DataData DataData ---------------> 0x46 hours mins secs