Am Tue, 19 Jul 2011 13:41:56 +0200
schrieb "EXTERNAL Konold Martin (Firma, RtP2/TEF72)"
register_chrdev(MajorNr, name, &SSHT_fops);
This gives me the dynamically allocated major number which I then printk to klog.
No, it doesnt. AFAICT. I'm pretty sure you need to set "MajorNr" to some value before (or if you don't, it will be "0", but you won't retrieve the allocated number then) This is how I did it (using a char device): hrt_class = class_create(THIS_MODULE, DEVICE_NAME); if (IS_ERR(hrt_class)) { printk(KERN_ERR "%s: can't register device class\n", DRV_NAM); close_clocks(); return PTR_ERR(hrt_class); } major = register_chrdev(0, DEVICE_NAME, &fops); if (major < 0) { printk(KERN_ALERT "Registering char device failed with %d\n", major); class_destroy(hrt_class); close_clocks(); return major; } hrt_class->devnode = hrt_devnode; device_create(hrt_class, NULL, MKDEV(major, 0), NULL, DEVICE_NAME); (no Greg, you really don't want to see the rest of this code, this module was simply written to abstract crappy vendor drivers (Meinberg and TSYNC) in order to not having to touch them and I'm not proud of it ;-)
In user space I then grep in /proc&devices in order to figure out which major number got dynamically allocated and then create the device nodes algorithmically.
udev creates the device for me. I think that the device_create() is the trigger for that. -- Stefan Seyfried "Dispatch war rocket Ajax to bring back his body!" -- To unsubscribe, e-mail: opensuse-kernel+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-kernel+help@opensuse.org