Difference between revisions of "DFU 0x1227"

From The iPhone Wiki
Jump to: navigation, search
m
 
(12 intermediate revisions by 6 users not shown)
Line 1: Line 1:
This is the protocol used by the [[WTF]] version 2.
+
'''DFU 0x1227''' is the protocol used to talk to a device in [[DFU Mode]] or [[WTF]] v2.
   
==Protocol==
+
== Protocol ==
Same as sending a file to [[Recovery Mode 0x1281]]
+
The protocol is the same as sending a file to a device in [[Recovery Mode (Protocols)|Recovery Mode]] on 2.x.
   
==Code==
+
== Code ==
  +
uint8_t fbuf[FBUF_LENGTH];
hexdump(fbuf, usb_control_msg(idev, 0x80, 6, 0x200, 0, fbuf, 0x100, 1000));
 
  +
uint8_t buf[100];
printf("WTF: "); fgets(buf,100,stdin); buf[strlen(buf)-1]=0;
 
  +
hexdump(fbuf, usb_control_msg(idev, 0x80, 6, 0x200, 0, fbuf, 0x100, 1000));
FILE *f=fopen(buf, "rb"); int s,c=0;
 
  +
printf("WTF: ");
if(f>0) {
 
  +
buf[strlen(buf) - 1] = 0;
if(usb_control_msg(idev, 0x21, 1, c, 0, fbuf, s, 1000)==s) printf(".");
 
else printf("x");
+
FILE *f = fopen(buf, "rb");
  +
int s;
if(usb_control_msg(idev, 0xA1, 3, 0, 0, fbuf, 6, 1000)!=6||fbuf[4]!=5) printf("%d",fbuf[4]);
 
}while(s>0);
+
if (f > 0) {
  +
do {
printf("\n");
 
  +
if (usb_control_msg(idev, 0x21, 1, c, 0, fbuf, s, 1000) == s)
hexdump(buf,6);
 
  +
printf(".");
usb_control_msg(idev, 0xA1, 3, 0, 0, buf, 6, 1000);
 
  +
else
hexdump(buf,6);
 
usb_reset(idev);
+
printf("x");
  +
if (usb_control_msg(idev, 0xA1, 3, 0, 0, fbuf, 6, 1000) != 6|| fbuf[4] != 5)
fclose(f); } else printf("file not found\n");
 
  +
printf("%d", fbuf[4]);
system("PAUSE");
 
  +
c++;
return 0;
 
do{s=fread(fbuf, 1, 0x800, f);
+
fgets(buf, 100, stdin);
c++;
+
int c = 0;
usb_control_msg(idev, 0xA1, 3, 0, 0, buf, 6, 1000);
+
s = fread(fbuf, 1, 0x800, f);
  +
} 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;
  +
}
  +
  +
[[Category:Protocols (S5L)]]

Latest revision as of 22:52, 30 December 2012

DFU 0x1227 is the protocol used to talk to a device in DFU Mode or WTF v2.

Protocol

The protocol is the same as sending a file to a device in Recovery Mode on 2.x.

Code

  uint8_t fbuf[FBUF_LENGTH];
  uint8_t buf[100];
  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;
  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;
}