SlideShare a Scribd company logo
Android のUSB support

       まごろく
USB on Android Yesterday
• Android USB device built-in functions
  – USB mass storage
  – Adb
  – USB tethering
• Limitations
  – Most Android devices have no USB host support
  – USB Host in Android 3.0 is very limited
  – No USB APIs
What is an Open Accessory
• Simple USB protocol for communication
  between peripherals and Android devices
• Accessory is the host, Android is the device
• Bi-directional communication over two bulk
  end points
• protocol for associating Android applications
  with the hardware they support
Accessory Mode
ADK
• Android Accessory Board:
  – Based on arduino Mega 2560
  – Maxim MAX3421E host controller
  – Works with arduino tool chain
Google Shield
•   3 RGB LEDs
•   4 buttons (3 channels, 1 capacitive)
•   3 servo channels, 2 relays
•   joystick
•   light & temperature sensors
Requirements for
       Open Accessory Hardware
• USB host
• Must supply 500mA @5V charging power
Open Accessory Handshake
• When a new device connected, the accessory will
  perform these steps:
  – Send "Get Protocol" command to get Accessory
    protocol version. if they fails, the device does not
    support accessories
  – Send manufacture, mode description version, serial
    number and URL strings to identify the accessory to
    the Android Device
  – Send "start" command
  – The Android device should re-enumerate in accessory
    mode and launch an app
USB Accessory Handshake, part2
• You're in Accessory Mode if:
    – vendor ID is 0x18d1 (Google)
    – Product ID is 0x2D00 or 0x2D01
•   Read configuration descriptors
•   Look for first In and first bulk OUT endpoint
•   Set configuration to 1
•   Endpoints are now ready for communication
Open Accessory APIs
• New USB APIs in Android 3.1
• - com.android.hardware.udb.*
• - Use the is your app will require Android 3.1 (API 12) or
  later
• - Supported on Motorola Xoom with android 3.1 update
• Compatibility Library for Gingerbread
• - com.andorid.future.ubs.*
• - Link against com.android.future.usb.accessory.jar
• - Very similar to Android 3.1 API
• - Use this if you want to support Gingerbread and later
• - Supported on Nexus One and Nexus S with 2.3.4 update
Connecting to and Accessory
• Application describes compatible accessories in
  manifest meta-data
• USB Manager matches accessory to compatible
  application(s)
• Asks user if it is OK to use your app with the accessory
  to choose among multiple applications
• Application's Activity is started with
  USB_ACCESSORY_ATTACHED Intent
• Association made permanent if the user selects
  "always use the app for this accessory" in this dialog
• USB_ACCESSORY_DETACHED Intent send when
  accessory disconnected
UsbAccessory class
• Describes the USB accessory base on the strings if
  provides in the handshake
  –   manufacture Name
  –   Model Name
  –   Description (user-visible strings)
  –   URL (web page to visit if no installed support the
      accessory)
• Serial Number (Optional)
• Manufacture, Model and Version are used for
  associating accessories with applications
USB Manager class
• getAccessoryList() return currently attached
  accessories (currently these can only one)
• openAccessory() returns a ParcelFileDescriptor
• hasPermission() to see if you have access to
  the accessory
• requestPermission() to request permission
  from user
What is ADK
arduino
• open-source electronics prototyping platform
• http://www.arduino.cc/
• http://www.circuitsathome.com/arduino_usb
  _host_shield_projects
ATmega2560
• ATmega2560
  フラッシュメモリ256KB
• SRAM 8KB
• EEPROM 4KB
• デジタルI/O 54本
  PWM
  I2C含
• アナログ入力 16本
USB Host
• MAX3421E が乗ってるだけ
よーするに




                              Shield
AVR マイコン




           USB HOST
Microchip からPIC24F
IOIO
Hrdakinoriさん
• 4月ごろからPIC24F OTG付きで実験
• https://github.com/hrdakinori/ADB_PIC24F
結論
• おもちゃ・遊び場が増えて
• 睡眠時間が減る
• Androidアプリ書けないけどDeviceの
                  prototypingはできます
• PIC24F OTG付き 64Kbyte DIP版入手

         いっしょに遊ぶ人募集

More Related Content

ODP
Android usbの基本
PDF
Androidを利用した外部機器の制御
PDF
PDF
AOA2.0を実装してみた
PPT
Learning AOSP - Android Linux Device Driver
PPT
"Learning AOSP" - Android Hardware Abstraction Layer (HAL)
PDF
Android HAL Introduction: libhardware and its legacy
PDF
Accessing Hardware on Android
Android usbの基本
Androidを利用した外部機器の制御
AOA2.0を実装してみた
Learning AOSP - Android Linux Device Driver
"Learning AOSP" - Android Hardware Abstraction Layer (HAL)
Android HAL Introduction: libhardware and its legacy
Accessing Hardware on Android

Similar to Android のusb support (20)

PDF
Leveraging the Android Open Accessory Protocol
PDF
FTF2014 - Android Accessory Protocol
PPTX
Android Things, Alexey Rybakov, Technical Evangelist, DataArt
PDF
CNIT 128 Ch 4: Android
PDF
Lick my Lollipop
PPTX
128-ch4.pptx
PDF
BOX of Illusion MOSEC'17
PDF
ch4-Software is Everywhere
PPTX
3. Android Architecture.pptx
PDF
aoa-adk-osidays-rajeshsola
PDF
Android Open Accessory Protocol - Turn Your Linux machine as ADK
KEY
I/O 2011 報告会 ADKで遊んでみた
PDF
De leukste Bug
PDF
Embedded Android Workshop with Marshmallow
PPT
Development, debug and deploy hardware/software solutions based on Android an...
PDF
Multipilot pres-ufficiale def
PPT
Introduction to android sessions new
PDF
Embedded Android Workshop with Lollipop
PDF
Better With Friends: Android+NFC+Arduino
PPTX
Quick prototyping using Gadgeteer, Raspberry Pi + Fez Cream
Leveraging the Android Open Accessory Protocol
FTF2014 - Android Accessory Protocol
Android Things, Alexey Rybakov, Technical Evangelist, DataArt
CNIT 128 Ch 4: Android
Lick my Lollipop
128-ch4.pptx
BOX of Illusion MOSEC'17
ch4-Software is Everywhere
3. Android Architecture.pptx
aoa-adk-osidays-rajeshsola
Android Open Accessory Protocol - Turn Your Linux machine as ADK
I/O 2011 報告会 ADKで遊んでみた
De leukste Bug
Embedded Android Workshop with Marshmallow
Development, debug and deploy hardware/software solutions based on Android an...
Multipilot pres-ufficiale def
Introduction to android sessions new
Embedded Android Workshop with Lollipop
Better With Friends: Android+NFC+Arduino
Quick prototyping using Gadgeteer, Raspberry Pi + Fez Cream
Ad

More from magoroku Yamamoto (20)

PDF
Deep learning入門
PDF
波形で見るBig.little
PDF
自動並列化コンパイラをAndroidに適用してみた
PDF
Oscar compiler for power reduction
PDF
Unix v6 セミナー vol. 5
PDF
仮想記憶入門 BSD-4.3を例題に
PDF
V6 unix vol.2 in okinawa
PDF
Android binder-ipc
PDF
V6 unix in okinawa
PDF
ぐだ生システム#2
PDF
ぐだ生って何
PDF
Android builders summit slide tour
PDF
第4回名古屋Android勉強会資料
PPTX
Poorman’s adk トレーナ
PPTX
20分でわかった事にするパワーマネジメント
PDF
Poormans sdk
KEY
PDF
オレオレ家電
PDF
PDF
Deep learning入門
波形で見るBig.little
自動並列化コンパイラをAndroidに適用してみた
Oscar compiler for power reduction
Unix v6 セミナー vol. 5
仮想記憶入門 BSD-4.3を例題に
V6 unix vol.2 in okinawa
Android binder-ipc
V6 unix in okinawa
ぐだ生システム#2
ぐだ生って何
Android builders summit slide tour
第4回名古屋Android勉強会資料
Poorman’s adk トレーナ
20分でわかった事にするパワーマネジメント
Poormans sdk
オレオレ家電
Ad

Recently uploaded (20)

PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Encapsulation theory and applications.pdf
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Approach and Philosophy of On baking technology
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PPTX
Big Data Technologies - Introduction.pptx
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Modernizing your data center with Dell and AMD
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
Cloud computing and distributed systems.
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Encapsulation theory and applications.pdf
The AUB Centre for AI in Media Proposal.docx
Approach and Philosophy of On baking technology
Spectral efficient network and resource selection model in 5G networks
Reach Out and Touch Someone: Haptics and Empathic Computing
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Big Data Technologies - Introduction.pptx
Mobile App Security Testing_ A Comprehensive Guide.pdf
Modernizing your data center with Dell and AMD
Digital-Transformation-Roadmap-for-Companies.pptx
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Cloud computing and distributed systems.
NewMind AI Weekly Chronicles - August'25 Week I
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Advanced methodologies resolving dimensionality complications for autism neur...
Build a system with the filesystem maintained by OSTree @ COSCUP 2025

Android のusb support

  • 1. Android のUSB support まごろく
  • 2. USB on Android Yesterday • Android USB device built-in functions – USB mass storage – Adb – USB tethering • Limitations – Most Android devices have no USB host support – USB Host in Android 3.0 is very limited – No USB APIs
  • 3. What is an Open Accessory • Simple USB protocol for communication between peripherals and Android devices • Accessory is the host, Android is the device • Bi-directional communication over two bulk end points • protocol for associating Android applications with the hardware they support
  • 5. ADK • Android Accessory Board: – Based on arduino Mega 2560 – Maxim MAX3421E host controller – Works with arduino tool chain
  • 6. Google Shield • 3 RGB LEDs • 4 buttons (3 channels, 1 capacitive) • 3 servo channels, 2 relays • joystick • light & temperature sensors
  • 7. Requirements for Open Accessory Hardware • USB host • Must supply 500mA @5V charging power
  • 8. Open Accessory Handshake • When a new device connected, the accessory will perform these steps: – Send "Get Protocol" command to get Accessory protocol version. if they fails, the device does not support accessories – Send manufacture, mode description version, serial number and URL strings to identify the accessory to the Android Device – Send "start" command – The Android device should re-enumerate in accessory mode and launch an app
  • 9. USB Accessory Handshake, part2 • You're in Accessory Mode if: – vendor ID is 0x18d1 (Google) – Product ID is 0x2D00 or 0x2D01 • Read configuration descriptors • Look for first In and first bulk OUT endpoint • Set configuration to 1 • Endpoints are now ready for communication
  • 10. Open Accessory APIs • New USB APIs in Android 3.1 • - com.android.hardware.udb.* • - Use the is your app will require Android 3.1 (API 12) or later • - Supported on Motorola Xoom with android 3.1 update • Compatibility Library for Gingerbread • - com.andorid.future.ubs.* • - Link against com.android.future.usb.accessory.jar • - Very similar to Android 3.1 API • - Use this if you want to support Gingerbread and later • - Supported on Nexus One and Nexus S with 2.3.4 update
  • 11. Connecting to and Accessory • Application describes compatible accessories in manifest meta-data • USB Manager matches accessory to compatible application(s) • Asks user if it is OK to use your app with the accessory to choose among multiple applications • Application's Activity is started with USB_ACCESSORY_ATTACHED Intent • Association made permanent if the user selects "always use the app for this accessory" in this dialog • USB_ACCESSORY_DETACHED Intent send when accessory disconnected
  • 12. UsbAccessory class • Describes the USB accessory base on the strings if provides in the handshake – manufacture Name – Model Name – Description (user-visible strings) – URL (web page to visit if no installed support the accessory) • Serial Number (Optional) • Manufacture, Model and Version are used for associating accessories with applications
  • 13. USB Manager class • getAccessoryList() return currently attached accessories (currently these can only one) • openAccessory() returns a ParcelFileDescriptor • hasPermission() to see if you have access to the accessory • requestPermission() to request permission from user
  • 15. arduino • open-source electronics prototyping platform • http://www.arduino.cc/ • http://www.circuitsathome.com/arduino_usb _host_shield_projects
  • 16. ATmega2560 • ATmega2560 フラッシュメモリ256KB • SRAM 8KB • EEPROM 4KB • デジタルI/O 54本 PWM I2C含 • アナログ入力 16本
  • 17. USB Host • MAX3421E が乗ってるだけ
  • 18. よーするに Shield AVR マイコン USB HOST
  • 20. IOIO
  • 21. Hrdakinoriさん • 4月ごろからPIC24F OTG付きで実験 • https://github.com/hrdakinori/ADB_PIC24F
  • 22. 結論 • おもちゃ・遊び場が増えて • 睡眠時間が減る • Androidアプリ書けないけどDeviceの prototypingはできます • PIC24F OTG付き 64Kbyte DIP版入手 いっしょに遊ぶ人募集