Question about file I/O in device driver kernel module

Mark Hall (praetor@mail1.i1.net)
Fri, 02 Jan 1970 16:06:32 -0500


I'm writing a device driver for a DMX lighting control card as a loadable
module for my 2.0.30 kernel. I'm wanting to write it so it's non-version
specific. So far, that's working fine. I can autodetect the card (DMX
lighting interface), but then I have to download the card's microcode (<1K)
into the card byte by byte.

I've searched all the FAQs I can find, have perused a few books on kernel and
device drivers, but I can't find a solution to the specific problem:

The card's microcode is in a file on my disk. I really need to be able to
open and read this file byte by byte at driver load time (insmod slhdmx.o).
Can anyone point out some routine names and/or where I could find
documentation for this? The only other alternative I can think of is to write
a program to write a module as an array of hex values, but that would have to
be recompiled every time the vendor updates their microcode, instead of
allowing the user to download and update the .bin file. Or, is it considered
"very bad form" to open a file from the kernel while initializing a module?
Oh, and also, since I'll need a device file (/dev/slhdmx0), and I plan to
release this driver, how can I find out about getting a static major/minor
device number, or does one exist where this type of device should fit?

An additional question that just came to mind, I have a section of
initialization right after the card's microcode loads that I have to sleep for
50 microseconds. Is it considered unacceptable to use udelay(50) for this at
module load time?

I'm sorry if this isn't the right place to ask this...
I don't like the idea of using WindBlowz to run a stage show from. This is to
write a show-control application using networked distributed processing for
several concurrent users. I'm going for reliability which is why I've
selected Linux for the platform... [but you all know that... =-]

Thanks in advance for any and all help.

Mark Hall

--
---  praetor@i1.net  -----------------------  Christian Technical Services  ---
|                                                                             |
| Seen on a bumper sticker:                                                   |
| Out of my mind.  Back in 5 minutes.                                         |
|                                                                             |
---  ICQ # 18801393  ----------------------------------  mehall@us.ibm.com  ---
See the Live Sound Reference Page @ http://www.i1.net/~praetor/sound/sound.html
                [Generated by sigrot (C) 1996 by Mark Hall]

- 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/