Closed X4 closed 11 years ago
There is however a problem, you removed while [ ! -e /sys/kernel/debug/vgaswitcheroo/switch ] which is important in case the script is run before the device is in the device tree.
On Mon, Jul 8, 2013 at 1:08 AM, Ferhat notifications@github.com wrote:
Hi, I removed the shell scripts and added an optional install script instead.
The main difference is that I run the shell script within the service file.
You can merge this Pull Request by running
git pull https://github.com/X4/vgaswitcheroo_systemd master
Or view, comment on, or merge it at:
https://github.com/fredoche/vgaswitcheroo_systemd/pull/3 Commit Summary
- Update vgaswitcheroo.service
- Delete vgaswitcheroo_start.sh
- Delete vgaswitcheroo_stop.sh
- Update vgaswitcheroo.service
- Update vgaswitcheroo.service
- added install helper
- fixed the install script and service
File Changes
- A install.shhttps://github.com/fredoche/vgaswitcheroo_systemd/pull/3/files#diff-0(10)
- M vgaswitcheroo.servicehttps://github.com/fredoche/vgaswitcheroo_systemd/pull/3/files#diff-1(6)
- D vgaswitcheroo_start.shhttps://github.com/fredoche/vgaswitcheroo_systemd/pull/3/files#diff-2(15)
- D vgaswitcheroo_stop.shhttps://github.com/fredoche/vgaswitcheroo_systemd/pull/3/files#diff-3(2)
Patch Links:
@fredoche OK, I've just commited a solution for that and it works.
+Requires=sys-kernel-debug.mount +After=sys-kernel-debug.mount
Please try it out and tell me if I should add the while-loop, because that could slow things down. It's already too slow, I should remove the modprobe, what do you think?
I mean you can load "radeon" by running (this is cleaner and could be added to the install script)
systemctl status vgaswitcheroo.service
vgaswitcheroo.service - Turn discrete graphics off
Loaded: loaded (/usr/lib64/systemd/system/vgaswitcheroo.service; enabled)
Active: active (exited) since Mo 2013-07-08 14:45:48 CEST; 2h 43min ago
Process: 4686 ExecStart=/bin/sh -c modprobe radeon && echo DIGD > /sys/kernel/debug/vgaswitcheroo/switch && echo OFF > /sys/kernel/debug/vgaswitcheroo/switch (code=exited, status=0/SUCCESS)
Jul 08 14:45:48 SGC-Abydoss.local systemd[1]: Started Turn discrete graphics off.
3.993s systemd-tmpfiles-setup-dev.service
3.950s systemd-fsck@dev-disk-by\x2duuid-6bf58251\x2d17c6\x2d47dd\x2dbbda\x2d3af100422215.service
3.816s NetworkManager.service
3.075s vgaswitcheroo.service
2.804s systemd-tmpfiles-clean.service
2.801s plymouth-quit-wait.service
2.801s plymouth-quit.service
2.684s plymouth-start.service
2.366s systemd-vconsole-setup.service
1.923s dev-disk-by\x2duuid-203b8247\x2dae65\x2d4c65\x2d9199\x2d1c9581e24b3f.swap
1.816s ufw.service
1.806s systemd-udev-trigger.service
1.255s alsa-restore.service
957ms systemd-udevd.service
953ms x-setup.service
857ms systemd-fsck-root.service
842ms systemd-fsck@dev-disk-by\x2duuid-42666536\x2dd745\x2d40c0\x2db5ca\x2d0e929641db6d.service
834ms avahi-daemon.service
828ms sys-kernel-debug.mount
712ms dev-mqueue.mount
704ms dev-hugepages.mount
517ms systemd-logind.service
472ms sys-fs-fuse-connections.mount
400ms rtkit-daemon.service
364ms systemd-tmpfiles-setup.service
358ms udisks2.service
320ms plymouth-read-write.service
278ms systemd-readahead-replay.service
241ms systemd-sysctl.service
229ms polkit.service
229ms ModemManager.service
190ms systemd-modules-load.service
87ms opt.mount
75ms home.mount
66ms var-run.mount
64ms systemd-readahead-collect.service
62ms upower.service
40ms systemd-remount-fs.service
32ms var-lock.mount
22ms tmp.mount
15ms wpa_supplicant.service
15ms vixie-cron.service
13ms systemd-user-sessions.service
9ms systemd-journal-flush.service
4ms systemd-readahead-done.service
2ms systemd-random-seed-load.service
btw. if you know how I can speed my boot, I'm all ears :) (I use "prelink" btw.)
The systemd "Requires" seems to be the right approach, thanks!
On Mon, Jul 8, 2013 at 5:38 PM, Ferhat notifications@github.com wrote:
btw. if you know how I can speed my boot, I'm all ears :) (I use "prelink" btw.)
— Reply to this email directly or view it on GitHubhttps://github.com/fredoche/vgaswitcheroo_systemd/pull/3#issuecomment-20614276 .
Can you send me another pull request with the latest commit?
The current pull request links to master, I think it auto updated.
Should we remove modprobe? I am not sure if it's required or not, I believe it's not required when you rightfully load the radeon module for example. (I know that the install script is really quick & dirty, but it does it's job :)
As far as I know the module load automatically, and the modprobe is here to be sure the device appear in the debug tree. So, the requisite part + the after in the service file should be enough. There is only one way to be sure ;) I'll accept the pull request as it is, but feel free to test removing the modprobe: if it works for you i'll also include the fix there. There will still be time for discussion and room for corner cases.
Thanks, I'm currently researching a little, but will reboot and test without modprobe a handful times to see if it works without modprobe. The README needs an update, soon btw.
@fredoche
Could you try removing the modprobe radeon and remove the blacklisting, then reboot and try if cat /sys/kernel/debug/vgaswitcheroo/switch gives you any output and if the discrete card is correctly turned off?
Hi, I removed the shell scripts and added an optional install script instead. The main difference is that I inlined the shell scripts into the service file.