pfps / yoga-laptop

Systems and information to make Lenovo Yoga laptops work better
GNU General Public License v3.0
156 stars 30 forks source link

Testing on Yoga 2 11'' #37

Open Aradan opened 9 years ago

Aradan commented 9 years ago

Hi, I was trying to test this in a Yoga 2 device with the 3.19 kernel (I'm using Manjaro). How does the orientation script is supposed to work? When I execute it (after running make) I get this

$ sudo ./orientation 
iio device number being used is 0
iio trigger number being used is 0
Orientation 1, x:    7, y: -992, z:    7
Orientation 1, x:    7, y: -992, z:    7
Orientation at 0.0 is normal
Orientation 1, x:    7, y: -992, z:    7
Orientation 1, x:    7, y: -992, z:    7
Orientation at 1.0 is normal
ROTATE to normal
unable to find device ELAN Touchscreen
Second child (xinput) returned 256 
Orientation 1, x:    7, y: -992, z:    7
Orientation 1, x:    7, y: -992, z:    7
Orientation at 2.0 is normal
Orientation 1, x:    7, y: -992, z:    7
Orientation 1, x:    7, y: -992, z:    7
Orientation at 3.0 is normal
...

But nothing changes if I rotate my screen. I didn't install the drivers since I'm using a new kernel, or should I?

Regards

pfps commented 9 years ago

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256

It does look as if you are close to getting the sensing to work. Try moving the laptop around to see if the orientation numbers change. If they don't, then it is likely that the sensor is not being initialized somehow. This is likely to be because your sensor requires a quirk (something out of the ordinary) to be correctly initialized and that quirk has not been added to your distribution or to Linux as a whole. The sensor in the Yoga 2 Pro needs such a quirk. You will have to find out which sensor you have and how to get the right quirk set up. This is not easy.

You should also try out the generic_buffer program. sudo ./generic_buffer -n accel_3d -c 100 should spit out a bunch of sensor values for whatever is thought to be the accelerometer in your system. Move your laptop around to see if the values change.

You also do not appear to have an ELAN Touchscreen. You will have to figure out which touchscreen you have, if any.

The sensor can probably be found via lsusb. On the Yoga 2 Pro it is ID 2047:0855 Texas Instruments Invensense Embedded MotionApp HID Sensor

To find out your touchscreen name use xinput and look for something named a touchscreen.

Let me know how your investigations progress.

peter

On 05/02/2015 04:16 AM, Aradan wrote:

Hi, I was trying to test this in a Yoga 2 device with the 3.19 kernel (I'm using Manjaro). How does the orientation script is supposed to work? When I execute it (after running make) I get this

|$ sudo ./orientation iio device number being used is 0 iio trigger number being used is 0 Orientation 1, x: 7, y: -992, z: 7 Orientation 1, x: 7, y: -992, z: 7 Orientation at 0.0 is normal Orientation 1, x: 7, y: -992, z: 7 Orientation 1, x: 7, y: -992, z: 7 Orientation at 1.0 is normal ROTATE to normal unable to find device ELAN Touchscreen Second child (xinput) returned 256 Orientation 1, x: 7, y: -992, z: 7 Orientation 1, x: 7, y: -992, z: 7 Orientation at 2.0 is normal Orientation 1, x: 7, y: -992, z: 7 Orientation 1, x: 7, y: -992, z: 7 Orientation at 3.0 is normal ... |

But nothing changes if I rotate my screen. I didn't install the drivers since I'm using a new kernel, or should I?

Regards

— Reply to this email directly or view it on GitHub https://github.com/pfps/yoga-laptop/issues/37.

-----BEGIN PGP SIGNATURE----- Version: GnuPG v2

iQEcBAEBCAAGBQJVRNK/AAoJECjN6+QThfjz+rEH/3BLce/XInwO1kz5mjgjmrEd KuUZxA5gqcHN0471UylFqrUA9HMgKqnOKcMsJ1RxUdEL4kmXH+r1cngKr+Lcnx9c bH3lcoEKhL2xMU/YopELelY6/T5dFZuGRvKxXjE2+Lnuwk1H5VdqxNr2/6IRlV88 yTbNGkPlqiuZ84PPUW8ERZwUbH2DF2d+7t4VsNhbzCzDlYxMp3Mg3X88UWkfr1a+ UJAD7BuXYLd/4A+O5BciYf2VvdBGWNOc06w1ltfZ0HHUMPAN4WV9Q2yk6zRkGtN8 /Sh5qiVgmqpFZP3UDMoWRcz9dtGmBDSMvCWwl2RBoPHuFwhMX3dQyAZ1v+Fmrf8= =G3+O -----END PGP SIGNATURE-----

pfps commented 9 years ago

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256

...

I just noticed that you already said that nothing changes if you rotate your screen.

Try generic_buffer first to see if its output changes. If not, and your sensor is not the one in the Yoga 2 Pro, then it is an almost certainty that you need a quirk.

You can apply a quirk locally, but it is not trivial. You will need to find out which sensor you have and whether the "standard" quirk for HID drivers is what you need. Then you will have to patch and install the hid-sensor-hub driver. (Get a current driver to patch, not the one in this system.) This is not for the faint of heart, and someone said that their sensor was put into a non-recoverable state.

peter -----BEGIN PGP SIGNATURE----- Version: GnuPG v2

iQEcBAEBCAAGBQJVRNUcAAoJECjN6+QThfjzo7YIAMReL8EEuNgfnE0OWKQvpA5m MK3Nd+i47Fm0F3xuWEsYZEXaJBT0neDPCJmrqJzlMmqHCGNC4aMz7Gt9Cdr4zVAD lC0idEBdvwIjNdelYD1stC54Kc6SUYmdOah88qy+yG83rlQ8U40QogU3qa8qNQ0+ OLWcoRvJX9R6Bxos9ysBefYyTcS4P1xb3jO7HRqSgTJBWg05HbMHjJBqcGInyHQX vZr4//f2sep5rmhNTexZ3Zsx/V0r6Ot69o01/FrmnO2D6pQhQHKkmce8yt/esKAy DKAtyDQXGV8dMHC4Inq9Ar7AV5Ky3/rF3dbptHk5QRKhQ0TPKJxoP8uLoeDnQYo= =5c7x -----END PGP SIGNATURE-----

Aradan commented 9 years ago

Thanks for the help :) Using the generic buffer does not show any improvement

$ sudo ./generic_buffer -n accel_3d -c 100
iio device number being used is 3
iio trigger number being used is 3
DEV_DIR_NAME /sys/bus/iio/devices/iio:device3  TRIGGER_NAME accel_3d-dev3
SCAN_SIZE 12
N000: in_accel_x    7    7.0  in_accel_y -992 -992.0  in_accel_z    7    7.0  
N000: in_accel_x    7    7.0  in_accel_y -992 -992.0  in_accel_z    7    7.0  

Also, it seems the sensors are not present when I use lsusb (I cannot see anything from Texas ) However, the touchscreen device works normally, xinput shows me this:

Virtual core pointer                        id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ Atmel Atmel maXTouch Digitizer            id=11   [slave  pointer  (2)]
⎜   ↳ ETPS/2 Elantech Touchpad                  id=14   [slave  pointer  (2)]

The maXTouch stuff is the one. I thought that the newest kernels were going to have everything already implemented, which seems not to be the case.

What I don't know is how to detect the accelerometer or sensors for the light. But according to your reply, it is a difficult task. If I do lsmod, I can get some sensor outputs:

hid_sensor_incl_3d     12667  0 
hid_sensor_rotation    12667  0 
hid_sensor_accel_3d    12674  1 
hid_sensor_gyro_3d     12667  0 
hid_sensor_als         12639  0 
hid_sensor_magn_3d     12667  0 
hid_sensor_trigger     12521  12 hid_sensor_gyro_3d,hid_sensor_incl_3d,hid_sensor_accel_3d,hid_sensor_rotation,hid_sensor_als,hid_sensor_magn_3d
uvcvideo               84822  0 
hid_sensor_iio_common    12737  6 hid_sensor_gyro_3d,hid_sensor_incl_3d,hid_sensor_accel_3d,hid_sensor_rotation,hid_sensor_als,hid_sensor_magn_3d
industrialio_triggered_buffer    12417  6 hid_sensor_gyro_3d,hid_sensor_incl_3d,hid_sensor_accel_3d,hid_sensor_rotation,hid_sensor_als,hid_sensor_magn_3d
kfifo_buf              12834  1 industrialio_triggered_buffer
industrialio           42744  10 hid_sensor_trigger,hid_sensor_gyro_3d,industrialio_triggered_buffer,hid_sensor_incl_3d,hid_sensor_accel_3d,hid_sensor_rotation,hid_sensor_als,kfifo_buf,hid_sensor_magn_3d
hid_sensor_incl_3d     12667  0 
hid_sensor_rotation    12667  0 
hid_sensor_accel_3d    12674  1 
hid_sensor_gyro_3d     12667  0 
hid_sensor_als         12639  0 
hid_sensor_magn_3d     12667  0 
hid_sensor_trigger     12521  12 hid_sensor_gyro_3d,hid_sensor_incl_3d,hid_sensor_accel_3d,hid_sensor_rotation,hid_sensor_als,hid_sensor_magn_3d
uvcvideo               84822  0 
hid_sensor_iio_common    12737  6 hid_sensor_gyro_3d,hid_sensor_incl_3d,hid_sensor_accel_3d,hid_sensor_rotation,hid_sensor_als,hid_sensor_magn_3d
industrialio_triggered_buffer    12417  6 hid_sensor_gyro_3d,hid_sensor_incl_3d,hid_sensor_accel_3d,hid_sensor_rotation,hid_sensor_als,hid_sensor_magn_3d
kfifo_buf              12834  1 industrialio_triggered_buffer
industrialio           42744  10 hid_sensor_trigger,hid_sensor_gyro_3d,industrialio_triggered_buffer,hid_sensor_incl_3d,hid_sensor_accel_3d,hid_sensor_rotation,hid_sensor_als,kfifo_buf,hid_sensor_magn_3d

I will try to search a little more about this, but does not look easy

Cheers

guilhem commented 9 years ago

Hi @pfps , I just change my Yoga 2 11 for a Yoga 3 14 and it seems to have same sensor controller. I was quite lazy before... but as it's my second laptop with this chip I want to make it working ;)

And... I'm not quite far from make it working: I use your commit: https://github.com/torvalds/linux/commit/825747bb85634a2a7b7dce4e373831e211ab1644 and change value for my laptop And it's working! When I cat values in /sys/bus/iio/devices/iio:deviceX values are moving according to environment (for als, gyro and magn). Now my problem is about buffer... it's working only when I "cat" values.... :/ I don't know where to look...

guilhem commented 9 years ago

@Aradan @pfps my uptream patch have been validated for inclusion in 4.3.

Let's test it when first RC goes out ;)

davidcortesortuno commented 9 years ago

Cool, will it work on the small Yoga 2? Because the sensors are not from Texas. BTW, I was using Arch, I hope it works when the new kernel goes out

guilhem commented 9 years ago

@davidcortesortuno I had support for sensors made by ITE used in yoga 2 11 and yoga 3 14 (and maybe other ;))

davidcortesortuno commented 9 years ago

Hi, how can I test your patch? Since the gyroscope is not working on my Windows partition and I think it is a software rather than a hardware related stuff. I would like to check if it at least working.

guilhem commented 9 years ago

Hi all,

4.3 rc1 have been released and I tested my yoga 3 14 with success \o/

I don't know for yoga 2 11 but I think it should work :)

davidcortesortuno commented 8 years ago

I installed kernel 4.3 rc1 in Arch Linux and it is working! Thanks for submitting the patch. I hope I can use the light sensor in the future :) and also that the new kernel comes up soon

davidcortesortuno commented 8 years ago

Hi, just to let you know, after this kernel patch it is possible to use screen rotation and ambient light sensors with iio-sensor-proxy https://github.com/hadess/iio-sensor-proxy in Gnome 3.18 or newer, which works nicely