Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 233246
b: refs/heads/master
c: 7ab7b5a
h: refs/heads/master
v: v3
  • Loading branch information
Dmitry Torokhov committed Feb 3, 2011
1 parent d2c29cc commit d53db1b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 19e955415398687b79fbf1c072a84c9874b8d576
refs/heads/master: 7ab7b5adfb923978a2cab7bd3fac9ccf7d21cc3f
17 changes: 16 additions & 1 deletion trunk/drivers/char/sysrq.c
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,7 @@ struct sysrq_state {
unsigned int alt_use;
bool active;
bool need_reinject;
bool reinjecting;
};

static void sysrq_reinject_alt_sysrq(struct work_struct *work)
Expand All @@ -581,6 +582,10 @@ static void sysrq_reinject_alt_sysrq(struct work_struct *work)
unsigned int alt_code = sysrq->alt_use;

if (sysrq->need_reinject) {
/* we do not want the assignment to be reordered */
sysrq->reinjecting = true;
mb();

/* Simulate press and release of Alt + SysRq */
input_inject_event(handle, EV_KEY, alt_code, 1);
input_inject_event(handle, EV_KEY, KEY_SYSRQ, 1);
Expand All @@ -589,6 +594,9 @@ static void sysrq_reinject_alt_sysrq(struct work_struct *work)
input_inject_event(handle, EV_KEY, KEY_SYSRQ, 0);
input_inject_event(handle, EV_KEY, alt_code, 0);
input_inject_event(handle, EV_SYN, SYN_REPORT, 1);

mb();
sysrq->reinjecting = false;
}
}

Expand All @@ -599,6 +607,13 @@ static bool sysrq_filter(struct input_handle *handle,
bool was_active = sysrq->active;
bool suppress;

/*
* Do not filter anything if we are in the process of re-injecting
* Alt+SysRq combination.
*/
if (sysrq->reinjecting)
return false;

switch (type) {

case EV_SYN:
Expand Down Expand Up @@ -629,7 +644,7 @@ static bool sysrq_filter(struct input_handle *handle,
sysrq->alt_use = sysrq->alt;
/*
* If nothing else will be pressed we'll need
* to * re-inject Alt-SysRq keysroke.
* to re-inject Alt-SysRq keysroke.
*/
sysrq->need_reinject = true;
}
Expand Down

0 comments on commit d53db1b

Please sign in to comment.