Subversion Repositories freemyipod

Rev

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

Rev 778 Rev 787
Line 17... Line 17...
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
19
#    You should have received a copy of the GNU General Public License
20
#    along with emCORE.  If not, see <http://www.gnu.org/licenses/>.
20
#    along with emCORE.  If not, see <http://www.gnu.org/licenses/>.
21
#
21
#
22
#
22
#
23
 
23
 
24
"""
24
"""
25
    Command line interface to communicate with emCORE devices.
25
    Command line interface to communicate with emCORE devices.
26
    Run it without arguments to see usage information.
26
    Run it without arguments to see usage information.
27
"""
27
"""
Line 894... Line 894...
894
            self.logger.info("done\n")
894
            self.logger.info("done\n")
895
        finally:
895
        finally:
896
            self.emcore.free(buf)
896
            self.emcore.free(buf)
897
    
897
    
898
    @command
898
    @command
-
 
899
    def ipodclassic_readbbt(self, filename, tempaddr = None):
-
 
900
        """
-
 
901
            Target-specific function: ipodclassic
-
 
902
            Reads the bad block table from the hard disk to memory at <tempaddr>
-
 
903
            (or an allocated block if not given) and writes it to <filename>
-
 
904
        """
-
 
905
        tempaddr = to_int(tempaddr)
-
 
906
        try:
-
 
907
            f = open(filename, 'wb')
-
 
908
        except IOError:
-
 
909
            raise ArgumentError("File not writable.")
-
 
910
        self.logger.info("Reading bad block table from disk...")
-
 
911
        f.write(self.emcore.ipodclassic_readbbt(tempaddr))
-
 
912
        f.close()
-
 
913
        self.logger.info(" done\n")
-
 
914
    
-
 
915
    @command
899
    def ipodclassic_writebbt(self, filename, tempaddr = None):
916
    def ipodclassic_writebbt(self, filename, tempaddr = None):
900
        """
917
        """
901
            Target-specific function: ipodclassic
918
            Target-specific function: ipodclassic
902
            Uploads the bad block table <filename> to memory at <tempaddr>
919
            Uploads the bad block table <filename> to memory at <tempaddr>
903
            (or an allocated block if not given) and writes it to the hard disk
920
            (or an allocated block if not given) and writes it to the hard disk