Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Aug 2009 14:39:31 +0300
From:      Krassimir Slavchev <krassi@bulinfo.net>
To:        freebsd-hackers@freebsd.org
Subject:   Help with device drivers
Message-ID:  <4A8006F3.5020800@bulinfo.net>

next in thread | raw e-mail | index | archive | help
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi All,

Looking at sys/dev/usb/misc/ufm.c

...
static int
ufm_open(struct usb_fifo *dev, int fflags)
{
        if ((fflags & (FWRITE | FREAD)) != (FWRITE | FREAD)) {
                return (EACCES);
        }
        return (0);
}
...

and sys/dev/usb/storage/urio.c
...
static int
urio_open(struct usb_fifo *fifo, int fflags)
{
        struct urio_softc *sc = usb_fifo_softc(fifo);

        if ((fflags & (FWRITE | FREAD)) != (FWRITE | FREAD)) {
                return (EACCES);
        }
...

If I try to open the device from userland with:
fd = open("/dev/xxx0", O_RDWR) it fails because open() tries to open the
device for reading first and then for writing.

Do I use the wrong function to open such devices?

Best Regards
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (FreeBSD)

iD8DBQFKgAbyxJBWvpalMpkRAt2ZAKCWfTWtaCu+1Xcf70Z9RM3+peZJ/ACgof4q
ybg2Mu3tDnz6Jwc1MA/Zwzs=
=Usso
-----END PGP SIGNATURE-----



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4A8006F3.5020800>