I am sorry that I am not clear about the strace..
I am giving here all the details, few of which could be irrelevant.
I have also attached the source code for the device driver (audio_7212.c)
and
the application code (au2.c)
1) The directory entry for the driver looks like this:
    crw-rw-r--    1    0    0    254,    0    Jun24  2000    audio_7212
2) directory entry for the application program:
    -rwxr-xr-x    1    0    0    225192     Jun24  2000    au2

When I execute the application program, I see the following:
------------------------------------------------------------
>./au2

Device audio_7212 opened successfully
...
... (Messages printed from au2.c,)
...
write(fp) returned: 9

Closed audio_7212 device.
----------------------------------------------------------

write(fp) returns errono = 9, i.e. EBADF.
This I traced by doing a printk from fs/read_write.c. It comes out
because of the FMODE (mode_f) bit.

I am running this from initrd. I create the initrd on my Linux PC and
download it with the kernel image (arch/arm/boot/Image).
While creating initrd, I do 'mknod /dev/audio_7212 c 254 0' to create the
device driver entry. Then I do a 'chmod 664 /dev/audio_7212' to grant
permissions.
After that I copy au2 to the initrd image.

Thanks....

Umesh Puranik


Russell King - ARM Linux Admin wrote:

> umesh writes:
> > I found out further that this is becasue of the f_mode bit in the
> > 'file' structure. it returns a value of 1 which indicates that there
> > are no read/wrte permissions.
>
> Please give an example of the strace output from running your test
> program.
>    _____
>   |_____| ------------------------------------------------- ---+---+-
>   |   |        Russell King       [EMAIL PROTECTED]      --- ---
>   | | | |            http://www.arm.linux.org.uk/            /  /  |
>   | +-+-+                                                     --- -+-
>   /   |               THE developer of ARM Linux              |+| /|\
>  /  | | |                                                     ---  |
>     +-+-+ -------------------------------------------------  /\\\  |

audio_7212.c

au2.c

Reply via email to