freemyipod r351 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r350‎ | r351 | r352 >
Date:01:49, 20 December 2010
Author:theseven
Status:new
Tags:
Comment:
embios.py: Make the file up-/download buffer arguments optional, defaulting to the first 64KiB of user memory. Also make "ls" show the contents of "/" if nothing is specified.
Modified paths:
  • /embios/trunk/tools/embios.py (modified) (history)

Diff [purge]

Index: embios/trunk/tools/embios.py
@@ -865,11 +865,12 @@
866866 self.logger.info(" done\n")
867867
868868 @command
869 - def get(self, buffer, buffsize, remotename, localname):
 869+ def get(self, remotename, localname, buffer = False, buffsize = "10000"):
870870 """
871871 Downloads a file
872872 """
873 - buffer = self._hexint(buffer)
 873+ if buffer == False: buffer = self.embios.lib.dev.usermem.lower
 874+ else: buffer = self._hexint(buffer)
874875 buffsize = self._hexint(buffsize)
875876 try:
876877 f = open(localname, 'wb')
@@ -880,7 +881,7 @@
881882 fd = self.embios.file_open(remotename, 0)
882883 size = self.embios.file_size(fd)
883884 while size > 0:
884 - bytes = self.embios.file_read(fd, buffer, buffsize)
 885+ bytes = self.embios.file_read(fd, buffer, buffsize = 0x10000)
885886 f.write(self.embios.read(buffer, bytes))
886887 size = size - bytes
887888 self.embios.file_close(fd)
@@ -888,11 +889,12 @@
889890 self.logger.info(" done\n")
890891
891892 @command
892 - def put(self, buffer, buffsize, localname, remotename):
 893+ def put(self, localname, remotename, buffer = False, buffsize = "10000"):
893894 """
894895 Uploads a file
895896 """
896 - buffer = self._hexint(buffer)
 897+ if buffer == False: buffer = self.embios.lib.dev.usermem.lower
 898+ else: buffer = self._hexint(buffer)
897899 buffsize = self._hexint(buffsize)
898900 try:
899901 f = open(localname, 'rb')
@@ -913,7 +915,7 @@
914916 self.logger.info(" done\n")
915917
916918 @command
917 - def ls(self, path):
 919+ def ls(self, path = "/"):
918920 """
919921 Lists all files in the specified path
920922 """