Re: Getting my own " ctrl + f "

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



To answer your question, I looked at the source code for implementing
the PAUSE_BREAK function when using KDB - and here is the patch:

   5152 --- linux.orig/drivers/char/keyboard.c
   5153 +++ linux/drivers/char/keyboard.c
   5154 @@ -43,6 +43,9 @@
   5155  #include <linux/reboot.h>
   5156  #include <linux/notifier.h>
   5157  #include <linux/jiffies.h>
   5158 +#ifdef CONFIG_KDB
   5159 +#include <linux/kdb.h>
   5160 +#endif /* CONFIG_KDB */
   5161
   5162  extern void ctrl_alt_del(void);
   5163
   5164 @@ -1178,6 +1181,13 @@ static void kbd_keycode(unsigned int key
   5165                         if (keycode < BTN_MISC && printk_ratelimit())
   5166                                 printk(KERN_WARNING
"keyboard.c: can't emulate rawmode for keycode %d\n", keycode);
   5167
   5168 +#ifdef CONFIG_KDB
   5169 +       if (down && !rep && keycode == KEY_PAUSE && kdb_on == 1) {
   5170 +               kdb(KDB_REASON_KEYBOARD, 0, get_irq_regs());
   5171 +               return;
   5172 +       }
   5173 +#endif /* CONFIG_KDB */
   5174 +
   5175  #ifdef CONFIG_MAGIC_SYSRQ             /* Handle the SysRq Hack */
   5176         if (keycode == KEY_SYSRQ && (sysrq_down || (down == 1
&& sysrq_alt))) {
   5177                 if (!sysrq_down) {

And so reading the file, u can get a rough picture of how scancode
from keyboard is detected.

>From above the keys KEY_PAUSE and KEY_LEFTALT are detected, for others
u can then find out in include/linux/input.h.



On Mon, Aug 11, 2008 at 10:43 PM, rishi agrawal <postrishi@xxxxxxxxx> wrote:
> Hello Everyone,
>
> I want to call a function whenever i press a combination of keys like
> " ctrl +f ".
>
> for eg :
>
> If i write a program which will execute a function like foo() on
> pressing " ctrl +c " (using sigaction interface) i will not be able to
> terminate the program on pressing " ctrl +c".
>
> So i want a different set of key combination ( unique and preferably
> ctrl + f )  which can be used to execute function foo() from any where
> in the program.
>
>
> --
> Regards,
> Rishi B. Agrawal
>
> --
> To unsubscribe from this list: send an email with
> "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
> Please read the FAQ at http://kernelnewbies.org/FAQ
>
>



-- 
Regards,
Peter Teoh

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux