Re: Reading a file inside the device driver.

From: Theodore Y. Ts'o (tytso@MIT.EDU)
Date: Wed Jul 26 2000 - 10:17:58 EST


   From: "Vinay Vernekar" <vinay.vernekar@wipro.com>
   Date: Wed, 26 Jul 2000 15:46:21 +0530

   I am developing a network driver which has to read a file 'firmware.bin'
   and dump it into the modem memory. I want to know how can the file be
   opened and read inside a driver. As far as I know the normal file
   operation functions used in User applications like - fopen, fread can't
   be used in the driver code.

The best way to do this is to do it in a user-mode program which is run
out of an /etc/rc.d script, which uses ioctl()'s to download the
firmware into kernel. This allows you to have much better error
recovery and timeout handling than if you try to do this in the kernel.

For an exmaple program of how to do this, see the rocketport driver,
especially how the loadrm2 program loads the Rocketmodem II firmware.
There's some clever code there which allows multiple modems to be
downloaded in parallel to speed things up. Feel free to steal it for
your project; it's under the GPL.

        http://rocketport.sourceforge.net

                                                - Ted

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Jul 31 2000 - 21:00:21 EST