lkml.org 
[lkml]   [2006]   [Jul]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch] Re: Magic Alt-SysRq change in 2.6.18-rc1
Bodo Eggert wrote:
> Paulo Marques <pmarques@grupopie.com> wrote:
>[...]
>>This allows for all the combinations mentioned before in this thread and
>>makes the logic simpler, IMHO.
>
> Why don't you use a bitmask?
> alt-sysrq down -> val = 0b11
> sysrq up -> val &= ~0b01
> alt up -> val &= ~0b10
>
> test is_sysrq == !!val

It can be done, but it doesn't seem to buy you much.

The sysrq_alt variable is used wether we use magic sysrq or not, so we
must keep it anyway. This var doesn't do what your high bit does,
because in the bit mask this bit only goes on when both are pressed (not
just alt).

alt up is actually 2 different keys (left and right). To detect it, we
either copy the same "if" that is outside the #ifdef or we try to follow
the state of sysrq_alt to detect the change from low to high :P

Anyway, I think the code can be simplified further, though, and it might
involve a similar trick. And it definitely needs some more comments in
there ;)

I'll play with it some more and try to produce a better patch.

--
Paulo Marques
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-07-13 00:39    [W:0.246 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site