Android connectivity-USB Host Mode and slave mode

Source: Internet
Author: User

This article translated from: http://developer.android.com/guide/topics/connectivity/usb/index.html

Android supports a variety of USB peripherals and Android USB accessories in two modes (hardware that implements the android sub-Protocol): USB sub-mode and USB Host Mode. In the USB slave mode, the external USB hardware serves as the USB host. Examples of affiliated USB devices include Robot controllers, pedestal, diagnostic and music devices, card readers, etc. Android devices without host capabilities do not have the ability to interact with USB hardware. Android USB accessories must work with Android devices, and must follow the android sub-mode communication protocol. In USB Host Mode, Android devices act as hosts. Examples of such devices include digital cameras, keyboards, mice, and game controllers.

Figure 1 shows the two different modes. When the Android device is in host mode, it acts as a USB host and power supply bus. When the Android device is in USB-dependent mode, the connected USB hardware serves as the host and power supply bus.

Figure 1. USB Host Mode and slave mode

The USB slave mode and host mode are directly supported after android3.1 (API Level 12. The USB slave mode can also be added as a class library to a wider range of devices for backward compatibility with android2.3.4 (API level 10 ). The device manufacturer can choose whether to include this attachment class library in their system images.

Note: The support for the USB Host Mode and slave mode depends on the hardware of the device instead of the platform level. You can use the <uses-feature> element to filter devices that support the USB Host Mode and slave mode.

Debugging considerations

When debugging applications that use the USB slave function or host function, you will connect the USB hardware to the Android device, which will prevent you from connecting to the ADB through the USB and Android device. You can still access ADB through network connection. To enable network-based ADB, follow these steps:

1. Connect the Android device to your computer through USB;

2. In the platform-tools/directory of your SDK, in command line mode, type the adb tcpip 5555 command;

3. Type ADB connect <device-IP-address>: 5555. Then you should connect to the Android device and be able to publish the ADB command, such as ADB logcat;

4. Type adb usb and set your device to listen to the USB mode.

Related Article

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.