no device creation by udev
I have written the following lines of code to get a char device working. ( lines with # indicate that I have tried versions of this code snippet without them) class_hello = class_create(THIS_MODULE, device_name); # class_hello->devnode = &hello_devnode; retval = alloc_chrdev_region( &dev_file, 0, 1, device_name ); cdev_init( &device, &file_ops ); # device.owner = THIS_MODULE; # kobject_set_name(&device.kobj, device_name); cdev_add( &device, MKDEV(dev_file, 0), 1 ) device = device_create( class_hello, NULL, MKDEV(dev_file, 0), NULL, device_name ); # kobj_device->devt = MKDEV(dev_file, 0); Make it open / close / read / write works fine - but look at that $ ls /sys/class/hello/hello power subsystem uevent The "dev" entry is missing - and udev does not react. Anybody knows what is else needed to make udev react?
On Fri, Jun 24, 2016 at 11:44 AM, <anno79@mailbox.org> wrote:
I have written the following lines of code
to get a char device working.
( lines with # indicate that I have tried versions of this code snippet without them)
class_hello = class_create(THIS_MODULE, device_name); # class_hello->devnode = &hello_devnode; retval = alloc_chrdev_region( &dev_file, 0, 1, device_name ); cdev_init( &device, &file_ops ); # device.owner = THIS_MODULE;
# kobject_set_name(&device.kobj, device_name); cdev_add( &device, MKDEV(dev_file, 0), 1 ) device = device_create( class_hello, NULL, MKDEV(dev_file, 0), NULL, device_name ); # kobj_device->devt = MKDEV(dev_file, 0);
Make it open / close / read / write works fine - but look at that
$ ls /sys/class/hello/hello power subsystem uevent
The "dev" entry is missing - and udev does not react.
Anybody knows what is else needed to make udev react?
http://www.linuxdevcenter.com/pub/a/linux/2007/07/05/devhelloworld-a-simple-... Did you register ? This simple tutorial works fine for me , what kernel version are you ussing ? Regards Victor Rodriguez
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
participants (2)
-
anno79@mailbox.org -
Victor Rodriguez