Find the answer to your Linux question:
Results 1 to 3 of 3
Hi all, Currently i am involved in developing a device driver for a custom hardware. My linux stack already has the directory structure /sys/class/hwmon/ My need is that, while loading ...
  1. #1
    Just Joined!
    Join Date
    Feb 2009
    Location
    Chennai, India
    Posts
    28

    Arrow [SOLVED] How to creating sysfs directory ?

    Hi all,

    Currently i am involved in developing a device driver for a custom hardware.

    My linux stack already has the directory structure

    /sys/class/hwmon/

    My need is that, while loading my device driver i need to create a "xyz" directory inside hwmon directory as shown below

    /sys/class/hwmon/xyz/

    How can i do that.Can anyone help me with the kernel function call.

    I know about a class_create_file call using which we can able to create a sysfs file.But, I don't know about a way to creating sysfs directory.

    - BalaC -

  2. #2
    Just Joined!
    Join Date
    Mar 2009
    Location
    Norway
    Posts
    52
    have you looked at kobjects?

    If you create a kobject (and add it to the sysfs tree), it will end up as a directory, and if you provide the hwmon-kobject as parent, it will be placed as a subdir in /sys/class/hwmon.

    To add files, you add attributes.
    LXR linux/samples/kobject/kobject-example.c

  3. #3
    Just Joined!
    Join Date
    Feb 2009
    Location
    Chennai, India
    Posts
    28
    Quote Originally Posted by henrikau View Post
    have you looked at kobjects?

    If you create a kobject (and add it to the sysfs tree), it will end up as a directory, and if you provide the hwmon-kobject as parent, it will be placed as a subdir in /sys/class/hwmon.

    To add files, you add attributes.
    LXR linux/samples/kobject/kobject-example.c
    Thanks henrikau for your reply.

    Now i can able to create the sysfs folder

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...