CN107229412A - A kind of key control method and device of embedded Linux equipment - Google Patents

A kind of key control method and device of embedded Linux equipment Download PDF

Info

Publication number
CN107229412A
CN107229412A CN201710390703.3A CN201710390703A CN107229412A CN 107229412 A CN107229412 A CN 107229412A CN 201710390703 A CN201710390703 A CN 201710390703A CN 107229412 A CN107229412 A CN 107229412A
Authority
CN
China
Prior art keywords
key
press
button
behavior
thread
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.)
Pending
Application number
CN201710390703.3A
Other languages
Chinese (zh)
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.)
Shenzhen Cool Flag Internet Co Ltd
Original Assignee
Shenzhen Cool Flag Internet 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 Shenzhen Cool Flag Internet Co Ltd filed Critical Shenzhen Cool Flag Internet Co Ltd
Priority to CN201710390703.3A priority Critical patent/CN107229412A/en
Publication of CN107229412A publication Critical patent/CN107229412A/en
Pending legal-status Critical Current

Links

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/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/02Input arrangements using manually operated switches, e.g. using keyboards or dials
    • G06F3/023Arrangements for converting discrete items of information into a coded form, e.g. arrangements for interpreting keyboard generated codes as alphanumeric codes, operand codes or instruction codes
    • 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/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0487Interaction techniques based on graphical user interfaces [GUI] using specific features provided by the input device, e.g. functions controlled by the rotation of a mouse with dual sensing arrangements, or of the nature of the input device, e.g. tap gestures based on pressure sensed by a digitiser
    • G06F3/0489Interaction techniques based on graphical user interfaces [GUI] using specific features provided by the input device, e.g. functions controlled by the rotation of a mouse with dual sensing arrangements, or of the nature of the input device, e.g. tap gestures based on pressure sensed by a digitiser using dedicated keyboard keys or combinations thereof

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Input From Keyboards Or The Like (AREA)

Abstract

The invention provides a kind of key control method and device of embedded Linux equipment, this method includes:Determine whether key-press event;If so, then calling the key and key assignments of key-press event according to key-press event;The behavior option of key-press event is marked according to the key of key-press event and key assignments;Created according to the behavior option of key-press event and start button thread;By in the incoming button thread of the behavior option of key-press event;The behavior of key-press event is handled in button thread.The problem of present invention is directed to many buttons of embedded Linux equipment and a variety of response conditions is there is provided a set of easy to use, and code readability is good, and may be such that user has more preferable experience based on the keypress function that the method is realized.

Description

A kind of key control method and device of embedded Linux equipment
Technical field
The present invention relates to embedded Linux equipment technical field, more particularly to a kind of embedded Linux equipment presses keying Method and device processed.
Background technology
Linux kernel has perfect input frameworks, and keypress function can be realized based on USB-HID and ADC samplings, and PC is used USB keyboard be usually to be realized using USB-HID, the button on Intelligent hardware is typically realized using ADC.
Linux kernel can provide the reading interface of key-press event for user's space, be exactly that system is adjusted for user's space With application program is called by system can get the key and key assignments of button.
A kind of existing technology is exactly to call to get by system that directly button is carried out after key and key assignments to parse so The response action of button is done afterwards.
But there are many shortcomings in existing this technology:First, it is very difficult to adapt to many buttons, each button has been likely to many The situation of kind of response action, for many intelligent hardware devices, it is the key factor of design consideration that interaction is easy to use.Press Key can excessively increase the complexity used, and button is very few, and it is difficult to which functional coverage is complete, therefore, the short-press of button is pressed, short-press pine Open, long-press, long-press, which is unclamped, can all be used in the action of response button interaction, existing this technology can not be solved well Solve complicated button interaction scenario, and the readability of code is poor, button autgmentability it is poor, it is necessary to increase, reduce button or Need to take a lot of time when keypress function is adjusted, it is maintainable poor;Secondly, it is impossible to cooperate well with linux threads Use, so, when some key responses are relatively time-consuming, will just influence whether timely responding to for next button.
There is provided a set of easy to use, generation for the problem of how being directed to many buttons of embedded Linux equipment and a variety of response conditions Code is readable good, and may be such that user has preferably experience to be urgently to be resolved hurrily at present based on the keypress function that the method is realized Technical problem.
The content of the invention
It is an object of the invention to overcome above-mentioned the deficiencies in the prior art, there is provided a kind of button of embedded Linux equipment Control method and device, it is intended to solve the problem of prior art is for many buttons of embedded Linux equipment and a variety of response conditions, It can not provide a set of easy to use, code readability is good, and can not realize that keypress function may be such that user has what is more preferably experienced Technical problem.
The present invention is achieved in that a kind of key control method of embedded Linux equipment, comprises the following steps:
Determine whether key-press event;
If so, then calling the key and key assignments of the key-press event according to the key-press event;
The behavior option of the key-press event is marked according to the key of the key-press event and key assignments;
Created according to the behavior option of the key-press event and start button thread;
By in the incoming button thread of the behavior option of the key-press event;
The behavior of the key-press event is handled in the button thread.
Further, it is described to determine whether also to include before the step of key-press event occurs:
Key, key assignments and the behavior option of key-press event triggering of pre-defined embedded Linux equipment;Wherein, the key Including collection key, voice key, English key, next Qu Jian, upper one bent key, pause play button, wechat key, virgin speech Tong Yujian, story Key, nursery rhymes key and national literature key;The key assignments is pressed including short-press, long-press and release;The behavior option is the key and institute State the result after key assignment combination.
Further, the short-press presses the action for stopping a upper key response, and the long-press is used to trigger people Machine interactive action, the release is used for the event for responding current button.
Further, the behavior option for marking the key-press event according to the key and key assignments of the key-press event Step includes:
The behavior option that the button short-press is pressed is marked according to the key of the key-press event and key assignments;
Or, the behavior option of the button long-press is marked according to the key of the key-press event and key assignments;
Or, the behavior option that the button unclamps is marked according to the key of the key-press event and key assignments.
Further, it is described to be included according to the step of the establishment of the behavior option of the key-press event and start button thread:
The behavior option pressed according to the button short-press is created and start button short-press presses thread;
Or, built and start button long-press thread according to the behavior option of the button long-press;
Or, built according to the behavior option of the release and unclamp thread with start button.
Further, the step in the incoming button thread of the behavior option by the key-press event includes:
The incoming button short-press of behavior option that the button short-press is pressed is pressed in thread;
Or, by the incoming button long-press thread of the behavior option of the button long-press;
Or, the incoming button of behavior option that the button unclamps is unclamped in thread.
Further, it is described to include the step of handle the behavior of the key-press event in the button thread:
Pressed in the button short-press and the behavior that the button short-press is pressed is handled in thread;
Or, the behavior of the button long-press is handled in the button long-press thread;
Or, unclamped in the button and the behavior that the button unclamps is handled in thread.
Further, it is described to determine whether that the step of key-press event occurs also includes:
If judgement does not have key-press event, the step of having continued to determine whether key-press event generation.
Correspondingly, present invention also offers a kind of key control device of embedded Linux equipment, including:
Pre-defined module, for pre-defining the behavior choosing that the key, key assignments and key-press event of embedded Linux equipment are triggered ;Wherein, the key include collection key, voice key, English key, next Qu Jian, a upper bent key, suspend play button, wechat key, Child's speech Tong Yujian, story key, nursery rhymes key and national literature key;The key assignments is pressed including short-press, long-press and release;The behavior option For the result after the key and the key assignment combination;
Judge module, for determining whether key-press event;
Calling module, for when the judge module judges to have key-press event generation, then calling institute according to the key-press event State the key and key assignments of key-press event;
Mark module, the behavior option of the key-press event is marked for the key according to the key-press event and key assignments;
Create and starting module, for being created and start button thread according to the behavior option of the key-press event;
Afferent module, for by the incoming button thread of the behavior option of the key-press event;
Processing module, the behavior for handling the key-press event in the button thread.
Further, the mark module includes:
First indexing unit, the behavior choosing that the button short-press is pressed is marked for the key according to the key-press event and key assignments ;
Second indexing unit, the behavior option of the button long-press is marked for the key according to the key-press event and key assignments;
3rd indexing unit, the behavior option that the button unclamps is marked for the key according to the key-press event and key assignments;
The establishment and starting module include:
First creates and start unit, the behavior option for being pressed according to the button short-press create and start button short-press by Lower thread;
Second creates and start unit, for being built and start button long-press thread according to the behavior option of the button long-press;
3rd is created and start unit, and thread is unclamped with start button for being built according to the behavior option of the release;
The afferent module includes:
First incoming unit, the incoming button short-press of behavior option for the button short-press to be pressed is pressed in thread;
Second incoming unit, for by the incoming button long-press thread of the behavior option of the button long-press;
3rd incoming unit, the incoming button of behavior option for the button to be unclamped is unclamped in thread;
The processing module includes:
First processing units, the behavior that the button short-press is pressed is handled for being pressed in the button short-press in thread;
Second processing unit, the behavior for handling the button long-press in the button long-press thread;
3rd processing unit, the behavior that the button unclamps is handled for being unclamped in the button in thread.
Beneficial effects of the present invention:The key control method for the embedded Linux equipment that the present invention is provided, when judge have by When key events occur, then the key and key assignments of key-press event are called according to key-press event;According to the key and key assignments of key-press event Mark the behavior option of key-press event;Created according to the behavior option of key-press event and start button thread;By key-press event In the incoming button thread of behavior option;The behavior of key-press event is handled in button thread.The present invention is set for embedded Linux The problem of standby many buttons and a variety of response conditions, code readability was good, and real based on the method there is provided a set of easy to use Existing keypress function may be such that user has more preferable experience, so that the present invention has advantages below:
First, the keypress function realized by the present invention, code readability is good, beneficial to extension and maintenance;
Second, it can be very good to handle the button interaction design of multiple buttons and a variety of triggering types by the present invention, to product Bring more succinct experience;
3rd, short-press presses the action for stopping a upper key response, the event of current button is responded during release, length is on time Trigger some interactive actions.The response efficiency of button can be improved in this way;
4th, behavior option tags and thread combine what how button when can be very good to solve quick repeatedly button responded Problem.
Brief description of the drawings
Fig. 1 is the schematic flow sheet of the key control method for the embedded Linux equipment that first embodiment of the invention is provided.
Fig. 2 is the structural representation of the key control device for the embedded Linux equipment that second embodiment of the invention is provided.
Fig. 3 is the structural representation of its mark module of the key control device of embedded Linux equipment of Fig. 2 offers.
Fig. 4 is its establishment of the key control device for the embedded Linux equipment that Fig. 2 is provided and the structural representation of starting module Figure.
Fig. 5 is the structural representation of its afferent module of the key control device of embedded Linux equipment of Fig. 2 offers.
Fig. 6 is the structural representation of its processing module of the key control device of embedded Linux equipment of Fig. 2 offers.
Embodiment
In order that technical problem solved by the invention, technical scheme and beneficial effect are more clearly understood, below in conjunction with Drawings and Examples, the present invention will be described in further detail.It should be appreciated that specific embodiment described herein is only used To explain the present invention, it is not intended to limit the present invention.
Referring to Fig. 1, Fig. 1 is the key control method for the embedded Linux equipment that first embodiment of the invention is provided Schematic flow sheet.As shown in figure 1, the key control method of the embedded Linux equipment may comprise steps of.
S100, determine whether key-press event;
As an alternative embodiment, described determine whether also to include before the step of key-press event occurs:
Key, key assignments and the behavior option of key-press event triggering of pre-defined embedded Linux equipment;Wherein, the key Including collection key, voice key, English key, next Qu Jian, upper one bent key, pause play button, wechat key, virgin speech Tong Yujian, story Key, nursery rhymes key and national literature key;The key assignments is pressed including short-press, long-press and release;The behavior option is the key and institute State the result after key assignment combination.
It should be noted that in the embodiment of the present invention, the short-press presses the action for stopping a upper key response, The long-press is used to trigger interactive action, and the release is used for the event for responding current button, for example, long-press triggers voice Interaction starts, and interactive voice terminates during release.
It should be noted that in the embodiment of the present invention, because the behavior option is the key and the key assignment combination Result afterwards, so, the number of the behavior option is the number of the key and the product of the key assignments number, for example, institute Stating key includes collection key, voice key, English key, next Qu Jian, upper one bent key, pause play button, wechat key, the virgin language of virgin speech Totally 11, key, story key, nursery rhymes key and national literature key, the key assignments is pressed including short-press, long-press and unclamp totally 3, the then behavior The number of option is 33.
It should be noted that be that key is defined by macro-variable in the embodiment of the present invention, it is specific as follows:
#define KEY_LOVE 60
#define KEY_VOICE 63
#define KEY_ENGLISH 103
#define KEY_NEXT 114
#define KEY_PREV 115
#define KEY_PLAYPAUSE 102
#define KEY_WECHAT 62
#define KEY_GUYCHAT 61
#define KEY_STORY 28
#define KEY_SONG 59
#define KEY_SINOLOGY 129
As an alternative embodiment, described determine whether that the step of key-press event occurs also includes:
If judgement does not have key-press event, the step of having continued to determine whether key-press event generation.
S101, if so, then calling the key and key assignments of the key-press event according to the key-press event;
S102, the key according to the key-press event and key assignments mark the behavior option of the key-press event;
As an alternative embodiment, described mark the key-press event according to the key and key assignments of the key-press event The step of behavior option, includes:
The behavior option that the button short-press is pressed is marked according to the key of the key-press event and key assignments;
Or, the behavior option of the button long-press is marked according to the key of the key-press event and key assignments;
Or, the behavior option that the button unclamps is marked according to the key of the key-press event and key assignments.
S103, according to the behavior option of the key-press event create and start button thread;
It should be noted that in the embodiment of the present invention, passing through linux thread function pthread_create(pthread_ Create is class Unix operating systems(Unix, Linux, Mac OS X etc.)Establishment thread function, create by button poll Scanning thread goes to create, and starts thread while establishment.
As an alternative embodiment, described create and start button line according to the behavior option of the key-press event The step of journey, includes:
The behavior option pressed according to the button short-press is created and start button short-press presses thread;
Or, built and start button long-press thread according to the behavior option of the button long-press;
Or, built according to the behavior option of the release and unclamp thread with start button.
S104, by the incoming button thread of the behavior option of the key-press event;
It should be noted that in the embodiment of the present invention, when pthread_create creates thread, behavior option, key Structure parameter is packaged into key assignments, pthread_create functions are transmitted to.Main purpose is that these behaviors are selected in thread Item is parsed, need to be by transmitting thread parameter because can not directly obtain the local variable of other threads inside a thread Form.How is the button that these behavior options handled by thread when can improve press key response speed and continuous several times button The problem of filtering and response.
As an alternative embodiment, in the incoming button thread of the behavior option by the key-press event The step of include:
The incoming button short-press of behavior option that the button short-press is pressed is pressed in thread;
Or, by the incoming button long-press thread of the behavior option of the button long-press;
Or, the incoming button of behavior option that the button unclamps is unclamped in thread.
S105, the behavior for handling in the button thread key-press event.
It should be noted that in the embodiment of the present invention, first passing through file lock(File lock is a kind of file read-write mechanism, Any specific time only allows a process to access a file.By it is this lock come ensure synchronization can only have one by Key is in response)Judge this button whether also in response(Pressed and do not responded before there may be also, if continuously pressed soon very much If lower), this secondary response is if it is abandoned, if not then by way of enumerating, which behavior option judgement is one by one, Different behavior options is carried out to do different function calls.
As an alternative embodiment, the step of the behavior that the key-press event is handled in the button thread Suddenly include:
Pressed in the button short-press and the behavior that the button short-press is pressed is handled in thread;
Or, the behavior of the button long-press is handled in the button long-press thread;
Or, unclamped in the button and the behavior that the button unclamps is handled in thread.
The key control method for the embedded Linux equipment that the present invention is provided, when judging to have key-press event generation, then root The key and key assignments of key-press event are called according to key-press event;The behavior of key-press event is marked according to the key of key-press event and key assignments Option;Created according to the behavior option of key-press event and start button thread;By the incoming key wire of behavior option of key-press event In journey;The behavior of key-press event is handled in button thread.The present invention is directed to many buttons of embedded Linux equipment and a variety of responses The problem of situation, code readability was good there is provided a set of easy to use, and may be such that based on the keypress function that the method is realized User has more preferable experience, so that the present invention has advantages below:
First, the keypress function realized by the present invention, code readability is good, beneficial to extension and maintenance;
Second, it can be very good to handle the button interaction design of multiple buttons and a variety of triggering types by the present invention, to product Bring more succinct experience;
3rd, short-press presses the action for stopping a upper key response, the event of current button is responded during release, length is on time Trigger some interactive actions.The response efficiency of button can be improved in this way;
4th, behavior option tags and thread combine what how button when can be very good to solve quick repeatedly button responded Problem.
Referring to Fig. 2, Fig. 2 is the key control device for the embedded Linux equipment that second embodiment of the invention is provided Structural representation.As shown in Fig. 2 the key control device of the embedded Linux equipment includes:
Pre-defined module 1, for pre-defining the behavior that the key, key assignments and key-press event of embedded Linux equipment are triggered Option;Wherein, the key includes collection key, voice key, English key, next Qu Jian, upper one bent key, pause play button, wechat Key, virgin speech Tong Yujian, story key, nursery rhymes key and national literature key;The key assignments is pressed including short-press, long-press and release;The behavior Option is the result after the key and the key assignment combination;
Judge module 2, for determining whether key-press event;
Calling module 3, for when the judge module 2 judges to have key-press event generation, then being called according to the key-press event The key and key assignments of the key-press event;
Mark module 4, the behavior option of the key-press event is marked for the key according to the key-press event and key assignments;
Create and starting module 5, for being created and start button thread according to the behavior option of the key-press event;
Afferent module 6, for by the incoming button thread of the behavior option of the key-press event;
Processing module 7, the behavior for handling the key-press event in the button thread.
Further, as shown in figure 3, the mark module 4 includes:
First indexing unit 41, the behavior that the button short-press is pressed is marked for the key according to the key-press event and key assignments Option;
Second indexing unit 42, the behavior choosing of the button long-press is marked for the key according to the key-press event and key assignments ;
3rd indexing unit 43, the behavior choosing that the button unclamps is marked for the key according to the key-press event and key assignments ;
Further, as shown in figure 4, the establishment and starting module 5 include:
First is created and start unit 51, and the behavior option for being pressed according to the button short-press is created and start button short-press Press thread;
Second creates and start unit 52, for being built and start button long-press thread according to the behavior option of the button long-press;
3rd is created and start unit 53, and thread is unclamped with start button for being built according to the behavior option of the release;
Further, as shown in figure 5, the afferent module 6 includes:
First incoming unit 61, the incoming button short-press of behavior option for the button short-press to be pressed presses thread It is interior;
Second incoming unit 62, for by the incoming button long-press thread of the behavior option of the button long-press;
3rd incoming unit 63, the incoming button of behavior option for the button to be unclamped is unclamped in thread;
Further, as shown in fig. 6, the processing module 7 includes:
First processing units 71, the behavior that the button short-press is pressed is handled for being pressed in the button short-press in thread;
Second processing unit 72, the behavior for handling the button long-press in the button long-press thread;
3rd processing unit 73, the behavior that the button unclamps is handled for being unclamped in the button in thread.
The key control device for the embedded Linux equipment that the present invention is provided, when judge module 2 judges there is key-press event hair When raw, then calling module 3 calls the key and key assignments of key-press event according to key-press event;Mark module 4 is according to key-press event Key and key assignments mark the behavior option of key-press event;Create and starting module 5 according to the behavior option of key-press event create and Start button thread;Afferent module 6 is by the incoming button thread of the behavior option of key-press event;Processing module 7 is in button thread The behavior of interior processing key-press event.The present invention be directed to many buttons of embedded Linux equipment and a variety of response conditions the problem of there is provided A set of easy to use, code readability is good, and may be such that user has more preferable body based on the keypress function that the method is realized Test, so that the present invention has advantages below:
First, the keypress function realized by the present invention, code readability is good, beneficial to extension and maintenance;
Second, it can be very good to handle the button interaction design of multiple buttons and a variety of triggering types by the present invention, to product Bring more succinct experience;
3rd, short-press presses the action for stopping a upper key response, the event of current button is responded during release, length is on time Trigger some interactive actions.The response efficiency of button can be improved in this way;
4th, behavior option tags and thread combine what how button when can be very good to solve quick repeatedly button responded Problem.
The foregoing is merely illustrative of the preferred embodiments of the present invention, is not intended to limit the invention, all essences in the present invention Any modifications, equivalent substitutions and improvements made within refreshing and principle etc., should be included in the scope of the protection.

Claims (10)

1. a kind of key control method of embedded Linux equipment, it is characterised in that comprise the following steps:
Determine whether key-press event;
If so, then calling the key and key assignments of the key-press event according to the key-press event;
The behavior option of the key-press event is marked according to the key of the key-press event and key assignments;
Created according to the behavior option of the key-press event and start button thread;
By in the incoming button thread of the behavior option of the key-press event;
The behavior of the key-press event is handled in the button thread.
2. the key control method of a kind of embedded Linux equipment according to claim 1, it is characterised in that described to sentence It is disconnected the step of whether have key-press event generation before also include:
Key, key assignments and the behavior option of key-press event triggering of pre-defined embedded Linux equipment;Wherein, the key Including collection key, voice key, English key, next Qu Jian, upper one bent key, pause play button, wechat key, virgin speech Tong Yujian, story Key, nursery rhymes key and national literature key;The key assignments is pressed including short-press, long-press and release;The behavior option is the key and institute State the result after key assignment combination.
3. the key control method of a kind of embedded Linux equipment according to claim 2, it is characterised in that described short By the action pressed for stopping a upper key response, the long-press is used to trigger interactive action, and the release is used for Respond the event of current button.
4. the key control method of a kind of embedded Linux equipment according to claim 3, it is characterised in that described The step of marking the behavior option of the key-press event according to the key and key assignments of the key-press event includes:
The behavior option that the button short-press is pressed is marked according to the key of the key-press event and key assignments;
Or, the behavior option of the button long-press is marked according to the key of the key-press event and key assignments;
Or, the behavior option that the button unclamps is marked according to the key of the key-press event and key assignments.
5. the key control method of a kind of embedded Linux equipment according to claim 4, it is characterised in that described The step of being created according to the behavior option of the key-press event with start button thread includes:
The behavior option pressed according to the button short-press is created and start button short-press presses thread;
Or, built and start button long-press thread according to the behavior option of the button long-press;
Or, built according to the behavior option of the release and unclamp thread with start button.
6. the key control method of a kind of embedded Linux equipment according to claim 5, it is characterised in that described to incite somebody to action Step in the incoming button thread of behavior option of the key-press event includes:
The incoming button short-press of behavior option that the button short-press is pressed is pressed in thread;
Or, by the incoming button long-press thread of the behavior option of the button long-press;
Or, the incoming button of behavior option that the button unclamps is unclamped in thread.
7. a kind of key control method of embedded Linux equipment according to claim 6, it is characterised in that it is described Include in the button thread the step of behavior of the processing key-press event:
Pressed in the button short-press and the behavior that the button short-press is pressed is handled in thread;
Or, the behavior of the button long-press is handled in the button long-press thread;
Or, unclamped in the button and the behavior that the button unclamps is handled in thread.
8. the key control method of a kind of embedded Linux equipment according to claim 1, it is characterised in that described to sentence The step of whether having key-press event generation of breaking also includes:
If judgement does not have key-press event, the step of having continued to determine whether key-press event generation.
9. a kind of key control device of embedded Linux equipment, it is characterised in that including:
Pre-defined module, for pre-defining the behavior choosing that the key, key assignments and key-press event of embedded Linux equipment are triggered ;Wherein, the key include collection key, voice key, English key, next Qu Jian, a upper bent key, suspend play button, wechat key, Child's speech Tong Yujian, story key, nursery rhymes key and national literature key;The key assignments is pressed including short-press, long-press and release;The behavior option For the result after the key and the key assignment combination;
Judge module, for determining whether key-press event;
Calling module, for when the judge module judges to have key-press event generation, then calling institute according to the key-press event State the key and key assignments of key-press event;
Mark module, the behavior option of the key-press event is marked for the key according to the key-press event and key assignments;
Create and starting module, for being created and start button thread according to the behavior option of the key-press event;
Afferent module, for by the incoming button thread of the behavior option of the key-press event;
Processing module, the behavior for handling the key-press event in the button thread.
10. a kind of key control device of embedded Linux equipment according to claim 9, it is characterised in that the mark Note module includes:
First indexing unit, the behavior choosing that the button short-press is pressed is marked for the key according to the key-press event and key assignments ;
Second indexing unit, the behavior option of the button long-press is marked for the key according to the key-press event and key assignments;
3rd indexing unit, the behavior option that the button unclamps is marked for the key according to the key-press event and key assignments;
The establishment and starting module include:
First creates and start unit, the behavior option for being pressed according to the button short-press create and start button short-press by Lower thread;
Second creates and start unit, for being built and start button long-press thread according to the behavior option of the button long-press;
3rd is created and start unit, and thread is unclamped with start button for being built according to the behavior option of the release;
The afferent module includes:
First incoming unit, the incoming button short-press of behavior option for the button short-press to be pressed is pressed in thread;
Second incoming unit, for by the incoming button long-press thread of the behavior option of the button long-press;
3rd incoming unit, the incoming button of behavior option for the button to be unclamped is unclamped in thread;
The processing module includes:
First processing units, the behavior that the button short-press is pressed is handled for being pressed in the button short-press in thread;
Second processing unit, the behavior for handling the button long-press in the button long-press thread;
3rd processing unit, the behavior that the button unclamps is handled for being unclamped in the button in thread.
CN201710390703.3A 2017-05-27 2017-05-27 A kind of key control method and device of embedded Linux equipment Pending CN107229412A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710390703.3A CN107229412A (en) 2017-05-27 2017-05-27 A kind of key control method and device of embedded Linux equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710390703.3A CN107229412A (en) 2017-05-27 2017-05-27 A kind of key control method and device of embedded Linux equipment

Publications (1)

Publication Number Publication Date
CN107229412A true CN107229412A (en) 2017-10-03

Family

ID=59933814

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710390703.3A Pending CN107229412A (en) 2017-05-27 2017-05-27 A kind of key control method and device of embedded Linux equipment

Country Status (1)

Country Link
CN (1) CN107229412A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108920285A (en) * 2018-06-12 2018-11-30 北京小米移动软件有限公司 event response method and device
CN109101118A (en) * 2018-08-10 2018-12-28 山东超越数控电子股份有限公司 It is a kind of to combine the method and apparatus for realizing shortcut key based on character keys
CN111858084A (en) * 2020-06-02 2020-10-30 深圳市鼎盛光电有限公司 Data sending method and device, electronic equipment and storage medium

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108920285A (en) * 2018-06-12 2018-11-30 北京小米移动软件有限公司 event response method and device
CN109101118A (en) * 2018-08-10 2018-12-28 山东超越数控电子股份有限公司 It is a kind of to combine the method and apparatus for realizing shortcut key based on character keys
CN111858084A (en) * 2020-06-02 2020-10-30 深圳市鼎盛光电有限公司 Data sending method and device, electronic equipment and storage medium
CN111858084B (en) * 2020-06-02 2023-07-25 深圳市鼎盛光电有限公司 Data transmission method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
CN106648779B (en) A kind of intelligent terminal suspended window authority setting method
CN104184875B (en) Open method, device and the terminal of terminal debugging port
CN107357580B (en) Method for guiding terminal user to open auxiliary function permission of application
CN107229412A (en) A kind of key control method and device of embedded Linux equipment
CN101192111B (en) Mouse with screen protection control function
CN103019596B (en) A kind of method and mobile terminal realizing operation of virtual key based on touch screen
CN104615334B (en) A kind of quick method and system for removing mobile terminal informing information
CN105094506B (en) Method, intelligent terminal and the operating platform of the solution lock screen of intelligent terminal
CN106127030A (en) A kind of interface control method and device
CN109410948A (en) Communication means, device, system, computer equipment and readable storage medium storing program for executing
CN103973892A (en) Method and device for starting and stopping mobile terminal based on voice and face recognition
CN103945070A (en) Emergency call method and emergency call device based on voice recognition
CN102880422A (en) Method and device for processing words of touch screen by aid of intelligent equipment
CN108011623A (en) One-key recovery default setting circuit
CN107015803A (en) Button monitor method and system based on Linux inner core
CN105930190B (en) A kind of program self-start method and device based on operating system
CN208829048U (en) A kind of elevator card machine with auto-alarm function
CN109787941A (en) A kind of message monitoring method and device based on sensitive word
CN108762838A (en) Application program preloads method, apparatus, storage medium and terminal
CN104486149A (en) Finite-state machine method for ground tests
US20120259591A1 (en) Keyboard testing method
CN103558977B (en) The method and apparatus preventing false-lock screen
CN106354370B (en) Emergency drilling system exchange method
CN108632069B (en) Client configuration method, system and related equipment
CN107193466B (en) Gesture recognition method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
WD01 Invention patent application deemed withdrawn after publication
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20171003