> I have tried to write an experimental simple device driver as follows: > a few glitches
* you did not pass pointers to the functions * you did not supply a release method (how should the kernel close the device again ??) * the default name for the cleanup function is cleanup_module (if you want to use free_module then declare module_exit(free_module); ) * to prevent stupid conflicts declare your private functions static (they should only be called via the fops any way). the "fixed" version below. check http://www.xml.com/ldd/chapter/book/index.html for Rubini & Corbet linux device drivers (2nd Edition) for details on linux device drivers. hofrat ---snip--- #include <linux/module.h> #include <linux/version.h> #include <linux/init.h> #include <asm/io.h> #include <asm/uaccess.h> #define DRIVER_MAJOR 17 static int device_read(struct file *filp, char *buf, size_t count, loff_t *f_pos) { printk(KERN_DEBUG "closed device\n"); return 0; } static int device_close (struct inode* i,struct file* f) { printk(KERN_DEBUG "closed device\n"); return 0; } static int device_open (struct inode* i,struct file* f) { printk(KERN_DEBUG "opened device\n"); return 0; } struct file_operations device_fns = { read: &device_read, open: &device_open, release: &device_close }; int init_module(void) { register_chrdev(17,"device",&device_fns); return 0; } void cleanup_module(void) { unregister_chrdev(17,"device"); } _______________________________________________ Rtl mailing list [EMAIL PROTECTED] http://www2.fsmlabs.com/mailman/listinfo.cgi/rtl