Kaostias
Kaostias

Reputation: 321

Permission denied in character device

I'm programming a device's driver module for the debian 6 kernel which acts as a FIFO device, the compilation is aparently correct, i use the following code to create it:

Major = register_chrdev(0, DEVICE_NAME, &fops); //Major is an integer value
if (Major < 0) {
  printk(KERN_ALERT "Registering char device failed with %d\n", Major);
  return -Major;
}
/*
 * Creation of buffer;
 */
if( (buf = create_cbuffer_t(MAX_BUFFER_SIZE)) == NULL){
    printk(KERN_ALERT "Error when creating the FIFO device.");
    return -EINVAL;
}
    printk(KERN_INFO "Buffer created without error.\n");

The major number asigned is 251, and i create it's file using this:

sudo mknod /dev/fifodev c 251 0

It works properly but when i try to access in terminal this is the result

dsouser@debian:~/Escritorio/Prac3/ParteB$ echo whatever > /dev/fifodev 
bash: /dev/fifodev: Permiso denegado **This means:Permission denied**

And this happens too:

dsouser@debian:~/Escritorio/Prac3/ParteB$ cat /dev/fifodev
cat: /dev/fifodev: Argumento inválido

What would be the problem within it or the right way to make it run?

Thanks a lot

Upvotes: 0

Views: 3968

Answers (1)

sujin
sujin

Reputation: 2853

change the permission of /dev/fifodev

 sudo chmod 666 /dev/fifodev

Upvotes: 8

Related Questions