SlideShare a Scribd company logo
1 of 22
Download to read offline
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

Similar to Android のusb support

Leveraging the Android Open Accessory Protocol
Leveraging the Android Open Accessory ProtocolLeveraging the Android Open Accessory Protocol
Leveraging the Android Open Accessory ProtocolGary Bisson
 
FTF2014 - Android Accessory Protocol
FTF2014 - Android Accessory ProtocolFTF2014 - Android Accessory Protocol
FTF2014 - Android Accessory ProtocolGary Bisson
 
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
 
CNIT 128 Ch 4: Android
CNIT 128 Ch 4: AndroidCNIT 128 Ch 4: Android
CNIT 128 Ch 4: AndroidSam Bowne
 
BOX of Illusion MOSEC'17
BOX of Illusion MOSEC'17BOX of Illusion MOSEC'17
BOX of Illusion MOSEC'17Python0x0
 
ch4-Software is Everywhere
ch4-Software is Everywherech4-Software is Everywhere
ch4-Software is Everywheressuser06ea42
 
3. Android Architecture.pptx
3. Android Architecture.pptx3. Android Architecture.pptx
3. Android Architecture.pptxHarshiniB11
 
Android Open Accessory Protocol - Turn Your Linux machine as ADK
Android Open Accessory Protocol - Turn Your Linux machine as ADKAndroid Open Accessory Protocol - Turn Your Linux machine as ADK
Android Open Accessory Protocol - Turn Your Linux machine as ADKRajesh Sola
 
aoa-adk-osidays-rajeshsola
aoa-adk-osidays-rajeshsolaaoa-adk-osidays-rajeshsola
aoa-adk-osidays-rajeshsolaRajesh Sola
 
I/O 2011 報告会 ADKで遊んでみた
I/O 2011 報告会 ADKで遊んでみたI/O 2011 報告会 ADKで遊んでみた
I/O 2011 報告会 ADKで遊んでみたMakoto Yamazaki
 
Embedded Android Workshop with Marshmallow
Embedded Android Workshop with MarshmallowEmbedded Android Workshop with Marshmallow
Embedded Android Workshop with MarshmallowOpersys inc.
 
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...Илья Родин
 
Multipilot pres-ufficiale def
Multipilot pres-ufficiale defMultipilot pres-ufficiale def
Multipilot pres-ufficiale defRoberto Navoni
 
Introduction to android sessions new
Introduction to android   sessions newIntroduction to android   sessions new
Introduction to android sessions newJoe Jacob
 
Embedded Android Workshop with Lollipop
Embedded Android Workshop with LollipopEmbedded Android Workshop with Lollipop
Embedded Android Workshop with LollipopOpersys inc.
 
Better With Friends: Android+NFC+Arduino
Better With Friends: Android+NFC+ArduinoBetter With Friends: Android+NFC+Arduino
Better With Friends: Android+NFC+ArduinoPearl Chen
 
Quick prototyping using Gadgeteer, Raspberry Pi + Fez Cream
Quick prototyping using Gadgeteer, Raspberry Pi + Fez CreamQuick prototyping using Gadgeteer, Raspberry Pi + Fez Cream
Quick prototyping using Gadgeteer, Raspberry Pi + Fez CreamMif Masterz
 

Similar to Android のusb support (20)

Leveraging the Android Open Accessory Protocol
Leveraging the Android Open Accessory ProtocolLeveraging the Android Open Accessory Protocol
Leveraging the Android Open Accessory Protocol
 
FTF2014 - Android Accessory Protocol
FTF2014 - Android Accessory ProtocolFTF2014 - Android Accessory Protocol
FTF2014 - Android Accessory Protocol
 
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
 
CNIT 128 Ch 4: Android
CNIT 128 Ch 4: AndroidCNIT 128 Ch 4: Android
CNIT 128 Ch 4: Android
 
Lick my Lollipop
Lick my LollipopLick my Lollipop
Lick my Lollipop
 
128-ch4.pptx
128-ch4.pptx128-ch4.pptx
128-ch4.pptx
 
BOX of Illusion MOSEC'17
BOX of Illusion MOSEC'17BOX of Illusion MOSEC'17
BOX of Illusion MOSEC'17
 
ch4-Software is Everywhere
ch4-Software is Everywherech4-Software is Everywhere
ch4-Software is Everywhere
 
3. Android Architecture.pptx
3. Android Architecture.pptx3. Android Architecture.pptx
3. Android Architecture.pptx
 
Android Open Accessory Protocol - Turn Your Linux machine as ADK
Android Open Accessory Protocol - Turn Your Linux machine as ADKAndroid Open Accessory Protocol - Turn Your Linux machine as ADK
Android Open Accessory Protocol - Turn Your Linux machine as ADK
 
aoa-adk-osidays-rajeshsola
aoa-adk-osidays-rajeshsolaaoa-adk-osidays-rajeshsola
aoa-adk-osidays-rajeshsola
 
I/O 2011 報告会 ADKで遊んでみた
I/O 2011 報告会 ADKで遊んでみたI/O 2011 報告会 ADKで遊んでみた
I/O 2011 報告会 ADKで遊んでみた
 
De leukste Bug
De leukste BugDe leukste Bug
De leukste Bug
 
Embedded Android Workshop with Marshmallow
Embedded Android Workshop with MarshmallowEmbedded Android Workshop with Marshmallow
Embedded Android Workshop with Marshmallow
 
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...
 
Multipilot pres-ufficiale def
Multipilot pres-ufficiale defMultipilot pres-ufficiale def
Multipilot pres-ufficiale def
 
Introduction to android sessions new
Introduction to android   sessions newIntroduction to android   sessions new
Introduction to android sessions new
 
Embedded Android Workshop with Lollipop
Embedded Android Workshop with LollipopEmbedded Android Workshop with Lollipop
Embedded Android Workshop with Lollipop
 
Better With Friends: Android+NFC+Arduino
Better With Friends: Android+NFC+ArduinoBetter With Friends: Android+NFC+Arduino
Better With Friends: Android+NFC+Arduino
 
Quick prototyping using Gadgeteer, Raspberry Pi + Fez Cream
Quick prototyping using Gadgeteer, Raspberry Pi + Fez CreamQuick prototyping using Gadgeteer, Raspberry Pi + Fez Cream
Quick prototyping using Gadgeteer, Raspberry Pi + Fez Cream
 

More from magoroku Yamamoto

More from magoroku Yamamoto (20)

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

Recently uploaded

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
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
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
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
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
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
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
 
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
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
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
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
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
 

Recently uploaded (20)

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
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
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
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
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
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
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
 
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
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
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)
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
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
 

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版入手 いっしょに遊ぶ人募集