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

Fixed segfault in light #6

Closed Buri closed 10 years ago

Buri commented 10 years ago
pfps commented 10 years ago

I think that a better way to go is to modify the permissions on the files that are being fiddled with, so that the program itself does not have to be suid root. I'll fix up the Makefile to include an install target for the orientation program that will do this (and get rid of the setup program).

peter

On 04/26/2014 01:37 PM, Jakub Buriánek wrote:

  • Minor tweaks and fixes

    You can merge this Pull Request by running

git pull https://github.com/Buri/yoga-laptop master

Or view, comment on, or merge it at:

https://github.com/pfps/yoga-laptop/pull/6

    Commit Summary

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

pfps commented 10 years ago

The install script now modifies permissions on the control files to give write permission to the user's group. That method should let light not need to be setuid.

I'm not sure just what the current best way to do this is. Perhaps some policy kit method?

peter

On 04/26/2014 01:37 PM, Jakub Buriánek wrote:

  • Minor tweaks and fixes

    You can merge this Pull Request by running

git pull https://github.com/Buri/yoga-laptop master

Or view, comment on, or merge it at:

https://github.com/pfps/yoga-laptop/pull/6

    Commit Summary

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

Buri commented 10 years ago

Changing file group will work well for single user computer, however it will break when running in multi user desktop. As short term solution its sufficient, but if we want to make this production ready code, we need to split all three aplications to two group: daemon that reads sensors and send events on bus/produces acpi events/etc. and control application, that will gather the events and make changes. Daemon can run as whatever user and modifiy permissions at will, since nothing else will really read output from sensors directly, however things like backlight are not reserved for theese drivers and therfore I think they should have default permissions unless there is absolute need to change them.

pfps commented 10 years ago

Yes, the code should be split as you suggest.

Permissions should be handled via something like policykit, so that the user who is physically using the screen is the one that can do things like rotating it or changing brightness. This would mean that thecode doesn't need to run suid or sgid.

peter

On 04/27/2014 09:33 AM, Jakub Buriánek wrote:

Changing file group will work well for single user computer, however it will break when running in multi user desktop. As short term solution its sufficient, but if we want to make this production ready code, we need to split all three aplications to two group: daemon that reads sensors and send events on bus/produces acpi events/etc. and control application, that will gather the events and make changes. Daemon can run as whatever user and modifiy permissions at will, since nothing else will really read output from sensors directly, however things like backlight are not reserved for theese drivers and therfore I think they should have default permissions unless there is absolute need to change them.

— Reply to this email directly or view it on GitHub https://github.com/pfps/yoga-laptop/pull/6#issuecomment-41501334.

Buri commented 10 years ago

Great, ill look to it in my spare time. :)

Buri commented 10 years ago

Ok, I've fixed some issues in light, cleaned up the code and made separate folder for docs. My next focus will be to do the same for orientation and then ill make the two level split bridged via dbus.

pfps commented 10 years ago

I've pulled these, and (finally) removed the binaries.

peter

On 05/02/2014 08:12 AM, Jakub Buriánek wrote:

Ok, I've fixed some issues in light, cleaned up the code and made separate folder for docs. My next focus will be to do the same for orientation and then ill make the two level split bridged via dbus.

— Reply to this email directly or view it on GitHub https://github.com/pfps/yoga-laptop/pull/6#issuecomment-42042141.

Buri commented 10 years ago

Ok, so I have working draft of dbus connection in my local copy. Right now I'm polishing it out and maybe tomorrow I may push it to git.

pfps commented 10 years ago

The directory structure should really be cleaned up at some point. I stupidly put the orientation program in the main directory, which made the drivers a subdirectory of that.

I think that it would be better to put the orientation and light programs in separate subdirectories. What do you think?

Buri commented 10 years ago

Ive made some progress on my branch regarding directory structure. It reflects sensor reader -> worker architecture. I am now facing following question: use multithreaded blocking read from sensors, or use nonblocking polling?

pfps commented 10 years ago

Hmm. I don't have any guidance here.

peter

On 05/07/2014 06:35 AM, Jakub Buriánek wrote:

Ive made some progress on my branch regarding directory structure. It reflects sensor reader -> worker architecture. I am now facing following question: use multithreaded blocking read from sensors, or use nonblocking polling?

— Reply to this email directly or view it on GitHub https://github.com/pfps/yoga-laptop/pull/6#issuecomment-42427103.