A screen flipping method and electronic device based on Linux system

By using sensors and microcontrollers to detect the posture changes of the secondary display screen in Linux system and generate flip commands, adaptive screen flip with high accuracy and high response performance is achieved, solving the problem of low screen adjustment efficiency in multi-screen displays, improving the ease of operation.

CN113970995BActive Publication Date: 2024-12-27SHANDONG CHAOYUE DATA CONTROL ELECTRONICS CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111240022.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-25
Publication Date
2024-12-27
Estimated Expiration
2041-10-25

Smart Images

  • Figure CN113970995B_ABST
    Figure CN113970995B_ABST
Patent Text Reader

Abstract

The present invention discloses a screen flipping method based on a Linux system, which is applied to an electronic device, wherein the electronic device includes a main display screen and a sub-display screen, wherein the main display screen is in a fixed state, and the sub-display screen is in a movable state. The method comprises: using a sensor to detect that the sub-display screen changes from a first posture to a second posture; according to the second posture and the correspondence between the pre-set posture and the flipping parameter, using a single-chip microcomputer to determine the flipping parameter corresponding to the second posture; according to the flipping parameter, using a display flipping application to generate a flipping instruction corresponding to the flipping parameter; according to the flipping instruction, executing the display flipping operation of the sub-display screen. The present invention also discloses an electronic device. Through the scheme of the present invention, it is possible to realize adaptive flipping of screen display content with high accuracy and high response performance, and the operation is simpler and more convenient.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a screen flipping method and electronic equipment based on a Linux system. Background Art

[0002] With the rapid development of computer technology and Internet communication technology, the popularization of multi-core CPUs and the continuous improvement of computer performance, people have gradually become accustomed to starting multiple applications at the same time. However, too many application windows will occupy a large amount of display space on the monitor, forcing users to frequently switch windows when performing multi-window operations, greatly reducing work efficiency and prolonging work time. Therefore, multi-screen display technology came into being.

[0003] Multi-screen display can be used to handle multi-file and multi-perspective work, and can expand the operation interface to other screens. For example: game enthusiasts can experience games more intuitively by displaying games on multiple screens; stockholders can use multiple screens to watch stock transactions; advertisers can use multiple screens to display commercial advertisements; merchants can display products on multiple screens, etc. When using multi-screen display, in order to facilitate viewing of content, people often need to adjust the position of the secondary screen when the main screen is fixed, such as moving, flipping, etc. The adjustment of the position of the secondary screen is generally accompanied by the adjustment of the content displayed on the screen. Therefore, how to perform adaptive screen flipping with high accuracy and high responsiveness is a problem to be solved by the present invention. Summary of the invention

[0004] The present invention proposes a screen flipping method, electronic device and computer-readable storage medium based on a Linux system, which can realize adaptive flipping of screen display content with high accuracy and high response performance, and the operation is simpler and more convenient.

[0005] Based on the above purpose, an embodiment of the present invention provides a flip screen method based on a Linux system, which can be applied to an electronic device, wherein the electronic device includes a main display screen and a sub-display screen, the main display screen is in a fixed state, and the sub-display screen is in a movable state, and the method includes:

[0006] Using a sensor to detect that the secondary display screen changes from a first posture to a second posture;

[0007] According to the second posture and the correspondence between the preset posture and the flipping parameter, the flipping parameter corresponding to the second posture is determined by using the single chip microcomputer;

[0008] According to the flip parameters, a flip instruction corresponding to the flip parameters is generated by using a display flip application program;

[0009] According to the flip instruction, the display flip operation of the secondary display screen is executed.

[0010] In some implementations, the first posture is an upright posture, and after using a sensor to detect that the secondary display screen changes from the first posture to the second posture, the method further includes:

[0011] Determine whether the second posture is an upright posture by using a single chip microcomputer;

[0012] If not, the flipping parameter corresponding to the second posture is determined by using the single chip microcomputer according to the second posture and the correspondence between the preset posture and the flipping parameter.

[0013] In some implementations, if the second posture is determined to be the upright posture, the display flipping operation is not performed.

[0014] In some embodiments, the flip parameter is a flag value;

[0015] The flag value is 1, indicating that the second posture is the upright posture;

[0016] The flag value is 0, indicating that the second posture is an inverted posture.

[0017] In some implementations, performing a display flipping operation of the secondary display screen according to the flipping instruction includes:

[0018] Create input events and send events according to the flip command and the predefined correspondence between the command and the button state and the screen flip state;

[0019] The input event represents the key and key status required to trigger the flip command to execute the flip operation;

[0020] The sending event indicates that the display flipping operation of the sub-display is executed according to the flipping instruction.

[0021] In some embodiments, the keys include: a ctrl key, an alt key, an up key, and a down key;

[0022] The key state includes pressed state and unpressed state; the pressed state is assigned a value of 1, and the unpressed state is assigned a value of 0.

[0023] In some implementations, values ​​are assigned to the ctrl key, the alt key, the up key, and the down key to obtain a combined value;

[0024] The combined value is 1110, which means that the display of the secondary display screen is flipped 180° counterclockwise;

[0025] The combined value is 1101, which means that the display of the secondary display screen is flipped 180° clockwise.

[0026] In some implementations, after creating an input event and sending an event according to the flip instruction and the predefined correspondence between the instruction and the button state and the screen flip state, the method further includes:

[0027] Monitor key readability;

[0028] When a key is detected to be unreadable, an alarm message is generated.

[0029] Another aspect of the embodiment of the present invention further provides an electronic device, the electronic device comprising a main display screen and a sub-display screen, the main display screen is in a fixed state, the sub-display screen is in a movable state, the electronic device comprises: a sensor, a single-chip microcomputer, a display flip application program and an execution unit, wherein:

[0030] The sensor is configured to detect that the secondary display screen changes from a first posture to a second posture;

[0031] The single chip microcomputer is configured to determine the flipping parameter corresponding to the second posture according to the second posture and the correspondence between the preset posture and the flipping parameter;

[0032] A display flip application is configured to generate a flip instruction corresponding to the flip parameter according to the flip parameter;

[0033] The execution unit is configured to execute a display flip operation of the secondary display screen according to the flip instruction.

[0034] According to another aspect of the embodiments of the present invention, a computer-readable storage medium is provided, which stores a computer program that implements the above method steps when executed by a processor.

[0035] In the embodiment of the present invention, a sensor is used to detect that the secondary display screen changes from a first posture to a second posture; according to the second posture and the correspondence between the posture and the flip parameter set in advance, a single-chip microcomputer is used to determine the flip parameter corresponding to the second posture; according to the flip parameter, a flip instruction corresponding to the flip parameter is generated by a display flip application program; according to the flip instruction, the display flip operation of the secondary display screen is executed. Through the scheme of the present invention, it is possible to realize adaptive flipping of screen display content with high accuracy and high response performance, and the operation is simpler and more convenient. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other embodiments can be obtained based on these drawings without paying creative work.

[0037] Figure 1 A schematic diagram of a screen flipping method based on a Linux system provided by an embodiment of the present invention;

[0038] Figure 2 A schematic diagram of a screen flipping method based on a Linux system provided by an embodiment of the present invention;

[0039] Figure 3 A block diagram of an electronic device provided for an embodiment of the present invention;

[0040] Figure 4 Schematic diagram of a computer-readable storage medium provided for embodiments of the present invention. DETAILED DESCRIPTION

[0041] In order to make the objectives, technical solutions and advantages of the present invention more clearly understood, the embodiments of the present invention are further described in detail below in combination with specific embodiments and with reference to the accompanying drawings.

[0042] It should be noted that all expressions using "first" and "second" in the embodiments of the present invention are for distinguishing two non-identical entities with the same name or non-identical parameters. It can be seen that "first" and "second" are only for the convenience of expression and should not be understood as limitations on the embodiments of the present invention. The subsequent embodiments will not explain this one by one.

[0043] Based on the above purpose, the first aspect of the embodiment of the present invention provides an embodiment of a flip screen method based on a Linux system. The method is applied to an electronic device, the electronic device includes a main display screen and a sub-display screen, the main display screen is in a fixed state, and the sub-display screen is in a movable state, such as Figure 1 As shown, the method includes:

[0044] S101, using a sensor to detect whether the secondary display screen changes from a first posture to a second posture. If yes, executing S102.

[0045] The posture can be understood as the physical state of the secondary display screen, such as the secondary display screen standing upright on the desktop, or the secondary display screen standing upside down on the desktop, etc.

[0046] The first posture is different from the second posture, and the change of the first posture to the second posture can be understood as a change in the posture of the secondary display screen.

[0047] Among them, the sensor may include a gyroscope sensor.

[0048] S102: The sensor sends the second posture to the single chip microcomputer.

[0049] In some embodiments, the first posture is an upright posture. After executing S102, a flip screen method based on a Linux system proposed in an embodiment of the present invention further includes:

[0050] S103, using the single chip microcomputer to determine whether the second posture is an upright posture; if so, executing S104; if not, executing S105.

[0051] Specifically, the single chip microcomputer determines the screen direction and relative position of the secondary display screen according to the second posture, thereby determining whether the second posture is an upright posture.

[0052] S104: Do not perform the display flipping operation.

[0053] S105 , according to the second posture and the preset correspondence between the posture and the flipping parameter, using the single chip microcomputer to determine the flipping parameter corresponding to the second posture.

[0054] The flip parameter may be a flag value. A flag value of 1 indicates that the posture is an upright posture, that is, the first posture is an upright posture; a flag value of 0 indicates that the posture is an inverted posture, that is, the first posture is an inverted posture. Of course, the embodiment of the present invention is not limited to the flip parameter being a flag value.

[0055] S106 , generating a flip instruction corresponding to the flip parameter using a display flip application according to the flip parameter.

[0056] Assumption: The flip parameter is a flag value, and the flag value is 0, then the display flip application generates a flip instruction, and the flip instruction is used to instruct the display of the secondary display screen to flip 180 degrees counterclockwise. The flip parameter is a flag value, and the flag value is 1, then the display flip application does not generate a flip instruction.

[0057] S107: Execute a display flipping operation of the secondary display screen according to the flipping instruction.

[0058] The electronic device can automatically control the display flipping of the secondary display screen according to the flipping instruction. Of course, the display flipping of the secondary display screen can also be controlled manually.

[0059] The electronic device manually controls the display flipping of the secondary display screen, which can be specifically implemented as follows:

[0060] like Figure 2 As shown, S201, according to the flip instruction, and the predefined correspondence between the instruction and the button state and the screen flip state, an input event and a sending event are created.

[0061] The input event represents the key and key status required to trigger the flip instruction to execute the flip operation.

[0062] The keys may include: a ctrl key, an alt key, an up key, and a down key. Of course, the keys may also include other keys, which are not specifically limited in the embodiment of the present invention.

[0063] Among them, the key state can include a pressed state and an unpressed state. The pressed state can be assigned a value of 1, and the unpressed state can be assigned a value of 0. That is, when the ctrl key is in a pressed state, the ctrl key is assigned a value of 1; when the ctrl key is not pressed, the ctrl key is assigned a value of 0. Similarly, when the alt key is in a pressed state, the alt key is assigned a value of 1; when the alt key is not pressed, the alt key is assigned a value of 0. Similarly, when the up key is in a pressed state, the up key is assigned a value of 1; when the up key is not pressed, the up key is assigned a value of 0. Similarly, when the down key is in a pressed state, the down key is assigned a value of 1; when the down key is not pressed, the down key is assigned a value of 0.

[0064] After assigning values ​​to the ctrl key, alt key, up key and down key in advance, a combination value is obtained. For example, a combination value of 1110 indicates that the display of the secondary display screen is flipped 180° counterclockwise; a combination value of 1101 indicates that the display of the secondary display screen is flipped 180° clockwise.

[0065] The sending event indicates that the display flipping operation of the secondary display screen is executed according to the flipping instruction. For example, as mentioned above, if the combination value of Ctrl+alt+up is 111, the flipping instruction is to execute the / usr / bin / xrandr -o inverted command, that is, to flip the display of the screen 180° counterclockwise; if the combination value of Ctrl+alt+down is 111, the flipping instruction is to execute the / usr / bin / xrandr -o normal command, that is, to flip the display of the screen 180° clockwise.

[0066] That is to say, this step can be understood as presetting the flip instruction, key status, screen flip status, input event and sending event.

[0067] S202: polling the posture change of the secondary display screen.

[0068] If the posture of the secondary display screen has not changed, the process is terminated. If the posture of the secondary display screen has changed, S203 is executed.

[0069] S203, open the keyboard event device to monitor whether the key is readable. If yes, execute S204; if no, execute S205.

[0070] Among them, after opening the keyboard event device, you can clear the file descriptor of the keyboard device event and add readability again.

[0071] This step can be specifically implemented as follows: the application module under the Linux system changes the screen direction by calling the xrandr command. First, you need to open the keyboard event device, define the open_kb() function, open the keyboard event, and then use the detect_mouse_kb() function to mainly implement the function of screen flipping by using the keyboard combination key.

[0072] S204: When it is detected that the key is readable, the key value of the key is received.

[0073] S205: When it is detected that the key is unreadable, an alarm message is generated.

[0074] When it is detected that the key is unreadable, the return value is 0. At this time, an alarm message is generated to inform the user.

[0075] S206: Determine whether the key value of the received key matches the combination value. If yes, execute S207; if no, execute S203.

[0076] S207, determine the key combination corresponding to the combination value. If the key combination is Ctrl+alt+up, execute S208; if the key combination is Ctrl+alt+down, execute S209.

[0077] S208, flip the display of the secondary display screen 180° counterclockwise.

[0078] S209, flip the display of the secondary display screen 180° clockwise.

[0079] In an embodiment of the present invention, the electronic device includes a main display screen and a sub-display screen, the main display screen is in a fixed state, and the sub-display screen is in a movable state. A sensor is used to detect a first posture of the sub-display screen; based on the first posture and the correspondence between the posture and the flip parameter set in advance, a single-chip microcomputer is used to determine the flip parameter corresponding to the first posture; based on the flip parameter, a flip instruction corresponding to the flip parameter is generated using a display flip application program; based on the flip instruction, a display flip operation of the sub-display screen is executed, so that the adaptive flipping of the screen display content can be achieved with high accuracy and high response performance, and the operation is simpler and more convenient.

[0080] Based on the same inventive concept, according to another aspect of the present invention, Figure 3 As shown, an embodiment of the present invention further provides an electronic device 300, the electronic device includes a main display screen and a sub-display screen, the main display screen is in a fixed state, and the sub-display screen is in a movable state, the electronic device 300 further includes: a sensor 301, a single-chip microcomputer 302, a display flip application 303 and an execution unit 304, wherein,

[0081] The sensor 301 is configured to detect a first posture of the secondary display screen;

[0082] The single chip computer 302 is configured to determine the flip parameter corresponding to the first posture according to the first posture and the correspondence between the preset posture and the flip parameter;

[0083] The display flip application 303 is configured to generate a flip instruction corresponding to the flip parameter according to the flip parameter;

[0084] The execution unit 304 is configured to execute a display flipping operation of the secondary display screen according to the flipping instruction.

[0085] In an embodiment of the present invention, the electronic device includes a main display screen and a sub-display screen, the main display screen is in a fixed state, and the sub-display screen is in a movable state. A sensor is used to detect a first posture of the sub-display screen; based on the first posture and the correspondence between the posture and the flip parameter set in advance, a single-chip microcomputer is used to determine the flip parameter corresponding to the first posture; based on the flip parameter, a flip instruction corresponding to the flip parameter is generated using a display flip application program; based on the flip instruction, a display flip operation of the sub-display screen is executed, so that the adaptive flipping of the screen display content can be achieved with high accuracy and high response performance, and the operation is simpler and more convenient.

[0086] Based on the same inventive concept, according to another aspect of the present invention, Figure 4 As shown, an embodiment of the present invention further provides a computer-readable storage medium 40, which stores a computer program 410 for executing the above method when executed by a processor.

[0087] Finally, it should be noted that a person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the storage medium of the program can be a disk, an optical disk, a read-only storage memory (ROM) or a random access memory (RAM), etc. The above-mentioned computer program embodiments can achieve the same or similar effects as the corresponding above-mentioned arbitrary method embodiments.

[0088] The above are exemplary embodiments disclosed in the present invention, but it should be noted that various changes and modifications may be made without departing from the scope disclosed in the embodiments of the present invention as defined in the claims. The functions, steps and / or actions of the method claims according to the disclosed embodiments described herein do not need to be performed in any particular order. In addition, although the elements disclosed in the embodiments of the present invention may be described or required in individual form, they may also be understood as multiple unless explicitly limited to the singular.

[0089] It should be understood that, as used herein, the singular forms "a", "an" are intended to include the plural forms as well, unless the context clearly supports an exception. It should also be understood that, as used herein, "and / or" refers to any and all possible combinations including one or more of the associated listed items.

[0090] The serial numbers of the embodiments disclosed in the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.

[0091] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.

[0092] A person skilled in the art should understand that the discussion of any of the above embodiments is only exemplary and is not intended to imply that the scope of the disclosure of the embodiments of the present invention (including the claims) is limited to these examples; under the concept of the embodiments of the present invention, the technical features in the above embodiments or different embodiments can also be combined, and there are many other changes in different aspects of the embodiments of the present invention as above, which are not provided in detail for the sake of simplicity. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the embodiments of the present invention should be included in the protection scope of the embodiments of the present invention.

Claims

1. A screen flipping method based on Linux system, applied to an electronic device, wherein the electronic device comprises a main display screen and a sub-display screen, wherein the main display screen is in a fixed state and the sub-display screen is in a movable state, characterized in that: The method comprises: Using a sensor to detect that the secondary display screen changes from a first posture to a second posture; According to the second posture and the correspondence between the preset posture and the flip parameter, using the single chip microcomputer to determine the flip parameter corresponding to the second posture; According to the flip parameters, using a display flip application to generate a flip instruction corresponding to the flip parameters; According to the flipping instruction, executing the display flipping operation of the secondary display screen; The performing the display flipping operation of the secondary display screen according to the flipping instruction includes: Open the keyboard event device to monitor whether the keystrokes are readable; In response to the key being readable, creating an input event and sending an event according to the flip instruction and a predefined correspondence between the instruction and the key state and the screen flip state; If the combination value corresponding to the input event is 1110, it is determined that the sending event is to flip the display of the secondary display screen 180° counterclockwise; If the combined value corresponding to the input event is 1101, it is determined that the sending event is to flip the display of the secondary display screen 180° clockwise; The input event is represented by the key and key state required to trigger the flip instruction to perform the flip operation; the sending event is represented by performing the display flip operation of the secondary display screen according to the flip instruction; The first posture is an upright posture. After detecting the first posture of the secondary display screen by using a sensor, the method further includes: Determining whether the second posture is an upright posture using the single chip microcomputer; If not, then according to the second posture and the correspondence between the preset posture and the flipping parameter, the single chip microcomputer is used to determine the flipping parameter corresponding to the second posture; If it is determined that the second posture is an upright posture, the display flipping operation is not performed; The step of opening the keyboard event device comprises: Poll the secondary display screen for attitude changes; If the posture of the secondary display screen does not change, the process ends; If the posture of the secondary display changes, open the keyboard event device, clear the file descriptor of the keyboard device event and add readability again.

2. The method according to claim 1, characterized in that The flip parameter is a flag value; The flag value is 1, indicating that the second posture is an upright posture; The flag value is 0, indicating that the second posture is an inverted posture.

3. The method according to claim 1, characterized in that The keys include: ctrl key, alt key, up key and down key; The key state includes a pressed state and a non-pressed state; the pressed state is assigned a value of 1, and the non-pressed state is assigned a value of 0.

4. The method according to claim 3, characterized in that Assigning values ​​to the ctrl key, alt key, up key and down key to obtain a combined value; The combination value is 1110, which means that the display of the secondary display screen is flipped 180° counterclockwise; The combination value is 1101, which means that the display of the secondary display screen is flipped 180° clockwise.

5. The method according to claim 4, characterized in that After creating an input event and sending an event according to the flip instruction and the predefined correspondence between the instruction and the key state and the screen flip state, the method further includes: In response to the key not being readable, a warning message is generated.

6. An electronic device, comprising a main display screen and a sub-display screen, wherein the main display screen is in a fixed state and the sub-display screen is in a movable state, characterized in that: The electronic device further comprises: a sensor, a single chip microcomputer, a display flip application program and an execution unit, wherein: The sensor is configured to detect that the secondary display screen changes from a first posture to a second posture; The single chip microcomputer is configured to determine the flip parameter corresponding to the second posture according to the second posture and the correspondence between the preset posture and the flip parameter; The display flip application is configured to generate a flip instruction corresponding to the flip parameter according to the flip parameter; The execution unit is configured to execute a display flipping operation of the secondary display screen according to the flipping instruction; The execution unit is also configured to: Open the keyboard event device to monitor whether the keystrokes are readable; In response to the key being readable, creating an input event and sending an event according to the flip instruction and a predefined correspondence between the instruction and the key state and the screen flip state; If the combination value corresponding to the input event is 1110, it is determined that the sending event is to flip the display of the secondary display screen 180° counterclockwise; If the combined value corresponding to the input event is 1101, it is determined that the sending event is to flip the display of the secondary display screen 180° clockwise; The input event is represented by the key and key state required to trigger the flip instruction to perform the flip operation; the sending event is represented by performing the display flip operation of the secondary display screen according to the flip instruction; The first posture is an upright posture. After the sensor is used to detect the first posture of the secondary display screen, the single chip microcomputer is further configured to: Determining whether the second posture is an upright posture using the single chip microcomputer; If not, then according to the second posture and the correspondence between the preset posture and the flipping parameter, the single chip microcomputer is used to determine the flipping parameter corresponding to the second posture; If it is determined that the second posture is an upright posture, the display flipping operation is not performed; The execution unit is further configured to: Poll the secondary display screen for attitude changes; If the posture of the secondary display screen does not change, the process ends; If the posture of the secondary display changes, open the keyboard event device, clear the file descriptor of the keyboard device event and add readability again.

7. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps included in the method according to any one of claims 1 to 5 are implemented.