linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* sysfs attribute example
@ 2005-06-10 17:05 Stephen Morgan
  2005-06-10 17:10 ` Kay Sievers
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Stephen Morgan @ 2005-06-10 17:05 UTC (permalink / raw)
  To: linux-hotplug

Hello all,

Can someone point me to an example of exporting a sysfs attribute from a
driver?  (Or tell me if I shouldn't.)  I'm trying to get a value from my USB
device driver's probe() into an attribute so my udev .rules file can pick it
up.

I've tried to follow what's in LDD 3rd ed. (page 374)  "...simply fill in an
attribute and pass it to sysfs_create_file()"

From my probe() function:

  mydev->my_attribute.name = "my_attribute_name";
  mydev->my_attribute.owner = THIS_MODULE;
  mydev->my_attribute.mode = S_IRUGO;

  sysfs_create_file(&(interface->class_dev->kobj), &(mydev->my_attribute));

When a device is probed, the file "my_attribute_name" shows up in sysfs, but
I get a "kernel NULL pointer dereference at virtual address 00000004"
(address changes with the USB port I plug into).

I'm also not seeing how to attach a value to the attribute.  So, clearly,
I'm missing something crucial here :-)

Thanks,

Stephen Morgan



-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.  How far can you shotput
a projector? How fast can you ride your desk chair down the office luge track?
If you want to score the big prize, get to know the little guy.  
Play to win an NEC 61" plasma display: http://www.necitguy.com/?r 
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2005-06-16 21:14 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-06-10 17:05 sysfs attribute example Stephen Morgan
2005-06-10 17:10 ` Kay Sievers
2005-06-13 23:01 ` Stephen Morgan
2005-06-14  0:54 ` Greg KH
2005-06-16 17:09 ` Stephen Morgan
2005-06-16 17:27 ` Greg KH
2005-06-16 21:14 ` Stephen Morgan

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).