Необходимо сообщать системе, что программа работает и не следует переводить компьютер в спящий или ждущий режимы, но при этом, чтобы не влиять на включение хранителя экрана?
В Windows была функция SetThreadExecutionState из библиотеки kernel32.dll, которую я использовал с параметром #ES_SYSTEM_REQUIRED
Подскажите пожалуйста, какие варианты реализации данной проблемы есть в линуксах..!?
Как сообщить системе, что программа работает
Видно, что проблема есть с аналогией в Linux...
Ладно, а не подскажите как программно можно выключать и включать ждущий и спящий режим?
Буду очень признателен, спасибо!
а не подскажите как программно можно выключать и включать ждущий и спящий режим?
Проверьте, чтобы был установлен пакет pm-utils (или подобное название, зависит от дистрибутива).
И, соответственно, команды
— «усыпить» в оперативную память
[console]pm-suspend[/console]
— «усыпить» на диск
[console]pm-hibernate[/console]
Необходимо сообщать системе, что программа работает и не следует переводить компьютер в спящий или ждущий режимы, но при этом, чтобы не влиять на включение хранителя экрана?
Какая именно программа не должна «засыпать»?
Какая именно программа не должна «засыпать»?
Нет не программа, а операционная система, если работает определенная программа.
Дык вот хотелось бы, обзавестись такой же опцией в настройках программы как у, например, "Transmission" в параметрах, на вкладке "Рабочий стол" пункт "Препятствовать переходу в спящий режим при активности торрентов".
Как такое реализованно у Торрент клиента?
И уж если нет аналогии в линуксе SetThreadExecutionState, то может быть программно отключать функцию спящего режима в ОС и по завершении программы включать, а не писать в инструкциях к программе юзеру мол не забудьте поковыряться в настройках питания, если не хотите, чтобы ваш копьютер уснул в самый неподходящий момент...))
никогда не пользовался гибернацией, да и обычным саспендом тоже не особо
Ладно, а не подскажите как программно можно выключать и включать ждущий и спящий режим?
включить - смотрите документацию к ядру: Documentation/power/swsusp.txt
возможно ещё стоит подумать о апи удава, может в нём что-то есть... ещё можно покопать исходники кед/гнома, как они реализуют.
а выключить их может только юзер wink
по поводу первого вопроса - не знаю, возможно ли такое, если вызов идёт напрямую к ядру... если вызов через что-то проходит, то нужно покурить соответствующие доки...
Как такое реализованно у Торрент клиента?
тогда в чём проблема? посмотрите как оно реализовано, расскажите другим...
по поводу второго - посмотрите исходники pm-utils.
тогда в чём проблема? посмотрите как оно реализовано, расскажите другим...
В духе опенсорса :D
Спасибо!
Необходимо сообщать системе, что программа работает и не следует переводить компьютер в спящий или ждущий режимы, но при этом, чтобы не влиять на включение хранителя экрана?
начните с того, что опишите, КАКОЙ у вас хранитель экрана.
ну может этот? так всё написано:
[console]doc@dt:~$ xscreensaver-command --help
usage: xscreensaver-command -<option>
This program provides external control of a running xscreensaver process.
Version 5.12, copyright (c) 1991-2008 Jamie Zawinski <jwz@jwz.org>.
The xscreensaver program is a daemon that runs in the background.
You control a running xscreensaver process by sending it messages
with this program, xscreensaver-command. See the man pages for
details. These are the arguments understood by xscreensaver-command:
-demo Ask the xscreensaver process to enter interactive demo mode.
-prefs Ask the xscreensaver process to bring up the preferences
panel.
-activate Turn on the screensaver (blank the screen), as if the user
had been idle for long enough.
-deactivate Turns off the screensaver (un-blank the screen), as if user
activity had been detected.
-cycle If the screensaver is active (the screen is blanked), then
stop the current graphics demo and run a new one (chosen
randomly.)
-next Like either -activate or -cycle, depending on which is more
appropriate, except that the graphics hack that will be run
is the next one in the list, instead of a randomly-chosen
one. In other words, repeatedly executing -next will cause
the xscreensaver process to invoke each graphics demo
sequentially. (Though using the -demo option is probably
an easier way to accomplish that.)
-prev Like -next, but goes in the other direction.
-select <N> Like -activate, but runs the Nth element in the list of
hacks. By knowing what is in the `programs' list, and in
what order, you can use this to activate the screensaver
with a particular graphics demo. (The first element in the
list is numbered 1, not 0.)
-exit Causes the xscreensaver process to exit gracefully.
This does nothing if the display is currently locked.
(Note that one must *never* kill xscreensaver with -9!)
-restart Causes the screensaver process to exit and then restart with
the same command line arguments as last time. You shouldn't
really need to do this, since xscreensaver notices when the
.xscreensaver file has changed and re-reads it as needed.
-lock Tells the running xscreensaver process to lock the screen
immediately. This is like -activate, but forces locking as
well, even if locking is not the default. If the saver is
already active, this causes it to be locked as well.
-version Prints the version of xscreensaver that is currently running
on the display -- that is, the actual version number of the
running xscreensaver background process, rather than the
version number of xscreensaver-command.
-time Prints the time at which the screensaver last activated or
deactivated (roughly, how long the user has been idle or
non-idle -- but not quite, since it only tells you when the
screen became blanked or un-blanked.)
-watch Prints a line each time the screensaver changes state: when
the screen blanks, locks, unblanks, or when the running hack
is changed. This option never returns; it is intended for
by shell scripts that want to react to the screensaver in
some way.
See the man page for more details.
For updates, check http://www.jwz.org/xscreensaver/
[/console]