Re: [RFC] Apple Motion Sensor driver

Stefan Richter
2006-07-03T13:28:06Z

Michael Hanselmann wrote:
> On Mon, Jul 03, 2006 at 12:12:47PM +0200, Stelian Pop wrote:
>> > +
>> > +static DEVICE_ATTR(mouse, S_IRUGO | S_IWUSR,
>> > + ams_mouse_show_mouse, ams_mouse_store_mouse);

[I think the following discussion is about ams_show_xyz, not
ams_mouse_show_mouse.]

>> I would prefer three different files for x, y and z instead of a single
>> one...
>
> Because of the way the values are calculated with orientation, that
> would mean that if a program needs all three, either all values are read
> three times or the ams_sensors function gets much more complicated.
>
> To prevent it from having to read them three times in a row, I joined
> all three values.

I don't know what a software will be doing with it, but "displacement"
(and its time derivatives "velocity", "acceleration", "jerk") is a
vector. Why not write the component-wise representation of the vector
into a single sysfs attribute? Especially if this keeps the kernel code
simple and small. I suppose even userspace code which evaluates the
attribute is in many cases simpler (and more precise anyway) if only a
single attribute is used.
--
Stefan Richter
-=====-=-==- -==- ===--