Skip to content

Commit

Permalink
[FlashManager]
Browse files Browse the repository at this point in the history
* fix findMedia
  • Loading branch information
jbleyel committed Jan 8, 2025
1 parent 9f27c45 commit f3fa31a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/python/Screens/FlashManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ def checkMedia(self, choice):
if choice:
def findMedia(paths):
def availableSpace(path):
if "/mmc" not in path and isdir(path) and access(path, W_OK):
if isdir(path) and access(path, W_OK):
try:
fs = statvfs(path)
return (fs.f_bavail * fs.f_frsize) / (1 << 20)
Expand All @@ -405,7 +405,7 @@ def checkIfDevice(path, diskStats):
deviceID = stat(path).st_dev
return (major(deviceID), minor(deviceID)) in diskStats

diskStats = [(int(x[0]), int(x[1])) for x in [x.split()[0:3] for x in open("/proc/diskstats").readlines()] if x[2].startswith("sd")]
diskStats = [(int(x[0]), int(x[1])) for x in [x.split()[0:3] for x in open("/proc/diskstats").readlines()] if x[2].startswith("sd") or x[2].startswith("mmc")]
for path in paths:
if isdir(path) and checkIfDevice(path, diskStats) and availableSpace(path) > 500:
return (path, True)
Expand Down

0 comments on commit f3fa31a

Please sign in to comment.