Commit Graph

50 Commits

Author SHA1 Message Date
Carsten Haitzler c4e76ed593 backlight + ddc - fix and improve several small things
1. use max valu in the get and store it once a get has been done so it
will get backlight level right on unsuaul monitors that do not use
0->100
2. detect as an error dinfing 2 screesn with the same edid and log it
3. use ddca_enable_sleep_suppression() to try speed up things a bit to
sleep less inside ddcutil
2020-11-26 00:38:01 +00:00
Carsten Haitzler d039b53484 e sys babcklight - streamline setting bl_power 2020-09-07 20:24:57 +01:00
Carsten Haitzler 63bc2a8093 backlight - support backlight on non-lid panels and bl_power too
i didn't know bl_ppower existed... i found a device that exposes this
sysfs node and it seems it's a good idea to swizzle it too in addition
to brightness. so fix that and also fix e's backlight handling to find
backlight devices for non-lid panels marked to have a backlight ... i
have such a device here. this makes backlight controls work in this
case.
2020-09-05 11:34:14 +01:00
Carsten Haitzler ead43c40c3 ddc - add libddcutil.so.3 as supported as it is compatible for our uses 2020-08-18 12:06:43 +01:00
Carsten Haitzler 072fd2d741 e system - isolate stdio of commands we run so they dont pollute 2020-07-14 13:31:29 +01:00
Carsten Haitzler 80f92ee486 e backlight - handle screens with no edid
this fixes backlight support on my pinephone...

@fix
2020-06-10 11:05:13 +00:00
Carsten Haitzler 596def7806 e system - storage - improve mount/umount code to enforce simple std
all dirs owned by root - so can't be exploited. this code is not
acessible at this point so no actual issues. it still needs testing.
until other work is done it won't be tested yet.

fixes T8671 further comments on umount check.
2020-05-28 11:24:32 +01:00
Elyes HAOUAS f84d23ffd2 Remove duplicated includes
Remove duplicated includes

Reviewed-by: Christopher Michael <devilhorns@comcast.net>
Differential Revision: https://phab.enlightenment.org/D11857
2020-05-19 13:06:21 -04:00
Elyes HAOUAS 44b029378a tree-wide: get rid of trailing whitespace (part 5)
Remove trailing whitespaces

Reviewed-by: Stefan Schmidt <stefan@datenfreihafen.org>
Differential Revision: https://phab.enlightenment.org/D11824
2020-05-14 13:49:17 +02:00
Elyes HAOUAS 153f479d3f tree-wide: fix typos all over the place
Fix some typos

Differential Revision: https://phab.enlightenment.org/D11778
2020-05-14 12:04:51 +02:00
Carsten Haitzler bab2b503f6 setuid setup - move to single shared file to stop cnp of code 2020-05-01 18:13:23 +01:00
Carsten Haitzler 2ae006cfbd e system - spew out unique exit codes we can then show dialogs for
tell the user all the possible exit reason we know about for
enlightenment_system.
2020-04-29 22:14:15 +01:00
Christopher Michael 194f1c77b5 e_system_main: Fix resource leak
Coverity reports a leak here because we are not closing the previously
opened file. Fix that.

fixes CID1427985
2020-04-28 11:31:24 -04:00
Carsten Haitzler 91c003100e e system - allow the per system permit/deny rules to work 2020-04-23 13:43:45 +01:00
Carsten Haitzler 3d490704ca e system - check chdir return
chdir to / will never fail... it's the root dir.. but let's make
coverity happy.

fix CID 1425454
2020-04-23 01:05:00 +01:00
Carsten Haitzler 089051af9e e system main - check getgrid return like elsewhere to maake cov happy
fix CID 1425457
2020-04-23 00:54:35 +01:00
Carsten Haitzler d8130a741c e sys storage - disable it effectively by failing all devices
all devices will fail the check for now as i have no filter to only
check for block + removable devices etc.

fixes T8672
2020-04-22 14:53:25 +01:00
Carsten Haitzler 800ff4e24f e sys store - unmount verify its root and right username
also check for relative paths, shell metachars etc.

fixes T8671
2020-04-22 14:40:59 +01:00
Carsten Haitzler dfed5c2718 e sys storage - also address media dirs to have to be user named
only allow media dirs to be /media/username/xxx ...

fixes T8672
2020-04-22 14:27:21 +01:00
Carsten Haitzler 0c79c6317b e sys store - make it all root owned for meda mount dirs
fixes T8670
2020-04-22 14:11:00 +01:00
Carsten Haitzler 027095b68e e system - use ERR - its not the eina log - it's already a custom one
i already made ERR do fprintf to stderr... so use it :)
2020-04-22 13:44:01 +01:00
Carsten Haitzler fc6c423a9f e system main - fix system.conf parsing to parse all of it
forgot my for loop.. :)

fixes T8675
2020-04-22 13:42:32 +01:00
Carsten Haitzler 2e75a9410e e sys man - double check root homedir to be paranoid 2020-04-22 13:15:08 +01:00
Carsten Haitzler ac37da4167 e sys inout - abort on messages more than 1m in size
i never see a need for messages more than 1m in size so lets just
abort on them to limit abuse

fixes T8677
2020-04-22 13:00:55 +01:00
Carsten Haitzler 5fb2fccd70 e sys main - double check return from getpwent homedir 2020-04-22 12:37:51 +01:00
Carsten Haitzler d42605f5c0 e sys main - change cwd to avoid loading .so's in ./
fixes T8676
2020-04-22 12:35:32 +01:00
Carsten Haitzler fc26d91ac0 e sys l2ping - handle null params
fixes T8674
2020-04-22 12:25:36 +01:00
Carsten Haitzler 6926d1d338 e sys l2ping - limit devv string scanf size to buffer size
fixes T8673
2020-04-22 12:20:54 +01:00
Alastair Poole d0b2f3db0c e_system: When setuid, set home also.
This ensures we have a matching $HOME when using setuid, without
which can potentially cause issues in eina_vpath on some
systems (FreeBSD as example).
2020-04-21 15:56:26 +01:00
Carsten Haitzler bd97c74492 e alert - in case of crash use e system in new alert mode
this forces all ddc/backlight devices to max when discovered so you
can always see the alert.
2020-04-21 03:01:54 +01:00
Carsten Haitzler f1e899fee0 e system ddc - handle error case of alloc fail and dont deref null
fix CID 1425220
2020-04-19 00:48:07 +01:00
Carsten Haitzler 8931a333eb e system - handle /dev/null not opening
fix CID 1425222
2020-04-19 00:39:51 +01:00
Carsten Haitzler 5e0bb63118 e system storage - fix double free found by coverity
fix CID 1425224
2020-04-18 23:19:54 +01:00
Carsten Haitzler 1edddcda66 e system rfkill - use list command for old rfkill output
some distros use an ancient rfkill without default listing of devices.
this adapts to work there.

@fix
2020-04-15 15:31:14 +01:00
Carsten Haitzler b5fa86e7f5 e system - disable singleton mode code - fewer pluses than minuses 2020-04-08 09:39:23 +01:00
Carsten Haitzler d524673f96 e system ddc - add optional sleep multiplier api - new in libddc
add ability to find it at any rate...
2020-02-14 11:02:42 +00:00
Carsten Haitzler fcacbe8a4f ddc - work around some probe fails, missing timer handle, etc.
beating on ddc support to make it solid. dealing with some bad screens
that don't respond, a libddcutil that was doing a printf messing up
the message stream from e_system to e .... and more.
2020-02-07 19:56:01 +00:00
Carsten Haitzler d7325c3aad ddc - use return val of system to decide to usleep or not 2020-02-07 13:36:09 +00:00
Carsten Haitzler ee59cec585 ddc - add small delay after modprobe to allow module to init in bg... 2020-02-07 10:48:54 +00:00
Carsten Haitzler 1cfd1f4242 backlight - add workaround monitor wakeups silently ignoring val sets
so if monitor is buys waking up from dpms, it may not be bothering to
do what we asked... but the sets of the propety say they succeed, so
use the get at the end of a fade in run to see if we get the target
brightness within some delta and it's one of our standard brightnesses
(1.0, normal or dim) and retry a few times until we succeed or give
up. this ensures on wakupe your monitors end up at their target
brightness even with some hiccups as opposed to stay dim. not much we
can do about iffy hardware or libddcutil (not sure which is to blame)
other than do workarounds like this.

also add logging so you can see what is being asked and if it succeeds
or fails according to libddcutil.
2020-02-07 10:24:59 +00:00
Carsten Haitzler 57e8805005 ddc - fix animation blocked by slow ddc response with multi screen
just by luck the queue "play catchup" happens to have a classic
scheduling issue. one screen always wins, the other always loses as we
play catch-up in the request queue so one is starved of "scheduling
slots" while the othe rgets them all. this fixes that by moving the
entire request queue into the thread work queue in one go so they all
get an equal chance. now botjh my desktop monitors dim smoothly on
idle like my laptop... smooooooooood
2020-02-06 19:47:04 +00:00
Carsten Haitzler eab2a34ef3 backlight - add ddc support via libddcutil
This adds ddc monitor control and glues it into the backlight system.
A result of this is now backlgiht control gadgets work screen by
screen and even on desktop monitors as well as on a laptop panel. If
you now put a backlight gadget on a shelf on each screen... it will
control THAT screen's backlight.

This requires libddcutil to be installed. That will require i2c
modules (i2c-dev specifically). This means that this is likely not
going to do anything useful on bsd's... unless libddcutil happens to
work there by chance.

so install ddcutil/libddcutil. ensure it's in ld.so.conf so setuid
root processes find it (as LD_LIBRARY_PATH won't help) and enjoy your
new funcky per-screen backlight controls... :)

@feature
2020-02-06 18:41:23 +00:00
Carsten Haitzler bac870bf61 malloc.h - bsd does not like me including it... 2020-01-18 01:33:21 +01:00
Carsten Haitzler 5b5c7c3cb3 e system - force a malloc trim regularly to keep back-end proc minimal 2020-01-16 12:09:49 +00:00
Carsten Haitzler 63ae3290fb e system - remove test tool as we can't use it anymore
it'll just be a fight between e and a cmdline tool - so no more test
tool needed. this is off the ground.
2020-01-16 11:59:12 +00:00
Carsten Haitzler 7e47977d9a printf format macros - put them in the right places for no warnings 2020-01-15 19:06:24 +01:00
Carsten Haitzler 72a2f7e8aa e system cpufreq - silence bsd warnings for unused params and ifdefs 2020-01-15 19:06:24 +01:00
Carsten Haitzler fb9948738b e system test - fix warnings about aligned types 2020-01-15 19:06:24 +01:00
Carsten Haitzler 72496cbfeb e system backlight - fix bsd size type for sysctl 2020-01-15 19:06:24 +01:00
Carsten Haitzler f57572b678 e system - add new uber setuid tool to replace all the previous ones
so e has had a bit of a mess of setuid root tools to do things that
are essential to maintaing a functioning desktop/laptop/tablet/phone
like device like shutting it down or suspending or sqizzling the cpu
governor or messing with the backlight or... you get the idea.

this has been spread around enlightenment_sys and other special
purpose tools. this now unifies it into a single "always there"
enlightenment_system backend setuid root slave process whose job it is
to do all these things via a stdio protocol in an organized way. this
means latency to do something is lower, but at the expense of
consuming ram and a lurking process. unfortunately the lurking will be
needed soon when i add ddc support to make it even vaguely efficient,
so it's a cost i guess we have to pay now. we'll need this in future
as well for some stats collection and more.

still need to port existing code to use this instead of the existing stuff,
and then remove of the old stuff.
2020-01-15 11:33:49 +00:00