[fpc-pascal] ioctl

Vinzent Hoefler JeLlyFish.software at gmx.net
Wed May 17 09:16:20 CEST 2006


On Tuesday 16 May 2006 16:18, Alain Michaud wrote:

> Do I need open a "file deccriptor" in order to communicate using
> IOCTL?

Yes, you have to open the device before talking to it. Or what the hell 
do you think, the "Handle" parameter of

|Function  FpIOCtl      (Handle:cint;Ndx: culong;Data: Pointer):cint;

is for?

As always: RTFM, reading the man page (man 2 ioctl) actually might help 
too:

|DESCRIPTION
|       [...] The arguĀ­ment d must be an open file descriptor.
|
|RETURN VALUE
|       Usually, on success zero is returned.  A  few  ioctls  use
|       the  return value as an output parameter and return a nonĀ­
|       negative value on success.  On error, -1 is returned,  and
|       errno is set appropriately.

BTW, I agree - writing device drivers sucks. I know. :-)

But checking out

http://www.freesoftwaremagazine.com/articles/drivers_linux

may be worth a try.


Regards,

Vinzent.




More information about the fpc-pascal mailing list