Proper syntax to open() device driver from app.

Steven Vacca svacca at valcom.com
Fri Dec 14 02:30:42 EST 2001


I have a test driver, which turns an onboard LED ON or OFF,
resident and directly linked to the kernel image.

In chr_dev_init(), the driver's init func is called and the
device registers itself with a specified MAJOR number.
When my app runs, I'm not exactly sure of
what the proper syntax is to open() the driver (call the driver's
open() func in the file_operations struct) and then execute
ioctl() to send an LED ON or OFF cmd to the driver.

Does anyone have some examples of this?
Most info regards modules rather than resident drivers.

Am I correct in assuming that I should do something similar
to the following:

	hndl = open("/dev/led",O_WRONLY,0);
	ioctl(hndl,LED_ON,0);

Thanks,

ShutEye Thinkin

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/





More information about the Linuxppc-embedded mailing list