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

08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Neo4j
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 

Recently uploaded (20)

08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 

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