# Use Case<a name="EN-US_TOPIC_0000001055301733"></a>
This use case takes **camera\_sample**\(contained in the source code\) as an example for photographing, recording, and previewing on the development board.
This use case takes **camera\_sample**\(contained in the source code\) as an example for photographing, recording, and previewing on the development board.
- You can obtain source code of the sample from **applications/sample/camera/media/camera\_sample.cpp**.
- Before running the sample camera, you need to compile, burn, and run the image. For details, see [Hi3516 Development Board](../quick-start/quickstart-lite-introduction-hi3516#section26131214194212).
- You can obtain source code of the sample from **applications/sample/camera/media/camera\_sample.cpp**.
- Before running the sample camera, you need to compile, burn, and run the image. For details, see [Quick Start Overview](../quick-start/quickstart-overview.md).
>After the development board is started, the home screen is loaded and displayed above the media layer by default. To prevent covering **camera\_sample**, you should remove the home screen during compilation or packaging.
>How to Remove: In **build/lite/components/applications.json**, comment out or delete the **//applications/sample/camera/launcher:launcher\_hap** line from the **target** field of **camera\_sample\_app**.
>After the development board is started, the home screen is loaded and displayed above the media layer by default. To prevent covering **camera\_sample**, you should remove the home screen during compilation or packaging.
>How to Remove: In **build/lite/components/applications.json**, comment out or delete the **//applications/sample/camera/launcher:launcher\_hap** line from the **target** field of **camera\_sample\_app**.
- The compilation result of the sample code is stored in **out/hi3516dv300/ipcamera\_hi3516dv300\_liteos/dev\_tools/bin**. To ensure that the code can be executed on the development board, you can copy the file to a TF card through a card reader, or modify the compilation script of **camera\_sample** to copy the compilation result to **rootfs.img**.
- The compilation result of the sample code is stored in **out/hi3516dv300/ipcamera\_hi3516dv300\_liteos/dev\_tools/bin**. To ensure that the code can be executed on the development board, you can copy the file to a TF card through a card reader, or modify the compilation script of **camera\_sample** to copy the compilation result to**rootfs.img**.
Modify the first **output\_dir** in the source code path **applications/sample/camera/media/BUILD.gn**.
Modify the first **output\_dir** in the source code path **applications/sample/camera/media/BUILD.gn**.
Recompile the source code repository and burn the code into the development board. Then you can find the **camera\_sample** file in the **bin** directory of the board.
Recompile the source code repository and burn the code into the development board. Then you can find the **camera\_sample** file in the **bin** directory of the board.
>You should insert a TF card \(up to 128 GB supported\) for photographing and video recording before system startup. This way, the TF card will be automatically mounted to the **/sdcard** directory. If you insert the TF card after the system is started, you have to manually mount the TF card.
>You should insert a TF card \(up to 128 GB supported\) for photographing and video recording before system startup. This way, the TF card will be automatically mounted to the **/sdcard** directory. If you insert the TF card after the system is started, you have to manually mount the TF card.
>To view the photos and videos in the TF card, copy them to a computer. If you just want to preview photos and videos, you do not need to insert a TF card.
- Perform the following steps to run the sample:
1. Run the **cd** command to go to the end path of the executable program and start **camera\_sample** by running the command in the following figure.
1. Run the **cd** command to go to the end path of the executable program and start **camera\_sample** by running the command in the following figure.
The control commands are displayed as shown in the preceding figure. Press **S** to stop the current operation \(including video recording and preview\), and press **Q** to exit the program.
The control commands are displayed as shown in the preceding figure. Press **S** to stop the current operation \(including video recording and preview\), and press **Q** to exit the program.
2. Press **1** to take a photo in JPG format. The photo is saved in the **/sdcard** directory and named **Capture\***.
2. Press **1** to take a photo in JPG format. The photo is saved in the **/sdcard** directory and named**Capture\***.
**Figure 2** Serial port logs displayed after the photographing command is executed<a name="fig17819185018384"></a>
**Figure 2** Serial port logs displayed after the photographing command is executed<a name="fig17819185018384"></a>
3. Press **2** to start recording. The video file is in MP4 format and saved in the **/sdcard** directory with the name **Record\***. Press **S** to stop recording.
3. Press **2** to start recording. The video file is in MP4 format and saved in the **/sdcard** directory with the name **Record\***. Press **S** to stop recording.
**Figure 4** Serial port logs displayed after the recording command is executed<a name="fig6340814174317"></a>
**Figure 4** Serial port logs displayed after the recording command is executed<a name="fig6340814174317"></a>
# Running on the Device<a name="EN-US_TOPIC_0000001054809161"></a>
Before you install the application and run it on the development board, install the DevEco Device Tool by following operations provided in [HUAWEI DevEco Device Tool User Guide](https://device.harmonyos.com/en/docs/ide/user-guides/service_introduction-0000001050166905). Burn OpenHarmony into the development board, and run it on the board. For details about how to compile, burn, and run an image, see the [Hi3516 Development Board](../quick-start/Readme-EN.md). After the image is running normally and the system is started properly, perform the following steps to install or uninstall the application:
Before you install the application and run it on the development board, install the DevEco Device Tool by following operations provided in [HUAWEI DevEco Device Tool User Guide](https://device.harmonyos.com/en/docs/ide/user-guides/service_introduction-0000001050166905). Burn OpenHarmony into the development board, and run it on the board. For details about how to compile, burn, and run an image, see the [Quick Start Overview](../quick-start/quickstart-overview.md). After the image is running normally and the system is started properly, perform the following steps to install or uninstall the application:
1. Store the compiled unsigned application installation package and installation tool in an SD card and insert the SD card into the development board slot. The installation tool is in **dev\_tools** of the directory where the image file is generated.
1. Store the compiled unsigned application installation package and installation tool in an SD card and insert the SD card into the development board slot. The installation tool is in **dev\_tools** of the directory where the image file is generated.
2. Run the following command to disable signature verification, which is enabled by default for application installation:
```
...
...
@@ -15,11 +15,11 @@ Before you install the application and run it on the development board, install
The **dev\_tools** directory stores the installation tool, and **airquality.hap** is the application installation package. Replace it with actual the package name.
The **dev\_tools** directory stores the installation tool, and **airquality.hap** is the application installation package. Replace it with actual the package name.
4. After the application is installed, touch the application icon on the home screen to enter the application.
**Figure 1** Home screen<a name="fig146361926155516"></a>
**Figure 1** Home screen<a name="fig146361926155516"></a>
>This development example applies to standard, small, and mini OpenHarmony systems. The following sections use the standard system as an example. You can refer to the specific guide for your system to set up the environment.
## Developing a Touchscreen Driver<a name="section15233162984520"></a>
...
...
@@ -37,9 +37,9 @@ Complete the following tasks to adapt a touchscreen IC based on the input driver
Configure the touchscreen driver description required for registering the driver with the HDF, for example, whether the driver is loaded and what is the loading priority.
You can configure the device driver description in the configuration file at **./drivers/adapter/khdf/linux/hcs/device\_info/device\_info.hcs**.
You can configure the device driver description in the configuration file at **./drivers/adapter/khdf/linux/hcs/device\_info/device\_info.hcs**.
The **device\_info.hcs** file contains all necessary information for registering drivers in the input driver model with the HDF. You do not need to make any modification for the information unless otherwise required in special scenarios. The private configuration data of each driver uses the **deviceMatchAttr** field to match the **match\_attr** field in the **input\_config.hcs** file.
The **device\_info.hcs** file contains all necessary information for registering drivers in the input driver model with the HDF. You do not need to make any modification for the information unless otherwise required in special scenarios. The private configuration data of each driver uses the **deviceMatchAttr** field to match the **match\_attr** field in the**input\_config.hcs** file.
The input-related fields in the configuration file are as follows. For details about these fields, see [Driver Development](../driver/driver-hdf-development.md).
...
...
@@ -91,21 +91,21 @@ Pay attention to the following fields in the configuration file:
**preload**: specifies whether to load the driver.
**moduleName**: This value must be the same as the **moduleName** value in the driver entry structure.
**moduleName**: This value must be the same as the **moduleName** value in the driver entry structure.
**serviceName**: This value is used by the HDF to create a device node name.
**deviceMatchAttr**: This value must be the same as the **match\_attr** value in the private configuration data.
**deviceMatchAttr**: This value must be the same as the **match\_attr** value in the private configuration data.
After the device descriptions are configured, the HDF matches the configuration with the code registered with the driver entry structure based on the **moduleName** field, ensuring that drivers can be loaded properly. If multiple drivers are configured, the **priority** field determines the loading sequence of each driver.
After the device descriptions are configured, the HDF matches the configuration with the code registered with the driver entry structure based on the **moduleName** field, ensuring that drivers can be loaded properly. If multiple drivers are configured, the**priority** field determines the loading sequence of each driver.
### Configuring the Touchscreen<a name="section156331030144617"></a>
The private data includes the power-on and power-off sequence, and the platform hardware information includes the GPIO port that connects the touchscreen to the main board.
You can configure the touchscreen in the configuration file at **./drivers/adapter/khdf/linux/hcs/input/input\_config.hcs**.
You can configure the touchscreen in the configuration file at **./drivers/adapter/khdf/linux/hcs/input/input\_config.hcs**.
The **input\_config.hcs** file consists of the private configuration data of both the common driver and chip driver. Information of this file is read and parsed by the driver code. The configuration in the file includes the board-level hardware information and private configuration of the touchscreen. You can tailor the configuration during your development.
The **input\_config.hcs** file consists of the private configuration data of both the common driver and chip driver. Information of this file is read and parsed by the driver code. The configuration in the file includes the board-level hardware information and private configuration of the touchscreen. You can tailor the configuration during your development.
```
root {
...
...
@@ -197,7 +197,7 @@ root {
}
```
In the example, **touchConfig** contains the **touch0** configuration, which describes the **boardConfig** and **chipConfig** configuration information. The **boardConfig** field provides the board-level hardware information of Hi3516D V300, and the **chipConfig** field provides the private configuration data of the touchscreen. To use another touchscreen, you can change the value of the **chipConfig** field. You can also configure multiple touchscreens for your product. In this example, **touch0** represents the hardware interface and chip configuration of the default touchscreen. If you need to configure a secondary touchscreen, add a **touch1** block parallel to **touch0**.
In the example, **touchConfig** contains the **touch0** configuration, which describes the **boardConfig** and **chipConfig** configuration information. The **boardConfig** field provides the board-level hardware information of Hi3516D V300, and the **chipConfig** field provides the private configuration data of the touchscreen. To use another touchscreen, you can change the value of the **chipConfig** field. You can also configure multiple touchscreens for your product. In this example, **touch0** represents the hardware interface and chip configuration of the default touchscreen. If you need to configure a secondary touchscreen, add a **touch1** block parallel to**touch0**.
### Adapting to the Private Drivers of the Touchscreen<a name="section17127331595"></a>
...
...
@@ -207,7 +207,7 @@ The input driver model consists of three parts of drivers. To develop a brand-ne
1. Implement differentiated APIs for the touchscreen to adapt to the input chip driver.
You can obtain the sample code at **./drivers/framework/model/input/driver/touchscreen/touch\_gt911.c**.
You can obtain the sample code at **./drivers/framework/model/input/driver/touchscreen/touch\_gt911.c**.
```
static struct TouchChipOps g_gt911ChipOps = { // IC options of the touchscreen
...
...
@@ -267,7 +267,7 @@ The input driver model consists of three parts of drivers. To develop a brand-ne
2. Initialize the input chip driver and register the driver with the HDF.
You can obtain the sample code at **./drivers/framework/model/input/driver/touchscreen/touch\_gt911.c**.
You can obtain the sample code at **./drivers/framework/model/input/driver/touchscreen/touch\_gt911.c**.