| Index: emcore/trunk/tools/libemcore.py |
| — | — | @@ -693,8 +693,9 @@ |
| 694 | 694 | self.logger.debug("Reading %d sectors from disk at volume %d, sector %d to memory at 0x%X\n" % (count, volume, sector, addr))
|
| 695 | 695 | result = self.lib.monitorcommand(struct.pack("<IIQIIII", 28, volume, sector, count, addr, 0, 0), "III", ("rc", None, None))
|
| 696 | 696 | self.logger.debug("Read sectors, result: 0x%X\n" % result.rc)
|
| 697 | | - if result.rc > 0x80000000:
|
| 698 | | - 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))
|
| | 697 | + self.logger.info(".");
|
| | 698 | +# if result.rc > 0x80000000:
|
| | 699 | +# raise DeviceError("storage_read_sectors_md(volume=%d, sector=%d, count=%d, addr=0x%08X) failed with RC 0x%08X" % (volume, sector, count, addr, result.rc))
|
| 699 | 700 |
|
| 700 | 701 | @command(timeout = 50000)
|
| 701 | 702 | def storage_write_sectors_md(self, volume, sector, count, addr):
|
| — | — | @@ -702,8 +703,9 @@ |
| 703 | 704 | self.logger.debug("Writing %d sectors from memory at 0x%X to disk at volume %d, sector %d\n" % (count, addr, volume, sector))
|
| 704 | 705 | result = self.lib.monitorcommand(struct.pack("<IIQIIII", 29, volume, sector, count, addr, 0, 0), "III", ("rc", None, None))
|
| 705 | 706 | self.logger.debug("Wrote sectors, result: 0x%X\n" % result.rc)
|
| 706 | | - if result.rc > 0x80000000:
|
| 707 | | - raise DeviceError("storage_write_sectors_md(volume=%d, sector=%d, count=%d, addr=0x%08X) failed with RC 0x%08X" % (volume, sector, count, addr, rc))
|
| | 707 | + self.logger.info(".");
|
| | 708 | +# if result.rc > 0x80000000:
|
| | 709 | +# raise DeviceError("storage_write_sectors_md(volume=%d, sector=%d, count=%d, addr=0x%08X) failed with RC 0x%08X" % (volume, sector, count, addr, result.rc))
|
| 708 | 710 |
|
| 709 | 711 | @command(timeout = 30000)
|
| 710 | 712 | def fat_enable_flushing(self, state):
|
| — | — | @@ -717,8 +719,9 @@ |
| 718 | 720 | @command(timeout = 30000)
|
| 719 | 721 | def file_open(self, filename, mode):
|
| 720 | 722 | """ Opens a file and returns the handle """
|
| | 723 | + fn = filename.encode("utf_8")
|
| 721 | 724 | self.logger.debug("Opening remote file %s with mode %d\n" % (filename, mode))
|
| 722 | | - result = self.lib.monitorcommand(struct.pack("<IIII%dsB" % len(filename), 30, mode, 0, 0, filename, 0), "III", ("fd", None, None))
|
| | 725 | + result = self.lib.monitorcommand(struct.pack("<IIII%dsB" % len(fn), 30, mode, 0, 0, fn, 0), "III", ("fd", None, None))
|
| 723 | 726 | if result.fd > 0x80000000:
|
| 724 | 727 | raise DeviceError("file_open(filename=\"%s\", mode=0x%X) failed with RC=0x%08X, errno=%d" % (filename, mode, result.fd, self.errno()))
|
| 725 | 728 | self.logger.debug("Opened file as handle 0x%X\n" % result.fd)
|
| — | — | @@ -827,8 +830,9 @@ |
| 828 | 831 | @command(timeout = 30000)
|
| 829 | 832 | def file_unlink(self, filename):
|
| 830 | 833 | """ Removes a file """
|
| | 834 | + fn = filename.encode("utf_8")
|
| 831 | 835 | self.logger.debug("Deleting file %s\n" % (filename))
|
| 832 | | - result = self.lib.monitorcommand(struct.pack("<IIII%dsB" % len(filename), 40, 0, 0, 0, filename, 0), "III", ("rc", None, None))
|
| | 836 | + result = self.lib.monitorcommand(struct.pack("<IIII%dsB" % len(fn), 40, 0, 0, 0, fn, 0), "III", ("rc", None, None))
|
| 833 | 837 | if result.rc > 0x80000000:
|
| 834 | 838 | raise DeviceError("file_unlink(filename=\"%s\") failed with RC=0x%08X, errno=%d" % (filename, result.rc, self.errno()))
|
| 835 | 839 | self.logger.debug("Delete file result: 0x%X\n" % (result.rc))
|
| — | — | @@ -837,8 +841,10 @@ |
| 838 | 842 | @command(timeout = 30000)
|
| 839 | 843 | def file_rename(self, oldname, newname):
|
| 840 | 844 | """ Renames a file """
|
| 841 | | - self.logger.debug("Renaming file %s to %s\n" % (oldname, newname))
|
| 842 | | - result = self.lib.monitorcommand(struct.pack("<IIII248s%dsB" % min(247, len(newname)), 41, 0, 0, 0, oldname, newname, 0), "III", ("rc", None, None))
|
| | 845 | + on = oldname.encode("utf_8")
|
| | 846 | + nn = newname.encode("utf_8")
|
| | 847 | + self.logger.debug("Renaming file %s to %s\n" % (on, nn))
|
| | 848 | + result = self.lib.monitorcommand(struct.pack("<IIII248s%dsB" % min(247, len(nn)), 41, 0, 0, 0, on, nn, 0), "III", ("rc", None, None))
|
| 843 | 849 | if result.rc > 0x80000000:
|
| 844 | 850 | raise DeviceError("file_rename(oldname=\"%s\", newname=\"%s\") failed with RC=0x%08X, errno=%d" % (oldname, newname, result.rc, self.errno()))
|
| 845 | 851 | self.logger.debug("Rename file result: 0x%X\n" % (result.rc))
|
| — | — | @@ -847,8 +853,9 @@ |
| 848 | 854 | @command(timeout = 30000)
|
| 849 | 855 | def dir_open(self, dirname):
|
| 850 | 856 | """ Opens a directory and returns the handle """
|
| | 857 | + dn = dirname.encode("utf_8")
|
| 851 | 858 | self.logger.debug("Opening directory %s\n" % (dirname))
|
| 852 | | - result = self.lib.monitorcommand(struct.pack("<IIII%dsB" % len(dirname), 42, 0, 0, 0, dirname, 0), "III", ("handle", None, None))
|
| | 859 | + result = self.lib.monitorcommand(struct.pack("<IIII%dsB" % len(dn), 42, 0, 0, 0, dn, 0), "III", ("handle", None, None))
|
| 853 | 860 | if result.handle == 0:
|
| 854 | 861 | raise DeviceError("dir_open(dirname=\"%s\") failed with RC=0x%08X, errno=%d" % (dirname, result.handle, self.errno()))
|
| 855 | 862 | self.logger.debug("Opened directory as handle 0x%X\n" % (result.handle))
|
| — | — | @@ -909,8 +916,9 @@ |
| 910 | 917 | @command(timeout = 30000)
|
| 911 | 918 | def dir_create(self, dirname):
|
| 912 | 919 | """ Creates a directory """
|
| | 920 | + dn = dirname.encode("utf_8")
|
| 913 | 921 | self.logger.debug("Creating directory %s\n" % (dirname))
|
| 914 | | - result = self.lib.monitorcommand(struct.pack("<IIII%dsB" % len(dirname), 47, 0, 0, 0, dirname, 0), "III", ("rc", None, None))
|
| | 922 | + result = self.lib.monitorcommand(struct.pack("<IIII%dsB" % len(dn), 47, 0, 0, 0, dn, 0), "III", ("rc", None, None))
|
| 915 | 923 | if result.rc > 0x80000000:
|
| 916 | 924 | raise DeviceError("dir_create(dirname=\"%s\") failed with RC=0x%08X, errno=%d" % (dirname, result.rc, self.errno()))
|
| 917 | 925 | self.logger.debug("Create directory result: 0x%X\n" % (result.rc))
|
| — | — | @@ -919,8 +927,9 @@ |
| 920 | 928 | @command(timeout = 30000)
|
| 921 | 929 | def dir_remove(self, dirname):
|
| 922 | 930 | """ Removes an (empty) directory """
|
| | 931 | + dn = dirname.encode("utf_8")
|
| 923 | 932 | self.logger.debug("Removing directory %s\n" % (dirname))
|
| 924 | | - result = self.lib.monitorcommand(struct.pack("<IIII%dsB" % len(dirname), 48, 0, 0, 0, dirname, 0), "III", ("rc", None, None))
|
| | 933 | + result = self.lib.monitorcommand(struct.pack("<IIII%dsB" % len(dn), 48, 0, 0, 0, dn, 0), "III", ("rc", None, None))
|
| 925 | 934 | if result.rc > 0x80000000:
|
| 926 | 935 | raise DeviceError("dir_remove(dirname=\"%s\") failed with RC=0x%08X, errno=%d" % (dirname, result.rc, self.errno()))
|
| 927 | 936 | self.logger.debug("Remove directory result: 0x%X\n" % (result.rc))
|