OpenQNX :: The QNX Community Portal

May 13, 2008 - 02:36 PM
Google
  Web openqnx.com   
     Create an account Home · Submit News · QNX Forums · QNX Download · Search   
_
Main Menu
Who's Online
There are 72 unlogged users and 1 registered user online.

You can log-in or register for a user account here.

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
Sameer2008
Post subject: Handling keyboard interrupts in QNX  PostPosted: 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
 
 View user's profile Send private message  
Reply with quote Back to top
mario
Post subject: RE: Handling keyboard interrupts in QNX  PostPosted: 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?
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
Sameer2008
Post subject: RE: Handling keyboard interrupts in QNX  PostPosted: 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
 
 View user's profile Send private message  
Reply with quote Back to top
kwschumm
Post subject: RE: Handling keyboard interrupts in QNX  PostPosted: 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.
 
 View user's profile Send private message  
Reply with quote Back to top
mario
Post subject: RE: Handling keyboard interrupts in QNX  PostPosted: 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.
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
Sameer2008
Post subject: RE: Handling keyboard interrupts in QNX  PostPosted: 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
 
 View user's profile Send private message  
Reply with quote Back to top
mario
Post subject: RE: Handling keyboard interrupts in QNX  PostPosted: 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.
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
cburgess
Post subject: RE: Handling keyboard interrupts in QNX  PostPosted: 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.
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
mario
Post subject: RE: Handling keyboard interrupts in QNX  PostPosted: 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,
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
Sameer2008
Post subject: RE: Handling keyboard interrupts in QNX  PostPosted: 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 Smile
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2007 The PNphpBB Group
Credits
All logos and trademarks in this site are property of their respective owners. The comments are property of their posters.
Powered by OpenQNX: The QNX Community Portal Site
QNX and the QNX logo are registered trademarks of QNX Software Systems.