How create a miscellaneous "crw-rw-rw-" device ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

This question is related to a simple driver implementing a miscellaneous device
under 2-6-32

Using the following code:

/* snippet  ------------------------------------------------------- 

static struct miscdevice  lab1_dev = {

  .minor = MISC_DYNAMIC_MINOR,
  .name  = "lab1",
  .fops  = &lab1_fops,
  .mode  = 0666
};


static int __init lab1_init(void)
{
  int   rc ; 
  
    rc = misc_register ( &lab1_dev ) ; 
    if ( 0 != rc ) {
      printk(KERN_ERR "LAB1 driver: misc_register failed.\n") ;
      return rc ; 
    }

----------------------------------------------- end snippet  */ 

The device is created as:

> ls -l /dev/lab1 
crw-rw---- 1 root root 10, 54 2010-08-13 11:56 /dev/lab1

The mode = 0666 is not taken into account. Is this the expected behavior ? 
If yes how can I change afterward (still from the driver context) the device 
protection.
Or is there another way to create a misc device for everybody (crw_rw_rw_)?

Looks like the mode = 0666 was successfully passed to the kernel:

> cat /sys/class/misc/lab1/uevent 
MAJOR=10
MINOR=54
DEVNAME=lab1
DEVMODE=0666


Thanks for your help,
Stephan

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux