From 2fb2c3fa6e0cde6f9a1769755dcfdbd05fbfa6a8 Mon Sep 17 00:00:00 2001 From: 2Shirt <2xShirt@gmail.com> Date: Thu, 19 Dec 2019 11:31:32 -0700 Subject: [PATCH] Adjusted loopback device descriptions --- scripts/wk/hw/ddrescue.py | 6 +++--- scripts/wk/hw/obj.py | 9 +++++++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/scripts/wk/hw/ddrescue.py b/scripts/wk/hw/ddrescue.py index 91061c59..ce4ad70a 100644 --- a/scripts/wk/hw/ddrescue.py +++ b/scripts/wk/hw/ddrescue.py @@ -545,9 +545,9 @@ def select_disk(prompt, skip_disk=None): def select_disk_parts(prompt, disk): """Select disk parts from list, returns list of Disk().""" - menu = std.Menu( - title=std.color_string(f'ddrescue TUI: Part Selection', 'GREEN'), - ) + title = std.color_string(f'ddrescue TUI: Partition Selection', 'GREEN') + title += f'\n\nDisk: {disk.path} {disk.description}' + menu = std.Menu(title) menu.separator = ' ' menu.add_action('Proceed') menu.add_action('Quit') diff --git a/scripts/wk/hw/obj.py b/scripts/wk/hw/obj.py index 933bc610..f473afaf 100644 --- a/scripts/wk/hw/obj.py +++ b/scripts/wk/hw/obj.py @@ -310,8 +310,9 @@ class Disk(BaseObj): self.details = get_disk_details_linux(self.path) # Set necessary details - self.details['bus'] = str(self.details.get('bus', '???')) - self.details['bus'] = self.details['bus'].upper().replace('NVME', 'NVMe') + self.details['bus'] = str(self.details.get('bus', '???')).upper() + self.details['bus'] = self.details['bus'].replace('IMAGE', 'Image') + self.details['bus'] = self.details['bus'].replace('NVME', 'NVMe') self.details['model'] = self.details.get('model', 'Unknown Model') self.details['name'] = self.details.get('name', self.path) self.details['phy-sec'] = self.details.get('phy-sec', 512) @@ -580,6 +581,10 @@ def get_disk_details_linux(path): dev['bus'] = dev.pop('tran', '???') dev['parent'] = dev.pop('pkname', None) dev['ssd'] = not dev.pop('rota', True) + if 'loop' in str(path) and dev['bus'] is None: + dev['bus'] = 'Image' + dev['model'] = '' + dev['serial'] = '' # Done return details