def mount(self): log.debug("Mounting photocard...") self.START_OPERATION('mount') try: stat = pcardext.mount(self._read, self._write) disk_info = pcardext.info() self.write_protect = disk_info[8] log.debug("stat=%d" % stat) if stat == 0: if self.write_protect: # if write_protect is True, # card write NAK'd and channel was # closed. We have to reopen here. self.open_channel() self.pcard_mounted = True pcardext.cd('/') self.ls(True, '*', False) else: self.pcard_mounted = False raise Error(ERROR_DEVICE_DOES_NOT_SUPPORT_OPERATION) finally: if self.pcard_mounted: self.END_OPERATION('mount')
def info(self): return pcardext.info()