USB

From Tizen Wiki
Jump to: navigation, search

Purpose

This site has been created to document USB related development in Tizen and related external contribution.

If You found any mistake please correct them, or contact with person responsible for the specific page.
If you will be not able to contact this person please write directly to Krzysztof Opasiak < k.opasiak (at) samsung (dot) com >.

USB introduction

USB is one the most popular connectors all over the word. Few years ago there was a lot of different connectors. It was the situation where almost each device has its own connector. For example keyboards were connected via DIN or PS/2, mouse via SERIAL, printers via LPT. That situation was hard to accept, so USB has been developed to replace them all with one universal connector. So Universal Serial Bus is a family of standards which defines connectors, cables and protocols to communicate different types of devices. This means that USB allows to connect keyboard, printer, mouse and many others using the same connector.

USB consist of two sides of communication: Host and Device. USB Host is a device (usually computer or smartphone) which functionality should be extended with additional devices. Host is a central point of USB communication. All the communication through the bus is seen only as communication between host and selected device. Host is also responsible for management of whole USB bus. All of connected USB devices are not allowed to send any data to host unless asked by it.

An USB device don't have to be a simple pendrive but it may only be a complex board with Linux on board like Beagle Bone Black for example. The only requirement to such board is to have an USB Device Controller - device side of physical USB channel. Such board may offer several functionality, so USB standards allow USB device to have multiple functions (in host nomenclature interfaces). Each USB interface may be treated by host quite separately and have its own driver. This allow device to provide several functions like keyboard (HID) and mass storage using one physical connection.

As mentioned above communication is always performed between host and one particular device. But what if device has multiple functions? How to select a function to talk? To achieve this USB provides destinations called endpoints. Each device must have at least endpoint 0 which is bidirectional (all other endpoints has only one direction IN - from device to host or OUT from host to device). This endpoint is used to control device as a whole. Other endpoints belongs to interfaces and allows drivers on host to communicate with given functions.

Special kind of USB devices are hubs. They are devices which allow to increase the number of USB ports on host machine. When we connect multiple hubs and devices we get a big tree of physical USB structure. Although physical USB structure is organized in tree where hubs are nodes and devices are leafs, the logical structure of USB is a star which host as a center and devices as leafs.

One of the most important features of USB is device auto-detection and identification. This is achieved during a process called enumeration. This process starts when one of hubs detect that new USB device has been connected. In first stage of this host gives new device an unique address on the bus. In second stage host asks device for it's details. Information about USB device is send using descriptors. First kind of descriptors is USB device descriptors. This structure contains information about device as a whole and provides information what functionality is provided by this device. Functionality description is provided using Interface descriptors. Each interface descriptors provides also information what endpoints are used in this interface. Endpoints descriptors provides details about each point, especially its direction and type.

USB standard allows also to create hardware which act like USB host or USB device according to current needs. This is done using USB On The Go. USB OTG requires only one additional line in micro USB connector. Depending to state of this additional line (so depending to connected cable type) hardware determines the side of communication which should be currently used. This allows form example to produce telephones which could be connected via USB to PC but also to which you can connect USB pendrive or keyboard using USB OTG connector.

Current Linux distributions supports both sides of USB communication. When Linux is installed on USB host, we are talking about device drivers for particular USB interfaces and devices. When Linux is installed on USB device we are talking about USB gadget drivers which provides software implementation of some functions. There are many different mechanism of support USB in Linux Kernel but this support is not enough. Tizen OS is supposed to have full USB support both in Kernel and in user space.

Valuable links to external sites about USB

Sub pages


Current status and problems

Standard USB devices handling problems

Linux USB Layers

USB Big Picture

  • Big Picture - Big picture of current USB support (Host mode) in Tizen

Kernel

Configfs Composite Gadget - Configfs Composite Gadget 

System framework

  • Gadget tool - Convenient tool for USB gadget configuration from user space

Ideas

Development aids

Testing results

  • USB Host Test - USB Host functionalities on android 4.1.2 testing

FAQ