-1

I'm now writing a keyboard driver module. I want to press shift key and other key at the same time to change a lowercase to uppercase. Do I need to parse the scancode? Some hints please, and I'm very appreciate to sample code.

Ivy
  • 21
  • 4
  • See if any of these guides help: https://stackoverflow.com/questions/39911846/source-code-of-keyboard-driver-of-linux https://www.linuxjournal.com/article/1080 I would recommend looking at other keyboard drivers and see how they do it. – charlesw Feb 14 '19 at 22:07

1 Answers1

0

Actually there are two different associated with each key of keyboard - an event when it (key) is pressed and a different event when it (key) is released. You just need to use these events.

For your problem, you will have to do something like (taking 0 for press and 1 for release):

/*eventA for shift key*/
if (eventA == 0)
{
    Flag = PRESSED;
}
else
{
    Flag = RELEASED;
}

...

/*eventX for any character key*/
if (eventX == 0 )
{
    if (Flag == PRESSED)
        toupper(...)


    //print the character

}
Syed Waris
  • 1,056
  • 1
  • 11
  • 16