mirror of
https://github.com/mbusb/multibootusb
synced 2024-11-01 15:40:16 +00:00
linux: rethink device detection logic
Don't rely on ID_USB udev item Should fix #110
This commit is contained in:
parent
4dcf38d523
commit
42f97f3a3c
@ -98,15 +98,16 @@ def list_devices(partition=1, fixed=False):
|
|||||||
import pyudev
|
import pyudev
|
||||||
context = pyudev.Context()
|
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:
|
if fixed is True:
|
||||||
for device in context.list_devices(subsystem='block'):
|
for device in context.list_devices(subsystem='block'):
|
||||||
if device.get('ID_BUS') in ("usb", "scsi", "ata") and device['DEVTYPE'] in ['disk', 'partition']:
|
if device.get('DEVTYPE') in ['disk', 'partition'] and device.get('ID_PART_TABLE_TYPE'):
|
||||||
devices.append(str(device['DEVNAME']))
|
if device['DEVNAME'] not in devices:
|
||||||
gen.log("\t" + device['DEVNAME'])
|
devices.append(str(device['DEVNAME']))
|
||||||
else:
|
gen.log("\t" + device['DEVNAME'])
|
||||||
for device in context.list_devices(subsystem='block', ID_BUS="usb"):
|
|
||||||
devices.append(str(device['DEVNAME']))
|
|
||||||
gen.log("\t" + device['DEVNAME'])
|
|
||||||
|
|
||||||
except:
|
except:
|
||||||
import dbus
|
import dbus
|
||||||
|
Loading…
Reference in New Issue
Block a user