/** * Get a list of USB devices attached to a given VM * * @param array $args array of arguments. See function body for details. * @return array list of devices */ public function remote_consoleGetUSBDevices($args) { // Connect to vboxwebsrv $this->connect(); /* @var $machine IMachine */ $machine = $this->vbox->findMachine($args['vm']); $this->session = $this->websessionManager->getSessionObject($this->vbox->handle); $machine->lockMachine($this->session->handle, 'Shared'); $response = array(); foreach ($this->session->console->USBDevices as $u) { /* @var $u IUSBDevice */ $response[$u->id] = array('id' => $u->id, 'remote' => $u->remote); $u->releaseRemote(); } $this->session->unlockMachine(); unset($this->session); $machine->releaseRemote(); return $response; }