libirecovery icon indicating copy to clipboard operation
libirecovery copied to clipboard

Fail to connect or recognize iPhone 4s in Recovery Mode

Open cjnott1999 opened this issue 10 years ago • 18 comments

Libirecovery fails to connect to iPhone 4s on iOS 7.1.2.

cjnott1999 avatar Jul 28 '14 21:07 cjnott1999

What platform are you on? Is the device visible on the USB bus? What version of libusb do you have?

aburgh avatar Jul 30 '14 01:07 aburgh

Mac OSX 10.10 and 10.9 (Dual Boot). Device is visible in iTunes when plugged in and libusb version is .0.19

cjnott1999 avatar Jul 30 '14 01:07 cjnott1999

@aburgh

cjnott1999 avatar Jul 30 '14 02:07 cjnott1999

OK, I can reproduce this on 10.10 (Yosemite Beta 4) and an iPhone 5 with iOS 6 (the device and OS shouldn't matter for a simple connection to the device in recovery mode). I cloned the latest libusb from https://github.com/libusb/libusb and built the library and listdevs from the Xcode project. I then cloned libirecovery and built it with the autogen.sh script. The device is listed by listdevs, but irecovery -m and irecovery -s do not find the device. I have a version of libusb that is a few months old installed on my system and I tried building irecovery against that, but it didn't help. I have an older version of irecovery installed on my system that does work, so it appears to be an issue with this project.

If you just want to get something working now, try building libirecovery from my fork (which includes an Xcode project).

aburgh avatar Jul 30 '14 10:07 aburgh

@aburgh @FunkyM Is it possible to build idevicerestore with your version of libirecovery

cjnott1999 avatar Aug 02 '14 02:08 cjnott1999

I found the change that broke connections on OS X. in irecv_open_with_ecid(), this code:

                if ((client->mode != IRECV_K_DFU_MODE) && (client->mode != IRECV_K_WTF_MODE)) {
                    error = irecv_usb_set_interface(client, 0, 0);
                    error = irecv_usb_set_interface(client, 1, 1);
                } else {

Got changed to:

                if ((client->mode != IRECV_K_DFU_MODE) && (client->mode != IRECV_K_WTF_MODE)) {
                    error = irecv_usb_set_interface(client, 0, 0);
                    if (client->mode > IRECV_K_RECOVERY_MODE_2) {
                        error = irecv_usb_set_interface(client, 1, 1);
                    }
                } else {

I'm not sure what the intent is regarding IRECV_K_RECOVERY_MODE_2. Should this be less-than-equal-to MODE_2? As far as I know, there are no devices that use MODE_3 yet (I have an iPad mini Retina with iOS 8 and it still comes up in Recovery Mode as Mode 2).

I discovered problems with setting both interfaces years ago and, IIRC, there is difference in the OS X implementation of libusb that prevented using two interfaces at once. It apparently didn't matter to irecovery because it appears to only use interface #1, so the first set interface call has no purpose (in fact, it fails on OS X). My fork of libirecovery has the option to build using I/O Kit directly, without libusb, and in there I only attempt to open interface #1.

I'll push an updated version of my fork tomorrow. I have a version of idevicerestore, too, but it is also out of date.

aburgh avatar Aug 04 '14 02:08 aburgh

I updated my fork of idevicerestore. Although it compiles, I haven't tested it, but you are welcome to give it a try. It depends on my fork of libirecovery, which has a work-around for the issue described above.

aburgh avatar Aug 18 '14 01:08 aburgh

This stems from a problem in /libirecovery-master/src/irecovery.c

Go to line number 429 change

break;

to

return 0;

and recompile....this fixes all the issues like if you start out in dfu mode and it needs to go to restore mode after uploading the iBEC and it will just tell you it can't go into restore mode. This fix works on all devices.

soswag avatar Aug 25 '14 16:08 soswag

@aburgh i have removed that if statment and recompiled, it still fails to connect in recovery mode:

Entering recovery mode... ERROR: Unable to connect to device in recovery mode ERROR: Unable to enter recovery mode ERROR: Unable to place device into recovery mode from Normal mode

markcoker avatar Aug 31 '14 12:08 markcoker

@soswag Do you mean src/libirecovery.c or tools/irecovery.c? There is a break on line 429 in tools/irecovery.c, but that is the command line program irecovery, which is not used in idevicerestore.

aburgh avatar Sep 01 '14 12:09 aburgh

@markcoker You are attempting to restore the latest IPSW to the device, the device successfully enters recovery mode, but idevicerestore can't find it? If you build the irecovery tool in the libirecovery project, can it connect with irecovery -s?

aburgh avatar Sep 01 '14 12:09 aburgh

@aburgh correct, and irecovery it can not find it. opensn0w by winocm does connect successfully though.

I also forgot to mention i am not using OSX but i'm running Ubuntu 14.04.1 LTS.

markcoker avatar Sep 02 '14 09:09 markcoker

@FunkyM : @aburgh : i have same issue in linux iphone 4s ios 7.1.2 irecv_copy_nonce_with_tag: WARNING: couldn't find tag SNON in string how do i fixit ?

ndezith avatar Nov 17 '14 10:11 ndezith

@ndezith that's not an error - it's a warning. It should work nevertheless if you're using the latest Firmware that is being signed. 7.1.2 is not signed by Apple anymore so of course it doesn't work.

nikias avatar Nov 17 '14 23:11 nikias

@nikias :thanks for replay i'll try to upgrade that signed firmware

ndezith avatar Nov 18 '14 00:11 ndezith

Can confirm that https://github.com/libimobiledevice/libirecovery/issues/5#issuecomment-51013203 is the solution for iPhone 5c/s atleast. I used ideviceenterrecovery, however use of irecovery -v -n would result in repeated logs like:

Attempting to connect... 
opening device 05ac:1281...
irecv_copy_nonce_with_tag: WARNING: couldn't find tag SNON in string  NONC:5C80FEFA733C35D4F339911A20E6FBDCFFE7E809
Setting to configuration 1
Setting to interface 0:0

I reverted the change as mentioned in the comment and I was able to:

$ irecovery -v -n
Attempting to connect... 
opening device 05ac:1281...
irecv_copy_nonce_with_tag: WARNING: couldn't find tag SNON in string  NONC:5C80FEFA733C35D4F339911A20E6FBDCFFE7E809
Setting to configuration 1
Setting to interface 0:0
Setting to interface 1:1
Connected to iPhone5,3, model ...
Command completed successfully

Thanks @aburgh

abhinavsingh avatar Jun 09 '15 07:06 abhinavsingh

Hi @aburgh Can you help me please? When trying to restore a custom iOS 8.3.IPSW on my iPhone 5 I face that problem :- Mohameds-MacBook-Pro:Library-iPhone mohamedhamada$ idevicerestore -u --6DB4AE27928942E0F045F5B33B7843EDCABBDEC7 -c iPhone5,2_8.3_12F70_Restore.ipsw NOTE: using cached version data Found device in Normal mode Identified device as iPhone5,2 Extracting Restore.plist from IPSW Product Version: 8.3 Product Build: 12F70 Major: 12 Device supports Image4: false Custom firmware requested. Disabled TSS request. Variant: Customer Upgrade Install (IPSW) This restore will update your device without losing data. Using cached filesystem from 'iPhone5,2_8.3_12F70_Restore/058-14626-073.dmg' Entering recovery mode... ERROR: Unable to connect to device in recovery mode ERROR: Unable to enter recovery mode ERROR: Unable to place device into recovery mode from Normal mode

mohamedhamada avatar Aug 04 '15 09:08 mohamedhamada

same here

huegene avatar Jan 14 '16 00:01 huegene