All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nicholas Mc Guire <der.herr@hofr.at>
To: Alexander Varnin <fenixk19@mail.ru>
Cc: linux-embedded@vger.kernel.org
Subject: Re: Need help adding platform UIO devices to board
Date: Wed, 28 Nov 2012 20:03:53 +0100	[thread overview]
Message-ID: <20121128190353.GA20385@opentech.at> (raw)
In-Reply-To: <50B65DA3.9000707@mail.ru>

On Wed, 28 Nov 2012, Alexander Varnin wrote:

> Hello!
> I'm trying to add UIO device to my system to handle interrupt. But i'm
> facing following problem. Docs says, on reading device /dev/uio0 it will
> block until interrupt occurs. I've made simple program for test. It
> tries to write 1 to enable interrupts.
> 
>     #include <unistd.h>
>     #include <errno.h>
>     #include <fcntl.h>
>     #include <stdio.h>
> 
>     int main()
>     {
>         int fd;
>         char c = 1;
>         fd = open("/dev/uio0", O_RDONLY);
>         if (fd<0) {
>             printf("open error: %d\n", errno);
>              return 0;
>         }
>         printf("fd == %d\n", fd);
>         int res = write(fd, &c, 1);
>         if(res<0) {
>             printf("write error: %d\n", errno);
>         }
>         return 0;
>     }
>
open O_RDONLY and then write to it ?

return of 9 == EBADF

man 2 write

 EBADF  fd is not a valid file descriptor or is not open for writing.

hofrat 

  reply	other threads:[~2012-11-28 19:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-28 18:53 Need help adding platform UIO devices to board Alexander Varnin
2012-11-28 19:03 ` Nicholas Mc Guire [this message]
2012-11-29  9:29   ` Alexander Varnin
2012-11-29  9:47     ` Alexander Varnin
     [not found] ` <008d01cdce0d$d6ea04d0$84be0e70$@iii.org.tw>
2012-11-29  9:38   ` Alexander Varnin

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=20121128190353.GA20385@opentech.at \
    --to=der.herr@hofr.at \
    --cc=fenixk19@mail.ru \
    --cc=linux-embedded@vger.kernel.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.