[udev] fix automount.
authorhschang <chang@dev3>
Thu, 22 Feb 2018 05:19:57 +0000 (14:19 +0900)
committerhschang <chang@dev3>
Thu, 22 Feb 2018 05:19:57 +0000 (14:19 +0900)
meta-openvuplus/recipes-core/udev/udev-182/automount.py
meta-openvuplus/recipes-core/udev/udev-182/vuzero4k/automount.py
meta-openvuplus/recipes-core/udev/udev_182.bbappend

index 05848d2..69f5a68 100755 (executable)
@@ -39,12 +39,25 @@ def isMountedByDevName(devName):
        return ismounted
 
 def isUsbDevice(dev_base):
        return ismounted
 
 def isUsbDevice(dev_base):
-       phyPath = os.path.realpath('/sys/block/' + dev_base)
+       phyPath = os.path.realpath('/sys/block/' + dev_base + '/device')
        for x in glob.glob("/sys/bus/usb/devices/usb*"):
                if phyPath.find(os.path.realpath(x)) != -1:
                        return True
        return False
 
        for x in glob.glob("/sys/bus/usb/devices/usb*"):
                if phyPath.find(os.path.realpath(x)) != -1:
                        return True
        return False
 
+def checkFilesystem(device):
+       p = os.popen("blkid %s" % device)
+       data = p.read()
+       p.close()
+
+       fs = None
+       for x in data.split():
+               if x.startswith('TYPE') and x.find('=') != -1:
+                       fs = x.split('=')[1].strip('"')
+                       break
+
+       return fs
+
 def automount():
        kernel = sys.argv[1]
        dev_kernel = os.path.join("/dev/", kernel)
 def automount():
        kernel = sys.argv[1]
        dev_kernel = os.path.join("/dev/", kernel)
@@ -84,7 +97,15 @@ def automount():
                if not os.access(mountPoint, os.F_OK):
                        return
 
                if not os.access(mountPoint, os.F_OK):
                        return
 
-       if os.system("mount -t auto -o noatime %s %s" % (dev_kernel, mountPoint)):
+       fs = checkFilesystem(dev_kernel)
+       if fs == "ntfs":
+               cmd = "mount.ntfs-3g %s %s" % (dev_kernel, mountPoint)
+       else:
+               cmd = "mount -t auto -o noatime %s %s" % (dev_kernel, mountPoint)
+
+       ret = os.system(cmd)
+
+       if ret:
                os.rmdir(mountPoint)
        else:
                if mountPoint == "/media/hdd":
                os.rmdir(mountPoint)
        else:
                if mountPoint == "/media/hdd":
index c70d38e..ed34b2a 100755 (executable)
@@ -39,12 +39,25 @@ def isMountedByDevName(devName):
        return ismounted
 
 def isUsbDevice(dev_base):
        return ismounted
 
 def isUsbDevice(dev_base):
-       phyPath = os.path.realpath('/sys/block/' + dev_base)
+       phyPath = os.path.realpath('/sys/block/' + dev_base + '/device')
        for x in glob.glob("/sys/bus/usb/devices/usb*"):
                if phyPath.find(os.path.realpath(x)) != -1:
                        return True
        return False
 
        for x in glob.glob("/sys/bus/usb/devices/usb*"):
                if phyPath.find(os.path.realpath(x)) != -1:
                        return True
        return False
 
+def checkFilesystem(device):
+       p = os.popen("blkid %s" % device)
+       data = p.read()
+       p.close()
+
+       fs = None
+       for x in data.split():
+               if x.startswith('TYPE') and x.find('=') != -1:
+                       fs = x.split('=')[1].strip('"')
+                       break
+
+       return fs
+
 def automount():
        kernel = sys.argv[1]
        dev_kernel = os.path.join("/dev/", kernel)
 def automount():
        kernel = sys.argv[1]
        dev_kernel = os.path.join("/dev/", kernel)
@@ -83,7 +96,15 @@ def automount():
                if not os.access(mountPoint, os.F_OK):
                        return
 
                if not os.access(mountPoint, os.F_OK):
                        return
 
-       if os.system("mount -t auto -o noatime %s %s" % (dev_kernel, mountPoint)):
+       fs = checkFilesystem(dev_kernel)
+       if fs == "ntfs":
+               cmd = "mount.ntfs-3g %s %s" % (dev_kernel, mountPoint)
+       else:
+               cmd = "mount -t auto -o noatime %s %s" % (dev_kernel, mountPoint)
+
+       ret = os.system(cmd)
+
+       if ret:
                os.rmdir(mountPoint)
        else:
                if mountPoint == "/media/hdd":
                os.rmdir(mountPoint)
        else:
                if mountPoint == "/media/hdd":
index a5599d6..06620a1 100644 (file)
@@ -1,4 +1,4 @@
-PR .= "-vuplus6"
+PR .= "-vuplus7"
 
 SRC_URI += " \
        file://99_vuplus.rules \
 
 SRC_URI += " \
        file://99_vuplus.rules \