Subversion Repositories freemyipod

Rev

Rev 424 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 424 Rev 427
Line 2... Line 2...
2
#
2
#
3
#
3
#
4
#    Copyright 2010 TheSeven
4
#    Copyright 2010 TheSeven
5
#
5
#
6
#
6
#
7
#    This file is part of emBIOS.
7
#    This file is part of emCORE.
8
#
8
#
9
#    emBIOS is free software: you can redistribute it and/or
9
#    emCORE is free software: you can redistribute it and/or
10
#    modify it under the terms of the GNU General Public License as
10
#    modify it under the terms of the GNU General Public License as
11
#    published by the Free Software Foundation, either version 2 of the
11
#    published by the Free Software Foundation, either version 2 of the
12
#    License, or (at your option) any later version.
12
#    License, or (at your option) any later version.
13
#
13
#
14
#    emBIOS is distributed in the hope that it will be useful,
14
#    emCORE is distributed in the hope that it will be useful,
15
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
15
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
16
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17
#    See the GNU General Public License for more details.
17
#    See the GNU General Public License for more details.
18
#
18
#
19
#    You should have received a copy of the GNU General Public License along
19
#    You should have received a copy of the GNU General Public License along
20
#    with emBIOS.  If not, see <http://www.gnu.org/licenses/>.
20
#    with emCORE.  If not, see <http://www.gnu.org/licenses/>.
21
#
21
#
22
#
22
#
23
 
23
 
24
 
24
 
25
import sys
25
import sys
Line 27... Line 27...
27
import struct
27
import struct
28
import time
28
import time
29
import usb
29
import usb
30
 
30
 
31
 
31
 
32
class embiosldr:
32
class emcoreldr:
33
  def __init__(self, generation = 0):
33
  def __init__(self, generation = 0):
34
    busses = usb.busses()
34
    busses = usb.busses()
35
 
35
 
36
    for bus in busses:
36
    for bus in busses:
37
      devices = bus.devices
37
      devices = bus.devices
Line 43... Line 43...
43
          if generation in [0, 2]:
43
          if generation in [0, 2]:
44
            self.devtype = 2;
44
            self.devtype = 2;
45
            self.maxin = 528;
45
            self.maxin = 528;
46
            self.maxout = 528
46
            self.maxout = 528
47
            self.handle = handle
47
            self.handle = handle
48
            print("Connected to emBIOS Loader Recovery Mode on iPod Nano 2G, USB version %s" % dev.deviceVersion)
48
            print("Connected to emCORE Loader Recovery Mode on iPod Nano 2G, USB version %s" % dev.deviceVersion)
49
            return
49
            return
50
          handle.releaseInterface()
50
          handle.releaseInterface()
51
 
51
 
52
    raise Exception("Could not find specified device (generation = %d)" % generation)
52
    raise Exception("Could not find specified device (generation = %d)" % generation)
53
 
53