[virt-tools-list] [PATCH 1/2] details: the bus, device values of USB device is decimal rather than hex
Cole Robinson
crobinso at redhat.com
Fri Apr 26 19:56:11 UTC 2013
On 04/23/2013 09:30 AM, Guannan Ren wrote:
> Although the code in lookup_nodedev() is general to deal with
> hostdev, it has to seperate USB device from PCI device there.
> For PCI device, the domain/bus/slot/function is hex.
> For USB device, the bus/device is decimal.
>
> This fix makes the label use hostdev pretty_name:
>
> +------------------------------------------------------+
> | Physical USB Device |
> | Device: 006:032 RSA RSA SecureID (R) Authenticator |
> ---
> virtManager/details.py | 24 +++++++++++++++---------
> 1 file changed, 15 insertions(+), 9 deletions(-)
>
> diff --git a/virtManager/details.py b/virtManager/details.py
> index cd18aa8..f43fefe 100644
> --- a/virtManager/details.py
> +++ b/virtManager/details.py
> @@ -270,19 +270,25 @@ def lookup_nodedev(vmmconn, hostdev):
> return None
> return getattr(node, attr)
>
> - devtype = hostdev.type
> - vendor_id = hostdev.vendor or -1
> - product_id = hostdev.product or -1
> - device = intify(hostdev.device, True)
> - bus = intify(hostdev.bus, True)
> - domain = intify(hostdev.domain, True)
> - func = intify(hostdev.function, True)
> - slot = intify(hostdev.slot, True)
> + devtype = hostdev.type
> found_dev = None
>
> + vendor_id = product_id = bus = device = \
> + domain = slot = function = None
> +
> # For USB we want a device, not a bus
> if devtype == 'usb':
> - devtype = 'usb_device'
> + devtype = 'usb_device'
> + vendor_id = hostdev.vendor or -1
> + product_id = hostdev.product or -1
> + bus = intify(hostdev.bus)
> + device = intify(hostdev.device)
> +
> + elif devtype == 'pci':
> + domain = intify(hostdev.domain, True)
> + bus = intify(hostdev.bus, True)
> + slot = intify(hostdev.slot, True)
> + func = intify(hostdev.function, True)
>
> devs = vmmconn.get_nodedevs(devtype, None)
> for dev in devs:
>
Thanks, applied.
- Cole
More information about the virt-tools-list
mailing list