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

Implementing on Yoga 11s #17

Open SpacemanPete opened 10 years ago

SpacemanPete commented 10 years ago

Hi! I was curious if you'd have any advice on implementing this on a Yoga 11s. I don't have much experience working with kernel modules but I bet there probably aren't too many modifications needed to get it working on such similar hardware to the Yoga 13, and it'll be good fun to learn a bit more about managing hardware configuration.

pfps commented 10 years ago

It really depends on whether the 11s uses similar hardware. If so, then everything should just work. If not, you may need to add new quirks, or make more drastic changes.

Erwyn commented 10 years ago

Hello,

I have the same question. I also have a Yoga 11s and would be great to know if anyone already tested this here?

Could you provide a hardware list so that we could compare with ours?

pfps commented 10 years ago

Here is the report that I get from lsusb for the hub controller. You should be able to get this information on any Linux system.

yoga> sudo lsusb -v -s 2:3

Bus 002 Device 003: ID 2047:0855 Texas Instruments Invensense Embedded MotionApp HID Sensor Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 2.00 bDeviceClass 0 (Defined at Interface level) bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 8 idVendor 0x2047 Texas Instruments idProduct 0x0855 Invensense Embedded MotionApp HID Sensor bcdDevice 11.51 iManufacturer 1 Invensense iProduct 2 Lenovo Yoga
iSerial 3 44F6806F1F002300 bNumConfigurations 1 Configuration Descriptor: bLength 9 bDescriptorType 2 wTotalLength 41 bNumInterfaces 1 bConfigurationValue 1 iConfiguration 4 Embedded MotionApps bmAttributes 0xa0 (Bus Powered) Remote Wakeup MaxPower 100mA Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 0 bAlternateSetting 0 bNumEndpoints 2 bInterfaceClass 3 Human Interface Device bInterfaceSubClass 0 No Subclass bInterfaceProtocol 0 None iInterface 5 HID Sensor Interface HID Device Descriptor: bLength 9 bDescriptorType 33 bcdHID 1.01 bCountryCode 0 Not supported bNumDescriptors 1 bDescriptorType 34 Report wDescriptorLength 2587 Report Descriptors: \ UNAVAILABLE ** Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x81 EP 1 IN bmAttributes 3 Transfer Type Interrupt Synch Type None Usage Type Data wMaxPacketSize 0x0040 1x 64 bytes bInterval 20 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x01 EP 1 OUT bmAttributes 3 Transfer Type Interrupt Synch Type None Usage Type Data wMaxPacketSize 0x0040 1x 64 bytes bInterval 20 Device Status: 0x0000 (Bus Powered)

pfps commented 10 years ago

If you have the IIO system installed, you should be able to cat /sys/bus/iio/devices/iio:device*/name If one of these is accel_3d then you have the correct kind of accelerometer.

Erwyn commented 10 years ago

Thank you, I'll check if it match soon.

rpseng commented 10 years ago

Hi all! Just got an Yoga ideapd 11s. I'm also willing to improve the support for this machine, I'm not a Linux kernel module expert but can program in C.

Currently I'm unable to make the screen rotate when it is upside down.

If I run: cat /sys/bus/iio/devices/iio:device*/name I've got: gyro_3d accel_3d magn_3d

Hope to hear from you. All the best.

pfps commented 10 years ago

If the screen is not rotating at all then try running the orientation program with a high debug level, as in orientation -d4, and send back the output. (If there is lots of output, then only the first 20 lines or so are needed.)

rpseng commented 10 years ago

Dear Peter,

Thanks for the prompt reply. If I run: $ sudo orientation --debug=4

I get only the following: iio device number being used is 2 iio trigger number being used is 2 Finding orientation 0 Polling the data

It is apparently stucked.

Some more details on the hardware below: $ sudo lsusb -v -s 2:3

Bus 002 Device 003: ID 2047:0855 Texas Instruments Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 2.00 bDeviceClass 0 (Defined at Interface level) bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 8 idVendor 0x2047 Texas Instruments idProduct 0x0855 bcdDevice 11.40 iManufacturer 1 Invensense iProduct 2 Lenovo Yoga
iSerial 3 46F5806F1B002B00 bNumConfigurations 1 Configuration Descriptor: bLength 9 bDescriptorType 2 wTotalLength 41 bNumInterfaces 1 bConfigurationValue 1 iConfiguration 4 Embedded MotionApps bmAttributes 0xa0 (Bus Powered) Remote Wakeup MaxPower 100mA Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 0 bAlternateSetting 0 bNumEndpoints 2 bInterfaceClass 3 Human Interface Device bInterfaceSubClass 0 No Subclass bInterfaceProtocol 0 None iInterface 5 HID Sensor Interface HID Device Descriptor: bLength 9 bDescriptorType 33 bcdHID 1.01 bCountryCode 0 Not supported bNumDescriptors 1 bDescriptorType 34 Report wDescriptorLength 2269 Report Descriptors: \ UNAVAILABLE ** Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x81 EP 1 IN bmAttributes 3 Transfer Type Interrupt Synch Type None Usage Type Data wMaxPacketSize 0x0040 1x 64 bytes bInterval 20 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x01 EP 1 OUT bmAttributes 3 Transfer Type Interrupt Synch Type None Usage Type Data wMaxPacketSize 0x0040 1x 64 bytes bInterval 20 Device Status: 0x0000 (Bus Powered)

pfps commented 10 years ago

This is the behaviour if some part of IIO (the I/O system that is used) isn't working right. There are some comments in the docs directory on what can go wrong.

I expect that the problem is permissions. Check to see that you can read and write the buffer via ls -l /sys/bus/iio/devices/iio:device2/buffer/. If you can, then it may be that you don't have the quirk installed for your device. I don't have the information on how to fix that at hand. Bug me sometime in the middle of next week if you are still stuck - I will have all the information available then.

rpseng commented 10 years ago

Dear Peter,

I don't believe we have a permission problem here, since I'm running 'orientation' under sudo. The list command you suggested produced the following: $ ls -l /sys/bus/iio/devices/iio:device2/buffer/ total 0 -rw-r--r-- 1 root root 4096 Set 6 13:36 enable -rw-r--r-- 1 root root 4096 Set 6 13:36 length

I can also cat the contents of some sensors, e.g.: $ cat /sys/bus/iio/devices/iio:device0/in_accel_offset -2 $ cat /sys/bus/iio/devices/iio:device1/in_anglvel_offset -2

They are all returning -2, irrespective the screen angle or position and sample frequency always return zero for all devices: $ cat /sys/bus/iio/devices/iio:device1/in_anglvel_sampling_frequency 0.000000

I've never heard about iio before and am a little confused on how to go further.

All the best.

rpseng commented 10 years ago

Dear Peter,

Just realized my kernel is 3.13 and I need to install the sensor drivers which I skiped before. Now orientation is working when executed under sudo.

All the best.

Erwyn commented 10 years ago

Hello rpseng,

Could you tell me what works and what does not?

Regards,

rpseng commented 10 years ago

Hi Martin (Erwyn),

Regarding the tools provided by this project, the orientation script works for me. Since I'm using a 3.13 kernel I had to install the drivers first: $ make sensors-drivers $ sudo make sensors-drivers-install

After reboot the orientation script could accurately determine the position of the screen and rotate it if necessary: $ sudo ./orientation

The light script is not working: $ sudo ./light Failed to find the als sensor

There are still several things missing for a fully functional 2 in 1, like automatically disable keyboard/touchpad when in tablet mode etc... I guess we need to use other sensor for that. I'm looking forward for a response for the onboard project on that: https://bugs.launchpad.net/onboard/+bug/1366421

All the best.

Erwyn commented 10 years ago

Thanks for all these informations. Shamely I was particularly interested in the light stuff :(. Don't we have such sensors or is it the script not detecting them?