[经验分享] [Experience Sharing] HarmonyOS Scan Driver Development Guide

itDyh12 显示全部楼层 发表于 2024-4-13 19:56:32
  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.

©著作权归作者所有,转载或内容合作请联系作者

您尚未登录,无法参与评论,登录后可以:
参与开源共建问题交流
认同或收藏高质量问答
获取积分成为开源共建先驱

Copyright   ©2023  OpenHarmony开发者论坛  京ICP备2020036654号-3 |技术支持 Discuz!

返回顶部