Cross-platform software application method based on soft link technology

By using soft link technology to unify the device file name on different Linux platforms, the problems of low development efficiency and difficulty in maintenance caused by different device file names are solved, and the efficiency and convenience of cross-platform device access is achieved.

CN120179282AActive Publication Date: 2025-06-20保定华智电气有限公司
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202510271307.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-08
Publication Date
2025-06-20
Estimated Expiration
2045-03-08

AI Technical Summary

Technical Problem

Under different Linux platforms, the device file names are different, which leads to the need to use different names to access and manage devices during software development, resulting in low development efficiency and difficulty in maintenance.

Method used

Using soft link technology, the file names of the same device under each platform are linked to the same file name. By writing soft link scripts and adding them to the system startup file, soft link files are automatically generated to achieve cross-platform device access.

Benefits of technology

The software is accessed across the platform, avoiding the inconvenience of modifying macro definitions and writing software on different platforms, improving development efficiency and reducing maintenance costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120179282A_ABST
    Figure CN120179282A_ABST
Patent Text Reader

Abstract

The invention discloses a cross-platform software application method based on a soft link technology, and is applied to the technical field of cross-platform software equipment access. Comprising the following steps: compiling a soft link script of equipment under a Linux1 system, and linking an equipment name needing to be accessed into a corresponding text name; the soft link script is added to a starting file, and a soft link file is automatically generated after the Linux1 system is started; compiling a soft link script of the equipment under the Linux2 system, and linking the name of the equipment needing to be accessed into a corresponding text name; the soft link script is added to a starting file, and a soft link file is automatically generated after the Linux2 system is started; and the Linux1 system and the Linux2 system directly call corresponding soft link files during equipment access during software design. According to the method, cross-platform application of software can be realized, the development efficiency is improved, the maintenance cost is reduced, and market requirements and changes can be quickly responded.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of cross - platform software device access, and more specifically to a cross - platform software application method based on soft link technology. Background Technique

[0002] Cross - platform technology refers to the technology that can maintain functional consistency and user experience consistency under different operating systems, different devices, or different software environments. This technology enables developers to write code once and then run it on multiple platforms, greatly improving development efficiency and reducing maintenance costs. In today's increasingly digital age, cross - platform technology has become an indispensable part of various industries. The cross - platform technology in software development has greatly improved work efficiency and user experience.

[0003] The device names in Linux refer to the names used to identify and access hardware devices (such as serial ports, network interfaces, USB devices, etc.) in the Linux operating system. These device names are usually files generated by the system according to certain rules and stored in the / dev directory, enabling users to access and manage these devices through these files. When developing software under the Linux system, accessing devices is an essential step. There are many platforms in the Linux system / embedded Linux system, and the device names are different. How to achieve cross - platform access to devices in software development and realize efficient software development is a problem faced by developers.

[0004] The disadvantages of existing software development device access under the Linux system are as follows: The device files on different Linux platforms are different. When users develop and design cross - platform software, they need to use different names to access and manage devices. Generally, macro definitions are used to distinguish different platforms, or different versions of programs are developed, which brings inconvenience to software maintenance and extension and results in low development efficiency. Therefore, how to provide a cross - platform software application method based on soft link technology is an urgent problem for those skilled in the art. Summary of the Invention

[0005] In view of this, the present invention provides a cross - platform software application method based on soft link technology, which uses the soft link method to link the same device file names under each platform into the same file name to achieve cross - platform device access for software.

[0006] To achieve the above object, the present invention provides the following technical solutions:

[0007] A cross - platform software application method based on soft link technology includes the following steps:

[0008] Write a soft link script for devices under the Linux1 system to link the device names to be accessed to the corresponding file names;

[0009] Add the soft link script to the startup file of Linux1 system, and the soft link file will be automatically generated after the Linux1 system starts up;

[0010] Write the soft link script for the devices under the Linux2 system, and link the device names to be accessed to the corresponding file names;

[0011] Add the soft link script to the startup file of Linux2 system, and the soft link file will be automatically generated after the Linux2 system starts up;

[0012] When accessing devices during the software design of Linux1 system and Linux2 system, directly call the corresponding soft link files.

[0013] Optionally, the soft link script of Linux1 system includes: command, serial port prefix of Linux1 system, file name of Linux1 system.

[0014] Optionally, the soft link script of Linux1 system includes: command, serial port prefix of Linux2 system, file name of Linux2 system.

[0015] Optionally, the file names of the same devices in the soft link script of Linux1 system and the soft link script of Linux2 system are the same.

[0016] Optionally, the device names of the same devices to be accessed in Linux1 system and Linux2 system are different, and after the system starts up, the automatically generated soft link file names are the same.

[0017] Optionally, when accessing the same device in Linux1 system and Linux2 system, use the same set of code to directly access the soft link file.

[0018] Through the above technical solutions, compared with the prior art, the present invention provides a cross-platform software application method based on soft link technology, which has the following beneficial effects:

[0019] The method of applying the soft link disclosed in the present invention to cross-platform software only requires one set of code to realize the cross-platform application of the software, avoiding the inconvenience of modifying macro definitions to compile different versions, and also avoiding the problems of difficult maintenance and difficult extension brought by writing software for different platforms; developers do not need to write code separately for each platform, but only need to write the code once, and multiple platform application programs can be generated through cross-platform technology. This not only improves the development efficiency, but also reduces the maintenance cost, and can quickly respond to market demands and changes. Brief Description of the Drawings

[0020] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the drawings in the following description are only the embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on the provided drawings.

[0021] Figure 1 Schematic diagram of the cross-platform software application method of the present invention. Detailed implementation manners

[0022] The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the scope of protection of the present invention.

[0023] The embodiment of the present invention discloses a cross-platform software application method based on soft link technology, as Figure 1 shown, including the following steps:

[0024] Write a soft link script for the device under the Linux1 system, and link the device name to be accessed to the corresponding file name;

[0025] Add the soft link script to the startup file of the Linux1 system, and a soft link file will be automatically generated after the Linux1 system starts;

[0026] Write a soft link script for the device under the Linux2 system, and link the device name to be accessed to the corresponding file name;

[0027] Add the soft link script to the startup file of the Linux2 system, and a soft link file will be automatically generated after the Linux2 system starts;

[0028] When the Linux1 system and the Linux2 system access devices during software design, directly call the corresponding soft link files.

[0029] Further, the soft link script of the Linux1 system includes: command, Linux1 system serial port prefix, Linux1 system file name.

[0030] Further, the soft link script of the Linux1 system includes: command, Linux2 system serial port prefix, Linux2 system file name.

[0031] Further, the file names of the same type of device in the soft link script of the Linux1 system and the soft link script of the Linux2 system are the same.

[0032] Further, the device names of the same type of device to be accessed in the Linux1 system and the Linux2 system are different. After the system starts up, the automatically generated soft link file names are the same.

[0033] Further, when the Linux1 system and the Linux2 system access the same type of device, they use the same set of code to directly access the soft link file.

[0034] In an embodiment of the present invention, the soft link cross-platform software application can be used for serial port terminal access, GPIO control access, and extended device access. Taking serial port terminal access as an example:

[0035] The serial port terminal is a terminal device connected to the serial port of the linux system. The linux system regards each serial port as a character device. The device names corresponding to these serial ports are / dev / tty* + device number. ttySAC is the prefix of the serial port name on the Samsung platform, such as ttySAC0, ttySAC1, etc.; ttymxc is the prefix of the serial port on the Freescale i.MX series platform, such as ttymxc0, ttymxc1, etc., corresponding to COM1, COM2, etc. under the Windows system respectively. The serial ports on the two platforms are linked to the same file name using soft link technology, such as COM1, COM2, etc. When designing the software, only access the linked file names COM1, COM2. The software has one set of code for cross-platform application, which improves the development efficiency.

[0036] Example:

[0037] 1) Serial port soft link on the Samsung platform, ttySAC0 --> COM1, ttySAC1 --> COM2;

[0038] 2) Serial port soft link on the Freescale i.MX platform, ttymxc0 --> COM1, ttymxc1 --> COM2;

[0039] 3) The software design uses the same code to implement access to serial ports 1 and 2 on different platforms. Open serial port 1: open(COM1), open serial port 2: open(COM2).

[0040] The various embodiments in this specification are described in a progressive manner. Each embodiment focuses on the differences from other embodiments. The same or similar parts among the various embodiments can be referred to each other.

[0041] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A cross-platform software application method based on soft link technology, characterized in that: The following steps are involved: Write a soft link script for devices under the Linux1 system, linking the device name to be accessed to the corresponding file name; Add the soft link script to the startup file of the Linux1 system, and the soft link file will be automatically generated after the Linux1 system starts; Write a soft link script for devices under the Linux2 system, linking the device name to be accessed to the corresponding file name; Add the soft link script to the startup file of the Linux2 system, and the soft link file will be automatically generated after the Linux2 system starts; When designing software, Linux1 and Linux2 systems directly call the corresponding soft link files for device access.

2. A cross-platform software application method based on soft link technology according to claim 1, characterized in that: The soft link script of the Linux1 system includes: command, Linux1 system serial port prefix, and Linux1 system file name.

3. The cross-platform software application method based on soft link technology according to claim 1, characterized in that: The soft link script of Linux1 system includes: command, serial port prefix of Linux2 system, and file name of Linux2 system.

4. The cross-platform software application method based on soft link technology according to claim 1, characterized in that: The file names of the same devices in the soft link script of the Linux1 system and the soft link script of the Linux2 system are the same.

5. The cross-platform software application method based on soft link technology according to claim 1, characterized in that: The device names of the same devices that need to be accessed in Linux1 and Linux2 systems are different. After the system starts, the automatically generated soft link file names are the same.

6. A cross-platform software application method based on soft link technology according to claim 1, It is characterized in that When Linux1 and Linux2 systems access the same device, the same set of codes are applied. Directly access the soft link file.

Citation Information

Patent Citations

  • Robot cross-platform graphical development system

    CN106484403A

  • Cross-platform application running method and device, computer system and medium

    CN111142935A

  • Cross-platform APP construction method, device and system and medium

    CN113778405A

  • Cross-platform universal database access middleware

    CN114860756A

  • Cross-platform file transmission method and device, electronic equipment and storage medium

    CN117492645A