if it is static data, that isnt going to change, then I would do that as a firmware binary blob. You can put the data in a file, and use the firmware_class functionality to get it from userland in to the kernel.

e.g.

struct firmware * fw;
request_firmware(&fs, "<name of file>, <driver device>);

The data from the file is in fw->data

If the data is not static, then you can use either a /proc file or /sys file to load the data from userland. There are plenty of examples of that around the web or in the kernel source


On 22/01/11 01:36, jon.schell wrote:
I just want to preface this by saying that I'm not a Linux nor an
Android developer, but I do develop embedded systems and so I do
understand the basic principles involved, I just don't know the
specific details in this case.

Having said that, I need to create a simple device driver so that I
can get an array of data from a user app down to my code that is
directly interfacing with the hardware.  I know that this means I need
a device driver.  I've already tried co-opting an existing one (in
this case, an LED driver), but I can't find an example of one that
takes more than a single character of data at a time.  I can make do
with that if I have to, but then I need one that has more than one
attribute, and I don't have a good example of that either.  Is there
some simple, somewhat generic, example of a driver that I can copy and
modify that would have either or both of those properties?

To be clear, I already have a setup where I copied an LED driver, and
I had my app just print characters to the brightness attribute and
eventually got all the data in the array into the kernelspace that
way, but it's not going to work for what I really need to do.  So, I
need a better driver to be an example of how to do it right.


--
unsubscribe: android-kernel+unsubscr...@googlegroups.com
website: http://groups.google.com/group/android-kernel

Reply via email to