Re: Basic device driver question

From: Josef Moellers (josef.moellers_at_fujitsu-siemens.com)
Date: 10/04/04


Date: Mon, 04 Oct 2004 09:33:00 +0200

Mike wrote:
> Hi,
>
> This is probally a stupid question, but I'm going to ask it anyway.
>
> If I develop a device driver, which allowed access to a specific piece of
> hardware, how could I access the function in the device driver? So for
> example, let's say I have a PCI card for which I develop a device driver.
> And let's say the device driver has a function called
> write_to_pci_card(...). And let's also say that I was developing an
> application, which needed to use the write_to_pci_card(...) function. How
> would I call the write_to_pci_card(...) function from my application?
>
> Or is it a case that the device driver would create a file in the /devs
> directory, which I would then access from the application? To access the
> /devs file would I need to use fread() and fwrite()?
>
> Can anyone shed any light on this?

There are several ways an application could access this function:

1. The function is the "official" write() function of the driver, then
your driver should regeister this function as such.
2. The function is not the "official" write() function, then you could
use an ioctl with a parameter structure as an argument to transfer data
back and forth.
3. You could use /proc to access the function.

-- 
Josef Möllers (Pinguinpfleger bei FSC)
	If failure had no penalty success would not be a prize
						-- T.  Pratchett


Relevant Pages

  • Re: [WANT] USB > Serial adapter (plugs into RS232 port)
    ... >I'll agree with Mike. ... >If one was available, though, it would probably be from Lantronics. ... >of a time getting the device driver in the computer to work correctly ...
    (sci.electronics.misc)
  • Re: Device Drivers w/eVC++
    ... Thanks Amit dude...you've sure been helpful. ... Mike ... >> can't find squat about device driver development. ...
    (microsoft.public.pocketpc.developer)
  • Re: [WANT] USB > Serial adapter (plugs into RS232 port)
    ... I'll agree with Mike. ... of a time getting the device driver in the computer to work correctly ... n o lindan at net com dot com ...
    (sci.electronics.misc)
  • Basic device driver question
    ... This is probally a stupid question, but I'm going to ask it anyway. ... how could I access the function in the device driver? ... /devs file would I need to use fread() and fwrite()? ...
    (comp.os.linux.development.system)

Loading