Re: Getting 'bad file number' error writing to device driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

> I am trying to write to mydriver but get a 'Bad file number' error.
>
> int fd = open("/dev/mydriver",O_RDWR);
>
> this opens successfully as fd is not -1.
>
> ssize_t bytesToWrite = strlen(buf);
>
> value is: bytesToWrite 28
>
> ssize_t bytesWritten = write(fd,buf,bytesToWrite);
>
> value is: bytesWritten -1
>
> __android_log_print(ANDROID_LOG_INFO,__FILE__,"ANIL
> strerror(errno) %s",  strerror(errno));
>
> value is: strerror(errno) Bad file number

Please use strace and let us know the full trace of system calls.
Also, if possible
could you paste the 'write' function of your driver?

thanks,
Daniel.

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux