On Wed, Feb 9, 2011 at 5:26 PM, jon.schell <jon.sch...@kyocera.com> wrote:
> I'm creating a binary attribute (struct bin_attribute) for a sys/class/
> led driver,

Wait, stop right there.  Binary sysfs attributes are for sending/receiving
binary data that is not intrepreted/manipulated by the kernel at all.

And LED devices do not seem to fall into the category that needs this
type of sysfs file, so please do not create it.

> and it seems to be correct, but when I echo data to the
> write function, it seems to get called 11 times.  Here's what I have
> and did:
>
> static ssize_t my_write(struct kobject *kobj, struct bin_attribute
> *attr, char *buf, loff_t pos, size_t size)
> {
>    print_string("called my_write function correctly.");
>    return 0;
> }

Did you read the documentation on what your write function should return?
(hint, 0 is not what you think it means here).

Fix this and your problem will be solved.

But again, don't create a binary sysfs attribute, that is almost
never what you want.

What specifically are you wanting to export to userspace for a LED device
that is not working with the existing LED api in the kernel?

thanks,

greg k-h

-- 
unsubscribe: android-kernel+unsubscr...@googlegroups.com
website: http://groups.google.com/group/android-kernel

Reply via email to