Android usb Master/Slave Device mode resolution and network connection debugging method

Source: Internet
Author: User

USB Master/Slave Device
 
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 ). You can use the <uses-feature> element to filter devices that support USB hosts and peripherals. View the USB peripherals and host documentation 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:
 
Connect the Android device to your computer through USB.
Enter adb tcpip 5555 in the command line from the platform-tools directory of the SDK
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.
To set your device to listen to USB, enter adb usb.

From eric_zhang's blog

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.