Skip to content
Snippets Groups Projects
Commit 861f4465 authored by efer's avatar efer
Browse files

add copyright, license and version

parent 01428ed2
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/python3
#!/usr/bin/env python3
#
# Copyright (c) 2018 Ejner Fergo efer@dtu.dk
#
# License: This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as published
# by the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version. This program is distributed in the
# hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.
#
__version__ = '0.1'
import os
from time import sleep
......@@ -20,14 +32,16 @@ C = pyudev.Context()
DISKS = []
DINFO = {}
for device in C.list_devices(subsystem='block', DEVTYPE='disk'):
dev = device.device_node
# Ignore USB and CDROM
if device.get('ID_BUS') == 'ata' and device.get('ID_TYPE') == 'disk':
# Ignore HDD
if device.get('ID_ATA_ROTATION_RATE_RPM') == '0':
DISKS.append(device.device_node)
DINFO[device.device_node] = device.get('ID_MODEL'), 'SSD'
DISKS.append(dev)
DINFO[dev] = device.get('ID_MODEL'), 'SSD'
if 'nvme' in device.get('DEVNAME'):
DISKS.append(device.device_node)
DINFO[device.device_node] = device.get('ID_SERIAL'), 'NVMe'
DISKS.append(dev)
DINFO[dev] = device.get('ID_SERIAL'), 'NVMe'
# Colours
RED = '\033[91m'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment