.DLL To Reboot?

Discussion in 'iOS Development' started by ZunePod, Apr 25, 2009.

  1. ZunePod

    ZunePod Banned

    Joined:
    Aug 28, 2008
    Messages:
    1,340
    Likes Received:
    0
    Device:
    iPhone 3G (Black)
    I know this could be in the wrong section, but is there a DLL that allows you to send a reboot command through USB?

    Thanking Youhh
  2. gojohnnyboi

    gojohnnyboi Well-Known Member

    Joined:
    Jan 25, 2008
    Messages:
    3,339
    Likes Received:
    55
    I'm confused of what you're trying to do? You're trying to reboot the iPod from your computer, via USB? If so, there is not really a way to do this if it's in userland. If it's in Recovery mode (0x1281) however, you can send the 'reboot' command to iBoot. To send it straight to Recovery from userland, however, you can use MobileDevice, listen for the notification of an iPod/iPhone plugged in booted in normal mode (will be called at point of notification callback registration if already plugged in), and then from there connect to it and call AMDeviceEnterRecovery(struct am_device *r_dev);

    If you wish to reboot via a program on the iPod itself, include sys/reboot.h and call reboot();

    ex:

    Code:
    #include <sys/reboot.h>
    
    void dofancystuffandreboot() {
            // do fancy stuff
            reboot(type);  
    }
    There is a list of defines that you can pass as type in that reboot call, defined in reboot.h. Just because I'm nice, here they are:

    Code:
    #define RB_AUTOBOOT	0	/* flags for system auto-booting itself */
    
    #define RB_ASKNAME	0x01	/* ask for file name to reboot from */
    #define RB_SINGLE	0x02	/* reboot to single user only */
    #define RB_NOSYNC	0x04	/* dont sync before reboot */
    #define RB_KDB		0x04	/* load kernel debugger */
    #define RB_HALT		0x08	/* don't reboot, just halt */
    #define RB_INITNAME	0x10	/* name given for /etc/init */
    #define RB_DFLTROOT	0x20	/* use compiled-in rootdev */
    #define RB_ALTBOOT	0x40	/* use /boot.old vs /boot */
    #define RB_UNIPROC	0x80	/* don't start slaves */
    #define RB_SAFEBOOT	0x100	/* booting safe */
    #define RB_UPSDELAY 0x200   /* Delays restart by 5 minutes */
    #define RB_PANIC	0	/* reboot due to panic */
    #define RB_BOOT		1	/* reboot due to boot() */

    RB_AUTOBOOT will reboot it, and RB_HALT will just power off.

    Your third option would be to execute the reboot program via SSH from your computer. Just execute 'reboot'. It will be in your PATH, but just in case you are wanting to know the exact location, it's '/sbin/reboot'. I believe that is included in the Cydia subsystem, and that it's not in there by default (Apple doesn't put it there).
  3. ZunePod

    ZunePod Banned

    Joined:
    Aug 28, 2008
    Messages:
    1,340
    Likes Received:
    0
    Device:
    iPhone 3G (Black)
    Thanks, but I need to rethink my method through.

    I figured that I dont actually need to reboot, so how do I make a file that can run commands as if they were in terminal, but on the iPhod?
  4. crizh4x

    crizh4x Active Member

    Joined:
    Sep 19, 2007
    Messages:
    4,474
    Likes Received:
    17
    Device:
    2G iPod touch
    If I'm reading that correctly, you should look into shell scripts

    Please Register or Log in to view images

  5. ZunePod

    ZunePod Banned

    Joined:
    Aug 28, 2008
    Messages:
    1,340
    Likes Received:
    0
    Device:
    iPhone 3G (Black)
    They run on the iPhone?

    But how would I go about compiling. (I know about GCC and stuff)
  6. crizh4x

    crizh4x Active Member

    Joined:
    Sep 19, 2007
    Messages:
    4,474
    Likes Received:
    17
    Device:
    2G iPod touch
    You don't, you just write them as plain text. They are not compiled binaries or anything. I'm sort of confused though, can you explain what you're trying to create overall here? Like are you making a PC application to interact with the iPod or what?
  7. ZunePod

    ZunePod Banned

    Joined:
    Aug 28, 2008
    Messages:
    1,340
    Likes Received:
    0
    Device:
    iPhone 3G (Black)
    Its an Automated BBDowngrader, 1-Click.

    When you send the command to update the BaseBand, before that, you need to disable ALL connections (such as WiFi, 3G etc.) or else it wont work.

    I figured that I might be able to send the Update BaseBand command through USB, but I can't find anything that can send these commands.

    So this is the last resort.

    The thing about rebooting was an oversight, I didn't think thoroughly.
  8. crizh4x

    crizh4x Active Member

    Joined:
    Sep 19, 2007
    Messages:
    4,474
    Likes Received:
    17
    Device:
    2G iPod touch
    Well, this has been a dilemma for me personally for almost a year now. No USB library/binary can 'talk' to the Userland shell, making it impossible to just send commands over usb arbitrarily. Even if you get the shell script onto the device, you can't execute it. You will have to do some serious searching around and make something up with duct tape and string to make this work. SSH is doable, and pretty easy, but it requires WiFi and user interaction.

    PM me if you need anything, good luck

    Please Register or Log in to view images

  9. ZunePod

    ZunePod Banned

    Joined:
    Aug 28, 2008
    Messages:
    1,340
    Likes Received:
    0
    Device:
    iPhone 3G (Black)
    My idea is a bit different though.

    1. It loads the shell script, along with the BB update files on to the device vis usb(or ssh)
    2. It executes the shell script, which updates the baseband, and voila.

    All I need is to write a shell script.
  10. crizh4x

    crizh4x Active Member

    Joined:
    Sep 19, 2007
    Messages:
    4,474
    Likes Received:
    17
    Device:
    2G iPod touch
    Yes, that's easy but how are you going to perform the execution? SSH isn't your best alternative since not everyone has WiFi

Share This Page