Re: Device driver question

Joe deBlaquiere (jadb@redhat.com)
15 May 2002 10:03:09 -0500


How about just write a driver that responds to the interrupt, and write
a program that does a blocking read from the driver. The driver read
routine stuff the program on a wait queue... until... interrupt occurs,
wake up the program, program does exec(/sbin/halt) ?

This could actually be made into a good demonstration of driver
programming in that you could hook the parport interrupt and do it with
any PC....

On Wed, 2002-05-15 at 08:36, Tommy Reynolds wrote:
> Uttered "Bloch, Jack" <Jack.Bloch@icn.siemens.com>, spoke thus:
>
> > I have a specific case where our HW can generate a
> > special interrupt. In this case I simply want the ISR to halt the system
> > (i.e. take the same action as if I typed halt from the command line). How
> > can I from within my device driver cause a halt? Please CC me specifically
> > on any replies.
>
> Check out the code for "sys_reboot" in "kernel/sys.c" for ideas on how to do
> this. I don't think you can invoke "sys_reboot" from inside an interrupt
> handler, but you could probably do the same thing by calling the service
> routines "sys_reboot" does.
>
> If that doesn't shut your machine down gracefully, then you might resort to
> "call_usermodehelper" in "kernel/kmod.c" to run "/sbin/shutdown -h now". You
> can't invoke "call_usermodehelper" from an interrupt top half, but it should
> work find from a tasklett.
> -
> 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/

-- 
Joe deBlaquiere
Red Hat, Inc.
voice : 256-217-0123
mobile: 256-527-5633
fax   : 256-837-3839
jadb@redhat.com

- 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/