Display the graphical interface program on the development board on the computer

      The development board running Linux system is used in the work, with Xorg program in the system (indicating that the development board can run the graphical interface program directly, if there is no special requirement, there is no need to install the graphics library separately, if your system lacks related graphics Library, you need to install), but the development board does not have a display screen. I have learned X Window System related knowledge before and knew that the graphical interface can be displayed on another computer through TCP, so I thought of putting the development board on the computer The graphical interface of the program is displayed.

1. Requirements:

1. Run the development board of Linux system (with Xorg program)

2. A PC with a graphical interface Linux system (the Ubuntu virtual machine I use)

3. The PC function and the development board network communication (can ping each other, the IP of my virtual machine is 192.168.0.28, and the IP of the development board is 192.168.0.25)

 

2. Ubuntu virtual machine configuration:

Run the following 2 commands in the virtual machine terminal:

命令1:xinit /usr/bin/xterm -- :1 -listen tcp  &

The above command means to start an Xserver, run the xterm program, monitor tcp (6000 + n, where n=1), Ubuntu will have a DISPLAY 0 when booting, so create DISPLAY 1 here ( here 1 will be used in the development board settings To ) After the program runs, the interface programming of the virtual machine is shown in the figure below. Don't worry, you can exit by entering the exit command in the terminal.

Command 2: xhost+

The above command indicates that all clients are allowed to connect to the Xserver created above through the network


 

 

3. Development board configuration:

Log in to the development board via ssh (or telnet) and run the following command to set the DISPLAY variable:

export DISPLAY=192.168.0.28:1

In this command, 192.168.0.28 is the IP of my Ubuntu virtual machine, and 1 is related to the parameters of the Xserver created in the Ubuntu virtual machine

 

Four. Test

After the DISPLAY variable is set, it can be run on the development board, the program with a graphical interface, I used the gedit program in the test.

Before the program runs, the content of 1.txt is 111

After the program runs, the display on the virtual machine is as follows:

 Edit the file (enter gedit) and save it, as shown in the figure below:

After saving the virtual machine and exiting gedit, check the 1.txt file on the development board. The file has been modified as shown in the figure below:

 

 At this point, the configuration test is complete.

Guess you like

Origin blog.csdn.net/kh815/article/details/83793283