int main(int argc){
        int fd,err;
         char* myString = "helloworld\n";
        fd = open("rtser0", O_RDWR);
        printf("fd is %d\n", fd);
        ioctl(fd, RTSER_RTIOC_SET_CONFIG, &write_config);
        err=write(fd, myString, strlen(myString));
        printf("err is %d\n", err);
        close(fd);
        return 0;
}

gives
sandbox:/home/bkw/code/driver_v4# ./simpledriver_v4
fd is -1
err is -1

Which means that fd didn't open the device successfully? :/
/B

On 13/09/2007, Gilles Chanteperdrix <[EMAIL PROTECTED]> wrote:
> On 9/13/07, Bachman Kharazmi <[EMAIL PROTECTED]> wrote:
> > int main(int argc)
> > {
> >        int fd;
> >         char* myString = "helloworld\n";
> >        fd = open("rtser0", O_RDWR);
> >        ioctl(fd, RTSER_RTIOC_SET_CONFIG, &write_config);
> >        write(fd, myString, strlen(myString));
> >        close(fd);
> >        return 0;
> > }
> > Is supposed to be the POSIX skin. It does compile, but nothing sent on
> > my serial port.
>
> This code is crappy. You do not check the return values of functions
> which return a result so you have no chance to understand what
> happens.
>
> --
>                                                Gilles Chanteperdrix
>

_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help

Reply via email to