Index: tools/ipoddfu/libipoddfu.py |
— | — | @@ -29,48 +29,60 @@ |
30 | 30 |
|
31 | 31 | class ipoddfu:
|
32 | 32 | def __init__(self, generation = 0, type = 0):
|
33 | | - self.dev = usb.core.find(idVendor=0x05ac, idProduct=0x1220)
|
34 | | - if self.dev and generation in [0, 2] and type in [0, 1]:
|
35 | | - self.dev.set_configuration(1)
|
36 | | - self.generation = 2;
|
37 | | - self.type = 1;
|
38 | | - print("Connected to S5L8701 Bootrom DFU mode, USB version %s" % self.dev.bcdDevice)
|
39 | | - return
|
40 | | - self.dev = usb.core.find(idVendor=0x05ac, idProduct=0x1240)
|
41 | | - if self.dev and generation in [0, 2] and type in [0, 2]:
|
42 | | - self.dev.set_configuration(1)
|
43 | | - self.generation = 2;
|
44 | | - self.type = 2;
|
45 | | - print("Connected to iPod Nano 2G NOR DFU mode, USB version %s" % self.dev.bcdDevice)
|
46 | | - return
|
47 | | - self.dev = usb.core.find(idVendor=0x05ac, idProduct=0x1223)
|
48 | | - if self.dev and generation in [0, 3] and type in [0, 1]:
|
49 | | - self.dev.set_configuration(1)
|
50 | | - self.generation = 3;
|
51 | | - self.type = 1;
|
52 | | - print("Connected to S5L8702 Bootrom DFU mode, USB version %s" % self.dev.bcdDevice)
|
53 | | - return
|
54 | | - self.dev = usb.core.find(idVendor=0x05ac, idProduct=0x1242)
|
55 | | - if self.dev and generation in [0, 3] and type in [0, 1]:
|
56 | | - self.dev.set_configuration(1)
|
57 | | - self.generation = 3;
|
58 | | - self.type = 2;
|
59 | | - print("Connected to iPod Nano 3G WTF mode, USB version %s" % self.dev.bcdDevice)
|
60 | | - return
|
61 | | - self.dev = usb.core.find(idVendor=0x05ac, idProduct=0x1225)
|
62 | | - if self.dev and generation in [0, 4] and type in [0, 1]:
|
63 | | - self.dev.set_configuration(1)
|
64 | | - self.generation = 4;
|
65 | | - self.type = 1;
|
66 | | - print("Connected to S5L8720 Bootrom DFU mode, USB version %s" % self.dev.bcdDevice)
|
67 | | - return
|
68 | | - self.dev = usb.core.find(idVendor=0x05ac, idProduct=0x1243)
|
69 | | - if self.dev and generation in [0, 4] and type in [0, 1]:
|
70 | | - self.dev.set_configuration(1)
|
71 | | - self.generation = 4;
|
72 | | - self.type = 2;
|
73 | | - print("Connected to iPod Nano 4G WTF mode, USB version %s" % self.dev.bcdDevice)
|
74 | | - return
|
| 33 | + try:
|
| 34 | + self.dev = usb.core.find(idVendor=0x05ac, idProduct=0x1220)
|
| 35 | + if self.dev and generation in [0, 2] and type in [0, 1]:
|
| 36 | + self.dev.set_configuration(1)
|
| 37 | + self.generation = 2;
|
| 38 | + self.type = 1;
|
| 39 | + print("Connected to S5L8701 Bootrom DFU mode, USB version %s" % self.dev.bcdDevice)
|
| 40 | + return
|
| 41 | + except usb.core.USBError: pass
|
| 42 | + try:
|
| 43 | + self.dev = usb.core.find(idVendor=0x05ac, idProduct=0x1240)
|
| 44 | + if self.dev and generation in [0, 2] and type in [0, 2]:
|
| 45 | + self.dev.set_configuration(1)
|
| 46 | + self.generation = 2;
|
| 47 | + self.type = 2;
|
| 48 | + print("Connected to iPod Nano 2G NOR DFU mode, USB version %s" % self.dev.bcdDevice)
|
| 49 | + return
|
| 50 | + except usb.core.USBError: pass
|
| 51 | + try:
|
| 52 | + self.dev = usb.core.find(idVendor=0x05ac, idProduct=0x1223)
|
| 53 | + if self.dev and generation in [0, 3] and type in [0, 1]:
|
| 54 | + self.dev.set_configuration(1)
|
| 55 | + self.generation = 3;
|
| 56 | + self.type = 1;
|
| 57 | + print("Connected to S5L8702 Bootrom DFU mode, USB version %s" % self.dev.bcdDevice)
|
| 58 | + return
|
| 59 | + except usb.core.USBError: pass
|
| 60 | + try:
|
| 61 | + self.dev = usb.core.find(idVendor=0x05ac, idProduct=0x1242)
|
| 62 | + if self.dev and generation in [0, 3] and type in [0, 2]:
|
| 63 | + self.dev.set_configuration(1)
|
| 64 | + self.generation = 3;
|
| 65 | + self.type = 2;
|
| 66 | + print("Connected to iPod Nano 3G WTF mode, USB version %s" % self.dev.bcdDevice)
|
| 67 | + return
|
| 68 | + except usb.core.USBError: pass
|
| 69 | + try:
|
| 70 | + self.dev = usb.core.find(idVendor=0x05ac, idProduct=0x1225)
|
| 71 | + if self.dev and generation in [0, 4] and type in [0, 1]:
|
| 72 | + self.dev.set_configuration(1)
|
| 73 | + self.generation = 4;
|
| 74 | + self.type = 1;
|
| 75 | + print("Connected to S5L8720 Bootrom DFU mode, USB version %s" % self.dev.bcdDevice)
|
| 76 | + return
|
| 77 | + except usb.core.USBError: pass
|
| 78 | + try:
|
| 79 | + self.dev = usb.core.find(idVendor=0x05ac, idProduct=0x1243)
|
| 80 | + if self.dev and generation in [0, 4] and type in [0, 2]:
|
| 81 | + self.dev.set_configuration(1)
|
| 82 | + self.generation = 4;
|
| 83 | + self.type = 2;
|
| 84 | + print("Connected to iPod Nano 4G WTF mode, USB version %s" % self.dev.bcdDevice)
|
| 85 | + return
|
| 86 | + except usb.core.USBError: pass
|
75 | 87 |
|
76 | 88 | raise Exception("Could not find specified DFU device (generation = %d, type = %d)" % (generation, type))
|
77 | 89 |
|