| Index: embios/trunk/tools/embios.py | 
| — | — | @@ -639,7 +639,6 @@ | 
| 640 | 640 |          size = self._hexint(size)
 | 
| 641 | 641 |          self.logger.info("Dumping boot flash addresses "+self._hex(addr_flash)+" - "+
 | 
| 642 | 642 |                           hex(addr_flash+size)+" to "+self._hex(addr_mem)+" - "+self._hex(addr_mem+size)+"\n")
 | 
| 643 |   | -        self.embios.lib.dev.timeout = 5000
 | 
| 644 | 643 |          self.embios.bootflashread(addr_mem, addr_flash, size)
 | 
| 645 | 644 |      
 | 
| 646 | 645 |      @command
 | 
| — | — | @@ -664,7 +663,6 @@ | 
| 665 | 664 |                  self.logger.info(".")
 | 
| 666 | 665 |                  time.sleep(1)
 | 
| 667 | 666 |              self.logger.info("\n")
 | 
| 668 |   | -        self.embios.lib.dev.timeout = 30000
 | 
| 669 | 667 |          self.embios.bootflashwrite(addr_mem, addr_flash, size)
 | 
| 670 | 668 |      
 | 
| 671 | 669 |      @command
 | 
| — | — | @@ -694,7 +692,6 @@ | 
| 695 | 693 |          addr = self._hexint(addr)
 | 
| 696 | 694 |          size = self._hexint(size)
 | 
| 697 | 695 |          keyindex = self._hexint(keyindex)
 | 
| 698 |   | -        self.embios.lib.dev.timeout = 30000
 | 
| 699 | 696 |          self.embios.aesencrypt(addr, size, keyindex)
 | 
| 700 | 697 |      
 | 
| 701 | 698 |      @command
 | 
| — | — | @@ -705,7 +702,6 @@ | 
| 706 | 703 |          addr = self._hexint(addr)
 | 
| 707 | 704 |          size = self._hexint(size)
 | 
| 708 | 705 |          keyindex = self._hexint(keyindex)
 | 
| 709 |   | -        self.embios.lib.dev.timeout = 30000
 | 
| 710 | 706 |          self.embios.aesdecrypt(addr, size, keyindex)
 | 
| 711 | 707 |      
 | 
| 712 | 708 |      @command
 | 
| — | — | @@ -720,7 +716,6 @@ | 
| 721 | 717 |          self.logger.info("Generating hmac-sha1 hash from the buffer at " + self._hex(addr) + \
 | 
| 722 | 718 |                           " with the size " + self._hex(size) + " and saving it to " + \
 | 
| 723 | 719 |                           self._hex(destination) + " - " + self._hex(destination+sha1size) + "...")
 | 
| 724 |   | -        self.embios.lib.dev.timeout = 30000
 | 
| 725 | 720 |          self.embios.hmac_sha1(addr, size, destination)
 | 
| 726 | 721 |          self.logger.info("done\n")
 | 
| 727 | 722 |          data = self.embios.read(destination, sha1size)
 | 
| — | — | @@ -753,7 +748,6 @@ | 
| 754 | 749 |          checkempty = int(checkempty)
 | 
| 755 | 750 |          self.logger.info("Reading " + self._hex(count) + " NAND pages starting at " + \
 | 
| 756 | 751 |                           self._hex(start) + " to " + self._hex(addr) + "...")
 | 
| 757 |   | -        self.embios.lib.dev.timeout = 30000
 | 
| 758 | 752 |          self.embios.ipodnano2g_nandread(addr, start, count, doecc, checkempty)
 | 
| 759 | 753 |          self.logger.info("done\n")
 | 
| 760 | 754 |  
 | 
| — | — | @@ -769,7 +763,6 @@ | 
| 770 | 764 |          doecc = int(doecc)
 | 
| 771 | 765 |          self.logger.info("Writing " + self._hex(count) + " NAND pages starting at " + \
 | 
| 772 | 766 |                           self._hex(start) + " from " + self._hex(addr) + "...")
 | 
| 773 |   | -        self.embios.lib.dev.timeout = 30000
 | 
| 774 | 767 |          self.embios.ipodnano2g_nandwrite(addr, start, count, doecc)
 | 
| 775 | 768 |          self.logger.info("done\n")
 | 
| 776 | 769 |  
 | 
| — | — | @@ -784,7 +777,6 @@ | 
| 785 | 778 |          count = self._hexint(count)
 | 
| 786 | 779 |          self.logger.info("Erasing " + self._hex(count) + " NAND blocks starting at " + \
 | 
| 787 | 780 |                           self._hex(start) + " and logging to " + self._hex(addr) + "...")
 | 
| 788 |   | -        self.embios.lib.dev.timeout = 30000
 | 
| 789 | 781 |          self.embios.ipodnano2g_nanderase(addr, start, count)
 | 
| 790 | 782 |          self.logger.info("done\n")
 | 
| 791 | 783 |  
 | 
| — | — | @@ -808,7 +800,6 @@ | 
| 809 | 801 |          infofile.write("Number of blocks: "     + str(info["blocks"]) + "\r\n")
 | 
| 810 | 802 |          infofile.write("Number of user blocks: "+ str(info["userblocks"]) + "\r\n")
 | 
| 811 | 803 |          infofile.write("Pages per block: "      + str(info["pagesperblock"]) + "\r\n")
 | 
| 812 |   | -        self.embios.lib.dev.timeout = 30000
 | 
| 813 | 804 |          for i in range(info["banks"] * info["blocks"] * info["pagesperblock"] / 8192):
 | 
| 814 | 805 |              self.logger.info(".")
 | 
| 815 | 806 |              self.embios.ipodnano2g_nandread(0x08000000, i * 8192, 8192, 1, 1)
 | 
| — | — | @@ -841,7 +832,6 @@ | 
| 842 | 833 |              statusfile = open(filename, 'wb')
 | 
| 843 | 834 |          except IOError:
 | 
| 844 | 835 |              raise ArgumentError("Can not open file for writing!")
 | 
| 845 |   | -        self.embios.lib.dev.timeout = 30000
 | 
| 846 | 836 |          for i in range(info["banks"] * info["blocks"] / 64):
 | 
| 847 | 837 |              self.logger.info(".")
 | 
| 848 | 838 |              self.embios.ipodnano2g_nanderase(0x08000000, i * 64, 64)
 | 
| — | — | @@ -861,7 +851,6 @@ | 
| 862 | 852 |              f = open(filename, 'rb')
 | 
| 863 | 853 |          except IOError:
 | 
| 864 | 854 |              raise ArgumentError("File not readable. Does it exist?")
 | 
| 865 |   | -        self.embios.lib.dev.timeout = 30000
 | 
| 866 | 855 |          self.logger.info("Writing bad block table to disk...")
 | 
| 867 | 856 |          data = self.embios.ipodclassic_writebbt(f.read(), tempaddr)
 | 
| 868 | 857 |          f.close()
 | 
| — | — | @@ -890,7 +879,6 @@ | 
| 891 | 880 |          count = self._hexint(count)
 | 
| 892 | 881 |          addr = self._hexint(addr)
 | 
| 893 | 882 |          self.logger.info("Reading volume %s sectors %X - %X to %08X..." % (volume, sector, sector + count - 1, addr))
 | 
| 894 |   | -        self.embios.lib.dev.timeout = 50000
 | 
| 895 | 883 |          self.embios.storage_read_sectors_md(volume, sector, count, addr)
 | 
| 896 | 884 |          self.logger.info("done\n")
 | 
| 897 | 885 |  
 | 
| — | — | @@ -904,7 +892,6 @@ | 
| 905 | 893 |          count = self._hexint(count)
 | 
| 906 | 894 |          addr = self._hexint(addr)
 | 
| 907 | 895 |          self.logger.info("Writing %08X to volume %s sectors %X - %X..." % (addr, volume, sector, sector + count - 1))
 | 
| 908 |   | -        self.embios.lib.dev.timeout = 50000
 | 
| 909 | 896 |          self.embios.storage_write_sectors_md(volume, sector, count, addr)
 | 
| 910 | 897 |          self.logger.info("done\n")
 | 
| 911 | 898 |  
 | 
| — | — | @@ -925,7 +912,6 @@ | 
| 926 | 913 |          except IOError:
 | 
| 927 | 914 |              raise ArgumentError("Could not open local file for writing.")
 | 
| 928 | 915 |          self.logger.info("Reading volume %s sectors %X - %X to %s..." % (volume, sector, sector + count - 1, file))
 | 
| 929 |   | -        self.embios.lib.dev.timeout = 50000
 | 
| 930 | 916 |          storageinfo = self.embios.storage_get_info(volume)
 | 
| 931 | 917 |          while count > 0:
 | 
| 932 | 918 |              sectors = min(count, int(buffsize / storageinfo.sectorsize))
 | 
| — | — | @@ -953,7 +939,6 @@ | 
| 954 | 940 |          except IOError:
 | 
| 955 | 941 |              raise ArgumentError("Could not open local file for reading.")
 | 
| 956 | 942 |          self.logger.info("Writing %s to volume %s sectors %X - %X..." % (file, volume, sector, sector + count - 1))
 | 
| 957 |   | -        self.embios.lib.dev.timeout = 50000
 | 
| 958 | 943 |          storageinfo = self.embios.storage_get_info(volume)
 | 
| 959 | 944 |          while count > 0:
 | 
| 960 | 945 |              sectors = min(count, int(buffsize / storageinfo.sectorsize))
 | 
| — | — | @@ -973,7 +958,6 @@ | 
| 974 | 959 |          """
 | 
| 975 | 960 |              Creates a directory
 | 
| 976 | 961 |          """
 | 
| 977 |   | -        self.embios.lib.dev.timeout = 30000
 | 
| 978 | 962 |          self.logger.info("Creating directory " + dirname + "...")
 | 
| 979 | 963 |          self.embios.dir_create(dirname)
 | 
| 980 | 964 |          self.logger.info(" done\n")
 | 
| — | — | @@ -983,7 +967,6 @@ | 
| 984 | 968 |          """
 | 
| 985 | 969 |              Removes an empty directory
 | 
| 986 | 970 |          """
 | 
| 987 |   | -        self.embios.lib.dev.timeout = 30000
 | 
| 988 | 971 |          self.logger.info("Removing directory " + dirname + "...")
 | 
| 989 | 972 |          self.embios.dir_remove(dirname)
 | 
| 990 | 973 |          self.logger.info(" done\n")
 | 
| — | — | @@ -993,7 +976,6 @@ | 
| 994 | 977 |          """
 | 
| 995 | 978 |              Removes a file
 | 
| 996 | 979 |          """
 | 
| 997 |   | -        self.embios.lib.dev.timeout = 30000
 | 
| 998 | 980 |          self.logger.info("Removing file " + filename + "...")
 | 
| 999 | 981 |          self.embios.file_unlink(filename)
 | 
| 1000 | 982 |          self.logger.info(" done\n")
 | 
| — | — | @@ -1003,7 +985,6 @@ | 
| 1004 | 986 |          """
 | 
| 1005 | 987 |              Renames or moves a file or directory
 | 
| 1006 | 988 |          """
 | 
| 1007 |   | -        self.embios.lib.dev.timeout = 30000
 | 
| 1008 | 989 |          self.logger.info("Renaming " + oldname + " to " + newname + "...")
 | 
| 1009 | 990 |          self.embios.file_rename(oldname, newname)
 | 
| 1010 | 991 |          self.logger.info(" done\n")
 | 
| — | — | @@ -1020,7 +1001,6 @@ | 
| 1021 | 1002 |              f = open(localname, 'wb')
 | 
| 1022 | 1003 |          except IOError:
 | 
| 1023 | 1004 |              raise ArgumentError("Could not open local file for writing.")
 | 
| 1024 |   | -        self.embios.lib.dev.timeout = 30000
 | 
| 1025 | 1005 |          self.logger.info("Downloading file " + remotename + " to " + localname + "...")
 | 
| 1026 | 1006 |          fd = self.embios.file_open(remotename, 0)
 | 
| 1027 | 1007 |          size = self.embios.file_size(fd)
 | 
| — | — | @@ -1044,7 +1024,6 @@ | 
| 1045 | 1025 |              f = open(localname, 'rb')
 | 
| 1046 | 1026 |          except IOError:
 | 
| 1047 | 1027 |              raise ArgumentError("Could not open local file for reading.")
 | 
| 1048 |   | -        self.embios.lib.dev.timeout = 30000
 | 
| 1049 | 1028 |          self.logger.info("Uploading file " + localname + " to " + remotename + "...")
 | 
| 1050 | 1029 |          fd = self.embios.file_open(remotename, 0x15)
 | 
| 1051 | 1030 |          while True:
 | 
| — | — | @@ -1063,7 +1042,6 @@ | 
| 1064 | 1043 |          """
 | 
| 1065 | 1044 |              Lists all files in the specified path
 | 
| 1066 | 1045 |          """
 | 
| 1067 |   | -        self.embios.lib.dev.timeout = 30000
 | 
| 1068 | 1046 |          handle = self.embios.dir_open(path)
 | 
| 1069 | 1047 |          self.logger.info("Directory listing of " + path + ":\n")
 | 
| 1070 | 1048 |          while True:
 | 
| Index: embios/trunk/tools/libembios.py | 
| — | — | @@ -504,7 +504,7 @@ | 
| 505 | 505 |          self.execimage(baseaddr)
 | 
| 506 | 506 |          return Bunch(baseaddr=baseaddr, name=name)
 | 
| 507 | 507 |      
 | 
| 508 |   | -    @command()
 | 
|   | 508 | +    @command(timeout = 5000)
 | 
| 509 | 509 |      def bootflashread(self, memaddr, flashaddr, size):
 | 
| 510 | 510 |          """ Copies the data in the bootflash at 'flashaddr' of the specified size
 | 
| 511 | 511 |              to the memory at addr 'memaddr'
 | 
| — | — | @@ -511,7 +511,7 @@ | 
| 512 | 512 |          """
 | 
| 513 | 513 |          return self.lib.monitorcommand(struct.pack("IIII", 22, memaddr, flashaddr, size), "III", (None, None, None))
 | 
| 514 | 514 |      
 | 
| 515 |   | -    @command()
 | 
|   | 515 | +    @command(timeout = 30000)
 | 
| 516 | 516 |      def bootflashwrite(self, memaddr, flashaddr, size):
 | 
| 517 | 517 |          """ Copies the data in the memory at 'memaddr' of the specified size
 | 
| 518 | 518 |              to the boot flash at addr 'flashaddr'
 | 
| — | — | @@ -523,7 +523,7 @@ | 
| 524 | 524 |          """ Executes the firmware at 'addr' and passes all control to it. """
 | 
| 525 | 525 |          return self.lib.monitorcommand(struct.pack("IIII", 24, addr, 0, 0))
 | 
| 526 | 526 |      
 | 
| 527 |   | -    @command()
 | 
|   | 527 | +    @command(timeout = 30000)
 | 
| 528 | 528 |      def aesencrypt(self, addr, size, keyindex):
 | 
| 529 | 529 |          """ Encrypts the buffer at 'addr' with the specified size
 | 
| 530 | 530 |              with the hardware AES key index 'keyindex'
 | 
| — | — | @@ -530,7 +530,7 @@ | 
| 531 | 531 |          """
 | 
| 532 | 532 |          return self.lib.monitorcommand(struct.pack("IBBHII", 25, 1, 0, keyindex, addr, size), "III", (None, None, None))
 | 
| 533 | 533 |      
 | 
| 534 |   | -    @command()
 | 
|   | 534 | +    @command(timeout = 30000)
 | 
| 535 | 535 |      def aesdecrypt(self, addr, size, keyindex):
 | 
| 536 | 536 |          """ Decrypts the buffer at 'addr' with the specified size
 | 
| 537 | 537 |              with the hardware AES key index 'keyindex'
 | 
| — | — | @@ -537,7 +537,7 @@ | 
| 538 | 538 |          """
 | 
| 539 | 539 |          return self.lib.monitorcommand(struct.pack("IBBHII", 25, 0, 0, keyindex, addr, size), "III", (None, None, None))
 | 
| 540 | 540 |      
 | 
| 541 |   | -    @command()
 | 
|   | 541 | +    @command(timeout = 30000)
 | 
| 542 | 542 |      def hmac_sha1(self, addr, size, destination):
 | 
| 543 | 543 |          """ Generates a HMAC-SHA1 hash of the buffer and saves it to 'destination' """
 | 
| 544 | 544 |          return self.lib.monitorcommand(struct.pack("IIII", 26, addr, size, destination), "III", (None, None, None))
 | 
| — | — | @@ -550,7 +550,7 @@ | 
| 551 | 551 |          if self.lib.dev.hwtypeid != 0x47324e49: raise DeviceError("Wrong device for target-specific command.")
 | 
| 552 | 552 |          return self.lib.monitorcommand(struct.pack("IIII", 0xffff0001, 0, 0, 0), "IHHHH", ("type", "pagesperblock", "banks", "userblocks", "blocks"))
 | 
| 553 | 553 |      
 | 
| 554 |   | -    @command()
 | 
|   | 554 | +    @command(timeout = 30000)
 | 
| 555 | 555 |      def ipodnano2g_nandread(self, addr, start, count, doecc, checkempty):
 | 
| 556 | 556 |          """ Target-specific function: ipodnano2g
 | 
| 557 | 557 |              Reads data from the NAND chip into memory
 | 
| — | — | @@ -558,7 +558,7 @@ | 
| 559 | 559 |          if self.lib.dev.hwtypeid != 0x47324e49: raise DeviceError("Wrong device for target-specific command.")
 | 
| 560 | 560 |          return self.lib.monitorcommand(struct.pack("IIII", 0xffff0002, addr | (0x80000000 if doecc != 0 else 0) | (0x40000000 if checkempty != 0 else 0), start, count), "III", (None, None, None))
 | 
| 561 | 561 |      
 | 
| 562 |   | -    @command()
 | 
|   | 562 | +    @command(timeout = 30000)
 | 
| 563 | 563 |      def ipodnano2g_nandwrite(self, addr, start, count, doecc):
 | 
| 564 | 564 |          """ Target-specific function: ipodnano2g
 | 
| 565 | 565 |              Writes data to the NAND chip
 | 
| — | — | @@ -566,7 +566,7 @@ | 
| 567 | 567 |          if self.lib.dev.hwtypeid != 0x47324e49: raise DeviceError("Wrong device for target-specific command.")
 | 
| 568 | 568 |          return self.lib.monitorcommand(struct.pack("IIII", 0xffff0003, addr | (0x80000000 if doecc != 0 else 0), start, count), "III", (None, None, None))
 | 
| 569 | 569 |      
 | 
| 570 |   | -    @command()
 | 
|   | 570 | +    @command(timeout = 30000)
 | 
| 571 | 571 |      def ipodnano2g_nanderase(self, addr, start, count):
 | 
| 572 | 572 |          """ Target-specific function: ipodnano2g
 | 
| 573 | 573 |              Erases blocks on the NAND chip and stores the results to memory
 | 
| — | — | @@ -582,7 +582,7 @@ | 
| 583 | 583 |          if self.lib.dev.hwtypeid != 0x4c435049: raise DeviceError("Wrong device for target-specific command.")
 | 
| 584 | 584 |          return self.lib.monitorcommand(struct.pack("IIII", 0xffff0001, 0, 0, 0), "IQQII", ("identifyptr", "totalsectors", "virtualsectors", "bbtptr", "bbtsize"))
 | 
| 585 | 585 |      
 | 
| 586 |   | -    @command()
 | 
|   | 586 | +    @command(timeout = 30000)
 | 
| 587 | 587 |      def ipodclassic_hddaccess(self, type, sector, count, addr):
 | 
| 588 | 588 |          """ Target-specific function: ipodclassic
 | 
| 589 | 589 |              Access the hard disk, type = 0 (read) / 1 (write)
 | 
| — | — | @@ -631,7 +631,7 @@ | 
| 632 | 632 |          result.revision = self.readstring(result.revisionptr)
 | 
| 633 | 633 |          return result
 | 
| 634 | 634 |      
 | 
| 635 |   | -    @command()
 | 
|   | 635 | +    @command(timeout = 50000)
 | 
| 636 | 636 |      def storage_read_sectors_md(self, volume, sector, count, addr):
 | 
| 637 | 637 |          """ Read sectors from as storage device """
 | 
| 638 | 638 |          result = self.lib.monitorcommand(struct.pack("IIQIIII", 28, volume, sector, count, addr, 0, 0), "III", ("rc", None, None, None))
 | 
| — | — | @@ -638,7 +638,7 @@ | 
| 639 | 639 |          if result.rc > 0x80000000:
 | 
| 640 | 640 |              raise DeviceError("storage_read_sectors_md(volume=%d, sector=%d, count=%d, addr=0x%08X) failed with RC 0x%08X" % (volume, sector, count, addr, rc))
 | 
| 641 | 641 |      
 | 
| 642 |   | -    @command()
 | 
|   | 642 | +    @command(timeout = 50000)
 | 
| 643 | 643 |      def storage_write_sectors_md(self, volume, sector, count, addr):
 | 
| 644 | 644 |          """ Read sectors from as storage device """
 | 
| 645 | 645 |          result = self.lib.monitorcommand(struct.pack("IIQIIII", 29, volume, sector, count, addr, 0, 0), "III", ("rc", None, None, None))
 | 
| — | — | @@ -645,7 +645,7 @@ | 
| 646 | 646 |          if result.rc > 0x80000000:
 | 
| 647 | 647 |              raise DeviceError("storage_read_sectors_md(volume=%d, sector=%d, count=%d, addr=0x%08X) failed with RC 0x%08X" % (volume, sector, count, addr, rc))
 | 
| 648 | 648 |      
 | 
| 649 |   | -    @command()
 | 
|   | 649 | +    @command(timeout = 30000)
 | 
| 650 | 650 |      def file_open(self, filename, mode):
 | 
| 651 | 651 |          """ Opens a file and returns the handle """
 | 
| 652 | 652 |          result = self.lib.monitorcommand(struct.pack("IIII%dsB" % len(filename), 30, mode, 0, 0, filename, 0), "III", ("fd", None, None))
 | 
| — | — | @@ -653,7 +653,7 @@ | 
| 654 | 654 |              raise DeviceError("file_open(filename=\"%s\", mode=0x%X) failed with RC=0x%08X, errno=%d" % (filename, mode, result.fd, self.errno()))
 | 
| 655 | 655 |          return result.fd
 | 
| 656 | 656 |      
 | 
| 657 |   | -    @command()
 | 
|   | 657 | +    @command(timeout = 30000)
 | 
| 658 | 658 |      def file_size(self, fd):
 | 
| 659 | 659 |          """ Gets the size of a file referenced by a handle """
 | 
| 660 | 660 |          result = self.lib.monitorcommand(struct.pack("IIII", 31, fd, 0, 0), "III", ("size", None, None))
 | 
| — | — | @@ -661,7 +661,7 @@ | 
| 662 | 662 |              raise DeviceError("file_size(fd=%d) failed with RC=0x%08X, errno=%d" % (fd, result.size, self.errno()))
 | 
| 663 | 663 |          return result.size
 | 
| 664 | 664 |      
 | 
| 665 |   | -    @command()
 | 
|   | 665 | +    @command(timeout = 30000)
 | 
| 666 | 666 |      def file_read(self, fd, addr, size):
 | 
| 667 | 667 |          """ Reads data from a file referenced by a handle """
 | 
| 668 | 668 |          result = self.lib.monitorcommand(struct.pack("IIII", 32, fd, addr, size), "III", ("rc", None, None))
 | 
| — | — | @@ -669,7 +669,7 @@ | 
| 670 | 670 |              raise DeviceError("file_read(fd=%d, addr=0x%08X, size=0x%08X) failed with RC=0x%08X, errno=%d" % (fd, addr, size, result.rc, self.errno()))
 | 
| 671 | 671 |          return result.rc
 | 
| 672 | 672 |      
 | 
| 673 |   | -    @command()
 | 
|   | 673 | +    @command(timeout = 30000)
 | 
| 674 | 674 |      def file_write(self, fd, addr, size):
 | 
| 675 | 675 |          """ Writes data from a file referenced by a handle """
 | 
| 676 | 676 |          result = self.lib.monitorcommand(struct.pack("IIII", 33, fd, addr, size), "III", ("rc", None, None))
 | 
| — | — | @@ -677,7 +677,7 @@ | 
| 678 | 678 |              raise DeviceError("file_write(fd=%d, addr=0x%08X, size=0x%08X) failed with RC=0x%08X, errno=%d" % (fd, addr, size, result.rc, self.errno()))
 | 
| 679 | 679 |          return result.rc
 | 
| 680 | 680 |      
 | 
| 681 |   | -    @command()
 | 
|   | 681 | +    @command(timeout = 30000)
 | 
| 682 | 682 |      def file_seek(self, fd, offset, whence):
 | 
| 683 | 683 |          """ Seeks the file handle to the specified position in the file """
 | 
| 684 | 684 |          result = self.lib.monitorcommand(struct.pack("IIII", 34, fd, offset, whence), "III", ("rc", None, None))
 | 
| — | — | @@ -685,7 +685,7 @@ | 
| 686 | 686 |              raise DeviceError("file_seek(fd=%d, offset=0x%08X, whence=%d) failed with RC=0x%08X, errno=%d" % (fd, offset, whence, result.rc, self.errno()))
 | 
| 687 | 687 |          return result.rc
 | 
| 688 | 688 |      
 | 
| 689 |   | -    @command()
 | 
|   | 689 | +    @command(timeout = 30000)
 | 
| 690 | 690 |      def file_truncate(self, fd, length):
 | 
| 691 | 691 |          """ Truncates a file referenced by a handle to a specified length """
 | 
| 692 | 692 |          result = self.lib.monitorcommand(struct.pack("IIII", 35, fd, offset, 0), "III", ("rc", None, None))
 | 
| — | — | @@ -693,7 +693,7 @@ | 
| 694 | 694 |              raise DeviceError("file_truncate(fd=%d, length=0x%08X) failed with RC=0x%08X, errno=%d" % (fd, length, result.rc, self.errno()))
 | 
| 695 | 695 |          return result.rc
 | 
| 696 | 696 |      
 | 
| 697 |   | -    @command()
 | 
|   | 697 | +    @command(timeout = 30000)
 | 
| 698 | 698 |      def file_sync(self, fd):
 | 
| 699 | 699 |          """ Flushes a file handles' buffers """
 | 
| 700 | 700 |          result = self.lib.monitorcommand(struct.pack("IIII", 36, fd, 0, 0), "III", ("rc", None, None))
 | 
| — | — | @@ -701,7 +701,7 @@ | 
| 702 | 702 |              raise DeviceError("file_sync(fd=%d) failed with RC=0x%08X, errno=%d" % (fd, result.rc, self.errno()))
 | 
| 703 | 703 |          return result.rc
 | 
| 704 | 704 |      
 | 
| 705 |   | -    @command()
 | 
|   | 705 | +    @command(timeout = 30000)
 | 
| 706 | 706 |      def file_close(self, fd):
 | 
| 707 | 707 |          """ Closes a file handle """
 | 
| 708 | 708 |          result = self.lib.monitorcommand(struct.pack("IIII", 37, fd, 0, 0), "III", ("rc", None, None))
 | 
| — | — | @@ -709,7 +709,7 @@ | 
| 710 | 710 |              raise DeviceError("file_close(fd=%d) failed with RC=0x%08X, errno=%d" % (fd, result.rc, self.errno()))
 | 
| 711 | 711 |          return result.rc
 | 
| 712 | 712 |      
 | 
| 713 |   | -    @command()
 | 
|   | 713 | +    @command(timeout = 30000)
 | 
| 714 | 714 |      def file_close_all(self):
 | 
| 715 | 715 |          """ Closes all file handles opened through the debugger """
 | 
| 716 | 716 |          result = self.lib.monitorcommand(struct.pack("IIII", 38, 0, 0, 0), "III", ("rc", None, None))
 | 
| — | — | @@ -717,7 +717,7 @@ | 
| 718 | 718 |              raise DeviceError("file_close_all() failed with RC=0x%08X, errno=%d" % (result.rc, self.errno()))
 | 
| 719 | 719 |          return result.rc
 | 
| 720 | 720 |      
 | 
| 721 |   | -    @command()
 | 
|   | 721 | +    @command(timeout = 30000)
 | 
| 722 | 722 |      def file_kill_all(self):
 | 
| 723 | 723 |          """ Kills all file handles (in the whole system) """
 | 
| 724 | 724 |          result = self.lib.monitorcommand(struct.pack("IIII", 39, 0, 0, 0), "III", ("rc", None, None))
 | 
| — | — | @@ -725,7 +725,7 @@ | 
| 726 | 726 |              raise DeviceError("file_kill_all() failed with RC=0x%08X, errno=%d" % (result.rc, self.errno()))
 | 
| 727 | 727 |          return result.rc
 | 
| 728 | 728 |      
 | 
| 729 |   | -    @command()
 | 
|   | 729 | +    @command(timeout = 30000)
 | 
| 730 | 730 |      def file_unlink(self, filename):
 | 
| 731 | 731 |          """ Removes a file """
 | 
| 732 | 732 |          result = self.lib.monitorcommand(struct.pack("IIII%dsB" % len(filename), 40, 0, 0, 0, filename, 0), "III", ("rc", None, None))
 | 
| — | — | @@ -733,7 +733,7 @@ | 
| 734 | 734 |              raise DeviceError("file_unlink(filename=\"%s\") failed with RC=0x%08X, errno=%d" % (filename, result.rc, self.errno()))
 | 
| 735 | 735 |          return result.rc
 | 
| 736 | 736 |      
 | 
| 737 |   | -    @command()
 | 
|   | 737 | +    @command(timeout = 30000)
 | 
| 738 | 738 |      def file_rename(self, oldname, newname):
 | 
| 739 | 739 |          """ Renames a file """
 | 
| 740 | 740 |          result = self.lib.monitorcommand(struct.pack("IIII248s%dsB" % min(247, len(newname)), 41, 0, 0, 0, oldname, newname, 0), "III", ("rc", None, None))
 | 
| — | — | @@ -741,7 +741,7 @@ | 
| 742 | 742 |              raise DeviceError("file_rename(oldname=\"%s\", newname=\"%s\") failed with RC=0x%08X, errno=%d" % (oldname, newname, result.rc, self.errno()))
 | 
| 743 | 743 |          return result.rc
 | 
| 744 | 744 |      
 | 
| 745 |   | -    @command()
 | 
|   | 745 | +    @command(timeout = 30000)
 | 
| 746 | 746 |      def dir_open(self, dirname):
 | 
| 747 | 747 |          """ Opens a directory and returns the handle """
 | 
| 748 | 748 |          result = self.lib.monitorcommand(struct.pack("IIII%dsB" % len(dirname), 42, 0, 0, 0, dirname, 0), "III", ("handle", None, None))
 | 
| — | — | @@ -749,7 +749,7 @@ | 
| 750 | 750 |              raise DeviceError("dir_open(dirname=\"%s\") failed with RC=0x%08X, errno=%d" % (dirname, result.handle, self.errno()))
 | 
| 751 | 751 |          return result.handle
 | 
| 752 | 752 |      
 | 
| 753 |   | -    @command()
 | 
|   | 753 | +    @command(timeout = 30000)
 | 
| 754 | 754 |      def dir_read(self, handle):
 | 
| 755 | 755 |          """ Reads the next entry from a directory """
 | 
| 756 | 756 |          result = self.lib.monitorcommand(struct.pack("IIII", 43, handle, 0, 0), "III", ("version", "maxpath", "ptr"))
 | 
| — | — | @@ -763,7 +763,7 @@ | 
| 764 | 764 |          ret.name = ret.name[:ret.name.index('\x00')]
 | 
| 765 | 765 |          return ret
 | 
| 766 | 766 |      
 | 
| 767 |   | -    @command()
 | 
|   | 767 | +    @command(timeout = 30000)
 | 
| 768 | 768 |      def dir_close(self, handle):
 | 
| 769 | 769 |          """ Closes a directory handle """
 | 
| 770 | 770 |          result = self.lib.monitorcommand(struct.pack("IIII", 44, handle, 0, 0), "III", ("rc", None, None))
 | 
| — | — | @@ -771,7 +771,7 @@ | 
| 772 | 772 |              raise DeviceError("dir_close(handle=0x%08X) failed with RC=0x%08X, errno=%d" % (handle, result.rc, self.errno()))
 | 
| 773 | 773 |          return result.rc
 | 
| 774 | 774 |      
 | 
| 775 |   | -    @command()
 | 
|   | 775 | +    @command(timeout = 30000)
 | 
| 776 | 776 |      def dir_close_all(self):
 | 
| 777 | 777 |          """ Closes all directory handles opened through the debugger """
 | 
| 778 | 778 |          result = self.lib.monitorcommand(struct.pack("IIII", 45, 0, 0, 0), "III", ("rc", None, None))
 | 
| — | — | @@ -779,7 +779,7 @@ | 
| 780 | 780 |              raise DeviceError("dir_close_all() failed with RC=0x%08X, errno=%d" % (result.rc, self.errno()))
 | 
| 781 | 781 |          return result.rc
 | 
| 782 | 782 |      
 | 
| 783 |   | -    @command()
 | 
|   | 783 | +    @command(timeout = 30000)
 | 
| 784 | 784 |      def dir_kill_all(self):
 | 
| 785 | 785 |          """ Kills all directory handles (in the whole system) """
 | 
| 786 | 786 |          result = self.lib.monitorcommand(struct.pack("IIII", 46, 0, 0, 0), "III", ("rc", None, None))
 | 
| — | — | @@ -787,7 +787,7 @@ | 
| 788 | 788 |              raise DeviceError("dir_kill_all() failed with RC=0x%08X, errno=%d" % (result.rc, self.errno()))
 | 
| 789 | 789 |          return result.rc
 | 
| 790 | 790 |      
 | 
| 791 |   | -    @command()
 | 
|   | 791 | +    @command(timeout = 30000)
 | 
| 792 | 792 |      def dir_create(self, dirname):
 | 
| 793 | 793 |          """ Creates a directory """
 | 
| 794 | 794 |          result = self.lib.monitorcommand(struct.pack("IIII%dsB" % len(dirname), 47, 0, 0, 0, dirname, 0), "III", ("rc", None, None))
 | 
| — | — | @@ -795,7 +795,7 @@ | 
| 796 | 796 |              raise DeviceError("dir_create(dirname=\"%s\") failed with RC=0x%08X, errno=%d" % (dirname, result.rc, self.errno()))
 | 
| 797 | 797 |          return result.rc
 | 
| 798 | 798 |      
 | 
| 799 |   | -    @command()
 | 
|   | 799 | +    @command(timeout = 30000)
 | 
| 800 | 800 |      def dir_remove(self, dirname):
 | 
| 801 | 801 |          """ Removes an (empty) directory """
 | 
| 802 | 802 |          result = self.lib.monitorcommand(struct.pack("IIII%dsB" % len(dirname), 48, 0, 0, 0, dirname, 0), "III", ("rc", None, None))
 |