VirtualBox

Ignore:
Timestamp:
Jan 24, 2011 2:22:39 PM (14 years ago)
Author:
vboxsync
Message:

vboxshell: lspci command

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxShell/vboxshell.py

    r35569 r35675  
    5252    'green':'\033[92m',
    5353    'yellow':'\033[93m',
    54     'magenta':'\033[35m'
     54    'magenta':'\033[35m',
     55    'cyan':'\033[36m'
    5556    }
    5657def colored(string,color):
     
    204205def colSize(ctx,m):
    205206    return colored(m, 'red')
     207
     208def colPci(ctx,vm):
     209    return colored(vm, 'green')
     210
     211def colDev(ctx,vm):
     212    return colored(vm, 'cyan')
    206213
    207214def colSizeM(ctx,m):
     
    30753082        dur = float(args[3])
    30763083    cmdExistingVm(ctx, mach, 'guestlambda', [lambda ctx,mach,console,args:  playbackDemo(ctx, console, filename, dur)])
     3084    return 0
     3085
     3086
     3087def pciAddr(ctx,addr):
     3088    str = "%d:%d.%d" %(addr >> 8, (addr & 0xff) >> 3, addr & 7)
     3089    return colPci(ctx, str)
     3090
     3091def lspci(ctx, console):
     3092    assigned = ctx['global'].getArray(console.machine, 'pciDeviceAssignments')
     3093    for a in assigned:
     3094        if a.isPhysicalDevice:
     3095            print "%s: assigned host device %s" %(colDev(ctx, a.name), pciAddr(ctx, a.hostAddress))
     3096
     3097    atts = ctx['global'].getArray(console, 'attachedPciDevices')
     3098    for a in atts:
     3099        if a.isPhysicalDevice:
     3100            print "%s: physical, guest %s, host %s" %(colDev(a.name), pciAddr(ctx, a.guestAddress), pciAddr(ctx, a.hostAddress))
     3101        else:
     3102            print "%s: virtual, guest %s" %(colDev(ctx, a.name), pciAddr(ctx, a.guestAddress))
     3103    return
     3104
     3105
     3106def lspciCmd(ctx, args):
     3107    if (len(args) < 2):
     3108        print "usage: lspci vm"
     3109        return 0
     3110    mach = argsToMach(ctx,args)
     3111    if mach == None:
     3112        return 0
     3113    cmdExistingVm(ctx, mach, 'guestlambda', [lambda ctx,mach,console,args:  lspci(ctx, console)])
    30773114    return 0
    30783115
     
    31583195            'nat':['NAT (network address translation engine) manipulation, nat help for more info', natCmd, 0],
    31593196            'nic' : ['Network adapter management', nicCmd, 0],
    3160             'prompt' : ['Control prompt', promptCmd, 0],
     3197            'prompt' : ['Control shell prompt', promptCmd, 0],
    31613198            'foreachvm' : ['Perform command for each VM', foreachvmCmd, 0],
    31623199            'foreach' : ['Generic "for each" construction, using XPath-like notation: foreach //vms/vm[@OSTypeId=\'MacOS\'] "print obj.name"', foreachCmd, 0],
    31633200            'recordDemo':['Record demo: recordDemo Win32 file.dmo 10', recordDemoCmd, 0],
    3164             'playbackDemo':['Playback demo: playbackDemo Win32 file.dmo 10', playbackDemoCmd, 0]
     3201            'playbackDemo':['Playback demo: playbackDemo Win32 file.dmo 10', playbackDemoCmd, 0],
     3202            'lspci': ['List PCI devices attached to the VM: lspci Win32', lspciCmd]
    31653203            }
    31663204
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette