CN114924703A - Resolution and refresh rate switching method, device and medium - Google Patents

Resolution and refresh rate switching method, device and medium Download PDF

Info

Publication number
CN114924703A
CN114924703A CN202210606769.2A CN202210606769A CN114924703A CN 114924703 A CN114924703 A CN 114924703A CN 202210606769 A CN202210606769 A CN 202210606769A CN 114924703 A CN114924703 A CN 114924703A
Authority
CN
China
Prior art keywords
resolution
refresh rate
information
display
switching
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202210606769.2A
Other languages
Chinese (zh)
Other versions
CN114924703B (en
Inventor
孙亚楠
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Senxinwei Computer Technology Co ltd
Inspur Computer Technology Co Ltd
Original Assignee
Inspur Shandong Computer Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Inspur Shandong Computer Technology Co Ltd filed Critical Inspur Shandong Computer Technology Co Ltd
Priority to CN202210606769.2A priority Critical patent/CN114924703B/en
Publication of CN114924703A publication Critical patent/CN114924703A/en
Application granted granted Critical
Publication of CN114924703B publication Critical patent/CN114924703B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/14Digital output to display device ; Cooperation and interconnection of the display device with other functional units
    • G06F3/1407General aspects irrespective of display type, e.g. determination of decimal point position, display with fixed or driving decimal point, suppression of non-significant zeros

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Controls And Circuits For Display Device (AREA)

Abstract

The application discloses a switching method, a switching device and a switching medium of resolution and a refresh rate, and relates to the technical field of computers. The method comprises the steps of obtaining the name of a video interface and the connection state of display equipment; generating display information of the display device according to the name and the connection state; the display information comprises resolution and refresh rate supported by display equipment connected with each video interface; and switching the resolution and the refresh rate at the resolution according to the display information for displaying the image according to the resolution and the refresh rate. Therefore, the scheme realizes the switching display of the resolution ratio and the refresh rate through the display information by generating the display information containing the resolution ratio and the refresh rate supported by the display equipment connected with each video interface, greatly improves the display efficiency, avoids the possibility of human errors caused by manual switching, and saves the labor and time cost.

Description

一种分辨率和刷新率的切换方法、装置及介质Method, device and medium for switching resolution and refresh rate

技术领域technical field

本申请涉及计算机技术领域,特别是涉及一种分辨率和刷新率的切换方法、装置及介质。The present application relates to the field of computer technology, and in particular, to a method, device and medium for switching resolution and refresh rate.

背景技术Background technique

目前,在对一些操作系统(Operating System,OS)、显卡及显示屏等进行测试时,需要切换所有分辨率及刷新率进行测试,以确认其显示功能是否正常。Currently, when testing some operating systems (Operating Systems, OS), graphics cards, and display screens, it is necessary to switch all resolutions and refresh rates for testing to confirm whether the display functions are normal.

但是,分辨率与搭配的显卡及显示屏等相关,不同配置可支持的分辨率有差异,且每种分辨率都搭配多个刷新率,手动切换所有分辨率及刷新率进行测试会花费大量时间。However, the resolution is related to the matching graphics card and display screen. Different configurations can support different resolutions, and each resolution is matched with multiple refresh rates. It will take a lot of time to manually switch all resolutions and refresh rates for testing. .

鉴于上述问题,设计一种分辨率和刷新率的切换方法,提高分辨率及刷新率的切换效率,是该领域技术人员亟待解决的问题。In view of the above problems, designing a method for switching resolution and refresh rate to improve the switching efficiency of resolution and refresh rate is an urgent problem to be solved by those skilled in the art.

发明内容SUMMARY OF THE INVENTION

本申请的目的是提供一种分辨率和刷新率的切换方法、装置及介质,解决手动切换所有分辨率及刷新率进行测试会花费大量时间的问题。The purpose of this application is to provide a method, device and medium for switching resolutions and refresh rates, so as to solve the problem that it takes a lot of time to manually switch all resolutions and refresh rates for testing.

为解决上述技术问题,本申请提供一种分辨率和刷新率的切换方法,包括:In order to solve the above technical problems, the present application provides a method for switching resolution and refresh rate, including:

获取视频接口的名称和显示设备的连接状态;Get the name of the video interface and the connection status of the display device;

根据所述名称和所述连接状态生成所述显示设备的显示信息;其中,所述显示信息中包含各所述视频接口连接的所述显示设备所支持的分辨率和刷新率;Generate the display information of the display device according to the name and the connection state; wherein, the display information includes the resolution and refresh rate supported by the display device connected to each of the video interfaces;

根据所述显示信息切换所述分辨率和所述分辨率下的所述刷新率,以用于根据所述分辨率和所述刷新率显示图像。The resolution and the refresh rate at the resolution are switched according to the display information for displaying an image according to the resolution and the refresh rate.

优选地,所述根据所述显示信息切换所述分辨率和所述分辨率下的所述刷新率包括:Preferably, the switching of the resolution and the refresh rate under the resolution according to the display information includes:

遍历所述显示信息中的各行信息;Traverse each line of information in the displayed information;

将各行所述信息分别分割为多个字符串;The information described in each line is divided into multiple character strings;

在各行的所述字符串中,获取各行第一个所述字符串作为所述分辨率,获取各行剩余的所述字符串作为所述分辨率下的所述刷新率;In the character strings of each row, the first character string of each row is obtained as the resolution, and the remaining character strings of each row are obtained as the refresh rate under the resolution;

依次切换所述分辨率和所述分辨率下的所述刷新率。The resolution and the refresh rate under the resolution are sequentially switched.

优选地,在所述将各行所述信息分别分割为多个字符串之前,还包括:Preferably, before dividing the information of each line into a plurality of character strings, the method further includes:

查找所述显示信息中的所述显示设备的连接关键词;Find the connection keyword of the display device in the display information;

若无法查找到所述显示信息中的所述显示设备的所述连接关键词,则获取标志位信息;If the connection keyword of the display device in the display information cannot be found, obtain flag bit information;

若所述标志位信息为1,则确认所述显示信息中本行所述信息为所述分辨率及所述刷新率,进入到所述将各行所述信息分别分割为多个字符串的步骤;If the flag bit information is 1, confirm that the information in the current line in the display information is the resolution and the refresh rate, and enter the step of dividing the information in each line into multiple character strings. ;

若所述标志位信息为0,则确认所述显示信息中本行所述信息不为所述分辨率及所述刷新率,获取所述显示信息中的下一行所述信息,返回至所述查找所述显示信息中的所述显示设备的连接关键词的步骤。If the flag bit information is 0, confirm that the information in the current line in the display information is not the resolution and the refresh rate, obtain the information in the next line in the display information, and return to the The step of searching for the connection keyword of the display device in the display information.

优选地,若查找到所述显示信息中的所述显示设备的所述连接关键词,还包括:Preferably, if the connection keyword of the display device in the display information is found, the method further includes:

根据所述连接关键词判断所述视频接口是否连接所述显示设备;Determine whether the video interface is connected to the display device according to the connection keyword;

若否,设置标志位为0,并获取所述显示信息的下一行所述信息,返回至所述查找所述显示信息中的所述显示设备的连接关键词的步骤;If not, set the flag bit to 0, and obtain the information in the next line of the display information, and return to the step of searching for the connection keyword of the display device in the display information;

若是,设置标志位为1,获取所述视频接口的所述名称,并获取所述显示信息的下一行所述信息,返回至所述查找所述显示信息中的所述显示设备的连接关键词的步骤。If so, set the flag bit to 1, obtain the name of the video interface, and obtain the information in the next line of the display information, and return to the search for the connection keyword of the display device in the display information A step of.

优选地,在所述依次切换所述分辨率和所述分辨率下的所述刷新率之后,还包括:Preferably, after the sequentially switching the resolution and the refresh rate under the resolution, the method further includes:

在预设时间后打印包含当前所述分辨率和当前所述刷新率的数据的截图文件,并将所述截图文件以当前所述分辨率和当前所述刷新率命名。After a preset time, a screenshot file containing data of the current resolution and the current refresh rate is printed, and the screenshot file is named with the current resolution and the current refresh rate.

优选地,在所述将各行所述信息分别分割为多个字符串之后,还包括:Preferably, after the information of each line is divided into multiple character strings, the method further includes:

删除所述字符串中除数字外的其余字符。Delete the remaining characters in the string except numbers.

优选地,所述根据所述显示信息切换所述分辨率和所述分辨率下的所述刷新率包括:Preferably, the switching of the resolution and the refresh rate under the resolution according to the display information includes:

通过xrandr指令输出显示所述分辨率和所述分辨率下的所述刷新率,并输出所述视频接口的所述名称。The resolution and the refresh rate under the resolution are displayed through the xrandr command output, and the name of the video interface is output.

为解决上述技术问题,本申请还提供一种分辨率和刷新率的切换装置,包括:In order to solve the above technical problems, the present application also provides a resolution and refresh rate switching device, including:

获取模块,用于获取视频接口的名称和显示设备的连接状态;The acquisition module is used to acquire the name of the video interface and the connection status of the display device;

生成模块,用于根据所述名称和所述连接状态生成所述显示设备的显示信息;其中,所述显示信息中包含各所述视频接口连接的所述显示设备所支持的分辨率和刷新率;A generating module, configured to generate display information of the display device according to the name and the connection state; wherein, the display information includes the resolution and refresh rate supported by the display device connected to each of the video interfaces ;

切换模块,用于根据所述显示信息切换所述分辨率和所述分辨率下的所述刷新率,以用于根据所述分辨率和所述刷新率显示图像。A switching module, configured to switch the resolution and the refresh rate under the resolution according to the display information, so as to display an image according to the resolution and the refresh rate.

为解决上述技术问题,本申请还提供另一种分辨率和刷新率的切换装置,包括:In order to solve the above technical problems, the present application also provides another device for switching resolution and refresh rate, including:

存储器,用于存储计算机程序;memory for storing computer programs;

处理器,用于执行所述计算机程序时实现上述所述的分辨率和刷新率的切换方法的步骤。The processor is configured to implement the steps of the above-mentioned method for switching the resolution and the refresh rate when executing the computer program.

为解决上述技术问题,本申请还提供一种计算机可读存储介质,所述计算机可读存储介质上存储有计算机程序,所述计算机程序被处理器执行时实现上述所述的分辨率和刷新率的切换方法的步骤。In order to solve the above technical problems, the present application also provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the above-mentioned resolution and refresh rate are realized. The steps of the switching method.

本申请所提供的一种分辨率和刷新率的切换方法,通过获取视频接口的名称和显示设备的连接状态;根据名称和连接状态生成显示设备的显示信息;其中,显示信息中包含各视频接口连接的显示设备所支持的分辨率和刷新率;根据显示信息切换分辨率和分辨率下的刷新率,以用于根据分辨率和刷新率显示图像。由此可知,上述方案通过生成包含各视频接口连接的显示设备所支持的分辨率和刷新率的显示信息,通过显示信息实现了分辨率和刷新率的切换显示,极大的提高了显示效率,避免了手动切换可能会出现了人为失误,节省了人力和时间成本。In a method for switching resolution and refresh rate provided by the present application, the name of the video interface and the connection state of the display device are obtained; the display information of the display device is generated according to the name and the connection state; wherein, the display information includes each video interface The resolution and refresh rate supported by the connected display device; switch the resolution and refresh rate under the resolution according to the display information, which is used to display the image according to the resolution and refresh rate. It can be seen that the above solution generates display information including the resolution and refresh rate supported by the display device connected to each video interface, and realizes the switching display of the resolution and the refresh rate through the display information, which greatly improves the display efficiency. It avoids the human error that may occur in manual switching, and saves manpower and time costs.

此外,本申请实施例还提供了一种分辨率和刷新率的切换装置及计算机可读存储介质,效果同上。In addition, the embodiments of the present application also provide a resolution and refresh rate switching device and a computer-readable storage medium, with the same effects as above.

附图说明Description of drawings

为了更清楚地说明本申请实施例,下面将对实施例中所需要使用的附图做简单的介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to describe the embodiments of the present application more clearly, the following will briefly introduce the drawings that are used in the embodiments. Obviously, the drawings in the following description are only some embodiments of the present application, which are not relevant to ordinary skills in the art. As far as personnel are concerned, other drawings can also be obtained from these drawings on the premise of no creative work.

图1为本申请实施例提供的一种分辨率和刷新率的切换方法的流程图;1 is a flowchart of a method for switching resolution and refresh rate according to an embodiment of the present application;

图2为本申请实施例提供的一种显示信息的示意图;2 is a schematic diagram of a display information provided by an embodiment of the present application;

图3为本申请实施例提供的分辨率和刷新率的切换方法在应用场景中的流程图;3 is a flowchart of a method for switching resolution and refresh rate in an application scenario provided by an embodiment of the present application;

图4为本申请实施例提供的一种分辨率和刷新率的切换装置的结构示意图;4 is a schematic structural diagram of a device for switching resolution and refresh rate according to an embodiment of the present application;

图5为本申请实施例提供的另一种分辨率和刷新率的切换装置的结构示意图。FIG. 5 is a schematic structural diagram of another device for switching resolution and refresh rate according to an embodiment of the present application.

具体实施方式Detailed ways

下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下,所获得的所有其他实施例,都属于本申请保护范围。The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, but not all of the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in the present application without creative work fall within the protection scope of the present application.

本申请的核心是提供一种分辨率和刷新率的切换方法、装置及介质。The core of the present application is to provide a resolution and refresh rate switching method, device and medium.

为了使本技术领域的人员更好地理解本申请方案,下面结合附图和具体实施方式对本申请作进一步的详细说明。In order to make those skilled in the art better understand the solution of the present application, the present application will be further described in detail below with reference to the accompanying drawings and specific embodiments.

目前,厂商在对一些OS系统、显卡及显示屏等进行测试时,需要切换所有分辨率及刷新率进行测试,以确认其显示功能是否正常。但是,分辨率与搭配的显卡及显示屏等相关,不同配置可支持的分辨率有差异,且每种分辨率都搭配多个刷新率,手动切换所有分辨率及刷新率进行测试会花费大量时间。因此,本申请提供了一种分辨率和刷新率的切换方法,主要应用于对大量显示设备进行分辨率和刷新率切换的场景。需要注意的是,本实施例中分辨率和刷新率的切换方法的切换场景仅仅是一种优选的实施例,不对分辨率和刷新率的切换方法的应用场景产生限制,还可以应用其他分辨率和刷新率的切换的场景,根据具体的实施情况而定。图1为本申请实施例提供的一种分辨率和刷新率的切换方法的流程图。如图1所示,方法包括:At present, when manufacturers test some OS systems, graphics cards and display screens, they need to switch all resolutions and refresh rates for testing to confirm whether their display functions are normal. However, the resolution is related to the matching graphics card and display screen. Different configurations can support different resolutions, and each resolution is matched with multiple refresh rates. It will take a lot of time to manually switch all resolutions and refresh rates for testing. . Therefore, the present application provides a method for switching between resolutions and refresh rates, which is mainly applied to a scenario in which a large number of display devices are switched between resolutions and refresh rates. It should be noted that the switching scenario of the switching method of resolution and refresh rate in this embodiment is only a preferred embodiment, and does not limit the application scenario of the switching method of resolution and refresh rate, and other resolutions can also be applied. The scenario of switching between refresh rates and refresh rates depends on the specific implementation. FIG. 1 is a flowchart of a method for switching a resolution and a refresh rate according to an embodiment of the present application. As shown in Figure 1, the method includes:

S10:获取视频接口的名称和显示设备的连接状态。S10: Obtain the name of the video interface and the connection status of the display device.

S11:根据名称和连接状态生成显示设备的显示信息;其中,显示信息中包含各视频接口连接的显示设备所支持的分辨率和刷新率。S11: Generate the display information of the display device according to the name and the connection state; wherein, the display information includes the resolution and refresh rate supported by the display device connected to each video interface.

S12:根据显示信息切换分辨率和分辨率下的刷新率,以用于根据分辨率和刷新率显示图像。S12: Switch the resolution and the refresh rate under the resolution according to the display information, so as to display the image according to the resolution and the refresh rate.

可以理解的是,进行分辨率和刷新率切换的主机设备的视频接口通过连接线连接不同的显示设备。在本实施中视频接口的种类包括视频图形阵列(Video Graphics Array,VGA)接口和高清多媒体接口(High Definition Multimedia Interface,HDMI),还可以包括DisplayPort(DP)接口,对于视频接口的种类不做限制,根据具体的实施情况而定。It can be understood that, the video interface of the host device that performs resolution and refresh rate switching is connected to different display devices through connecting cables. In this implementation, the types of video interfaces include a Video Graphics Array (VGA) interface and a High Definition Multimedia Interface (HDMI), and may also include a DisplayPort (DP) interface, and the types of video interfaces are not limited , depending on the specific implementation.

显示设备的连接状态,即通过视频接口连接的显示设备是否处于连接的状态。因此在步骤S10中,为了实现显示设备的分辨率和刷新率的切换,需要获取视频接口的名称和显示设备的连接状态,确定切换分辨率和刷新率的显示设备连接的是哪个视频接口,并确定显示设备是否连接视频接口。The connection status of the display device, that is, whether the display device connected through the video interface is in the connected state. Therefore, in step S10, in order to realize the switching of the resolution and refresh rate of the display device, it is necessary to obtain the name of the video interface and the connection status of the display device, determine which video interface the display device that switches the resolution and the refresh rate is connected to, and Determine if a display device is connected to a video interface.

以Linux系统为例,可以使用“xrandr”指令获取当前配置下支持的视频接口的名称和显示设备的连接状态。后续进行分辨率和刷新率切换的可执行程序可以通过python语言实现。需要注意的是,本实施例中分辨率和刷新率的切换方法基于Linux系统通过python语言实现仅仅是一种优选的实施例,并不对分辨率和刷新率的切换方法的实施方式产生限制,根据具体的实施情况而定。Taking the Linux system as an example, you can use the "xrandr" command to obtain the name of the video interface supported under the current configuration and the connection status of the display device. The executable program for subsequent resolution and refresh rate switching can be implemented in python language. It should be noted that the implementation of the method for switching the resolution and the refresh rate in this embodiment through the python language based on the Linux system is only a preferred embodiment, and does not limit the implementation of the method for switching the resolution and the refresh rate. It depends on the specific implementation.

进一步地,在得到视频接口的名称和显示设备的连接状态之后,根据视频接口的名称和显示设备的连接状态生成显示设备的显示信息。其中,显示信息中包含各视频接口连接的显示设备所支持的分辨率和刷新率。可以理解的是,对于一台显示设备,可能存在不同的分辨率,例如1920*1080、1600*900或1280*960等;而每种分辨率下又分别存在着多个刷新率,例如1920*1080分辨率下存在着60.00和74.97的刷新率。不同显示设备的分辨率和刷新率由显示设备本身决定,在本实施例对显示设备所包含的分辨率和刷新率不做限制。Further, after obtaining the name of the video interface and the connection state of the display device, the display information of the display device is generated according to the name of the video interface and the connection state of the display device. The display information includes the resolution and refresh rate supported by the display device connected to each video interface. It is understandable that for a display device, there may be different resolutions, such as 1920*1080, 1600*900 or 1280*960, etc.; and each resolution has multiple refresh rates, such as 1920* There are 60.00 and 74.97 refresh rates at 1080 resolution. The resolution and refresh rate of different display devices are determined by the display device itself, and the resolution and refresh rate included in the display device are not limited in this embodiment.

需要注意的是,本实施例中对于显示设备的显示信息的生成格式不做限制;作为一种优选的实施例,为了实现了读写以及信息识别的便捷,显示信息的格式可以设置为txt格式。在得到显示信息后,根据信息切换分辨率和分辨率下的刷新率,以用于个根据切换的分辨率和刷新率显示图像。本实施例对于根据信息切换分辨率和分辨率下的刷新率的具体过程不做限制,根据具体的实施情况而定。It should be noted that there is no restriction on the generation format of the display information of the display device in this embodiment; as a preferred embodiment, in order to realize the convenience of reading and writing and information identification, the format of the display information can be set to txt format. . After the display information is obtained, the resolution and the refresh rate under the resolution are switched according to the information, so as to display the image according to the switched resolution and the refresh rate. This embodiment does not limit the specific process of switching the resolution and the refresh rate under the resolution according to the information, which is determined according to the specific implementation situation.

本实施例中,通过获取视频接口的名称和显示设备的连接状态;根据名称和连接状态生成显示设备的显示信息;其中,显示信息中包含各视频接口连接的显示设备所支持的分辨率和刷新率;根据显示信息切换分辨率和分辨率下的刷新率,以用于根据分辨率和刷新率显示图像。由此可知,上述方案通过生成包含各视频接口连接的显示设备所支持的分辨率和刷新率的显示信息,通过显示信息实现了分辨率和刷新率的切换显示,极大的提高了显示效率,避免了手动切换可能会出现了人为失误,节省了人力和时间成本。In this embodiment, the name of the video interface and the connection state of the display device are obtained; the display information of the display device is generated according to the name and the connection state; wherein, the display information includes the resolution and refresh rate supported by the display device connected to each video interface. rate; toggles the resolution and refresh rate under resolution according to the display information for displaying images according to the resolution and refresh rate. It can be seen that the above solution generates display information including the resolution and refresh rate supported by the display device connected to each video interface, and realizes the switching display of the resolution and the refresh rate through the display information, which greatly improves the display efficiency. It avoids the human error that may occur in manual switching, and saves manpower and time costs.

在上述实施例的基础上:On the basis of the above-mentioned embodiment:

作为一种优选的实施例,根据显示信息切换分辨率和分辨率下的刷新率包括:As a preferred embodiment, switching the resolution and the refresh rate under the resolution according to the display information includes:

遍历显示信息中的各行信息;Traverse each line of information in the display information;

将各行信息分别分割为多个字符串;Divide each line of information into multiple strings;

在各行的字符串中,获取各行第一个字符串作为分辨率,获取各行剩余的字符串作为分辨率下的刷新率;In the strings of each line, the first string of each line is obtained as the resolution, and the remaining strings of each line are obtained as the refresh rate under the resolution;

依次切换分辨率和分辨率下的刷新率。Toggle resolution and then refresh rate under resolution.

在上述实施例中,对于根据信息切换分辨率和分辨率下的刷新率的具体过程不做限制,根据具体的实施情况而定。作为一种优选的实施例,在获得显示信息后,首先遍历显示信息中的各行信息。In the above embodiment, there is no limitation on the specific process of switching the resolution and the refresh rate under the resolution according to the information, which is determined according to the specific implementation situation. As a preferred embodiment, after the display information is obtained, each row of information in the display information is first traversed.

图2为本申请实施例提供的一种显示信息的示意图。如图2所示,在显示信息中,分辨率和刷新率在行的信息中呈现。为了提取出分辨率和刷新率,需要遍历显示信息中的各行信息,将各行信息分别分割为多个字符串。可以理解的是,在本实施例中采用字符分割函数将各行信息分割为多个字符串。在得到了多个字符串后,在各行的字符串中,获取各行第一个字符串作为分辨率,获取各行剩余的字符串作为分辨率下的刷新率。依次切换分辨率和分辨率下的刷新率。例如某行中的分辨率为1920*1080,该分辨率下的刷新率为60.00和74.97,则切换分辨率/刷新率为:1920*1080/60.00和1920*1080/74.97。在本行分辨率和刷新率切换完成之后,切换至下一行的分辨率和刷新率。FIG. 2 is a schematic diagram of displaying information according to an embodiment of the present application. As shown in Figure 2, in the display information, the resolution and refresh rate are presented in the information of the row. In order to extract the resolution and refresh rate, it is necessary to traverse each line of information in the display information, and divide each line of information into multiple character strings. It can be understood that, in this embodiment, a character division function is used to divide each line of information into a plurality of character strings. After obtaining multiple strings, in the strings of each line, the first string of each line is obtained as the resolution, and the remaining strings of each line are obtained as the refresh rate under the resolution. Toggle resolution and then refresh rate under resolution. For example, the resolution in a row is 1920*1080, and the refresh rate under this resolution is 60.00 and 74.97, then the switching resolution/refresh rate is: 1920*1080/60.00 and 1920*1080/74.97. After the resolution and refresh rate of the current line are switched, switch to the resolution and refresh rate of the next line.

本实施例中,通过遍历显示信息中的各行信息;将各行信息分别分割为多个字符串;在各行的字符串中,获取各行第一个字符串作为分辨率,获取各行剩余的字符串作为分辨率下的刷新率,依次切换分辨率和分辨率下的刷新率,实现了分辨率和分辨率下的刷新率的切换。In this embodiment, each line of information in the displayed information is traversed; each line of information is divided into multiple character strings; in each line of strings, the first character string of each line is obtained as the resolution, and the remaining character strings of each line are obtained as The refresh rate under the resolution is switched between the resolution and the refresh rate under the resolution in turn, and the switching of the resolution and the refresh rate under the resolution is realized.

在上述实施例的基础上:On the basis of the above-mentioned embodiment:

作为一种优选的实施例,在将各行信息分别分割为多个字符串之前,还包括:As a preferred embodiment, before dividing each line of information into multiple character strings, the method further includes:

查找显示信息中的显示设备的连接关键词;Find the connection keyword of the display device in the display information;

若无法查找到显示信息中的显示设备的连接关键词,则获取标志位信息;If the connection keyword of the display device in the display information cannot be found, obtain the flag bit information;

若标志位信息为1,则确认显示信息中本行信息为分辨率及刷新率,进入到将各行信息分别分割为多个字符串的步骤;If the flag bit information is 1, confirm that the information of the current line in the display information is the resolution and refresh rate, and enter the step of dividing each line of information into multiple character strings;

若标志位信息为0,则确认显示信息中本行信息不为分辨率及刷新率,获取显示信息中的下一行信息,返回至查找显示信息中的显示设备的连接关键词的步骤。If the flag bit information is 0, confirm that the information in the current line in the display information is not the resolution and refresh rate, obtain the information in the next line in the display information, and return to the step of finding the connection keyword of the display device in the display information.

如图2所示,图2中的分辨率和刷新率是VGA接口连接的显示设备的分辨率和刷新率。可以理解的是,对各行信息分别分割为多个字符串的目的是为了获取分辨率和刷新率,但是在图中可知,显示信息中部分行的内容不是分辨率和刷新率,而是视频接口及其连接的显示设备的信息,或是其他无用信息;而在包含视频接口及其连接的显示设备的信息的行的下一行信息中才有可能包含分辨率和刷新率。As shown in FIG. 2 , the resolution and refresh rate in FIG. 2 are the resolution and refresh rate of the display device connected to the VGA interface. It can be understood that the purpose of dividing each line of information into multiple strings is to obtain the resolution and refresh rate. However, as can be seen from the figure, the content of some lines in the display information is not the resolution and refresh rate, but the video interface and the refresh rate. Information about the display device it is connected to, or other useless information; and resolution and refresh rate may be included in the next line of information on the line containing information about the video interface and its connected display device.

在具体实施中,在将各行信息分别分割为多个字符串之前,首先查找显示信息中的显示设备的连接关键词。可以理解的是,在显示信息中包含着视频接口连接的显示设备的信息。但在具体实施中,由于某些原因部分显示设备没有连接成功,连接关键词即为“disconnected”;而对于连接成功的显示设备的连接关键词即为“connected”。如图2所示,对于HDMI接口所连接的显示设备的关键词为“disconnected”,说明显示设备没有连接;而VGA接口所连接的显示设备的关键词为“connected”,说明显示设备连接成功,VGA接口所连接的显示设备的分辨率和刷新率在该行的下一行。需要注意的是,在包含分辨率和刷新率的行中,不存在连接关键词。In a specific implementation, before dividing each line of information into a plurality of character strings, the connection keyword of the display device in the display information is searched first. It can be understood that the display information includes the information of the display device connected to the video interface. However, in a specific implementation, due to some reasons, some display devices are not successfully connected, and the connection keyword is "disconnected"; and the connection keyword for a display device that is successfully connected is "connected". As shown in Figure 2, the keyword for the display device connected to the HDMI interface is "disconnected", indicating that the display device is not connected; and the keyword for the display device connected to the VGA interface is "connected", indicating that the display device is successfully connected, The resolution and refresh rate of the display device connected to the VGA port are in the next line of this line. It is important to note that in the row containing the resolution and refresh rate, the join keyword is not present.

因此,若无法查找到显示信息中的显示设备的连接关键词,则获取标志位信息;标志位信息用于本行是否为分辨率和刷新率信息。若标志位信息为1,则确认显示信息中本行信息为分辨率及刷新率,从而将各行信息分别分割为多个字符串,得到分辨率和分辨率下的刷新率,进行分辨率和刷新率的切换;若标志位信息为0,则确认显示信息中本行信息不为分辨率及刷新率,又由于本行中肯定不是视频接口连接的显示设备的信息,则确认本行中的信息为无用信息或错误信息,需要获取显示信息中的下一行信息,再次查找这一行的连接关键词。Therefore, if the connection keyword of the display device in the display information cannot be found, the flag bit information is obtained; the flag bit information is used to determine whether the current row is the resolution and refresh rate information. If the flag bit information is 1, confirm that the information in the current line in the display information is the resolution and refresh rate, so that each line of information is divided into multiple strings, and the resolution and the refresh rate under the resolution are obtained. If the flag bit information is 0, confirm that the information in this line is not the resolution and refresh rate in the display information, and because the information in this line is definitely not the information of the display device connected to the video interface, confirm the information in this line. For useless information or error information, it is necessary to obtain the next line of information in the displayed information, and search for the connection keyword of this line again.

本实施例中,通过查找显示信息中的显示设备的连接关键词;若无法查找到显示信息中的显示设备的连接关键词,则获取标志位信息;若标志位信息为1,则确认显示信息中本行信息为分辨率及刷新率,进入到将各行信息分别分割为多个字符串的步骤;若标志位信息为0,则确认显示信息中本行信息不为分辨率及刷新率,获取显示信息中的下一行信息,返回至查找显示信息中的显示设备的连接关键词的步骤,从而确定了显示信息的行中是否包含分辨率和刷新率。In this embodiment, the connection keyword of the display device in the display information is searched; if the connection keyword of the display device in the display information cannot be found, the flag bit information is obtained; if the flag bit information is 1, the display information is confirmed The information of the bank in the middle is the resolution and refresh rate. Enter the step of dividing the information of each line into multiple strings. If the flag bit information is 0, confirm that the information of the bank in the display information is not the resolution and refresh rate, and obtain The next line of information in the display information returns to the step of searching for the connection keyword of the display device in the display information, so as to determine whether the line of the display information includes the resolution and the refresh rate.

在上述实施例的基础上:On the basis of the above-mentioned embodiment:

作为一种优选的实施例,若查找到显示信息中的显示设备的连接关键词,还包括:As a preferred embodiment, if the connection keyword of the display device in the display information is found, the method further includes:

根据连接关键词判断视频接口是否连接显示设备;Determine whether the video interface is connected to a display device according to the connection keyword;

若否,设置标志位为0,并获取显示信息的下一行信息,返回至查找显示信息中的显示设备的连接关键词的步骤;If not, set the flag bit to 0, obtain the next line of information in the display information, and return to the step of finding the connection keyword of the display device in the display information;

若是,设置标志位为1,获取视频接口的名称,并获取显示信息的下一行信息,返回至查找显示信息中的显示设备的连接关键词的步骤。If so, set the flag bit to 1, obtain the name of the video interface, and obtain the next line of information in the display information, and return to the step of finding the connection keyword of the display device in the display information.

在上述实施例可知,显示信息的行中,一部分行的内容是分辨率和刷新率,另一部分行的内容是视频接口及其连接的显示设备的信息或无用信息。因此针对于对带有连接关键词的显示信息的行,为了便于该行的下一行的分辨率和刷新率的获取,需要根据本行显示信息设置标志位信息。具体地,根据连接关键词判断视频接口是否连接显示设备;若根据连接关键词判断视频接口没有连接显示设备,即连接关键词为“disconnected”,此时设置标志位为0,确认显示设备没有连接,在下一行中不包含分辨率和刷新率信息,进一步获取显示信息的下一行信息,查找下一行显示信息中的显示设备的连接关键词;若根据连接关键词判断视频接口连接显示设备,即连接关键词为“connected”,确认显示设备连接,下一行包含分辨率和刷新率信息,设置标志位为1,获取视频接口的名称,并获取显示信息的下一行信息,查找下一行显示信息中的显示设备的连接关键词。It can be known from the above embodiment that among the rows of displayed information, the contents of some rows are resolution and refresh rate, and the contents of other rows are information or useless information of the video interface and its connected display device. Therefore, for a row of display information with a connection keyword, in order to facilitate the acquisition of the resolution and refresh rate of the next row of the row, it is necessary to set the flag bit information according to the display information of this row. Specifically, determine whether the video interface is connected to a display device according to the connection keyword; if it is determined that the video interface is not connected to the display device according to the connection keyword, that is, the connection keyword is "disconnected", and the flag bit is set to 0 at this time, confirming that the display device is not connected. , the resolution and refresh rate information is not included in the next line, further obtain the information of the next line of the display information, and find the connection keyword of the display device in the display information of the next line; The keyword is "connected", confirm that the display device is connected, the next line contains the resolution and refresh rate information, set the flag bit to 1, get the name of the video interface, and get the information in the next line of the display information, and find the information in the next line of display information. Displays the connection keyword of the device.

本实施例中,通过根据连接关键词判断视频接口是否连接显示设备;若否,设置标志位为0,并获取显示信息的下一行信息,返回至查找显示信息中的显示设备的连接关键词的步骤;若是,设置标志位为1,获取视频接口的名称,并获取显示信息的下一行信息,返回至查找显示信息中的显示设备的连接关键词的步骤。实现了标志位的设置,以便于对下一行显示信息是否为分辨率和刷新率的判断。In this embodiment, it is determined whether the video interface is connected to the display device according to the connection keyword; if not, the flag bit is set to 0, and the next line of information in the display information is obtained, and the process returns to the search for the connection keyword of the display device in the display information. Step; if yes, set the flag bit to 1, obtain the name of the video interface, and obtain the next line of information in the display information, and return to the step of searching for the connection keyword of the display device in the display information. The setting of the flag bit is implemented to facilitate the judgment of whether the display information of the next line is the resolution and refresh rate.

在上述实施例的基础上:On the basis of the above-mentioned embodiment:

作为一种优选的实施例,在依次切换分辨率和分辨率下的刷新率之后,还包括:As a preferred embodiment, after sequentially switching the resolution and the refresh rate under the resolution, the method further includes:

在预设时间后打印包含当前分辨率和当前刷新率的数据的截图文件,并将截图文件以当前分辨率和当前刷新率命名。Print a screenshot file containing the data of the current resolution and current refresh rate after a preset time, and name the screenshot file with the current resolution and current refresh rate.

可以理解的是,在大规模的显示设备的分辨率和刷新率的切换场景下,持续监测显示设备的显示情况对于工作人员是一件十分耗费精力的过程。因此作为一种优选的实施例,在本实施例中,在依次切换分辨率和分辨率下的刷新率之后的预设时间打印包含当前分辨率和当前刷新率的数据的截图文件,并将截图文件以当前分辨率和当前刷新率命名,保证分辨率切换时间充足,从而保留下当前分辨率和刷新率的显示情况,以便于工作人员不用及时的依次监测,能够有效降低工作人员精力的耗费。需要注意的是,本实施例中对于预设时间不做限制,可以为20s也可以为其他的时间长度,根据具体的实施情况而定。It can be understood that, in a large-scale display device resolution and refresh rate switching scenario, it is a very labor-intensive process for staff to continuously monitor the display status of the display device. Therefore, as a preferred embodiment, in this embodiment, a screenshot file containing the data of the current resolution and the current refresh rate is printed at a preset time after switching the resolution and the refresh rate under the resolution in turn, and the screenshot is taken. The file is named after the current resolution and current refresh rate to ensure sufficient time for resolution switching, so as to retain the display of the current resolution and refresh rate, so that the staff does not need to monitor in sequence in time, which can effectively reduce the energy consumption of the staff. It should be noted that the preset time is not limited in this embodiment, which may be 20 s or other time lengths, depending on the specific implementation.

本实施例中,在预设时间后打印包含当前分辨率和当前刷新率的数据的截图文件,并将截图文件以当前分辨率和当前刷新率命名,以便于工作人员对显示设备的分辨率和刷新率进行查看,提高了工作人员的体验感。In this embodiment, a screenshot file containing the data of the current resolution and the current refresh rate is printed after a preset time, and the screenshot file is named with the current resolution and the current refresh rate, so that the staff can easily check the resolution and the current refresh rate of the display device. The refresh rate is used for viewing, which improves the experience of the staff.

在上述实施例的基础上:On the basis of the above-mentioned embodiment:

作为一种优选的实施例,在将各行信息分别分割为多个字符串之后,还包括:As a preferred embodiment, after dividing each line of information into multiple character strings, it also includes:

删除字符串中除数字外的其余字符。Remove the rest of the characters in the string except numbers.

可以理解的是,由于包含分辨率和刷新率的显示信息的行中,除了分辨率和刷新率可能还会存在其他信息。这些信息对于分辨率和刷新率的获取是无用的,还有可能造成字符串的读取错误。因此在本实施例中,在将各行信息分别分割为多个字符串之后,删除字符串中除数字外的其余字符,以便于得到处理过的字符串,防止字符串读取错误得到错误的分辨率或刷新率。It will be appreciated that, since the row containing the display information of the resolution and refresh rate, there may be other information in addition to the resolution and refresh rate. This information is useless for resolution and refresh rate acquisition, and may cause string reading errors. Therefore, in this embodiment, after dividing each line of information into a plurality of character strings, the remaining characters in the character string except the numbers are deleted, so as to obtain the processed character string, and prevent the character string from being read incorrectly from being erroneously distinguished. rate or refresh rate.

在上述实施例的基础上:On the basis of the above-mentioned embodiment:

作为一种优选的实施例,根据显示信息切换分辨率和分辨率下的刷新率包括:As a preferred embodiment, switching the resolution and the refresh rate under the resolution according to the display information includes:

通过xrandr指令输出显示分辨率和分辨率下的刷新率,并输出视频接口的名称。Output the display resolution and refresh rate under the resolution through the xrandr command, and output the name of the video interface.

可以理解的是,xrandr指令时Linux系统下的分辨率和刷新率的显示的指令。因此根据显示信息切换分辨率和分辨率下的刷新率具体为:通过xrandr指令输出显示分辨率和分辨率下的刷新率,并输出视频接口的名称。输出结果为“xrandr--output视频接口名称--mode分辨率--rate刷新率”,以切换显示分辨率和刷新率。It can be understood that the xrandr command is the command for displaying the resolution and refresh rate under the Linux system. Therefore, switching the resolution and the refresh rate under the resolution according to the display information is specifically: output the display resolution and the refresh rate under the resolution through the xrandr command, and output the name of the video interface. The output result is "xrandr --output video interface name --mode resolution --rate refresh rate" to switch the display resolution and refresh rate.

为了使本领域的技术人员更好的理解本申请的技术方案,下面结合附图3对上述本申请作进一步的详细说明。图3为本申请实施例提供的分辨率和刷新率的切换方法在应用场景中的流程图。如图3所示,该方法包括:In order to make those skilled in the art better understand the technical solutions of the present application, the above-mentioned present application will be further described in detail below with reference to FIG. 3 . FIG. 3 is a flowchart of the method for switching between resolution and refresh rate in an application scenario provided by an embodiment of the present application. As shown in Figure 3, the method includes:

S20:使用“xrandr”指令获取当前配置下支持的视频接口名称和显示设备连接状态。S20: Use the "xrandr" command to obtain the supported video interface names and display device connection status under the current configuration.

S21:生成txt文件,保留视频接口名称和显示设备连接状态。S21: Generate a txt file, keep the video interface name and display device connection status.

S22:遍历txt文件中的每一个行。S22: Traverse each line in the txt file.

S23:查找本行中是否含有关键词“disconnected”;若是,进入步骤S24;若否,进入步骤S25。S23: Find out whether the current row contains the keyword "disconnected"; if yes, go to step S24; if not, go to step S25.

S24:设置标志位为0,进入步骤S34。S24: Set the flag bit to 0, and go to step S34.

S25:查找本行是否含有关键词“connected”;若是,进入步骤S26;若否,进入步骤S27。S25: Find out whether the current bank contains the keyword "connected"; if yes, go to step S26; if not, go to step S27.

S26:将标志位设为1,且获取该行第一个字符串为视频接口名称;进入步骤S34。S26: Set the flag bit to 1, and obtain the first character string of the line as the video interface name; go to step S34.

S27:判断标志位是否为1;若是,进入步骤S28;若否,进入步骤S34。S27: Determine whether the flag bit is 1; if yes, go to step S28; if not, go to step S34.

S28:通过“”将此行分割成多个字符串,删除字符串中除数字外其他的字符。S28: Divide this line into multiple strings by "", and delete characters other than numbers in the string.

S29:将第一个字符串作为将要切换的分辨率。S29: Take the first string as the resolution to be switched.

S30:遍历剩余的每一个字符串,作为将要切换的刷新率。S30: Traverse each remaining character string as the refresh rate to be switched.

S31:输出Linux指令“xrandr-output视频接口名称-mode分辨率-rate刷新率”,系统可自动切换分辨率及刷新率。S31: Output the Linux command "xrandr-output video interface name-mode resolution-rate refresh rate", the system can automatically switch the resolution and refresh rate.

S32:等待20s,在终端打印出当前分辨率、刷新率并进行截图,将截图文件重命名为当前分辨率及刷新率。S32: Wait for 20s, print out the current resolution and refresh rate on the terminal and take a screenshot, and rename the screenshot file to the current resolution and refresh rate.

S33:判断是否遍历至最后一个字符串;若是,进入步骤S34;若否,进入步骤S30。S33: Determine whether to traverse to the last character string; if yes, go to step S34; if not, go to step S30.

S34:判断是否为文件最后一行;若否,进入步骤S22,以继续遍历其他行。若是,结束。S34: Determine whether it is the last line of the file; if not, go to step S22 to continue traversing other lines. If so, end.

在应用场景中通过上述步骤最终实现了分辨率和刷新率的切换。In the application scenario, the switching of resolution and refresh rate is finally realized through the above steps.

在上述实施例中,对于分辨率和刷新率的切换方法进行了详细描述,本申请还提供分辨率和刷新率的切换装置对应的实施例。需要说明的是,本申请从两个角度对装置部分的实施例进行描述,一种是基于功能模块的角度,另一种是基于硬件结构的角度。In the above embodiments, the method for switching the resolution and the refresh rate is described in detail, and the present application also provides an embodiment corresponding to the device for switching the resolution and the refresh rate. It should be noted that this application describes the embodiments of the device part from two perspectives, one is based on the perspective of functional modules, and the other is based on the perspective of hardware structure.

图4为本申请实施例提供的一种分辨率和刷新率的切换装置的结构示意图。如图4所示,分辨率和刷新率的切换装置包括:FIG. 4 is a schematic structural diagram of a device for switching resolution and refresh rate according to an embodiment of the present application. As shown in Figure 4, the switching device for resolution and refresh rate includes:

获取模块10,用于获取视频接口的名称和显示设备的连接状态;an acquisition module 10 for acquiring the name of the video interface and the connection status of the display device;

生成模块11,用于根据名称和连接状态生成显示设备的显示信息;其中,显示信息中包含各视频接口连接的显示设备所支持的分辨率和刷新率;The generation module 11 is used to generate the display information of the display device according to the name and the connection state; wherein, the display information includes the resolution and refresh rate supported by the display device connected by each video interface;

切换模块12,用于根据显示信息切换分辨率和分辨率下的刷新率,以用于根据分辨率和刷新率显示图像。The switching module 12 is configured to switch the resolution and the refresh rate under the resolution according to the display information, so as to display the image according to the resolution and the refresh rate.

本实施例提供的分辨率和刷新率的切换装置,包括获取模块、生成模块和切换模块。通过获取视频接口的名称和显示设备的连接状态;根据名称和连接状态生成显示设备的显示信息;其中,显示信息中包含各视频接口连接的显示设备所支持的分辨率和刷新率;根据显示信息切换分辨率和分辨率下的刷新率,以用于根据分辨率和刷新率显示图像。由此可知,上述方案通过生成包含各视频接口连接的显示设备所支持的分辨率和刷新率的显示信息,通过显示信息实现了分辨率和刷新率的切换显示,极大的提高了显示效率,避免了手动切换可能会出现了人为失误,节省了人力和时间成本。The device for switching resolution and refresh rate provided by this embodiment includes an acquisition module, a generation module, and a switching module. By obtaining the name of the video interface and the connection status of the display device; generating the display information of the display device according to the name and the connection state; wherein, the display information includes the resolution and refresh rate supported by the display device connected to each video interface; according to the display information Toggles the resolution and refresh rate under resolution for displaying images according to the resolution and refresh rate. It can be seen that the above solution generates display information including the resolution and refresh rate supported by the display device connected to each video interface, and realizes the switching display of the resolution and the refresh rate through the display information, which greatly improves the display efficiency. It avoids the human error that may occur in manual switching, and saves manpower and time costs.

图5为本申请实施例提供的另一种分辨率和刷新率的切换装置的结构示意图,如图5所示,分辨率和刷新率的切换装置包括:FIG. 5 is a schematic structural diagram of another device for switching resolution and refresh rate provided by an embodiment of the application. As shown in FIG. 5 , the device for switching resolution and refresh rate includes:

存储器20,用于存储计算机程序;a memory 20 for storing computer programs;

处理器21,用于执行计算机程序时实现如上述实施例中所提到的分辨率和刷新率的切换的方法的步骤。The processor 21 is configured to implement the steps of the method for switching the resolution and the refresh rate as mentioned in the above embodiments when executing the computer program.

本实施例提供的分辨率和刷新率的切换装置可以包括但不限于智能手机、平板电脑、笔记本电脑或台式电脑等。The device for switching the resolution and refresh rate provided in this embodiment may include, but is not limited to, a smart phone, a tablet computer, a notebook computer, or a desktop computer.

其中,处理器21可以包括一个或多个处理核心,比如4核心处理器、8核心处理器等。处理器21可以采用数字信号处理器(Digital Signal Processor,DSP)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)、可编程逻辑阵列(Programmable LogicArray,PLA)中的至少一种硬件形式来实现。处理器21也可以包括主处理器和协处理器,主处理器是用于对在唤醒状态下的数据进行处理的处理器,也称中央处理器(CentralProcessing Unit,CPU);协处理器是用于对在待机状态下的数据进行处理的低功耗处理器。在一些实施例中,处理器21可以在集成有图形处理器(Graphics Processing Unit,GPU),GPU用于负责显示屏所需要显示的内容的渲染和绘制。一些实施例中,处理器21还可以包括人工智能(Artificial Intelligence,AI)处理器,该AI处理器用于处理有关机器学习的计算操作。The processor 21 may include one or more processing cores, such as a 4-core processor, an 8-core processor, and the like. The processor 21 may use at least one hardware form of a digital signal processor (Digital Signal Processor, DSP), a Field-Programmable Gate Array (Field-Programmable Gate Array, FPGA), and a Programmable Logic Array (Programmable Logic Array, PLA). accomplish. The processor 21 may also include a main processor and a coprocessor. The main processor is a processor used to process data in the wake-up state, also called a central processing unit (CPU); A low-power processor for processing data in a standby state. In some embodiments, the processor 21 may be integrated with a graphics processor (Graphics Processing Unit, GPU), and the GPU is used for rendering and drawing the content that needs to be displayed on the display screen. In some embodiments, the processor 21 may further include an artificial intelligence (Artificial Intelligence, AI) processor for processing computing operations related to machine learning.

存储器20可以包括一个或多个计算机可读存储介质,该计算机可读存储介质可以是非暂态的。存储器20还可包括高速随机存取存储器,以及非易失性存储器,比如一个或多个磁盘存储设备、闪存存储设备。本实施例中,存储器20至少用于存储以下计算机程序201,其中,该计算机程序被处理器21加载并执行之后,能够实现前述任一实施例公开的分辨率和刷新率的切换方法的相关步骤。另外,存储器20所存储的资源还可以包括操作系统202和数据203等,存储方式可以是短暂存储或者永久存储。其中,操作系统202可以包括Windows、Unix、Linux等。数据203可以包括但不限于分辨率和刷新率的切换方法涉及到的数据。Memory 20 may include one or more computer-readable storage media, which may be non-transitory. Memory 20 may also include high-speed random access memory, as well as non-volatile memory, such as one or more magnetic disk storage devices, flash storage devices. In this embodiment, the memory 20 is at least used to store the following computer program 201, wherein, after the computer program is loaded and executed by the processor 21, it can implement the relevant steps of the method for switching between resolution and refresh rate disclosed in any of the foregoing embodiments . In addition, the resources stored in the memory 20 may also include an operating system 202, data 203, etc., and the storage mode may be short-term storage or permanent storage. The operating system 202 may include Windows, Unix, Linux, and the like. The data 203 may include, but is not limited to, data related to the switching method of resolution and refresh rate.

在一些实施例中,分辨率和刷新率的切换装置还可包括有显示屏22、输入输出接口23、通信接口24、电源25以及通信总线26。In some embodiments, the device for switching resolution and refresh rate may further include a display screen 22 , an input/output interface 23 , a communication interface 24 , a power supply 25 and a communication bus 26 .

本领域技术人员可以理解,图5中示出的结构并不构成对分辨率和刷新率的切换装置的限定,可以包括比图示更多或更少的组件。Those skilled in the art can understand that the structure shown in FIG. 5 does not constitute a limitation on the device for switching resolution and refresh rate, and may include more or less components than those shown in the drawings.

本实施例提供的分辨率和刷新率的切换装置,包括存储器和处理器。其中处理器用于执行计算机程序时实现如上述实施例中所提到的分辨率和刷新率的切换的方法的步骤。通过获取视频接口的名称和显示设备的连接状态;根据名称和连接状态生成显示设备的显示信息;其中,显示信息中包含各视频接口连接的显示设备所支持的分辨率和刷新率;根据显示信息切换分辨率和分辨率下的刷新率,以用于根据分辨率和刷新率显示图像。由此可知,上述方案通过生成包含各视频接口连接的显示设备所支持的分辨率和刷新率的显示信息,通过显示信息实现了分辨率和刷新率的切换显示,极大的提高了显示效率,避免了手动切换可能会出现了人为失误,节省了人力和时间成本。The device for switching resolution and refresh rate provided by this embodiment includes a memory and a processor. The steps of the method for switching between the resolution and the refresh rate as mentioned in the above embodiments are implemented when the processor is used to execute the computer program. By obtaining the name of the video interface and the connection status of the display device; generating the display information of the display device according to the name and the connection state; wherein, the display information includes the resolution and refresh rate supported by the display device connected to each video interface; according to the display information Toggles the resolution and refresh rate under resolution for displaying images according to the resolution and refresh rate. It can be seen that the above solution generates display information including the resolution and refresh rate supported by the display device connected to each video interface, and realizes the switching display of the resolution and the refresh rate through the display information, which greatly improves the display efficiency. It avoids the human error that may occur in manual switching, and saves manpower and time costs.

最后,本申请还提供一种计算机可读存储介质对应的实施例。计算机可读存储介质上存储有计算机程序,计算机程序被处理器执行时实现如上述方法实施例中记载的步骤。Finally, the present application also provides an embodiment corresponding to a computer-readable storage medium. A computer program is stored on the computer-readable storage medium, and when the computer program is executed by the processor, the steps described in the foregoing method embodiments are implemented.

可以理解的是,如果上述实施例中的方法以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。It can be understood that, if the methods in the above embodiments are implemented in the form of software functional units and sold or used as independent products, they may be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the present application can be embodied in the form of software products in essence, or the parts that contribute to the prior art, or all or part of the technical solutions, and the computer software products are stored in a storage medium , execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic disk or optical disk and other media that can store program codes .

本实施例提供的计算机可读存储介质存储有计算机程序,计算机程序被处理器执行时实现如上述方法实施例中记载的步骤。通过获取视频接口的名称和显示设备的连接状态;根据名称和连接状态生成显示设备的显示信息;其中,显示信息中包含各视频接口连接的显示设备所支持的分辨率和刷新率;根据显示信息切换分辨率和分辨率下的刷新率,以用于根据分辨率和刷新率显示图像。由此可知,上述方案通过生成包含各视频接口连接的显示设备所支持的分辨率和刷新率的显示信息,通过显示信息实现了分辨率和刷新率的切换显示,极大的提高了显示效率,避免了手动切换可能会出现了人为失误,节省了人力和时间成本。The computer-readable storage medium provided in this embodiment stores a computer program, and when the computer program is executed by a processor, the steps described in the foregoing method embodiments are implemented. By obtaining the name of the video interface and the connection status of the display device; generating the display information of the display device according to the name and the connection state; wherein, the display information includes the resolution and refresh rate supported by the display device connected to each video interface; according to the display information Toggles the resolution and refresh rate under resolution for displaying images according to the resolution and refresh rate. It can be seen that the above solution generates display information including the resolution and refresh rate supported by the display device connected to each video interface, and realizes the switching display of the resolution and the refresh rate through the display information, which greatly improves the display efficiency. It avoids the human error that may occur in manual switching, and saves manpower and time costs.

以上对本申请所提供的一种分辨率和刷新率的切换方法、装置及介质进行了详细介绍。说明书中各个实施例采用递进的方式描述,每个实施例重点说明的都是与其他实施例的不同之处,各个实施例之间相同相似部分互相参见即可。对于实施例公开的装置而言,由于其与实施例公开的方法相对应,所以描述的比较简单,相关之处参见方法部分说明即可。应当指出,对于本技术领域的普通技术人员来说,在不脱离本申请原理的前提下,还可以对本申请进行若干改进和修饰,这些改进和修饰也落入本申请权利要求的保护范围内。The method, device and medium for switching between resolution and refresh rate provided by the present application have been described in detail above. The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same and similar parts between the various embodiments can be referred to each other. As for the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant part can be referred to the description of the method. It should be pointed out that for those of ordinary skill in the art, without departing from the principles of the present application, several improvements and modifications can also be made to the present application, and these improvements and modifications also fall within the protection scope of the claims of the present application.

还需要说明的是,在本说明书中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。It should also be noted that, in this specification, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply these entities or operations. There is no such actual relationship or sequence between operations. Moreover, the terms "comprising", "comprising" or any other variation thereof are intended to encompass a non-exclusive inclusion such that a process, method, article or device that includes a list of elements includes not only those elements, but also includes not explicitly listed or other elements inherent to such a process, method, article or apparatus. Without further limitation, an element qualified by the phrase "comprising a..." does not preclude the presence of additional identical elements in a process, method, article or apparatus that includes the element.

Claims (10)

1.一种分辨率和刷新率的切换方法,其特征在于,包括:1. a switching method of resolution and refresh rate, is characterized in that, comprises: 获取视频接口的名称和显示设备的连接状态;Get the name of the video interface and the connection status of the display device; 根据所述名称和所述连接状态生成所述显示设备的显示信息;其中,所述显示信息中包含各所述视频接口连接的所述显示设备所支持的分辨率和刷新率;Generate the display information of the display device according to the name and the connection state; wherein, the display information includes the resolution and refresh rate supported by the display device connected to each of the video interfaces; 根据所述显示信息切换所述分辨率和所述分辨率下的所述刷新率,以用于根据所述分辨率和所述刷新率显示图像。The resolution and the refresh rate at the resolution are switched according to the display information for displaying an image according to the resolution and the refresh rate. 2.根据权利要求1所述的分辨率和刷新率的切换方法,其特征在于,所述根据所述显示信息切换所述分辨率和所述分辨率下的所述刷新率包括:2 . The method for switching a resolution and a refresh rate according to claim 1 , wherein the switching of the resolution and the refresh rate under the resolution according to the display information comprises: 2 . 遍历所述显示信息中的各行信息;Traverse each line of information in the displayed information; 将各行所述信息分别分割为多个字符串;The information described in each line is divided into multiple character strings; 在各行的所述字符串中,获取各行第一个所述字符串作为所述分辨率,获取各行剩余的所述字符串作为所述分辨率下的所述刷新率;In the character strings of each row, the first character string of each row is obtained as the resolution, and the remaining character strings of each row are obtained as the refresh rate under the resolution; 依次切换所述分辨率和所述分辨率下的所述刷新率。The resolution and the refresh rate under the resolution are sequentially switched. 3.根据权利要求2所述的分辨率和刷新率的切换方法,其特征在于,在所述将各行所述信息分别分割为多个字符串之前,还包括:3. The method for switching between resolution and refresh rate according to claim 2, characterized in that, before said dividing the information of each row into a plurality of character strings, the method further comprises: 查找所述显示信息中的所述显示设备的连接关键词;Find the connection keyword of the display device in the display information; 若无法查找到所述显示信息中的所述显示设备的所述连接关键词,则获取标志位信息;If the connection keyword of the display device in the display information cannot be found, obtain flag bit information; 若所述标志位信息为1,则确认所述显示信息中本行所述信息为所述分辨率及所述刷新率,进入到所述将各行所述信息分别分割为多个字符串的步骤;If the flag bit information is 1, confirm that the information in the current line in the display information is the resolution and the refresh rate, and enter the step of dividing the information in each line into multiple character strings. ; 若所述标志位信息为0,则确认所述显示信息中本行所述信息不为所述分辨率及所述刷新率,获取所述显示信息中的下一行所述信息,返回至所述查找所述显示信息中的所述显示设备的连接关键词的步骤。If the flag bit information is 0, confirm that the information in the current line in the display information is not the resolution and the refresh rate, obtain the information in the next line in the display information, and return to the The step of searching for the connection keyword of the display device in the display information. 4.根据权利要求3所述的分辨率和刷新率的切换方法,其特征在于,若查找到所述显示信息中的所述显示设备的所述连接关键词,还包括:4. The method for switching between resolution and refresh rate according to claim 3, wherein if the connection keyword of the display device in the display information is found, the method further comprises: 根据所述连接关键词判断所述视频接口是否连接所述显示设备;Determine whether the video interface is connected to the display device according to the connection keyword; 若否,设置标志位为0,并获取所述显示信息的下一行所述信息,返回至所述查找所述显示信息中的所述显示设备的连接关键词的步骤;If not, set the flag bit to 0, and obtain the information in the next line of the display information, and return to the step of searching for the connection keyword of the display device in the display information; 若是,设置标志位为1,获取所述视频接口的所述名称,并获取所述显示信息的下一行所述信息,返回至所述查找所述显示信息中的所述显示设备的连接关键词的步骤。If so, set the flag bit to 1, obtain the name of the video interface, and obtain the information in the next line of the display information, and return to the search for the connection keyword of the display device in the display information A step of. 5.根据权利要求2所述的分辨率和刷新率的切换方法,其特征在于,在所述依次切换所述分辨率和所述分辨率下的所述刷新率之后,还包括:5 . The method for switching between resolution and refresh rate according to claim 2 , wherein after the sequential switching of the resolution and the refresh rate under the resolution, the method further comprises: 5 . 在预设时间后打印包含当前所述分辨率和当前所述刷新率的数据的截图文件,并将所述截图文件以当前所述分辨率和当前所述刷新率命名。After a preset time, a screenshot file containing data of the current resolution and the current refresh rate is printed, and the screenshot file is named with the current resolution and the current refresh rate. 6.根据权利要求2所述的分辨率和刷新率的切换方法,其特征在于,在所述将各行所述信息分别分割为多个字符串之后,还包括:6. The method for switching between resolution and refresh rate according to claim 2, characterized in that, after dividing the information of each row into a plurality of character strings, the method further comprises: 删除所述字符串中除数字外的其余字符。Delete the remaining characters in the string except numbers. 7.根据权利要求1至6任意一项所述的分辨率和刷新率的切换方法,其特征在于,所述根据所述显示信息切换所述分辨率和所述分辨率下的所述刷新率包括:7. The method for switching resolution and refresh rate according to any one of claims 1 to 6, wherein the resolution and the refresh rate under the resolution are switched according to the display information include: 通过xrandr指令输出显示所述分辨率和所述分辨率下的所述刷新率,并输出所述视频接口的所述名称。The resolution and the refresh rate under the resolution are displayed through the xrandr command output, and the name of the video interface is output. 8.一种分辨率和刷新率的切换装置,其特征在于,包括:8. A switching device for resolution and refresh rate, characterized in that, comprising: 获取模块,用于获取视频接口的名称和显示设备的连接状态;The acquisition module is used to acquire the name of the video interface and the connection status of the display device; 生成模块,用于根据所述名称和所述连接状态生成所述显示设备的显示信息;其中,所述显示信息中包含各所述视频接口连接的所述显示设备所支持的分辨率和刷新率;A generating module, configured to generate display information of the display device according to the name and the connection state; wherein, the display information includes the resolution and refresh rate supported by the display device connected to each of the video interfaces ; 切换模块,用于根据所述显示信息切换所述分辨率和所述分辨率下的所述刷新率,以用于根据所述分辨率和所述刷新率显示图像。A switching module, configured to switch the resolution and the refresh rate under the resolution according to the display information, so as to display an image according to the resolution and the refresh rate. 9.一种分辨率和刷新率的切换装置,其特征在于,包括:9. A switching device for resolution and refresh rate, characterized in that, comprising: 存储器,用于存储计算机程序;memory for storing computer programs; 处理器,用于执行所述计算机程序时实现如权利要求1至7任一项所述的分辨率和刷新率的切换方法的步骤。The processor is configured to implement the steps of the method for switching resolution and refresh rate according to any one of claims 1 to 7 when executing the computer program. 10.一种计算机可读存储介质,其特征在于,所述计算机可读存储介质上存储有计算机程序,所述计算机程序被处理器执行时实现如权利要求1至7任一项所述的分辨率和刷新率的切换方法的步骤。10. A computer-readable storage medium, wherein a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the resolution according to any one of claims 1 to 7 is realized. The steps of the switching method of the rate and refresh rate.
CN202210606769.2A 2022-05-31 2022-05-31 Resolution and refresh rate switching method, device and medium Active CN114924703B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210606769.2A CN114924703B (en) 2022-05-31 2022-05-31 Resolution and refresh rate switching method, device and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210606769.2A CN114924703B (en) 2022-05-31 2022-05-31 Resolution and refresh rate switching method, device and medium

Publications (2)

Publication Number Publication Date
CN114924703A true CN114924703A (en) 2022-08-19
CN114924703B CN114924703B (en) 2023-12-26

Family

ID=82811817

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210606769.2A Active CN114924703B (en) 2022-05-31 2022-05-31 Resolution and refresh rate switching method, device and medium

Country Status (1)

Country Link
CN (1) CN114924703B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN119248216A (en) * 2024-12-05 2025-01-03 杭州冰特科技股份有限公司 A method and device for dynamically synchronizing EDID of computer display screen in cloud PC mode

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060092187A1 (en) * 2004-10-29 2006-05-04 Hon Hai Precision Industry Co., Ltd. Method for adjusting resolution and refresh rate of display monitor of computer system
US20070279407A1 (en) * 2006-05-30 2007-12-06 Maximino Vasquez Switching of display refresh rates
US20140085275A1 (en) * 2012-09-26 2014-03-27 Apple Inc. Refresh Rate Matching for Displays
CN104981766A (en) * 2014-04-28 2015-10-14 华为终端有限公司 Method for displaying data on screen and display control device
CN105825801A (en) * 2016-03-21 2016-08-03 联想(北京)有限公司 Display control method and electronic device
WO2022068592A1 (en) * 2020-09-30 2022-04-07 华为技术有限公司 Display method and electronic device

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060092187A1 (en) * 2004-10-29 2006-05-04 Hon Hai Precision Industry Co., Ltd. Method for adjusting resolution and refresh rate of display monitor of computer system
US20070279407A1 (en) * 2006-05-30 2007-12-06 Maximino Vasquez Switching of display refresh rates
US20140085275A1 (en) * 2012-09-26 2014-03-27 Apple Inc. Refresh Rate Matching for Displays
CN104981766A (en) * 2014-04-28 2015-10-14 华为终端有限公司 Method for displaying data on screen and display control device
CN105825801A (en) * 2016-03-21 2016-08-03 联想(北京)有限公司 Display control method and electronic device
WO2022068592A1 (en) * 2020-09-30 2022-04-07 华为技术有限公司 Display method and electronic device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
远望图书部: "《Windows XP/98/2000/NT/CE/Server 2003注册表全攻略:设置、优化、安全、故障、维护、个性化实例精解》", vol. 1, 人民交通出版社, pages: 184 - 185 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN119248216A (en) * 2024-12-05 2025-01-03 杭州冰特科技股份有限公司 A method and device for dynamically synchronizing EDID of computer display screen in cloud PC mode

Also Published As

Publication number Publication date
CN114924703B (en) 2023-12-26

Similar Documents

Publication Publication Date Title
US10176239B2 (en) Automation-assisted curation of technical support information
EP4105791A2 (en) Method and apparatus for training, based on cross-modal information, document reading comprehension model
US11055560B2 (en) Unsupervised domain adaptation from generic forms for new OCR forms
CN103559223A (en) Table data refreshing system and method
US20160110207A1 (en) Methods for copying information handling system configuration settings
CN103559512B (en) A kind of Text region output intent and system
CN114924703A (en) Resolution and refresh rate switching method, device and medium
CN107943377A (en) A kind of list is loaded into transition method, device, terminal and the storage medium of displaying
CN102903349B (en) Video detecting method and display device
CN116341538A (en) Text rendering method, device and electronic device
CN115906875A (en) Document translation method, device, storage medium and program product
CN108509301A (en) The update method and more new system of system slot information in a kind of SMBIOS
US20240089222A1 (en) Intelligent, personalized, and dynamic chatbot conversation
US12254313B2 (en) Contextualization of code development
CN109086181A (en) A kind of BIOS framework, self checking method, system and storage medium
CN110515530B (en) Method, device and equipment for processing character operation and storage medium
CN107526814A (en) Mobile terminal document storage method and device
CN110704241A (en) Method, device, equipment and medium for recovering file metadata
US12333791B2 (en) Determining media documents embedded in other media documents
CN113138910B (en) Input data acquisition method, device and medium
US20170017385A1 (en) Interacting With Application Beneath Transparent Layer
CN110389862B (en) Data storage method, device, equipment and storage medium
CN113961843A (en) Page list refreshing method and device, electronic equipment and storage medium
CN114594915A (en) A data caching method, device and readable storage medium
CN115878574A (en) Enterprise development data processing method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CP03 Change of name, title or address

Address after: 2324, Building 1, Aosheng Building, No. 1166 Xinluo Street, High tech Zone, Jinan City, Shandong Province, 250000

Patentee after: Inspur Computer Technology Co.,Ltd.

Country or region after: China

Address before: 250000 Room 501, building S05, No. 1036, Langchao Road, Jinan area, pilot Free Trade Zone, Jinan, Shandong Province

Patentee before: Inspur (Shandong) Computer Technology Co.,Ltd.

Country or region before: China

CP03 Change of name, title or address
TR01 Transfer of patent right

Effective date of registration: 20240923

Address after: Room 702, 7th Floor, Building 1, No. 15 Lingxiao Road, Haidian District, Beijing 100080

Patentee after: Beijing Senxinwei Computer Technology Co.,Ltd.

Country or region after: China

Address before: 2324, Building 1, Aosheng Building, No. 1166 Xinluo Street, High tech Zone, Jinan City, Shandong Province, 250000

Patentee before: Inspur Computer Technology Co.,Ltd.

Country or region before: China

TR01 Transfer of patent right