Global Sources
EE Times-India
Stay in touch with EE Times India
EE Times-India > Embedded

Designing USB device with Android framework

Posted: 05 Dec 2014     Print Version  Bookmark and Share

Keywords:Android  USB  Compatibility Test Suite  Linux kernel  RFC2119 

This class represents a USB device connected to an Android in USB host mode. A UsbDevice object contains information that describes the capabilities and other USB specific details of the USB device, such as protocol, class, device ID, and so on. It is important to note that a UsbDevice can be instantiated by a UsbService implementation of the UsbHostManager. Complete details of this class are available at

This class is the core part of the Android USB package. It provides the state information of USB and discusses the methods to communicate with the USB devices that are connected. At this moment of writing, this class provides methods only for host mode. The class provides the necessary methods in order to provide permission to the USB device and shares the intent that communicates state information. Complete details of this class are available at

This class is used to provide the necessary methods for the user to send and receive data to a USB device. An instance of the usefulness of this class is when an application opens a USB device using the openDevice method. This class supports the transfer of bulk and controls data synchronously, unlike the queue method of UsbRequest. It also provides the requestWait method, which is used for asynchronous data transfer. Complete details of this class are available at

This class is also used to represent an interface of a USB device connected to the Android host. An interface in USB is used to represent functionalities of the USB device. If a USB device has multiple functionalities, there will be multiple UsbInterface objects. This class provides methods to retrieve class, protocol, and end-point details. Complete details of this class are available at

Usb Endpoint
This class is used to represent the end-point of an interface and provides methods that can retrieve the details of an end-point. In USB terms, this class provides information from a USB end-point descriptor of a connected device. At the time of this writing, there is no support for an isochronous end-point. Complete details of this class are available here.

This class represents a USB packet used to read and write to or from a connected USB device. An object of UsbRequest is used to transfer bulk or to interrupt data asynchronously. After "queuing" a request, a program has to wait for the response using the requestWait method of UsbDeviceConnection. This class does not support control transfer over end-point zero. At the time of this writing, support for isochronous transfer has not been provided. Complete details of this class are available here.

These classes discussed previously, other than UsbAccessory, constitute the Android USB host APIs and are packaged as for developers who create USB host applications. There are other packages, like android.mtp, that are derived from these set of APIs. The android. mtp class provides MTP class support for an application developer.

Android is widely deployed across many platforms and different vendors, and it is important to have interoperability and to maintain quality. Android defines a brief requirement specification, namely the Android Compatibility Definition Document (CDD), to ensure that the different vendors of an Android device can interoperate easily.

This article has provided a brief overview of the USB requirements as defined in the latest Android CDD 4.4, applicable to the Jelly Bean version of Android. There have been few changes in the USB requirement, and you can explore different CDD versions to understand how USB requirements have evolved on the Android developer site.

About the author
Rajaram Regupathy works as a principal software engineer with Cypress Semiconductor. He has more than 15 years of professional experience in developing firmware and system software embedded products. He enjoys designing and developing new technology products from scratch. He has patents in embedded domain and is also a senior ACM member and Linux and open source enthusiast. He has published books on Linux USB stack programming and other open source articles.

Used with permission from Apress Media LLC, a division of Springer Science+Business Media Publishing, Copyright 2014, this article was excerpted from Unboxing Android: A hands on approach with real world examples, by Rajaram Regupathy.

 First Page Previous Page 1 • 2 • 3 • 4 • 5

Comment on "Designing USB device with Android fr..."
*  You can enter [0] more charecters.
*Verify code:


Visit Asia Webinars to learn about the latest in technology and get practical design tips.


Go to top             Connect on Facebook      Follow us on Twitter      Follow us on Orkut

Back to Top