Android developer Guide (29) -- USB Host and Accessory

Source: Internet
Author: User

 

Preface

This chapter is about USB in the Android developer guide and translated into "USB Master/Slave devices". The version is Android 4.0 r1 and translated from: "beautiful life of the sun and fire". Welcome to his blog: "http://alot.sinaapp.com", thanks again "the charm of the sun and Fire God "! We look forward to your participation in translation of Android related information, contact me over140@gmail.com.

 

Statement

You are welcome to repost, but please keep the original source of the article :)

Blog Garden: http://www.cnblogs.com/

Android Chinese translation group: http://goo.gl/6vJQl

 

 

 

USBHost and Accessory

Translator's name: The beautiful life of the Sun and the fire

Link: http://alot.sinaapp.com

Version: Android 4.0 r1

Original

Http://developer.android.com/guide/topics/usb/index.html

 

USBMaster/Slave Devices

Android supports a variety of USB peripherals. Android USB peripherals (hardware that implements the Android peripheral Protocol) are supported in two modes: USB Peripheral mode and USB Host Mode. In USB Peripheral mode, the external USB hardware (an external device with Android devices to connect) acts as a USB host. Examples of peripherals include robots, extended sockets, diagnostic and music devices, electronic kiosks, card readers, and other devices. This mode allows Android devices that do not have host functions to interact with USB hardware. Android USB peripherals must be designed to work with devices equipped with Android and must comply with the Android peripheral communication protocol. In USB host mode, an Android device plays the role of a host. Examples of such devices include digital cameras, keyboards, mice, and game controllers. USB devices with wide adaptability can still interact with Android applications, provided that these Android applications can communicate with these devices correctly.

Figure 1 shows the similarities and differences between the two modes. When the Android device is in host mode, it acts as a USB host and powers the bus. When the Android device is in Attachment mode, the connected USB hardware (in this case, an Android USB attachment) plays the host role and powers the bus.

 

Figure 1. USB Master/Slave Mode

USB peripherals and host modes are directly supported on Android 3.1 (API level 12) or a higher platform. The USB Peripheral mode, as a peripheral Library, is also fed back to Android 2.3.4 (API level 10) to support a wider range of devices. The device manufacturer can choose whether to include additional libraries in the system image of the device.

Note:: The support for the USB host and peripheral mode depends on the hardware of the device, regardless of the platform level (what is ). You can use the <uses-feature> element to filter devices that support USB hosts and peripherals. View USBPeripheralsAndHostDocument for more details.

 

 

Debugging considerations

When debugging applications that use USB peripherals and host features, you are likely to connect your USB hardware to your Android device, this will prevent you from establishing an adb connection to the Android device through USB. You can still access adb through the network. Connect to adb through network:

  1. Connect the Android device to your computer through USB.
  2. Enter adb tcpip 5555 in the command line from the platform-tools directory of the SDK
  3. Enter: adb connect <device IP address>: 5555. Now you will be connected to the Android device and can issue general adb commands like adb logcat.
  4. To set your device to listen to USB, enter adb usb.

 

Supplement

Article Selection

USB Baidu encyclopedia

Google I/O conference keynote speech: entering the new version of Honeycomb

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.