Difference between revisions of "DFU 0x1227"

From The iPhone Wiki
Jump to: navigation, search
m (Redirect fix.)
(Code)
Line 5: Line 5:
   
 
==Code==
 
==Code==
hexdump(fbuf, usb_control_msg(idev, 0x80, 6, 0x200, 0, fbuf, 0x100, 1000));
+
hexdump(fbuf, usb_control_msg(idev, 0x80, 6, 0x200, 0, fbuf, 0x100, 1000));
printf("WTF: "); fgets(buf,100,stdin); buf[strlen(buf)-1]=0;
+
printf("WTF: ");
FILE *f=fopen(buf, "rb"); int s,c=0;
+
fgets(buf, 100, stdin);
  +
buf[strlen(buf) - 1] = 0;
if(f>0) {
 
  +
int s = 0;
if(usb_control_msg(idev, 0x21, 1, c, 0, fbuf, s, 1000)==s) printf(".");
 
  +
int c = 0;
else printf("x");
 
  +
if (f > 0)
if(usb_control_msg(idev, 0xA1, 3, 0, 0, fbuf, 6, 1000)!=6||fbuf[4]!=5) printf("%d",fbuf[4]);
 
  +
do
}while(s>0);
 
  +
{
printf("\n");
 
  +
s = fread(fbuf, 1, 0x800, f);
usb_control_msg(idev, 0xA1, 3, 0, 0, buf, 6, 1000);
 
  +
if (usb_control_msg(idev, 0x21, 1, c, 0, fbuf, s, 1000) == s)
hexdump(buf,6);
 
  +
{
usb_control_msg(idev, 0xA1, 3, 0, 0, buf, 6, 1000);
 
  +
}
usb_reset(idev);
 
  +
else
fclose(f); } else printf("file not found\n");
 
  +
{
system("PAUSE");
 
  +
printf("x");
return 0;
 
do{s=fread(fbuf, 1, 0x800, f);
+
FILE *f = fopen(buf, "rb");
c++;
+
{
hexdump(buf,6);
+
printf(".");
  +
}
  +
if (usb_control_msg(idev, 0xA1, 3, 0, 0, fbuf, 6, 1000) != 6|| fbuf[4] != 5)
  +
{
  +
printf("%d", fbuf[4]);
  +
}
  +
c++;
  +
} while (s > 0);
  +
printf("\n");
  +
usb_control_msg(idev, 0xA1, 3, 0, 0, buf, 6, 1000);
  +
hexdump(buf, 6);
  +
usb_control_msg(idev, 0xA1, 3, 0, 0, buf, 6, 1000);
  +
hexdump(buf, 6);
  +
usb_reset(idev);
  +
fclose(f);
  +
}
  +
else
  +
{
  +
printf("file not found\n");
  +
}
  +
system("PAUSE");
  +
return 0;
  +
}

Revision as of 05:02, 11 February 2012

This is the protocol used to talk to DFU Mode and WTF version 2.

Protocol

Same as sending a file to the 2.x Recovery Mode

Code

  hexdump(fbuf, usb_control_msg(idev, 0x80, 6, 0x200, 0, fbuf, 0x100, 1000));
  printf("WTF: ");
  fgets(buf, 100, stdin);
  buf[strlen(buf) - 1] = 0;  
  FILE *f = fopen(buf, "rb");
  int s = 0;
  int c = 0;
  if (f > 0)
  {
      do
      {
          s = fread(fbuf, 1, 0x800, f);
          if (usb_control_msg(idev, 0x21, 1, c, 0, fbuf, s, 1000) == s)
          {
              printf(".");
          }
          else
          {
              printf("x");
          }
          if (usb_control_msg(idev, 0xA1, 3, 0, 0, fbuf, 6, 1000) !=  6|| fbuf[4] != 5)
          {
              printf("%d", fbuf[4]);
          }
          c++;
       } while (s > 0);
       printf("\n");
       usb_control_msg(idev, 0xA1, 3, 0, 0, buf, 6, 1000);
       hexdump(buf, 6);
       usb_control_msg(idev, 0xA1, 3, 0, 0, buf, 6, 1000);
       hexdump(buf, 6);
       usb_reset(idev);
       fclose(f);
   }
   else
   {
       printf("file not found\n");
   }
   system("PAUSE");
   return 0;
}