2
0
mirror of https://github.com/mbusb/multibootusb synced 2024-11-01 15:40:16 +00:00

Merge pull request #131 from alindt/no-bus-check

linux: rethink device detection logic
This commit is contained in:
multibootusb 2017-04-20 06:34:09 +05:30 committed by GitHub
commit a150156509

View File

@ -98,15 +98,16 @@ def list_devices(partition=1, fixed=False):
import pyudev
context = pyudev.Context()
for device in context.list_devices(subsystem='block', ID_BUS="usb"):
devices.append(str(device['DEVNAME']))
gen.log("\t" + device['DEVNAME'])
if fixed is True:
for device in context.list_devices(subsystem='block'):
if device.get('ID_BUS') in ("usb", "scsi", "ata") and device['DEVTYPE'] in ['disk', 'partition']:
devices.append(str(device['DEVNAME']))
gen.log("\t" + device['DEVNAME'])
else:
for device in context.list_devices(subsystem='block', ID_BUS="usb"):
devices.append(str(device['DEVNAME']))
gen.log("\t" + device['DEVNAME'])
if device.get('DEVTYPE') in ['disk', 'partition'] and device.get('ID_PART_TABLE_TYPE'):
if device['DEVNAME'] not in devices:
devices.append(str(device['DEVNAME']))
gen.log("\t" + device['DEVNAME'])
except:
import dbus