kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: valdis.kletnieks@vt.edu (valdis.kletnieks at vt.edu)
To: kernelnewbies@lists.kernelnewbies.org
Subject: Problems with adding a sysfs file
Date: Mon, 17 Apr 2017 16:43:58 -0400	[thread overview]
Message-ID: <24220.1492461838@turing-police.cc.vt.edu> (raw)
In-Reply-To: <CAEukwi6LbVr5QB9Vf8rrQBnU00x+N=59nKsvqatREB=479BVRw@mail.gmail.com>

On Mon, 17 Apr 2017 01:17:08 -0700, Abhishek Bhardwaj said:
> I followed this link to add a sysfs file
> http://kroah.com/log/blog/2013/06/26/how-to-create-a-sysfs-file-correctly/
> .
>
> I set the driver.groups field and declared the attribute and attribute
> groups required by the sysfs file. When I boot my kernel I see the
> file but my store and show handlers don't get called when I try to cat
> or echo to the file. Is there any step I'm missing ?.

The traditional way to start debugging this is to add a line at the beginning
of your show and store routines:

	printk(KERN_DEBUG "Now in our special sysfs show routine\n");

and see if it shows up in your dmesg or not.  If not, your routine
is probably not being called.  If it is, the problem is in the routine.

(You'd be surprised how often people say their routine isn't getting called,
when it in fact is, or vice versa..)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 484 bytes
Desc: not available
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20170417/a7185733/attachment.bin 

  reply	other threads:[~2017-04-17 20:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-17  8:17 Problems with adding a sysfs file Abhishek Bhardwaj
2017-04-17 20:43 ` valdis.kletnieks at vt.edu [this message]
2017-04-17 21:04   ` Abhishek Bhardwaj
2017-04-18  0:05     ` Tobin C. Harding

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=24220.1492461838@turing-police.cc.vt.edu \
    --to=valdis.kletnieks@vt.edu \
    --cc=kernelnewbies@lists.kernelnewbies.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).