| Author |
Message |
|
|
Post subject: Handling keyboard interrupts in QNX
Posted: May 02, 2008 - 07:52 AM
|
|
New Member
Joined: Mar 22, 2008
Posts: 8
|
|
Hello all,
I have an issue when I handle the keyboard interrupt (interrupt number 1) in my application
After servicing the interrupt and closing the application the QNX shell stops receiving keyboard inputs.
The code is as follows
InterruptAttachEvent (1, sigevent..)
InterruptWait (NULL, NULL);
InterruptMask ()
InterruptDetach ()
Does anyone know of a fix?
Any help will be greatly appreciated.
Regards,
-Sameer |
|
|
| |
|
|
|
 |
|
|
Post subject: RE: Handling keyboard interrupts in QNX
Posted: May 02, 2008 - 01:07 PM
|
|
QNX Master
Joined: Sep 01, 2002
Posts: 2667
|
|
InterruptMask is called leaving the interrupt disabled. The OS needs that interrupt to handle the keyboard properly.
Why do you need to attach to the keyboard interrupt? |
|
|
| |
|
|
|
 |
|
|
Post subject: RE: Handling keyboard interrupts in QNX
Posted: May 05, 2008 - 02:14 AM
|
|
New Member
Joined: Mar 22, 2008
Posts: 8
|
|
Hi,
Even when I donot call the interrupt mask or interrupt detach, I get the same effect of shell not receiving the keyboard interrupt after the application exits.
What I am doing is tring to simulate a hardware interrupt like the powerfail. The interrupt number is a custom one. As I do not have the hardware yet, thenext best thing was the key board. I am using the keyboard to simulate the power fail interrupt.
Is there any other way to generate a hardware interrupt?
Regards,
-Sameer |
|
|
| |
|
|
|
 |
|
|
Post subject: RE: Handling keyboard interrupts in QNX
Posted: May 05, 2008 - 03:59 AM
|
|
Senior Member
Joined: Sep 17, 2004
Posts: 172
|
|
If you set up the interrupt to deliver a pulse then it's very easy to simulate. Any process can send a pulse.
Look at InterruptAttachEvent() and the associated docs on writing an interrupt handler. |
|
|
| |
|
|
|
 |
|
|
Post subject: RE: Handling keyboard interrupts in QNX
Posted: May 05, 2008 - 06:31 AM
|
|
QNX Master
Joined: Sep 01, 2002
Posts: 2667
|
|
| There is probably something in your code that you not telling us about that is causing the problem. |
|
|
| |
|
|
|
 |
|
|
Post subject: RE: Handling keyboard interrupts in QNX
Posted: May 05, 2008 - 12:14 PM
|
|
New Member
Joined: Mar 22, 2008
Posts: 8
|
|
Hello,
Thanks for your help. The issue is resolved. The issue got resolved when I called the InterruptUnmask when exiting the application.
Regards,
-Sameer |
|
|
| |
|
|
|
 |
|
|
Post subject: RE: Handling keyboard interrupts in QNX
Posted: May 05, 2008 - 01:11 PM
|
|
QNX Master
Joined: Sep 01, 2002
Posts: 2667
|
|
| Woops I kind of miss that. When the kernel received the interrupt it disables it, it's up to the application to enable it. |
|
|
| |
|
|
|
 |
|
|
Post subject: RE: Handling keyboard interrupts in QNX
Posted: May 05, 2008 - 05:24 PM
|
|
QNX Master
Joined: Aug 31, 2004
Posts: 175
Location: Ottawa
|
|
| You should always use _NTO_INTR_FLAGS_TRK_MSK - that way the OS keeps track of the mask/unmask count and will do the appropriate cleanup if your process exits. |
|
|
| |
|
|
|
 |
|
|
Post subject: RE: Handling keyboard interrupts in QNX
Posted: May 05, 2008 - 08:23 PM
|
|
QNX Master
Joined: Sep 01, 2002
Posts: 2667
|
|
Colin, the doc on InterruptDetach should probably make that clear, (not only in InterruptAttach*().
Cheers, |
|
|
| |
|
|
|
 |
|
|
Post subject: RE: Handling keyboard interrupts in QNX
Posted: May 07, 2008 - 11:01 AM
|
|
New Member
Joined: Mar 22, 2008
Posts: 8
|
|
Thanks for the information on _NTO_INTR_FLAGS_TRK_MSK flag. I am using this and I am able to simulate the hardware interrupt.
Thanks once again  |
|
|
| |
|
|
|
 |
|
|