Results 1 to 7 of 7
Discuss What SIG signal gets sent on button press? at the Free Toolchain Software - Hackint0sh.org; Does anyone know what SIG gets sent when we press the main button to close ...
  1. #1
    Advanced Array

    Join Date
    Aug 2007
    Posts
    36
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    0

    Default What SIG signal gets sent on button press?

    Does anyone know what SIG gets sent when we press the main button to close an app and exit back to the Springboard? I am trying to initiate a trap in a shell script and the ones that I have used thus far SIGHUP, SIGTERM, etc haven't worked so rather than going through all 29 or so signals I figured someone here probably knew the info.

    Much appreciated!

    -KennX


  2. #2
    Senior Professional Array

    Join Date
    Aug 2007
    Posts
    227
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    17

    Default

    Quote Originally Posted by KennX View Post
    Does anyone know what SIG gets sent when we press the main button to close an app and exit back to the Springboard? I am trying to initiate a trap in a shell script and the ones that I have used thus far SIGHUP, SIGTERM, etc haven't worked so rather than going through all 29 or so signals I figured someone here probably knew the info.

    Much appreciated!

    -KennX
    Are you attempting to do something like this?

    =======
    # traptest.sh

    trap "echo Booh!" SIGINT SIGTERM
    echo "pid is $$"

    while : # This is the same as "while true".
    do
    sleep 60 # This script is not really doing anything.
    done
    ========



    Or are you trying to detect when a different application launched from a shell script has exited...?


    (BTW the above will work in bash not sure about the vanilla shell)

  3. #3
    Senior Professional Array

    Join Date
    Aug 2007
    Posts
    227
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    17

    Default

    Quote Originally Posted by MetalRat View Post
    Are you attempting to do something like this?

    =======
    # traptest.sh

    trap "echo Booh!" SIGINT SIGTERM
    echo "pid is $$"

    while : # This is the same as "while true".
    do
    sleep 60 # This script is not really doing anything.
    done
    ========



    Or are you trying to detect when a different application launched from a shell script has exited...?


    (BTW the above will work in bash not sure about the vanilla shell)

    Just had a thought, you could write a separate script that basically traps any SIG it recieves and writes it to a file, but it may be forced to exit before it finishes echoing....

  4. #4
    Rookie Array

    Join Date
    Aug 2007
    Posts
    15
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    0

    Default

    I would assume it's something in the frameworks that is used to signal an app to quit rather than a unix signal.

  5. #5
    Senior Professional Array

    Join Date
    Jul 2007
    Posts
    445
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    29

    Default

    it could be a unix sig, and the hardware has probably 2 sig levels, one being press, and one being the hold...

    i also assume you mean the home button right...

    I was thinking about it and i kinda wish that the home button would take you straight to the phone dialpad, when already on the home screen... afterall, this is still supposed to be a phone, right, so with a double-press of the home button from within any app, we can get to the dialpad.

    just an idea


  6. #6
    Advanced Array

    Join Date
    Aug 2007
    Posts
    36
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    0

    Default Clarification...

    Okay, what I'd like to be able to do is to put something in a script that will terminate the script when the home button is pressed so I'd like to be able to trap for that event. I've got a particular script that I call like an app from an icon and it will run but just stay on the default.icon screen and never leave that (even when the home button is pressed) so I have to re-start the iPhone (which obviously defeats the purpose of the script. I can jump out of a script by killing the Springboard.app like I do in iSwap but that will not do for what I have in mind. Was hoping that I could put a trap to exit on a SIG event triggered by the home button press.

    -KennX

  7. #7
    Senior Professional Array

    Join Date
    Aug 2007
    Posts
    227
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    17

    Default

    Quote Originally Posted by MetalRat View Post
    Are you attempting to do something like this?

    =======
    # traptest.sh

    trap "echo Booh!" SIGINT SIGTERM
    echo "pid is $$"

    while : # This is the same as "while true".
    do
    sleep 60 # This script is not really doing anything.
    done
    ========



    Or are you trying to detect when a different application launched from a shell script has exited...?


    (BTW the above will work in bash not sure about the vanilla shell)
    Quote Originally Posted by KennX View Post
    Okay, what I'd like to be able to do is to put something in a script that will terminate the script when the home button is pressed so I'd like to be able to trap for that event. I've got a particular script that I call like an app from an icon and it will run but just stay on the default.icon screen and never leave that (even when the home button is pressed) so I have to re-start the iPhone (which obviously defeats the purpose of the script. I can jump out of a script by killing the Springboard.app like I do in iSwap but that will not do for what I have in mind. Was hoping that I could put a trap to exit on a SIG event triggered by the home button press.

    -KennX

    Well a common trick would be to launch a script that writes its PID to a lockfile. The second time the script it launched it checks the lockfile for the pid, and kills it, then exits. So in effect the script will either run, if its not running, or kill if it is. (if you see what I mean) not a perfect solution, but it works.

    If you are really clever you can change the icon to tell you if it is running, or not ;-)


    (I am assuming you are running this script as a background process via nohup)

    MR

 

 

Similar Threads

  1. Replies: 0
    Last Post: 09-06-2010, 09:36 PM
  2. Home button - press and hold function. Does exist patch?
    By rexeany in forum Free Toolchain Software
    Replies: 2
    Last Post: 06-22-2009, 05:44 AM
  3. Replies: 4
    Last Post: 02-05-2009, 07:39 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Powered by vBulletin®
Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.
Search Engine Friendly URLs by vBSEO
(c) 2006-2012 Hackint0sh.org
All times are GMT +2. The time now is 05:23 PM.
twitter, follow us!