Changeset 28631 in vbox
- Timestamp:
- Apr 23, 2010 8:57:19 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxShell/vboxshell.py
r28621 r28631 225 225 p.waitForCompletion(wait) 226 226 ctx['global'].waitForEvents(0) 227 return 0 227 228 except KeyboardInterrupt: 228 229 print "Interrupted." 230 if p.cancelable: 231 print "Canceling task..." 232 p.cancel() 233 return 1 234 229 235 230 236 … … 439 445 machine.saveSettings() 440 446 447 def cond(c,v1,v2): 448 if c: 449 return v1 450 else: 451 return v2 452 453 def printHostUsbDev(ctx,ud): 454 print " %s: %s (vendorId=%d productId=%d serial=%s) %s" %(ud.id, ud.product, ud.vendorId, ud.productId, ud.serialNumber,getUSBStateString(ud.state)) 455 456 def printUsbDev(ctx,ud): 457 print " %s: %s (vendorId=%d productId=%d serial=%s)" %(ud.id, ud.product, ud.vendorId, ud.productId, ud.serialNumber) 458 459 def printSf(ctx,sf): 460 print "name=%s host=%s %s %s" %(sf.name, sf.hostPath, cond(sf.accessible, "accessible", "not accessible"), cond(sf.writable, "writable", "read-only")) 461 441 462 def ginfo(ctx,console, args): 442 463 guest = console.guest … … 450 471 else: 451 472 print "No additions" 473 usbs = ctx['global'].getArray(console, 'USBDevices') 474 print "Attached USB:" 475 for ud in usbs: 476 printUsbDev(ctx,ud) 477 rusbs = ctx['global'].getArray(console, 'remoteUSBDevices') 478 print "Remote USB:" 479 for ud in rusbs: 480 printHostUsbDev(ctx,ud) 481 print "Transient shared folders:" 482 sfs = rusbs = ctx['global'].getArray(console, 'sharedFolders') 483 for sf in sfs: 484 printSf(ctx,sf) 452 485 453 486 def cmdExistingVm(ctx,mach,cmd,args): … … 487 520 'plugcpu': lambda: plugCpu(ctx, session.machine, session, args), 488 521 'unplugcpu': lambda: unplugCpu(ctx, session.machine, session, args), 489 'mountiso': lambda: mountIso(ctx, session.machine, session, args) 522 'mountiso': lambda: mountIso(ctx, session.machine, session, args), 490 523 } 491 524 try: … … 1032 1065 print "USB devices:" 1033 1066 for ud in ctx['global'].getArray(host, 'USBDevices'): 1034 print " %s (vendorId=%d productId=%d serial=%s) %s" %(ud.product, ud.vendorId, ud.productId, ud.serialNumber, getUSBStateString(ud.state))1067 printUsbHostDev(ctx,ud) 1035 1068 1036 1069 if ctx['perf']: … … 1269 1302 p = app.write(format, path) 1270 1303 progressBar(ctx, p) 1271 print "Exported to %s in format %s" %(path, format) 1304 if (p.completed and int(p.resultCode) == 0): 1305 print "Exported to %s in format %s" %(path, format) 1272 1306 return 0 1273 1307 … … 1503 1537 return 0 1504 1538 1539 def listUsbCmd(ctx,args): 1540 if (len(args) > 1): 1541 print "usage: listUsb" 1542 return 0 1543 1544 host = ctx['vb'].host 1545 for ud in ctx['global'].getArray(host, 'USBDevices'): 1546 printHostUsbDev(ctx,ud) 1547 1548 return 0 1549 1505 1550 def createHddCmd(ctx,args): 1506 1551 if (len(args) < 3): … … 1812 1857 return 0 1813 1858 1859 def usbctr(ctx,mach,console,args): 1860 if (args[0]): 1861 console.attachUSBDevice(args[1]) 1862 else: 1863 console.detachUSBDevice(args[1]) 1864 1865 def attachUsbCmd(ctx,args): 1866 if (len(args) < 3): 1867 print "usage: attachUsb vm deviceuid" 1868 return 0 1869 1870 mach = argsToMach(ctx,args) 1871 if mach is None: 1872 return 0 1873 dev = args[2] 1874 cmdExistingVm(ctx, mach, 'guestlambda', [usbctr,True,dev]) 1875 return 0 1876 1877 def detachUsbCmd(ctx,args): 1878 if (len(args) < 3): 1879 print "usage: detachUsb vm deviceuid" 1880 return 0 1881 1882 mach = argsToMach(ctx,args) 1883 if mach is None: 1884 return 0 1885 dev = args[2] 1886 cmdExistingVm(ctx, mach, 'guestlambda', [usbctr,False,dev]) 1887 return 0 1814 1888 1815 1889 aliases = {'s':'start', … … 1877 1951 'attachCtr': ['Attach storage controller to the VM: attachCtr win Ctr0 IDE ICH6', attachCtrCmd, 0], 1878 1952 'detachCtr': ['Detach HDD from the VM: detachCtr win Ctr0', detachCtrCmd, 0], 1879 'listMediums': ['List mediums known to this VBox instance', listMediumsCmd, 0] 1953 'attachUsb': ['Attach USB device to the VM (use listUsb to show available devices): attachUsb win uuid', attachUsbCmd, 0], 1954 'detachUsb': ['Detach USB device from the VM: detachUsb win uui', detachUsbCmd, 0], 1955 'listMediums': ['List mediums known to this VBox instance', listMediumsCmd, 0], 1956 'listUsb': ['List known USB devices', listUsbCmd, 0] 1880 1957 } 1881 1958
Note:
See TracChangeset
for help on using the changeset viewer.