Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementing on Yoga 11s #17

Open
SpacemanPete opened this issue Aug 7, 2014 · 14 comments
Open

Implementing on Yoga 11s #17

SpacemanPete opened this issue Aug 7, 2014 · 14 comments

Comments

@SpacemanPete
Copy link

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
Copy link
Owner

pfps commented Aug 7, 2014

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
Copy link

Erwyn commented Aug 19, 2014

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
Copy link
Owner

pfps commented Aug 19, 2014

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
Copy link
Owner

pfps commented Aug 19, 2014

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
Copy link

Erwyn commented Aug 19, 2014

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

@rpseng
Copy link

rpseng commented Sep 5, 2014

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
Copy link
Owner

pfps commented Sep 5, 2014

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
Copy link

rpseng commented Sep 5, 2014

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
Copy link
Owner

pfps commented Sep 5, 2014

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
Copy link

rpseng commented Sep 6, 2014

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
Copy link

rpseng commented Sep 6, 2014

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
Copy link

Erwyn commented Sep 8, 2014

Hello rpseng,

Could you tell me what works and what does not?

Regards,

@rpseng
Copy link

rpseng commented Sep 8, 2014

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
Copy link

Erwyn commented Sep 9, 2014

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants