From: p.ittershagen@googlemail.com (Philipp Ittershagen)
To: kernelnewbies@lists.kernelnewbies.org
Subject: interface for a hardware trigger driver
Date: Thu, 10 May 2012 14:52:11 +0200 [thread overview]
Message-ID: <20120510125211.GB5622@peter> (raw)
In-Reply-To: <20120510090907.GA9154@ahauptfedora.berlin.teseq.com>
(resend, forgot CC)
Hi Andre!
On Thu, May 10, 2012 at 11:09:07AM +0200, Andre Haupt wrote:
> Hi folks,
>
> Its been a while since i last did some kernel related stuff,
> so please bear with me if this sounds strange to your ears.
>
> What i want to achieve:
> I want to implement a hardware trigger that a user space process
> can react on.
>
> I need a driver that blocks a process/thread until a sepcific
> hardware interrupt occurs. The process should call a kernel
> interface and then should get blocked until another
> process/thread calls another kernel interface to stop waiting
> for the irq or an interrupt actually occurs.
>
> What i have:
> Back in the days i wrote a little character driver which implemented
> 2 ioctl commands. One command (IOCTL_TRIGGER_WAIT_IRQ) put the
> calling process to sleep using wait_evemt_interruptible() and
> the other command (IOCTL_TRIGGER_STOP_WAIT_IRQ) woke a processes
> again by calling wake_up_interruptible().
>
> Now ioctls are frowned upon and i do not want to mess with
> majors and minors anymore either.
>
> Do you have any hints to the right approach for such a driver?
> Should i use some sysfs interface? If yes, which? Or does
> such a driver already exist? Can it be one completely in
> user space?
Why don't you use open(), write(), read() etc. to do the job?
Tasks which should block can then do
echo wait > /dev/yourdevname
and another process can cancel the waiting by doing
echo cancel > /dev/yourdevname
Greeting,
Philipp
next prev parent reply other threads:[~2012-05-10 12:52 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-10 9:09 interface for a hardware trigger driver Andre Haupt
2012-05-10 12:52 ` Philipp Ittershagen [this message]
2012-05-10 13:18 ` Andre Haupt
2012-05-10 14:16 ` Philipp Ittershagen
2012-05-12 20:15 ` richard -rw- weinberger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120510125211.GB5622@peter \
--to=p.ittershagen@googlemail.com \
--cc=kernelnewbies@lists.kernelnewbies.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.