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

Dbus hooks #22

Open jymbob opened 9 years ago

jymbob commented 9 years ago

More of a feature request than an issue: Would it be possible to compile with dbus hooks so that dbus-notify can be called upon rotation? This could track orientation, or 'mode' as per Windows usage (Tablet, tent, stand, laptop)

pfps commented 9 years ago

This is a good idea, but someone will need to do the work. :-)

However, I don't think that we would get tablet, ... indications out. That requires determining the hinge angle, which isn't yet being calculated.

It would be nice to know how Windows calculates this information, to be able to emulate the Windows behaviour. I have tried a bit to shame the information out of Lenovo, but no response.

jymbob commented 9 years ago

It might be possible to fake a lot of it - pretty sure 'screen is upside-down' is the primary trigger for Tent Mode, for example. I note you've found a magnetic sensor for Tablet Mode, so the only tricky distinction left is Stand vs Laptop mode...

If I knew more C I'd see if I could work something out, but unfortunately my skills there are severely limited. )o:

pfps commented 9 years ago

I have found out that tablet mode is triggered by a magnetic sensor, but there does not appear to be any reporting back through ACPI to the OS. The newer embedded controller to OS interface may do better but I don't think that there is an implementation of that in Linux.

Buri commented 9 years ago

https://github.com/Buri/yoga-laptop

I have done notifiing via dbus, but only for screen rotation. Code is bit old, but it might just work. If not, it then needs to be merged with current pfps repository.

pfps commented 9 years ago

I'm happy having someone else do this merging, as I don't have time to do anything in this area just now.

jymbob commented 9 years ago

@Buri I've pulled your code, but can't quite work out how you're refactoring? Is everything supposed to be called through controller, or does orientation now trigger controller, which handles what to do?