OpenHarmony开发者论坛

标题: [Experience Sharing] HarmonyOS Scan Driver Development Guide [打印本页]

作者: itDyh12    时间: 2024-4-13 19:56
标题: [Experience Sharing] HarmonyOS Scan Driver Development Guide
[md]1. Background:To enable scanning devices on HarmonyOS, you need to complete the following tasks: 1) migrate the scanning driver based on the OpenHarmony environment, 2) develop a third-party driver and install the Hap application, and 3) use the default scanning application to verify the basic functions of the driver. In this article, we will focus on how to migrate scan drivers based on the OpenHarmony environment.2. Preparation:Before the porting work begins, we first need to configure the OpenHarmony compilation environment, and then we need to have the driver code developed based on the SANE scanning framework.3. Transplant Jobs:

* Copy the attached sane to the third\_party folder in the root directory of OpenHarmony and extract it
* Go to the sane folder and add the prepared SANE scan driver code
* Find the Build.gn file in the root directory and add the Gn compilation command of the corresponding driver file to it
* Find the //build/subsystem\_config.json file and add the following configuration to the end of the json file:
* "peripheral": {
  "path": "base/peripheral",
  "name": "peripheral"
  }
* Locate the //vendor/hihope/rk3568/config.json file and add the following configuration to the end of the json file:
*

1. {
2.     "subsystem": "peripheral",
3.     "components": [
4. ```
       {
   ```
5.             "component": "sane",
6.             "features": []
7. ```
       }
   ```
8. ```
   ]
   ```
9. ```
   }
   ```

Run the following command to compile: ./build.sh --product-name rk3568 --gn-argsis_debug=true --build-target sane

**4. Fruits:**
After compilation, it can be found in the out/rk3568/common/common directorySANE, where libsane-xxx.z.so is the driver file we need.
[/md]




欢迎光临 OpenHarmony开发者论坛 (https://forums.openharmony.cn/) Powered by Discuz! X3.5