class DeviceManager(Screen):
skin = """
- <screen position="center,center" size="670,400" title="DeviceManager">
+ <screen position="center,center" size="590,350" title="DeviceManager">
<ePixmap pixmap="skin_default/buttons/red.png" position="20,0" size="140,40" alphatest="on" />
- <ePixmap pixmap="skin_default/buttons/green.png" position="180,0" size="140,40" alphatest="on" />
- <ePixmap pixmap="skin_default/buttons/yellow.png" position="340,0" size="140,40" alphatest="on" />
- <ePixmap pixmap="skin_default/buttons/blue.png" position="500,0" size="140,40" alphatest="on" />
+ <ePixmap pixmap="skin_default/buttons/green.png" position="160,0" size="140,40" alphatest="on" />
+ <ePixmap pixmap="skin_default/buttons/yellow.png" position="300,0" size="140,40" alphatest="on" />
+ <ePixmap pixmap="skin_default/buttons/blue.png" position="440,0" size="140,40" alphatest="on" />
<widget name="key_red" position="20,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" foregroundColor="#ffffff" backgroundColor="#9f1313" transparent="1" />
- <widget name="key_green" position="180,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" foregroundColor="#ffffff" backgroundColor="#1f771f" transparent="1" />
- <widget name="key_yellow" position="340,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" foregroundColor="#ffffff" backgroundColor="#a08500" transparent="1" />
- <widget name="key_blue" position="500,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" foregroundColor="#ffffff" backgroundColor="#18188b" transparent="1" />
- <ePixmap pixmap="skin_default/div-h.png" position="0,48" size="670,2" alphatest="on" />
- <widget source="menu" render="Listbox" position="0,48" size="670,350" scrollbarMode="showOnDemand">
+ <widget name="key_green" position="160,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" foregroundColor="#ffffff" backgroundColor="#1f771f" transparent="1" />
+ <widget name="key_yellow" position="300,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" foregroundColor="#ffffff" backgroundColor="#a08500" transparent="1" />
+ <widget name="key_blue" position="440,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" foregroundColor="#ffffff" backgroundColor="#18188b" transparent="1" />
+ <ePixmap pixmap="skin_default/div-h.png" position="0,48" size="590,2" alphatest="on" />
+ <widget source="menu" render="Listbox" position="0,48" size="590,350" scrollbarMode="showOnDemand">
<convert type="TemplatedMultiContent">
{"templates":
{"default": (54,[
- MultiContentEntryText(pos = (100, 0), size = (560, 30), font=0, flags = RT_HALIGN_LEFT|RT_VALIGN_CENTER, text = 0), # index 0 is vendor - model
- MultiContentEntryText(pos = (100, 32), size = (130, 20), font=1, flags = RT_HALIGN_LEFT|RT_VALIGN_CENTER, text = 1), # index 1 is Device
- MultiContentEntryText(pos = (230, 32), size = (130, 20), font=1, flags = RT_HALIGN_LEFT|RT_VALIGN_CENTER, text = 2), # index 2 is Size
- MultiContentEntryText(pos = (360, 32), size = (130, 20), font=1, flags = RT_HALIGN_LEFT|RT_VALIGN_CENTER, text = 3), # index 3 is Partitions
- MultiContentEntryText(pos = (490, 32), size = (140, 20), font=1, flags = RT_HALIGN_LEFT|RT_VALIGN_CENTER, text = 4), # index 4 is Removable
- MultiContentEntryPixmapAlphaTest(pos = (0, 52), size = (670, 2), png = 5), # png 5 is the div pixmap
+ MultiContentEntryText(pos = (50, 0), size = (510, 30), font=0, flags = RT_HALIGN_LEFT|RT_VALIGN_CENTER, text = 0), # index 0 is vendor - model
+ MultiContentEntryText(pos = (50, 32), size = (120, 20), font=1, flags = RT_HALIGN_LEFT|RT_VALIGN_CENTER, text = 1), # index 1 is Device
+ MultiContentEntryText(pos = (170, 32), size = (120, 20), font=1, flags = RT_HALIGN_LEFT|RT_VALIGN_CENTER, text = 2), # index 2 is Size
+ MultiContentEntryText(pos = (290, 32), size = (120, 20), font=1, flags = RT_HALIGN_LEFT|RT_VALIGN_CENTER, text = 3), # index 3 is Partitions
+ MultiContentEntryText(pos = (410, 32), size = (130, 20), font=1, flags = RT_HALIGN_LEFT|RT_VALIGN_CENTER, text = 4), # index 4 is Removable
+ MultiContentEntryPixmapAlphaTest(pos = (0, 52), size = (590, 2), png = 5), # png 5 is the div pixmap
]),
"partitions": (98, [
- MultiContentEntryText(pos = (100, 0), size = (560, 30), font=0, flags = RT_HALIGN_LEFT|RT_VALIGN_CENTER, text = 0), # index 1 is Partition
- MultiContentEntryText(pos = (100, 32), size = (560, 20), font=1, flags = RT_HALIGN_LEFT|RT_VALIGN_CENTER, text = 1), # index 2 is Mounted on
- MultiContentEntryText(pos = (100, 54), size = (560, 20), font=1, flags = RT_HALIGN_LEFT|RT_VALIGN_CENTER, text = 2), # index 3 UUID
- MultiContentEntryText(pos = (100, 76), size = (140, 20), font=1, flags = RT_HALIGN_LEFT|RT_VALIGN_CENTER, text = 3), # index 4 Type
- MultiContentEntryText(pos = (230, 76), size = (140, 20), font=1, flags = RT_HALIGN_LEFT|RT_VALIGN_CENTER, text = 4), # index 5 Size_total
- MultiContentEntryText(pos = (380, 76), size = (200, 20), font=1, flags = RT_HALIGN_LEFT|RT_VALIGN_CENTER, text = 5), # index 6 Size_free
- MultiContentEntryPixmapAlphaTest(pos = (0, 96), size = (670, 2), png = 6), # png 6 is the div pixmap
+ MultiContentEntryText(pos = (50, 0), size = (500, 30), font=0, flags = RT_HALIGN_LEFT|RT_VALIGN_CENTER, text = 0), # index 1 is Partition
+ MultiContentEntryText(pos = (50, 32), size = (500, 20), font=1, flags = RT_HALIGN_LEFT|RT_VALIGN_CENTER, text = 1), # index 2 is Mounted on
+ MultiContentEntryText(pos = (50, 54), size = (500, 20), font=1, flags = RT_HALIGN_LEFT|RT_VALIGN_CENTER, text = 2), # index 3 UUID
+ MultiContentEntryText(pos = (50, 76), size = (130, 20), font=1, flags = RT_HALIGN_LEFT|RT_VALIGN_CENTER, text = 3), # index 4 Type
+ MultiContentEntryText(pos = (180, 76), size = (130, 20), font=1, flags = RT_HALIGN_LEFT|RT_VALIGN_CENTER, text = 4), # index 5 Size_total
+ MultiContentEntryText(pos = (310, 76), size = (190, 20), font=1, flags = RT_HALIGN_LEFT|RT_VALIGN_CENTER, text = 5), # index 6 Size_free
+ MultiContentEntryPixmapAlphaTest(pos = (0, 96), size = (590, 2), png = 6), # png 6 is the div pixmap
]),
"mountpoint": (54,[
MultiContentEntryPixmapAlphaTest(pos = (10, 7), size = (30, 30), png = 0), # index 0: picture
MultiContentEntryText(pos = (40, 0), size = (500, 30), font=0, flags = RT_HALIGN_LEFT|RT_VALIGN_CENTER, text = 1), # index 1 name
MultiContentEntryText(pos = (40, 32), size = (500, 20), font=1, flags = RT_HALIGN_LEFT|RT_VALIGN_CENTER, text = 2), # index 2 path
- MultiContentEntryPixmapAlphaTest(pos = (0, 52), size = (670, 2), png = 5), # index 5 is the div pixmap
+ MultiContentEntryPixmapAlphaTest(pos = (0, 52), size = (590, 2), png = 5), # index 5 is the div pixmap
])
},
"fonts": [gFont("Regular", 22),gFont("Regular", 16),gFont("Regular", 28)],
self["menu"].setList(self.mountPointList)
def getCurrentDevice(self):
- if self.currList == "default":
+ try:
return self["menu"].getCurrent()[6]
- return None
+ except:
+ return None
def getCurrentPartition(self):
- if self.currList == "partitions":
+ try:
return self["menu"].getCurrent()[7]
- return None
+ except:
+ return None
def keyOk(self):
# print "keyOk"
if self.currList == "default":
self.currDevice = self.getCurrentDevice()
- if len(self.currDevice["partitions"]) == 0:
- self.session.open(MessageBox, _("No partition list found on device.\nPlease click BLUE key and do Initialize to use this device."), MessageBox.TYPE_ERROR, timeout = 10)
+ if self.currDevice is not None:
+ if len(self.currDevice["partitions"]) == 0:
+ self.session.open(MessageBox, _("No partition list found on device.\nPlease click BLUE key and do Initialize to use this device."), MessageBox.TYPE_ERROR, timeout = 10)
+ else:
+ self.showPartitionList()
else:
- self.showPartitionList()
+ self.session.open(MessageBox, _("Device not found."), MessageBox.TYPE_ERROR, timeout = 10)
elif self.currList == "partitions":
- currMountPoint = self.getCurrentPartition()["mountpoint"]
- currUuid = self.getCurrentPartition()["uuid"]
- if currMountPoint == "":
- self.currPartition = self.getCurrentPartition()
- self.showMountPointSetup()
+ currentPartition = self.getCurrentPartition()
+ if currentPartition is not None:
+ currMountPoint = currentPartition["mountpoint"]
+ currUuid = currentPartition["uuid"]
+ if currMountPoint == "":
+ self.currPartition = currentPartition
+ self.showMountPointSetup()
+ else:
+ self.doUmount(currMountPoint, self.showPartitionList)
else:
- self.doUmount(currMountPoint, self.showPartitionList)
+ self.session.open(MessageBox, _("Partition info is not found."), MessageBox.TYPE_ERROR, timeout = 10)
elif self.currList == "mountpoint":
# self["menu"].getCurrent() : (green_button, "menu description", "mount point description, "default", mountpoint, self.divpng)
currEntry = self["menu"].getCurrent()[3]
def keyYellow(self):
if self.currList == "partitions":
- partition = self.getCurrentPartition()
self.choiceBoxFstype()
def keyBlue(self):
if self.currList == "default":
device = self.getCurrentDevice()
- self.session.openWithCallback(self.deviceInitCB, DeviceInit, device["blockdev"], device["size"])
+ if device is not None:
+ self.session.openWithCallback(self.deviceInitCB, DeviceInit, device["blockdev"], device["size"])
+ else:
+ self.session.open(MessageBox, _("Device not found."), MessageBox.TYPE_ERROR, timeout = 10)
elif self.currList == "partitions":
partition = self.getCurrentPartition()
- self.session.openWithCallback(self.deviceCheckCB, DeviceCheck, partition)
+ if partition is not None:
+ self.session.openWithCallback(self.deviceCheckCB, DeviceCheck, partition)
+ else:
+ self.session.open(MessageBox, _("Partition info is not found."), MessageBox.TYPE_ERROR, timeout = 10)
def keyMenu(self):
self.session.open(DeviceManagerConfiguration)
return
else:
partition = self.getCurrentPartition()
- self.session.openWithCallback(self.deviceFormatCB, DeviceFormat, partition, choice[1])
+ if partition is not None:
+ self.session.openWithCallback(self.deviceFormatCB, DeviceFormat, partition, choice[1])
+ else:
+ self.session.open(MessageBox, _("Partition info is not found."), MessageBox.TYPE_ERROR, timeout = 10)
# about mount funcs..
def doUmount(self, mountpoint, callback):
self.exitMessageTimer = eTimer()
self.exitMessageTimer.callback.append(self.exitMessage)
self.msg = ""
+ self.fstype = None
+ self.mkfs_cmd = ""
+ self.doMkfsTimer = eTimer()
+ self.doMkfsTimer.callback.append(self.doMkfs)
+ self.doInitializeTimer = eTimer()
+ self.doInitializeTimer.callback.append(self.doInitialize)
def timerStart(self):
self.initStartTimer.start(100,True)
def InputPartitionSize_step2(self):
current_partition = len(self.inputbox_partitionSizeList)+1
if self.inputbox_partitionSizeRemain == 0:
- self.initInitializeConfirm()
+ self.choiceBoxFstype()
elif current_partition == self.inputbox_partitions:
self.inputbox_partitionSizeList.append(str(self.inputbox_partitionSizeRemain))
- self.initInitializeConfirm()
+ self.choiceBoxFstype()
else:
text = str(int(self.inputbox_partitionSizeRemain/(self.inputbox_partitions-len(self.inputbox_partitionSizeList) )))
self.session.openWithCallback(self.InputPartitionSize_step2_CB, InputBox, title=_("Input size of partition %s.(Max = %d MB)")%(current_partition,self.inputbox_partitionSizeRemain ), text=text, maxSize=False, type=Input.NUMBER)
else:
self.session.openWithCallback(self.exit ,MessageBox, _("The number you entered is wrong!"), MessageBox.TYPE_ERROR, timeout = 10)
+ def choiceBoxFstype(self):
+ menu = []
+ menu.append((_("ext2 - recommended for USB flash memory"), "ext2"))
+ menu.append((_("ext3 - recommended for harddisks"), "ext3"))
+ menu.append((_("ext4 - experimental"), "ext4"))
+ menu.append((_("vfat - for USB flash memory"), "vfat"))
+ self.session.openWithCallback(self.choiceBoxFstypeCB, ChoiceBox, title=_("Choice filesystem."), list=menu)
+
+ def choiceBoxFstypeCB(self, choice):
+ if choice is None:
+ self.exit()
+ else:
+ self.fstype = choice[1]
+ if self.fstype not in ["ext2", "ext3", "ext4", "vfat"]:
+ self.exit()
+ else:
+ self.initInitializeConfirm()
+
def initInitializeConfirm(self):
# print self.inputbox_partitionSizeList
partitionsInfo = ""
for index in range(len(self.inputbox_partitionSizeList)):
print "partition %d : %s Bytes"%(index+1, str(self.inputbox_partitionSizeList[index]))
partitionsInfo += "partition %d : %s MB\n"%(index+1, str(self.inputbox_partitionSizeList[index]))
+ partitionsInfo += "filesystem type : %s"%(self.fstype)
self.session.openWithCallback(self.initInitializeConfirmCB, MessageBoxConfirm, _("%s\nStart Device Inititlization?") % partitionsInfo , MessageBox.TYPE_YESNO)
def initInitializeConfirmCB(self,ret):
for index in range(len(self.inputbox_partitionSizeList)):
msg += _("\npartition %d : %s MB")%(index+1, str(self.inputbox_partitionSizeList[index]))
self.msgWaiting = self.session.openWithCallback(self.msgWaitingCB, MessageBox_2, msg, type = MessageBox.TYPE_INFO, enable_input = False)
- set = ""
- partitions = len(self.inputbox_partitionSizeList)
- if partitions == 1:
- cmd = 'printf "8,\n;0,0\n;0,0\n;0,0\ny\n" | sfdisk -f -uS /dev/' + self.device
- else:
- for p in range(4):
- if partitions > p+1:
- set += ",%s\n"%(self.inputbox_partitionSizeList[p])
- else:
- set +=";\n"
- set+="y\n"
- cmd = 'printf "%s" | sfdisk -f -uM /dev/%s'%(set,self.device)
- self.deviceInitConsole.ePopen(cmd, self.initInitializeFinished)
+ self.doInitializeTimer.start(500,True)
+
+ def doInitialize(self):
+ set = ""
+ partitions = len(self.inputbox_partitionSizeList)
+ if partitions == 1:
+ cmd = 'printf "8,\n;0,0\n;0,0\n;0,0\ny\n" | sfdisk -f -uS /dev/' + self.device
+ else:
+ for p in range(4):
+ if partitions > p+1:
+ set += ",%s\n"%(self.inputbox_partitionSizeList[p])
+ else:
+ set +=";\n"
+ set+="y\n"
+ cmd = 'printf "%s" | sfdisk -f -uM /dev/%s'%(set,self.device)
+ self.deviceInitConsole.ePopen(cmd, self.initInitializeFinished)
def initInitializeFinished(self, result, retval, extra_args = None):
if retval == 0:
break
partitions.close()
- if partitionsize > 64 * 1024 * 1024:
- cmd = "/sbin/mkfs.ext3 "
- filesystem = "ext3"
+ if self.fstype == "ext4":
+ cmd = "/sbin/mkfs.ext4 -F "
+ if partitionsize > 2 * 1024 * 1024: # 2GB
+ cmd += "-T largefile "
+ cmd += "-O extent,flex_bg,large_file,uninit_bg -m1 " + fulldevicename
+ elif self.fstype == "ext3":
+ cmd = "/sbin/mkfs.ext3 -F "
+ if partitionsize > 2 * 1024 * 1024:
+ cmd += "-T largefile "
+ cmd += "-m0 " + fulldevicename
+ elif self.fstype == "ext2":
+ cmd = "/sbin/mkfs.ext2 -F "
+ if partitionsize > 2 * 1024 * 1024:
+ cmd += "-T largefile "
+ cmd += "-m0 " + fulldevicename
+ elif self.fstype == "vfat":
+ if partitionsize > 4 * 1024 * 1024 * 1024:
+ cmd = "/usr/sbin/mkfs.vfat -I -S4096 " + fulldevicename
+ else:
+ cmd = "/usr/sbin/mkfs.vfat -I " + fulldevicename
else:
- cmd = "/sbin/mkfs.ext2 "
- filesystem = "ext2"
-
- if partitionsize > 2 * 1024 * 1024:
- cmd += "-T largefile "
- cmd += "-m0 " + fulldevicename
+ self.createFilesystemFinished(None, -1, (self.device, fulldevicename))
+ return
msg = _("Create filesystem, please wait ...")
msg += _("\nPartition : %s") % (fulldevicename)
- msg += _("\nFilesystem : %s") % (filesystem)
+ msg += _("\nFilesystem : %s") % (self.fstype)
msg += _("\nSize : %d MB\n")%int(self.inputbox_partitionSizeList[self.devicenumber-1])
self.msgWaitingMkfs = self.session.openWithCallback(self.msgWaitingMkfsCB, MessageBox_2, msg, type = MessageBox.TYPE_INFO, enable_input = False)
- self.deviceInitConsole.ePopen(cmd, self.createFilesystemFinished, (self.device, fulldevicename))
+ self.mkfs_cmd = cmd
+ self.doMkfsTimer.start(500,True)
+
+ def doMkfs(self):
+ fulldevicename = "/dev/" + self.device + str(self.devicenumber)
+ self.deviceInitConsole.ePopen(self.mkfs_cmd, self.createFilesystemFinished, (self.device, fulldevicename))
def createFilesystemFinished(self, result, retval, extra_args = None):
device = extra_args[0]
self.onLayoutFinish.append(self.timerStart)
self.checkStartTimer = eTimer()
self.checkStartTimer.callback.append(self.confirmMessage)
+ self.umountTimer = eTimer()
+ self.umountTimer.callback.append(self.doUnmount)
def timerStart(self):
self.checkStartTimer.start(100,True)
print "deviceCheckStart "
print "partition : ", self.partition
device = self.partition["partition"]
- mountpoint = self.partition["mountpoint"]
fstype = self.partition["fstype"]
fssize = self.partition["size"]
if device is not None and fstype.startswith("ext"):
msg += _("\nDevice : /dev/%s")%(device)
msg += _("\nFilesystem : %s")%(fstype)
self.msgWaiting = self.session.openWithCallback(self.msgWaitingCB, MessageBox_2, msg, type = MessageBox.TYPE_INFO, enable_input = False)
- if mountpoint != "":
- self.doUmountFsck(device, mountpoint, fstype)
- else:
- self.umountFsckFinished("NORESULT", 0, (device, mountpoint, fstype))
+ self.umountTimer.start(500,True)
else:
self.exit()
+ def doUnmount(self):
+ device = self.partition["partition"]
+ mountpoint = self.partition["mountpoint"]
+ fstype = self.partition["fstype"]
+ if mountpoint != "":
+ self.doUmountFsck(device, mountpoint, fstype)
+ else:
+ self.umountFsckFinished("NORESULT", 0, (device, mountpoint, fstype))
+
def doUmountFsck(self, device, mountpoint, fstype):
cmd = "umount /dev/%s" % device
self.deviceCheckConsole.ePopen(cmd, self.umountFsckFinished, (device, mountpoint, fstype))
self.onLayoutFinish.append(self.timerStart)
self.formatStartTimer = eTimer()
self.formatStartTimer.callback.append(self.DeviceFormatStart)
+ self.setHotplugDisabled = False
+ self.umountTimer = eTimer()
+ self.umountTimer.callback.append(self.doUnmount)
def timerStart(self):
self.formatStartTimer.start(100,True)
def DeviceFormatStart(self):
+ devicemanagerhotplug.setHotplugActive(False)
+ self.setHotplugDisabled = True
print "DeviceFormatStart : ", self.partition,
print "Filesystem : ",self.newfstype
device = self.partition["partition"]
devicepath = "/dev/"+device
- mountpoint = self.partition["mountpoint"]
fssize = self.partition["size"]
newfstype = self.newfstype
-
msg = _("Format filesystem, please wait ...")
msg += _("\nDevice : %s")%(devicepath)
msg += _("\nFilesystem : %s")%(newfstype)
msg += _("\nSize : %s")%(byteConversion(fssize))
- self.msgWaiting = self.session.openWithCallback(self.msgWaitingCB, MessageBox_2, msg, type = MessageBox_2.TYPE_INFO, enable_input = False)
+ self.msgWaiting = self.session.openWithCallback(self.msgWaitingCB, MessageBox_2, msg, type = MessageBox_2.TYPE_INFO, enable_input = False, msgBoxID = None)
+ self.umountTimer.start(500,True)
+
+ def doUnmount(self):
+ mountpoint = self.partition["mountpoint"]
if mountpoint != "":
self.doumountPartition()
else:
self.session.openWithCallback(self.exit, MessageBox, msg, MessageBox.TYPE_ERROR, timeout = 10)
def exit(self, ret):
+ if self.setHotplugDisabled == True:
+ devicemanagerhotplug.setHotplugActive(True)
+ self.setHotplugDisabled = False
self.close()
#device format end
def __init__(self):
self.hotplugActive = True
+ def setHotplugActive(self,value=True):
+ if value:
+ self.hotplugActive = True
+ else:
+ self.hotplugActive = False
+
def printDebug(self):
for p in harddiskmanager.partitions:
print " # partition : %s %s %s %s %s(mp, des, f_mounted, is_hot, dev)"%(p.mountpoint, p.description, p.force_mounted, p.is_hotplug,p.device)
print "[DeviceManager] Mount Failed. (Another device is already mounted)"
return
# do mount
- print "[DeviceManager] doMount"
+# print "[DeviceManager] doMount"
if not path.exists(mountpoint):
os.system("mkdir %s"%mountpoint)
if path.exists(mountpoint):
def doUmount(self, device, mountpoint):
devpath = "/dev/"+device
- if len(deviceinfo.checkMountDev(devpath)) == 0:
+ mountpoints = deviceinfo.checkMountDev(devpath)
+ if len(mountpoints) == 0:
return
- cmd = "umount %s"%devpath
- print "[DeviceManager] cmd : %s"%cmd
- os.system(cmd)
+ for mp in mountpoints:
+ cmd = "umount %s"%devpath
+ print "[DeviceManager] cmd : %s"%cmd
+ os.system(cmd)
def addHotPlugDevice(self, partition):
device = partition.device
return
# do mount
if deviceinfo.isMounted(devpath, mountpoint):
- print "[DeviceManagerHotplug] already mounted"
+ pass
+# print "[DeviceManagerHotplug] already mounted"
else:
self.doMount(uuid, devpath, mountpoint, filesystem)
if uuid_cfg == uuid:
# do mount
if deviceinfo.isMounted(devpath, mountpoint_cfg):
- print "[Devicemanager startup] already mounted"
+# print "[Devicemanager startup] already mounted"
self.addPartitionAutofsMountpoint(devpath, mountpoint_cfg)
else:
# print "[autoMountOnStartup] do mount(%s %s %s)"%(devpath, configmountpoint, filesystem)
continue
devpath, mountpoint = x.split()[:2]
mounts.append((path.basename(devpath), mountpoint))
-# print "[DeviceManager] mounts : ",mounts
+# get blkid info
data = self.getBlkidInfo()
# check configList
for c in configList:
if uuid_cfg in data.keys():
device_cfg = data[uuid_cfg]
if device_cfg is None:
- return
+ continue
for (device, mountpoint) in mounts:
if device_cfg == device:
if not deviceinfo.isFstabAutoMounted(uuid_cfg, "/dev/"+device_cfg, mountpoint_cfg):
def getBlkidInfo(self):
data = {}
- blkid_lines = os.popen("blkid -c /dev/NULL /dev/sd*").readlines()
- for line in blkid_lines:
+ blkid_data = os.popen("blkid -c /dev/NULL /dev/sd*").read()
+ for line in blkid_data.split('\n'):
+# print "[DeviceManager] getBlkidInfo line : ",line
device = uuid = ""
device = path.basename(line.split(':')[0])
if line.find(" UUID=") != -1:
if noMountable_dev != "":
print "Umountable partitions found."
- InfoText = _("No mountable devices found.! (%s)\nDo you want to open DeviceManager and do initialize or format this device?\n\n(Open 'Menu->Setup->System -> Harddisk -> DeviceManager'\n and press MENU button to deactivate this check.)"%noMountable_dev)
+ InfoText = _("No mountable devices found.! (%s)\nDo you want to open DeviceManager and do initialize or format this device?\n\n(Open 'Menu->Setup->System -> Harddisk -> DeviceManager'\n and press MENU button to deactivate this check.)")%noMountable_dev
AddNotificationWithCallback(
boundFunction(callBackforDeviceManager, session),
MessageBox, InfoText, timeout = 60, default = False
devicemanagerhotplug.umountOnShutdown()
def menu(menuid, **kwargs):
- if menuid == "harddisk":
- return [(_("DeviceManager"), main, "device_manager", 1)]
+ if menuid == "system":
+ return [(_("DeviceManager"), main, "device_manager", 50)]
return []
def main(session, **kwargs):