Help with device drivers

Krassimir Slavchev krassi at bulinfo.net
Mon Aug 10 11:59:02 UTC 2009


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


More information about the freebsd-hackers mailing list