A cross-platform software application method based on soft link technology

By using symbolic links to enable cross-platform device access under Linux, the problem of low development efficiency caused by differences in device file names is solved, and efficient and low-cost maintenance of cross-platform software development is achieved.

CN120179282BActive Publication Date: 2025-11-07保定华智电气有限公司
View PDF 1 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

In Linux systems, differences in device file names during cross-platform software development lead to low development efficiency and inconvenience in maintenance and expansion. Existing technologies require writing different code for different platforms.

Method used

By using symbolic links, the file names of the same device on different Linux platforms are linked together to form the same file name. The symbolic link script automatically generates the link when the system starts up, enabling cross-platform device access.

Benefits of technology

It enables cross-platform software development with only one set of code, improving development efficiency, reducing maintenance costs, and simplifying the software maintenance and expansion process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120179282B_ABST
    Figure CN120179282B_ABST
Patent Text Reader

Abstract

The application 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 technology.The method comprises the following steps: a soft link script of equipment under a Linux1 system is written, and the equipment name to be accessed is linked to a corresponding text name; the soft link script is added to a start file, and a soft link file is automatically generated after the Linux1 system is started; a soft link script of equipment under a Linux2 system is written, and the equipment name to be accessed is linked to a corresponding text name; the soft link script is added to a start file, and a soft link file is automatically generated after the Linux2 system is started; and the equipment access of the Linux1 system and the Linux2 system in software design directly calls the corresponding soft link file.The application can realize cross-platform software application, improves the development efficiency, reduces the maintenance cost, and can quickly respond to market demand and changes.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

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

[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 allows 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 world, cross-platform technology has become an indispensable part of various industries. Cross-platform technology in software development greatly improves work efficiency and user experience.

[0003] Linux device name refers to the name 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 generated by the system according to certain rules and stored in the / dev directory, so that users can access and manage these devices through these files. Accessing devices is an essential part of software development on Linux systems. There are many Linux systems and embedded Linux systems, and the device names are different. How to achieve cross-platform device access for software development and achieve efficient software development is a problem faced by developers.

[0004] The existing software development device access under the Linux system has the following disadvantages: the device files of different Linux platforms are different, and users need to use different names to access and manage devices when developing cross-platform software. Generally, macro definitions are used to distinguish different platforms, or different versions of programs are developed, which brings inconvenience to software maintenance and expansion and reduces development efficiency. Therefore, how to provide a cross-platform software application method based on soft link technology is a problem that needs to be solved by those skilled in the art. SUMMARY

[0005] Therefore, the present application provides a cross-platform software application method based on soft link technology, which links the same device file names under each platform into the same file name using the soft link method, thereby achieving cross-platform device access for software.

[0006] In order to achieve the above purpose, the present application provides the following technical scheme:

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

[0008] A soft link script for devices under Linux1 system is written to link the device names to be accessed to the corresponding file names.

[0009] Add the soft link script to the start file of the Linux1 system, and automatically generate the soft link file after the Linux1 system starts;

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

[0011] Add the soft link script to the start file of the Linux2 system, and automatically generate the soft link file after the Linux2 system starts;

[0012] The Linux1 system and the Linux2 system directly call the corresponding soft link file when accessing the device during software design.

[0013] Optionally, the soft link script of the Linux1 system comprises a command, a serial port prefix of the Linux1 system, and a file name of the Linux1 system.

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

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

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

[0017] Optionally, the same set of codes is applied when the Linux1 system and the Linux2 system access the same kind of device, and the soft link file is directly accessed.

[0018] According to the technical solution, compared with the prior art, the application provides a cross-platform software application method based on a soft link technology, and has the following beneficial effects:

[0019] The soft link application method disclosed in the application can realize cross-platform application of software by using only one set of codes, avoids the inconvenience of modifying macro definitions to compile different versions, and avoids the problems of maintenance difficulty and expansion difficulty caused by writing different platform software; developers do not need to write codes for each platform separately, but only need to write codes once, and then 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 demand and changes. BRIEF DESCRIPTION OF DRAWINGS

[0020] In order to make the technical solutions in the embodiments of the present application or the prior art clearer, the accompanying drawings needed in the embodiments or prior art description will be briefly introduced. Obviously, the accompanying drawings in the following description only aim to explain part of the embodiments of the present application, and for those skilled in the art, other drawings can be obtained without creative effort based on the provided drawings.

[0021] Figure 1 The figure shows a cross-platform software application method of the present application. DETAILED DESCRIPTION

[0022] The technical solutions in the embodiments of the present application will be described clearly and completely with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present application.

[0023] The embodiments of the present application disclose a cross-platform software application method based on soft link technology, as shown in the figure, comprising the following steps: Figure 1

[0024] A soft link script of the device under Linux1 system is written, and the device name to be accessed is linked to the corresponding file name;

[0025] The soft link script is added to the startup file of the Linux1 system, and the soft link file is automatically generated after the Linux1 system is started;

[0026] A soft link script of the device under Linux2 system is written, and the device name to be accessed is linked to the corresponding file name;

[0027] The soft link script is added to the startup file of the Linux2 system, and the soft link file is automatically generated after the Linux2 system is started;

[0028] The device access of the Linux1 system and the Linux2 system in software design directly calls the corresponding soft link file.

[0029] Further, the soft link script of the Linux1 system comprises a command, a Linux1 system serial port prefix, and a Linux1 system file name.

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

[0031] ​Further, the soft link script of the Linux1 system and the soft link script of the Linux2 system have the same file name of the same device.

[0032] Further, the device name of the same device required to be accessed in the Linux1 system and the Linux2 system is different, and the soft link file name generated automatically after the system is started is the same.

[0033] Further, the same code is applied when the Linux1 system and the Linux2 system access the same device, and the soft link file is directly accessed.

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

[0035] The serial port terminal is a terminal device connected with the serial port of the linux system, and the linux system regards each serial port as a character device, and the device name corresponding to the serial port is / dev / tty*+device number, and ttySAC is the serial port name prefix on the Samsung platform, such as ttySAC0, ttySAC1 and the like; ttymxc is the serial port prefix of the Freescale i.MX series platform, such as ttymxc0, ttymxc1 and the like, which respectively correspond to COM1, COM2 and the like under the Windows system. The serial ports on the two platforms are linked to the same file name such as COM1, COM2 by using the soft link technology, and the software is designed to only access the file name COM1, COM2 after the linking, and the two platforms have one set of code, the software is cross-platform applied, and the development efficiency is improved.

[0036] Examples:

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

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

[0039] 3) The same code is used to realize the access to the serial port 1 and the serial port 2 of different platforms in the software design, the serial port 1 is opened: open(COM1), and the serial port 2 is opened: open(COM2).

[0040] In the present specification, each embodiment is described in a progressive manner, and each embodiment mainly explains the difference from other embodiments, and the same or similar parts between each embodiment can be referred to each other.

[0041] The foregoing description of the disclosed embodiments enables a person skilled in the art to make or use the application. Modifications of these embodiments will occur to persons of skill in the art, and that the appended claims are intended to cover all such modifications that do not depart from the true spirit and scope of the application. Therefore, the application is not limited to the embodiments shown but is to be accorded 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 method comprises the following steps: a soft link script of a device under a Linux1 system is written, and a device name to be accessed is linked to a corresponding file name; the soft link script is added to a start file of the Linux1 system, and a soft link file is automatically generated after the Linux1 system starts; a soft link script of a device under a Linux2 system is written, and a device name to be accessed is linked to a corresponding file name; the soft link script is added to a start file of the Linux2 system, and a soft link file is automatically generated after the Linux2 system starts; device access of the Linux1 system and the Linux2 system in software design directly calls corresponding soft link files; file names of the same kind of device in the soft link script of the Linux1 system and the soft link script of the Linux2 system are the same; device names of the same kind of device to be accessed in the Linux1 system and the Linux2 system are different, and file names of automatically generated soft links are the same after the system starts; the same set of codes is applied when the Linux1 system and the Linux2 system access the same kind of device, and the soft link file is directly accessed.

2. The 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 comprises a command, a serial port prefix of the Linux1 system and a file name of the Linux1 system.

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

Citation Information

Patent Citations

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

    CN111142935A