Skip to content

Commit

Permalink
add action 19 - quick reboot force
Browse files Browse the repository at this point in the history
  • Loading branch information
Apaczer committed Jul 20, 2023
1 parent 5e22203 commit de5b3e5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ Remember: all hotkeys will work only in combination with RESET/HOME button (see
13 = screenshot in PNG using fbgrab (slow/accurate)
14 = screenshot in PPM using fbcat (fast/less accurate)
15 = screenshot in RAW framebuffer data - copy of=/dev/fb0 (fast/accurate)
20 = kill, sync and shutdown (quick shutdown)
19 = kill force, sync and reboot (quick reboot force)
20 = kill force, sync and shutdown (quick shutdown force)
21 = kill gui. Does not work on most apps. do not use
22 = kill force app. Work on most apps.
23 = kill soft app. Work on a few apps, guaranties proper closing.
14 changes: 12 additions & 2 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -558,16 +558,26 @@ int main(int argc, char** argv)
case 15:
system("mkdir -p /mnt/screenshots ; name=/mnt/screenshots/system ; if test -e $name.raw ; then i=1 ; while test -e $name-$i.raw ; do i=$((i+1)) ; done; name=\"$name-$i\" ; fi ; dd if=/dev/fb0 of=\"$name\".raw bs=1M");
break;
case 19:
{
//printf("quick reboot (forced)\n");
int status;
pid_t son = fork();
if (!son) {
execlp("sh", "sh", "-c", "kill -9 $(ps -al | grep \"/mnt/\" | grep -v \"/kernel/\" | tr -s [:blank:] | cut -d \" \" -f 2) ; sleep 0.1 ; sync && swapoff -a && reboot", NULL);
}
break;
}
case 20:
{
//printf("quick shutdown\n");
//printf("quick shutdown (forced)\n");
int status;
pid_t son = fork();
if (!son) {
execlp("sh", "sh", "-c", "kill -9 $(ps -al | grep \"/mnt/\" | grep -v \"/kernel/\" | tr -s [:blank:] | cut -d \" \" -f 2) ; sleep 0.1 ; sync && swapoff -a && poweroff", NULL);
}
break;
}
}
case 21:
{
//printf("kill GUI\n");
Expand Down

0 comments on commit de5b3e5

Please sign in to comment.