RE: Driver on Linux
From: Jean-Denis Boyer <hidden>
Date: 2003-06-27 17:18:06
I thought I could make fd=open("/dev/visu", 0) in init of the
driver 2 but I
get ooops.
To open a device from kernel mode, you need to:
/* Bypass argument validity check in FS calls. See <asm/uaccess.h> */
mm_segment_t oldfs = get_fs();
set_fs(KERNEL_DS);
fd=open("/dev/visu", 0)
/* Restore argument validity check */
set_fs(oldfs);
I also need to make something like ioctl(fd, IO_Special... )but the function ioctl is unknown in the kernel.
To have the ioctl, you should add to the beginning of your source file: #include <linux/unistd.h> /* Declare "ioctl" system call */ static inline _syscall3(int,ioctl,int,fd,int,request,void*,arg1) Regards, -------------------------------------------- Jean-Denis Boyer, Software Designer M5T Centre d'Excellence en Télécom Inc. 4283 Garlock Street Sherbrooke (Québec) J1L 2C8 CANADA (819)829-3972 x241 -------------------------------------------- ** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/