1# Introduction to Driver Development Kit 2<!--Kit: Driver Development Kit--> 3<!--Subsystem: Driver--> 4<!--Owner: @lixinsheng2--> 5<!--Designer: @w00373942--> 6<!--Tester: @dong-dongzhen--> 7<!--Adviser: @w_Machine_cc--> 8 9Empowered by the C-API solution, Driver Development Kit (DDK) provides easy-to-use, secure, and diversified ArkTs-API and C APIs to elevate your experience in developing peripheral drivers, which bring ultimate plug-and-play experience to users. 10 11## When to Use 12 13With DDK, you can develop dedicated or extended peripheral drivers in an efficient and secure manner. 14 151. Develop drivers of dedicated 16 17 peripherals for bank counters, enterprise office, and medical detection, such as high-speed document scanners, ID card scanners, fingerprint scanners, and blood oxygen and blood glucose meters. 18 192. Develop enhanced functions of non-standard peripherals, 20 21 such as customizing handwriting pad shortcut keys, setting the pressure sensing/drawing area, setting extended enhancement capabilities, setting the mouse lighting effect, customizing mouse extended buttons, and setting DPI and X and Y axes. 22 23## Typical Use Cases 24 25- You can develop advanced peripheral functions to meet user requirements. 26 27- The extended driver framework supports lifecycle management of peripheral drivers and provides APIs for querying and binding peripheral devices. 28 29## Basic Concepts 30 31- Peripheral driver client: [basic UI-based driver](externaldevice-guidelines.md), which is used to query and bind drivers, and customize the communication mode and data processing mode. 32- Peripheral driver: [basic UI-free driver](driverextensionability.md), which is the dedicated peripheral driver or enhanced peripheral driver developed based on DDK. 33- External Device Manager: performs lifecycle management of peripheral devices and driver packages. 34- Bundle Manager Service (BMS): manages application installation, uninstallation, and data on the system. 35- Ability Manager Service (AMS): starts and stops **DriverExtensionAbility**. 36 37## Implementation Principles 38 39The HDF extended driver framework provides unified APIs for you to leverage the DDK capabilities for user-mode peripheral driver development. 40 41External Device Manager, the core service of user-mode peripheral management, performs lifecycle management of peripherals and peripheral drivers. In addition, standard ArkTS APIs are provided to query, bind, and unbind peripherals. 42 43### Peripheral Driver Architecture 44 45 **Figure 1** Peripheral driver working mechanism 46 47 48 49 50### Operation Process 51 52Figure 2 shows the process for matching a peripheral driver client with a peripheral driver when a peripheral is connected. 53 54**Figure 2** Process for matching a peripheral driver client with a peripheral driver 55 56 57 58Figure 3 shows the process for binding the peripheral driver client with a peripheral driver. 59 60**Figure 3** Process of binding the peripheral driver client with a peripheral driver 61 62 63 64## Notes and Constraints 65 66To call the ArkTs or C APIs provided by DDK, you need to apply for specified permissions. 67 68The following table lists the required permissions. 69 70| API Type| DDK Type| Permission| 71| --------- | --------- | --------- | 72| ArkTs-API | NA| ohos.permission.ACCESS_EXTENSIONAL_DEVICE_DRIVER | 73| C-API | USB DDK | ohos.permission.ACCESS_DDK_USB | 74| C-API | HID DDK | ohos.permission.ACCESS_DDK_HID | 75| C-API | USB Serial DDK | ohos.permission.ACCESS_DDK_USB_SERIAL | 76| C-API | SCSI Peripheral DDK | ohos.permission.ACCESS_DDK_SCSI_PERIPHERAL | 77 78## Associated Modules 79 80The following table lists the associated modules you may use during development of peripheral drivers. 81 82| Name| Description| 83| --------- | --------- | 84| PerformanceAnalysisKit | Introduces {hilog} for log printing.| 85| BasicServicesKit | Introduces {BusinessError} to capture error information.| 86| IPCKit | Introduces {rpc} to implement inter-process communication between the driver and the client.| 87| AbilityKit | Introduces {want} for lifecycle management.| 88 89## Driver Application Specifications 901. Driver application definition 91- A driver application is a user-mode driver developed based on DDK for non-standard peripherals. 92- Since driver applications are based on **DriverExtensionAbility**, you need to override its lifecycle callback APIs. 93 942. Driver application installation and uninstallation 95- Installation policy 96 - When a user installs a driver application, the system installs the application in all existing user spaces. 97 - When a user is created, the system installs the installed driver application in the respective user space. 98- Uninstallation policy: When a user uninstalls a driver application in any user space, the system uninstalls the driver application in all user spaces. 99