Re: [PATCH] lis3lv02d: add axes knowledge of HP Pavilion dv5 models

Giuseppe Bilotta
2009-02-10T20:29:40Z

On Tue, Feb 10, 2009 at 1:42 PM, Éric Piel <E.A.B.Piel@tudelft.nl> wrote:
> Giuseppe Bilotta schreef:
>> oblomov@oblomov:~$ cat /sys/devices/platform/lis3lv02d/position
>> (-256,256,14592)
>> oblomov@oblomov:~$ cat /sys/devices/platform/lis3lv02d/position
>> (0,256,14848)
>> oblomov@oblomov:~$ cat /sys/devices/platform/lis3lv02d/position
>> (-256,256,14848)
>> oblomov@oblomov:~$ cat /sys/devices/platform/lis3lv02d/position
>> (-256,0,14336)
>> oblomov@oblomov:~$ cat /sys/devices/platform/lis3lv02d/position
>> (-256,512,14336)
>> oblomov@oblomov:~$ cat /sys/devices/platform/lis3lv02d/position
>> (256,256,14592)
>>
>> Left edge raised:
>> oblomov@oblomov:~$ cat /sys/devices/platform/lis3lv02d/position
>> (5120,512,13312)
>> oblomov@oblomov:~$ cat /sys/devices/platform/lis3lv02d/position
>> (5632,512,13312)
>>
>> You might be onto something.
> Yes, beautiful! All are multiples of 2⁸, so much a sign of MSB/LSB
> inversion! And the good news is that the device just happens to have a
> register to set the endianess: CTRL2/BLE . For now, in the driver, we
> expect the device to be little endian (which is the default according to
> the manual). So at initialization we could force the endianess and see
> if that fix the problem.
>
> Can you try something like this in lis3lv02d_poweron():
> adev.read(handle, CTRL_REG2, &val);
> val |= CTRL2_BDU | CTRL2_IEN;
> + val &= ~CTRL2_BLE;
> adev.write(handle, CTRL_REG2, val);

I reverted both my patch and the 'minimal init' patch from Pavel, then
added this line. However, it seems to change nothing. Even using
CTRL2_BLE instead of its negation doesn't seem to change much: same
fluctuations, and cat'ing the sysfs file still gives 256, 512 etc.

--
Giuseppe "Oblomov" Bilotta