1. I'm using an LED driver for testing, it's not relevant to the issue. 2. Thank you for pointing out that the problem is likely with the return value. I was going from chapter 14 of LDD3 and didn't check what the regular char driver function returned back in chapter 3. 3. Do you have an alternate way to pass an array of binary data to a driver that doesn't have such a capability, like an LED driver? For an LED driver, this is useful if you wanted to send it a particular pattern of blinking to run at a faster rate than just setting it off/ on from userspace could do, for example.
On Feb 9, 7:02 pm, Greg KH <[email protected]> wrote: > On Wed, Feb 9, 2011 at 5:26 PM, jon.schell <[email protected]> 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: [email protected] website: http://groups.google.com/group/android-kernel
