call function of device driver

call function of device driver

Post by Reed La » Tue, 14 Sep 1999 04:00:00



I write a device drive for linux and export some of its functions to
kernel's symbol table.  May I call these functions from my C application

in user space? how to do?

Thanks!
Reed Lai

 
 
 

call function of device driver

Post by Keith Wrigh » Tue, 14 Sep 1999 04:00:00



> I write a device drive for linux and export some of its functions to
> kernel's symbol table.  May I call these functions from my C application
> in user space?

No.  You write functions to open, read, write, close, etc. and the kernel
calls them at the proper time when somebody says:
 ff=fopen("/dev/ReedLai","w");
 fprintf(ff,"Hello Reed\n");

Quote:> how to do?

Sorry, no can do.

--

Programmer in Chief, Free Computer Shop <http://www.free-comp-shop.com>
         ---  Food, Shelter, Source code.  ---

 
 
 

call function of device driver

Post by Mark McDougal » Wed, 15 Sep 1999 04:00:00



> No.  You write functions to open, read, write, close, etc. and the kernel
> calls them at the proper time when somebody says:
>  ff=fopen("/dev/ReedLai","w");
>  fprintf(ff,"Hello Reed\n");
> Sorry, no can do.

Correct, but not very helpful!

Perhaps you can access your desired functionality via the ioctl() call?
The ioctl interface allows you to specify 'internal' command codes that
may be sent to your driver and interpreted as you like. Note there are
times/functions for which this is appropriate, and other for which it is
not.

Regards,

--
|     Mark McDougall    |
|        Engineer       |
| Virtual Logic Pty Ltd |
| http://www.vl.com.au  |

 
 
 

call function of device driver

Post by Horst von Bra » Tue, 21 Sep 1999 04:00:00



>I write a device drive for linux and export some of its functions to
>kernel's symbol table.  May I call these functions from my C application
>in user space? how to do?

You can't. You can create a way to read(2)/write(2) your driver, or use
ioctl(2) on it. Look at Rubini's book on Linux Device Drivers (it is
somewhat dated, but very useful still).

Hope this helps.
--

Casilla 9G, Vi?a del Mar, Chile                               +56 32 672616

 
 
 

1. Device driver calling another device driver.

Hi.

I am having a problem writing a "meta-driver", ie one that is sandwiched
between the kernel and a real device driver. The platform I am using
consists of a Sun IPC, running SunOS 4.1.1.

My problem is that in attempting to use the OPEN(2V) system call from within
the "xxopen" routine of my metadriver (to open another device-driver (which
then opens the device)); OPEN(2V) "fails".

It appears that calling OPEN(2V) from within the kernel requires a different
calling sequence and argument list. Viz-a-viz: instead of a file descriptor
being returned by OPEN(2V), it seems a pointer is returned (which itself is
a pointer to something else).

Is this true? Is the OPEN(2V) syscall different for a process executing in
user address space, compared to the OPEN call executed by a process running
in kernel mode/address space?

If this is true for OPEN, what about CLOSE, READ, WRITE, etc? Unfortunately,
I don't have (easy) access to any Unix (source) code, to verify this.

Thanks in advance for help/advice.

2. Help! Red Hat 6.2 can not detect my modem

3. Calling functions in a device driver module

4. Sound quits working 2.4 and 2.6 kernels

5. calling functions in a device driver module

6. Large file on NT Server

7. booting "headless" i.e. without a keyboard, mouse or video display

8. how to know the instruction address of calling function within called function?

9. Browser calls CGI C function which sets an env var and call a c function crashes

10. Driver calling driver and multiple physio() calls

11. calling a time function from a driver

12. mmap() does not call my driver function