File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change 2525from .newsRenderer import NewsRenderer
2626
2727sd_path = ""
28- sd_wad_path = ""
28+ sd_wad_path = "WAD "
2929
3030
3131def get_devices (removable_only = True ):
3232 devices = {}
3333 for part in psutil .disk_partitions ():
34- if removable_only and check_removable (part ):
34+ if removable_only and not check_removable (part ):
3535 continue
3636 try :
3737 capacity = psutil .disk_usage (part .mountpoint ).total
@@ -56,9 +56,14 @@ def check_removable(device: psutil._common.sdiskpart):
5656 return "Removable Media: Yes" in device_info
5757 case "linux" :
5858 context = pyudev .Context ()
59- device_name = os .path .basename (device .device )
6059
61- udev_device = pyudev .Devices .from_device_file (context , device_name )
60+ udev_partition = pyudev .Devices .from_device_file (context , device .device )
61+
62+ if udev_partition .device_type != "disk" :
63+ udev_device = udev_partition .find_parent ("block" , "disk" )
64+ else :
65+ udev_device = udev_partition
66+
6267 return udev_device .attributes .get ("removable" ) == b"1"
6368 case _:
6469 return True
You can’t perform that action at this time.
0 commit comments