Hi guys
i have an SDL program that runs ok when i run it from shell. also i have an
script that i have put it in startup applications of Gnome/Debian that runs
the program automatically when system boots. i have decided to autostart my
app when the machine comes back from suspend mode so i put this script in
“/etc/pm/sleep.d/myscript”
#! /bin/sh
case “$1” in
thaw|resume)
/home/p/Desktop/myscript
;;
*)
;;
esac
exit $?
this script simply run my app after coming back from suspend mode!
http://ubuntuforums.org/showthread.php?t=1484156
after coming back from suspend mode, my app runs well but my app has just
get 2/3 of screen and the other areas are black and any key doesn’t work.
i decided to remove the script from /etc/pm/sleep.d and run my app by
myself. in this way my app works correctly, i think something shoul be
wrong with running my script from sleep.d
does anyone has any idea? thanks.
Hi guys
i have an SDL program that runs ok when i run it from shell. also i have an
script that i have put it in startup applications of Gnome/Debian that runs
the program automatically when system boots. i have decided to autostart my
app when the machine comes back from suspend mode so i put this script in
“/etc/pm/sleep.d/myscript”
#! /bin/sh
case “$1” in
thaw|resume)
/home/p/Desktop/myscript
;;
*)
;;
esac
exit $?
this script simply run my app after coming back from suspend mode!
http://ubuntuforums.org/showthread.php?t=1484156
after coming back from suspend mode, my app runs well but my app has just
get 2/3 of screen and the other areas are black and any key doesn’t work.
i decided to remove the script from /etc/pm/sleep.d and run my app by
myself. in this way my app works correctly, i think something shoul be
wrong with running my script from sleep.d
does anyone has any idea? thanks.
Hello !
i have an SDL program that runs ok when i run it from shell. also i have an
script that i have put it in startup applications of Gnome/Debian that runs
the program automatically when system boots. i have decided to autostart my
app when the machine comes back from suspend mode so i put this script in
“/etc/pm/sleep.d/myscript”
#! /bin/sh
case “$1” in
thaw|resume)
Please try if changing this line from :
/home/p/Desktop/myscript
to:
su -u p -c "/home/p/Desktop/myscript"
helps, it might.
If p is your user name, i guessed from /home/p/…
CU
su -u p -c "/home/p/Desktop/myscript"
su: invalid option – 'u’
Usage: su [options] [LOGIN]
Options:
-c, --command COMMAND pass COMMAND to the invoked shell
-h, --help display this help message and exit
-, -l, --login make the shell a login shell
-m, -p,
–preserve-environment do not reset environment variables, and
keep the same shell
-s, --shell SHELL use SHELL instead of the default in passwd
It seems that -u doesn’t work. is there any other option that could help?
i have also tried su -c “/home/p/Desktop/myscript” but have the same
problem again
and looket at sudo but it doesn’t have any switch like -c to invoke my app
from shellOn Sun, Jun 24, 2012 at 12:55 PM, Torsten Giebl wrote:
Hello !
i have an SDL program that runs ok when i run it from shell. also i have
an
script that i have put it in startup applications of Gnome/Debian that
runs
the program automatically when system boots. i have decided to autostart
my
app when the machine comes back from suspend mode so i put this script in
“/etc/pm/sleep.d/myscript”
#! /bin/sh
case “$1” in
thaw|resume)
Please try if changing this line from :
/home/p/Desktop/myscript
to:
su -u p -c "/home/p/Desktop/myscript"
helps, it might.
If p is your user name, i guessed from /home/p/…
CU
SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Hello !
su -u p -c "/home/p/Desktop/myscript"
su: invalid option – 'u’
Usage: su [options] [LOGIN]
Options:
-c, --command COMMAND pass COMMAND to the invoked shell
-h, --help display this help message and exit
-, -l, --login make the shell a login shell
-m, -p,
–preserve-environment do not reset environment variables, and
keep the same shell
-s, --shell SHELL use SHELL instead of the default in passwd
It seems that -u doesn’t work. is there any other option that could help?
i have also tried su -c “/home/p/Desktop/myscript” but have the same
problem again
and looket at sudo but it doesn’t have any switch like -c to invoke my app
from shell
Please try :
su p -c “/home/p/Desktop/myscript”
p being the username.
CU
Same problem again
but think my problem can solve in another way!
when the user press power/suspend key my app will exit, is ther any way to
pass the power/suspend key to Debian and let Debian handle it(suspend the
machine) ? in this way my app won’t exit and no problem will occur
my code for handling keyboard is as simple as this:
SDL_Event event;
int keypress = 0;
while(!keypress)
{
while(SDL_PollEvent(&event))
{
switch (event.type)
{
case SDL_QUIT:
keypress = 1;
break;
case SDL_KEYDOWN:
keypress = 1;
break;
//I want to say if key is power/suspend pass it to debian
to handle it and don’t exit my app
}
}
}On Mon, Jun 25, 2012 at 11:51 AM, Torsten Giebl wrote:
Hello !
su -u p -c "/home/p/Desktop/myscript"
su: invalid option – 'u’
Usage: su [options] [LOGIN]
Options:
-c, --command COMMAND pass COMMAND to the invoked shell
-h, --help display this help message and exit
-, -l, --login make the shell a login shell
-m, -p,
–preserve-environment do not reset environment variables, and
keep the same shell
-s, --shell SHELL use SHELL instead of the default in
passwd
It seems that -u doesn’t work. is there any other option that could help?
i have also tried su -c “/home/p/Desktop/myscript” but have the same
problem again
and looket at sudo but it doesn’t have any switch like -c to invoke my
app
from shell
Please try :
su p -c “/home/p/Desktop/myscript”
p being the username.
CU
SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Same problem again
but think my problem can solve in another way!
when the user press power/suspend key my app will exit, is ther any way to
pass the power/suspend key to Debian and let Debian handle it(suspend the
machine) ? in this way my app won’t exit and no problem will occur
Intercepting the power key might need a BIOS change to make it return
suspend rather than power-down, also some GUI’s intercept it too
and pop-up a confirm window, however…
In general, power buttons, lid close buttons (laptop) suspend, etc. are
controlled by the ACPI systems, so look in /etc/acpi/events for scripts to
be actioned on these events. Also make sure you have acpi installed -
sudo apt-get install acpi
Then go check on the Debian websites, etc. Suspend doesn’t normally kill
programs.
So as a quickie, on my laptops, I change /etc/acpi/lid.sh to simply call
/usr/sbin/pm-suspend than go through all the other stuff to check…
GordonOn Mon, 25 Jun 2012, Mohsen Jamali wrote:
*Thanks Torsten&Gordon
solved that with this spaghetti
-
while(!keypress)
{
char *s;
while(SDL_PollEvent(&event))
{
switch (event.type)
{
case SDL_QUIT:
keypress = 1;
break;
case SDL_KEYDOWN:
s=SDL_GetKeyName(event.key.keysym.sym);
printf("The %s was pressed !\n",s);
if(strcmp(s,"unknown key")==0)
{
printf("unknown key\n");
system("sudo pm-suspend");
// ftStatus = FT_Purge(ftHandle, FT_PURGE_RX | FT_PURGE_TX); //
Purge both Rx and Tx bu
break;
}else{
keypress = 1;
break;
}
}
}
}On Mon, Jun 25, 2012 at 1:03 PM, Gordon Henderson <gordon+sdl at drogon.net>wrote:
On Mon, 25 Jun 2012, Mohsen Jamali wrote:
Same problem again
but think my problem can solve in another way!
when the user press power/suspend key my app will exit, is ther any way to
pass the power/suspend key to Debian and let Debian handle it(suspend the
machine) ? in this way my app won’t exit and no problem will occur
Intercepting the power key might need a BIOS change to make it return
suspend rather than power-down, also some GUI’s intercept it too and pop-up
a confirm window, however…
In general, power buttons, lid close buttons (laptop) suspend, etc. are
controlled by the ACPI systems, so look in /etc/acpi/events for scripts to
be actioned on these events. Also make sure you have acpi installed -
sudo apt-get install acpi
Then go check on the Debian websites, etc. Suspend doesn’t normally kill
programs.
So as a quickie, on my laptops, I change /etc/acpi/lid.sh to simply call
/usr/sbin/pm-suspend than go through all the other stuff to check…
Gordon
_____________**
SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/**listinfo.cgi/sdl-libsdl.orghttp://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org