1# USB Service Development Overview 2 3<!--Kit: Basic Services Kit--> 4<!--Subsystem: USB--> 5<!--Owner: @hwymlgitcode--> 6<!--Designer: @w00373942--> 7<!--Tester: @dong-dongzhen--> 8<!--Adviser: @w_Machine_cc--> 9 10## Basic Concepts 11 12The USB service is an abstraction of underlying hardware-based USB devices. It is classified into a host and a device. 13In a host, with the APIs provided by the USB service, you can obtain the list of connected USB devices, manage device access permissions, and perform data transfer or control transfer with the connected devices. In addition, for transfer modes, synchronous transfer and asynchronous transfer are available; for transfer types, interrupt transfer, isochronous transfer, and bulk transfer are supported. Before data transfer, you need to obtain the device list, verify the device access permission, enable or connect to the device, and declare the device APIs. 14 15 16## Working Principles 17 18The USB subsystem logically consists of three parts: USB API, USB Service, and USB HAL. The following figure shows how the USB service is implemented. 19 20**Figure 1** Implementation of the USB service 21 22 23 24- USB API: provides USB APIs that implement various basic functions, for example, query of the USB device list, bulk data transfer, control transfer, and permission control. 25 26- USB Service: receives, parses, and distributes Hardware Abstraction Layer (HAL) data, and manages devices. 27 28- USB HAL: provides driver capability APIs that can be directly called in user mode. 29