|
@@ -76,10 +76,12 @@ class DeviceAssignment(object): # pylint: disable=too-few-public-methods
|
|
class DeviceInfo(object):
|
|
class DeviceInfo(object):
|
|
''' Holds all information about a device '''
|
|
''' Holds all information about a device '''
|
|
# pylint: disable=too-few-public-methods
|
|
# pylint: disable=too-few-public-methods
|
|
- def __init__(self, backend_domain, ident, description=None,
|
|
|
|
|
|
+ def __init__(self, backend_domain, devclass, ident, description=None,
|
|
options=None, **kwargs):
|
|
options=None, **kwargs):
|
|
#: domain providing this device
|
|
#: domain providing this device
|
|
self.backend_domain = backend_domain
|
|
self.backend_domain = backend_domain
|
|
|
|
+ #: device class
|
|
|
|
+ self.devclass = devclass
|
|
#: device identifier (unique for given domain and device type)
|
|
#: device identifier (unique for given domain and device type)
|
|
self.ident = ident
|
|
self.ident = ident
|
|
#: human readable description/name of the device
|
|
#: human readable description/name of the device
|
|
@@ -107,12 +109,12 @@ class UnknownDevice(DeviceInfo):
|
|
# pylint: disable=too-few-public-methods
|
|
# pylint: disable=too-few-public-methods
|
|
'''Unknown device - for example exposed by domain not running currently'''
|
|
'''Unknown device - for example exposed by domain not running currently'''
|
|
|
|
|
|
- def __init__(self, backend_domain, ident, description=None,
|
|
|
|
|
|
+ def __init__(self, backend_domain, devclass, ident, description=None,
|
|
**kwargs):
|
|
**kwargs):
|
|
if description is None:
|
|
if description is None:
|
|
description = "Unknown device"
|
|
description = "Unknown device"
|
|
- super(UnknownDevice, self).__init__(backend_domain, ident, description,
|
|
|
|
- **kwargs)
|
|
|
|
|
|
+ super(UnknownDevice, self).__init__(backend_domain, devclass, ident,
|
|
|
|
+ description, **kwargs)
|
|
|
|
|
|
|
|
|
|
class DeviceCollection(object):
|
|
class DeviceCollection(object):
|
|
@@ -229,7 +231,8 @@ class DeviceCollection(object):
|
|
info, _, description = info.partition('description=')
|
|
info, _, description = info.partition('description=')
|
|
info_dict = dict(info_single.split('=', 1)
|
|
info_dict = dict(info_single.split('=', 1)
|
|
for info_single in info.split(' ') if info_single)
|
|
for info_single in info.split(' ') if info_single)
|
|
- yield DeviceInfo(self._vm, ident, description=description,
|
|
|
|
|
|
+ yield DeviceInfo(self._vm, self._class, ident,
|
|
|
|
+ description=description,
|
|
options=None, **info_dict)
|
|
options=None, **info_dict)
|
|
|
|
|
|
def update_persistent(self, device, persistent):
|
|
def update_persistent(self, device, persistent):
|
|
@@ -271,7 +274,7 @@ class DeviceCollection(object):
|
|
return dev
|
|
return dev
|
|
# if still nothing, return UnknownDevice instance for the reason
|
|
# if still nothing, return UnknownDevice instance for the reason
|
|
# explained in docstring, but don't cache it
|
|
# explained in docstring, but don't cache it
|
|
- return UnknownDevice(self._vm, item)
|
|
|
|
|
|
+ return UnknownDevice(self._vm, self._class, item)
|
|
|
|
|
|
|
|
|
|
|
|
|