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
__a
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);
>
> valu
: kernelnewbies@kernelnewbies.org
Subject: Re: Getting 'bad file number' error writing to device driver
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
On Sat, Oct 15, 2011 at 2:42 AM, Philip Anil-QBW348
wrote:
> I am calling the driver from an Android program (OMAP4/Blaze). It calls a
> c++ program via JNI which then calls the device driver.
> Someone suggested it might be a permissions problem - the program is running
> in user mode.
>
> on Bla
-Original Message-
From: Daniel Baluta [mailto:daniel.bal...@gmail.com]
Sent: Saturday, October 15, 2011 3:34 AM
To: Philip Anil-QBW348
Cc: kernelnewbies@kernelnewbies.org
Subject: Re: Getting 'bad file number' error writing to device driver
On Sat, Oct 15, 2011 at 2:42 AM, P
On Mon, Oct 17, 2011 at 6:49 PM, Philip Anil-QBW348
wrote:
> -Original Message-
> From: Daniel Baluta [mailto:daniel.bal...@gmail.com]
> Sent: Saturday, October 15, 2011 3:34 AM
> To: Philip Anil-QBW348
> Cc: kernelnewbies@kernelnewbies.org
> Subject: Re: Getting '
-Original Message-
Maybe setuid bit can help you ([1]). When this bit is set, a certain program
can run with the privileges of its owner.
thanks,
Daniel.
[1] http://en.wikipedia.org/wiki/Setuid
Daniel,
Thanks for the link; but this bit has to be set on the original executable
> Thanks for the link; but this bit has to be set on the original executable.
> Is there any way a program in user mode can get around this or set the bit
> himself?
Ummm...now that would be a security violation, don't you think? If a
program can elevate it's own privileges, then whats the point o
> Thanks for the link; but this bit has to be set on the original executable.
> Is there any way a program in user mode can get around this or set the bit
> himself?
Ummm...now that would be a security violation, don't you think? If a
program can elevate it's own privileges, then whats the point