Page 1 of 4 123 ... LastLast
Results 1 to 20 of 77

Your favorite Apple, iPhone, iPad, iOS, Jailbreak, and Cydia site.


Thread: iPad 1 Gestures and Display Mirroring Without Jailbreak

  1. #1
    Default iPad 1 Gestures and Display Mirroring Without Jailbreak
    I decided to modify the redsn0w ramdisk, replacing the jailbreak executable with a small program the purpose of which is to enable gestures and display mirroring only.

    I am sure I'm not the only one who would like gestures enabled without being stuck with a tethered jailbreak.

    In any case, here is the code I've written along with the compiled binary, packaged in the usual redsn0w ramdisk. Note that this is for OS X only until redsn0w 0.9.9b5 is released for Windows.

    Code:
    /*
     *  Gestures tweak
     *  Replacement for jailbreak executable in redsn0w ramdisk
     *
     *  - dB
     */
    
    #include <stdio.h>
    #include <stdlib.h>
    #include <stdarg.h>
    #include <unistd.h>
    #include <string.h>
    #include <limits.h>
    
    static int execute ( int *status, const char *command, char *arguments[] ) {
        // Fork the process
        int result = fork ();
        if ( result == -1 ) {
            perror ( "fork" ); return -1;
        }
        // Child process
        else if ( result == 0 ) {
            execv ( command, arguments );
            perror ( "execv" );
            exit(-1);
        }
        // Parent process
        else {
            // Wait for the child process to end
            if ( waitpid ( result, status, 0 ) == -1 ) {
                perror ( "waitpid" ); return -1;
            } return 0;
        }
    }
    
    static int executev ( int *status, const char *command, ... ) {
        // Argument list
        int argc = 0;
        char* argv[512];
    
        // Setup variable arguments
        va_list vargs;
        va_start ( vargs, command );
    
        // Add passed arguments to the list
        while ( argc++ < (sizeof(argv)/sizeof(argv[0])) ) {
            int i = argc - 1;
            argv[i] = va_arg ( vargs, char* );
            if ( !argv[i] ) break;
        } argv[argc] = NULL;
    
        // Execute the command
        int result = execute ( status, command, argv );
    
        // Cleanup and return the result
        va_end ( vargs );
        return result;
    }
    
    static int modifycapability ( const char *capability, const char *device, int enable ) {
        // Setup the path
        char path[PATH_MAX];
        snprintf ( path, sizeof ( path ), "/System/Library/CoreServices/SpringBoard.app/%s.plist", device );
    
        // Perform the operation and return the result
        int status = 0;
        int result = executev ( &status, "/plutil", "/plutil",
            "-key", "capabilities",
            "-key", capability,
            enable ? "-true" : "-false",
            path, NULL
        ); return ( result != 0 || !(WIFEXITED(status) && WEXITSTATUS(status) == 0) ) ? -1 : 0;
    }
    
    static int copy ( const char *sourcepath, const char *targetpath ) {
        // The reading buffer
        char buffer[512];
    
        // Open the source and target files
        FILE* source = fopen ( sourcepath, "rb" );
        if ( !source ) { perror ( "fopen" ); return -1; }
        FILE* target = fopen ( targetpath, "wb" );
        if ( !target ) { fclose ( source ); perror ( "fopen" ); return -1; }
    
        // Perform the copy
        for ( ;; ) {
            int count = fread ( buffer, 1, sizeof ( buffer ), source );
            if ( count <= 0 ) break;
            fwrite ( buffer, 1, count, target );
        }
    
        // Cleanup
        fclose ( source );
        fclose ( target );
        return 0;
    }
    
    static int replace ( const char *path, const char *pattern, const char *replacement ) {
        // Open the source and target files
        FILE* source = fopen ( path, "rb" );
        if ( !source ) { perror ( "fopen" ); return -1; }
        FILE* target = fopen ( "/tmp/replacement", "wb" );
        if ( !target ) { fclose ( source ); perror ( "fopen" ); return -1; }
    
        // Initial allocations and length calculations
        int repllen = strlen ( replacement );
        int pattlen = strlen ( pattern );
        int bufflen = pattlen * 5;
        char* buffer = malloc ( bufflen + 1 );
    
        // Perform the search and replace
        for ( ;; ) {
            int count = fread ( buffer, 1, bufflen, source );
            if ( count < pattlen ) {
                fwrite ( buffer, 1, count, target ); break;
            }
    
            int i; for ( i = 0; i <= count - pattlen; i++ ) {
                // If a match is found
                if ( memcmp ( buffer + i, pattern, pattlen ) == 0 ) {
                    fwrite ( replacement, 1, repllen, target );
                    i += pattlen - 1;
                }
                // No match was found
                else {
                    fwrite ( buffer + i, 1, 1, target );
                }
            } fwrite ( buffer + i, 1, count - i, target );
        }
    
        // Cleanup
        fclose ( source );
        fclose ( target );
        free ( buffer );
    
        // Copy
        copy ( "/tmp/replacement", path );
        unlink ( "/tmp/replacement" );
        return 0;
    }
    
    int main () {
        // Op status
        int status = 0;
    
        // Greeting message
        printf ( "\n" ); // Initial blank line
        printf ( "Gestures & display mirroring for iPad 1 (w/o Jailbreak)\n"
                 "by dB\n\n" ); fflush ( stdout );
    
        // Attempt to update SpringBoard capabilities
        printf ( "Updating SpringBoard capabilities...\n" );
        printf ( "Enabling multitasking-gestures...\n" );
        printf ( "%s\n",
            modifycapability ( "multitasking-gestures", "K48AP", 1 ) == 0 ? "OK" : "FAIL" );
        printf ( "Enabling display-mirroring...\n" );
        printf ( "%s\n",
            modifycapability ( "display-mirroring", "K48AP", 1 ) == 0 ? "OK" : "FAIL" );
    
        // Convert /Applications/Preferences.app/General.plist into XML format
        printf ( "Converting Preferences/General.plist into XML...\n" );
        status = executev ( NULL, "/plutil", "/plutil",
            "-xml", "/Applications/Preferences.app/General.plist", NULL
        ); printf ( "%s\n", (status == 0) ? "OK" : "FAIL" );
        
        // Patch the file, correcting the misspelled "Mutltitasking_Gesture" to "Multitasking_Gesture"
        printf ( "Patching Preferences/General.plist...\n" );
        status = replace ( "/Applications/Preferences.app/General.plist", "Mutltitasking_Gesture", "Multitasking_Gesture" );
        printf ( "%s\n", (status == 0) ? "OK" : "FAIL" );
    
        // Convert /Applications/Preferences.app/General.plist back into binary format
        printf ( "Converting Preferences/General.plist back into binary...\n" );
        status = executev ( NULL, "/plutil", "/plutil",
            "-binary", "/Applications/Preferences.app/General.plist", NULL
        ); printf ( "%s\n", (status == 0) ? "OK" : "FAIL" );
    
        // Perform a disk sync
        printf ( "\n" );
        printf ( "Performing a sync... " ); fflush ( stdout );
        sync (); printf ( "OK\n" );
    
        // Countdown to reboot
        printf ( "\n" );
        printf ( "Rebooting in... " );
        int i; for ( i = 10; i >= 1; i-- ) {
            printf ( "%d ", i ); fflush ( stdout );
            sleep ( 2 );
        } printf ( "0!\n" );
    
        // Reboot the device
        reboot ( 0 );
        return EXIT_SUCCESS;
    }
    Here is the ramdisk with the modified jailbreak executable:
    gestures-ramdisk.tar | localhostr.com

    Here is the full redsn0w application with the modified ramdisk (OS X only):
    redsn0w_mac_0.9.9b5_gestures_only.zip | localhostr.com

    Update: Windows version posted
    Last edited by d.B.; 10-21-2011 at 04:44 PM.

  2. The Following 16 Users Say Thank You to d.B. For This Useful Post:

    alvaroliva (10-17-2011), birdtales (10-18-2011), codeorama (10-21-2011), ergun71 (10-22-2011), Greenmon (10-22-2011), Hungba (10-19-2011), ipad1 (10-21-2011), johnnynitro890 (10-19-2011), MasterBelt (10-21-2011), Melvin Udall (10-23-2011), Monk Key (11-19-2011), PhilCollins (10-22-2011), qwerty7788 (10-21-2011), realsteve (10-25-2011), zace66 (10-21-2011), zanzib (10-27-2011)

  3. #2
    Quote Originally Posted by d.B. View Post
    Here is the full redsn0w application with the modified ramdisk (OS X only):
    redsn0w_mac_0.9.9b5_gestures_only.zip | localhostr.com
    This one... I need this one !!
    But I cannot download it, when i click it nothing happen ... Can you upload it on another hosting website ? (Please Deposit Files or Uploadhere.com - free file storage & hosting or UploadKing.com - free file storage & hosting are these ones aren't block by the chinese great firewall (mediafire, megaupload and others are...)

    Thank you very much !!

    ((Steo))

  4. #3
    What's Jailbreak?
    Join Date
    Feb 2011
    Location
    Navarre, FL
    Posts
    20
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Awesome job!
    Once redsn0w comes out for windows since I don't have a Mac I will definitely download this. I was so ticked when apple did not specify that iPad 1 users would not be able to use the multi gestures also I like the idea how you were able to mirror. Now I have a quick question with the mirroring is it just like the iPad 2 with the apple TV comepletely wireless? And if so is it stable?? Thanks a lot and keep up the good work!

  5. #4
    Default Amazing Job!!!
    I was looking for something like this since the IOS 5 beta 1's release!
    I have to admit I didn't believe it would work, but it really does, awesome!
    Thank you very much for the solution!

  6. #5
    Quote Originally Posted by Steo View Post
    ... Can you upload it on another hosting website ? (Please Deposit Files ...
    Alright, here it is on Deposit Files
    redsn0w_mac_0.9.9b5_gestures_only.zip | Deposit Files

  7. #6
    Man, that's great!!!
    But I don't own a Mac...
    Waiting for the windows version... :-P

  8. #7
    Ok, exactly how do I use this, new to all this,
    Y friend has a mac so I can do to that way, but a quick walk thorough guide would be awesome

  9. #8
    Which option do we choose in redsn0w?

  10. #9
    Cool! I will test this out later today :-). I want so badly to have the display mirroring on my iPad1, thanks for your hard work! How does one go about making a ramdisk for RedSn0w? What knowledge must one have? Thanks again!
    And it will be like a taco inside a taco within a Taco Bell that's inside a KFC that's within a mall that's inside your dream! Springboard screwy after reboot? Here is the fix

  11. #10
    Has anyone tried this yet and can confirm it works?

    Will it flag anything at apple? Im a registered developer and don't want to put that status at risk. Thanks.

    I decided to try it anyway - several questions arise:
    How do I install the ramdisk?
    What option do I choose on reds0w that you pointed us to? jailbreak or extras (I am assuming extras as I don't want to jailbreak)
    Last edited by zace66; 10-18-2011 at 08:41 AM.

  12. #11
    You only need the redsn0w gestures only package. It already has the modified ramdisk built-in. Furthermore, the options you select do not matter, as the replacement ramdisk ignores any options selected and just performs the gestures tweak.

    To clarify, you do select "jailbreak". However, this will not actually jailbreak the device as the jailbreak executable has been replaced with the gestures only program.
    Last edited by d.B.; 10-18-2011 at 08:49 AM.

  13. #12
    Forgive the noob question, but I'm a noob.

    When iOS 5.1 comes out, if I applied this change, will I be able to upgrade? Will I need to back out this change using redSn0w before I can upgrade?

  14. #13
    You should be able to upgrade to a newer version of iOS without issue. However, you will likely lose the gestures until redsn0w is available for the new iOS version.

  15. The Following User Says Thank You to d.B. For This Useful Post:

    zanzib (10-18-2011)

  16. #14
    Gestures work great but is there a trick to display mirroring? Is it with an HDMI adapter only or wireless like the iPad 2? I went to where you select mirroring on the iPad 2 and Airplay is the only option on the iPad 1 with your Ramdisk installed. On the iPad 2 selecting Airplay brings up the option for toggling Mirroring, selecting Airplay here changes nothing and the mirroring toggle does not come up.

  17. #15
    I believe it is wired only, although I have not tested mirroring.

  18. #16
    Quote Originally Posted by d.B. View Post
    You only need the redsn0w gestures only package. It already has the modified ramdisk built-in. Furthermore, the options you select do not matter, as the replacement ramdisk ignores any options selected and just performs the gestures tweak.

    To clarify, you do select "jailbreak". However, this will not actually jailbreak the device as the jailbreak executable has been replaced with the gestures only program.
    Incredible!!!!!!!!!!!!!! It's working!!!!!!!!!!! Thanks a lot! You've saved my day! )

  19. #17
    I joined this forum just to say thank you for this! Theres so much more of a smooth flow to everything with multitouch, and I didn't have to jailbreak! It completely worked, and I am thoroughly satisfied. Hopefully apple will realize what they've done was foolish, and enable these gestures by default. My worry is they're purposely trying to phase out features in order to push people towards newer models. I don't want to upgrade right now! my first gen ipad runs like a charm, especially with multitouch gestures. I sent my feedback to apple, as have a lot of others, let's just hope they listen. For now though, thank you! It worked GREAT

  20. #18
    ABSOLUTELY AMAZING! Thank you for making my iPad1 usable again under iOS5.

  21. #19
    Quote Originally Posted by d.B. View Post
    Alright, here it is on Deposit Files
    redsn0w_mac_0.9.9b5_gestures_only.zip | Deposit Files
    Cheers man !

    ((Steo))

  22. #20
    This is fantastic! Great work!!
    21.5" iMac 3.06 GHz Intel Core i3 l 15" MacBook Pro 2.2 GHz Intel Core i7 l 17" PowerBook 1.67 GHz
    iPhone 4 32 GB l  TV 160 GB l 32 GB iPad

Page 1 of 4 123 ... LastLast
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •