Re: How to add a device file to sysfs?

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

 



On Tue, Oct 31, 2006 at 01:30:36PM +0800, Aubrey wrote:
> Hi all,
> 
> When a misc device file is registered, there are two files under my
> own class directory:
> 
> /sys --> class --> misc --> myprog --> dev
>                                                   --> uevent
>                                                   --> myprog_show (to be 
>                                                   added)
> 
> Now, my question is, is it possbile to add the third file
> "myprog_show" under "myprog" directory without modify any common code?

Yes.

> I've read the doc under linux-2.6.x/Documentation, I can add it to
> some other directory, but not found a way to add it to my own
> directory.

After misc_register() has been successfully called, the variable "class"
will be set in the miscdevice structure.  Use that pointer to call
class_device_create_file() to create your new file in this directory.

Hope this helps,

greg k-h
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux