Esempio n. 1
0
def icf_to_image(icf_file, img_file):
    # FIXME: Why is this here?
    """Convert an ICF file to a .img file"""
    mdata, mmap = icf.read_file(icf_file)
    img_data = None

    for model in list(DRV_TO_RADIO.values()):
        try:
            if model._model == mdata:
                img_data = mmap.get_packed()[:model._memsize]
                break
        except Exception:
            pass  # Skip non-Icoms

    if img_data:
        f = file(img_file, "wb")
        f.write(img_data)
        f.close()
    else:
        LOG.error("Unsupported model data: %s" % util.hexprint(mdata))
        raise Exception("Unsupported model")
Esempio n. 2
0
def icf_to_image(icf_file, img_file):
    # FIXME: Why is this here?
    """Convert an ICF file to a .img file"""
    mdata, mmap = icf.read_file(icf_file)
    img_data = None

    for model in DRV_TO_RADIO.values():
        try:
            if model._model == mdata:
                img_data = mmap.get_packed()[:model._memsize]
                break
        except Exception:
            pass  # Skip non-Icoms

    if img_data:
        f = file(img_file, "wb")
        f.write(img_data)
        f.close()
    else:
        LOG.error("Unsupported model data: %s" % util.hexprint(mdata))
        raise Exception("Unsupported model")
Esempio n. 3
0
 def load_mmap(self, filename):
     _mdata, self._mmap = icf.read_file(filename)
Esempio n. 4
0
 def load_mmap(self, filename):
     _mdata, self._mmap = icf.read_file(filename)