VirtualBox

Ignore:
Timestamp:
Apr 14, 2016 1:45:31 PM (9 years ago)
Author:
vboxsync
Message:

ValidationKit/usb: More fixes for the server and client side

Location:
trunk/src/VBox/ValidationKit/tests/usb
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/tests/usb/tdUsb1.py

    r60488 r60493  
    295295        if fRc is True:
    296296            reporter.log('Connect succeeded');
    297             self.oVBox.host.addUSBDeviceSource('USBIP', sGadgetHost, sGadgetHost, [], []);
     297            self.oVBox.host.addUSBDeviceSource('USBIP', sGadgetHost, sGadgetHost + (':%s' % oUsbGadget.getUsbIpPort()), [], []);
    298298
    299299            # Create device filter
     
    341341        if fRc is True:
    342342            reporter.log('Connect succeeded');
    343             self.oVBox.host.addUSBDeviceSource('USBIP', sGadgetHost, sGadgetHost, [], []);
     343            self.oVBox.host.addUSBDeviceSource('USBIP', sGadgetHost, sGadgetHost + ':' + oUsbGadget.getUsbIpPort(), [], []);
    344344
    345345            # Create device filter
  • trunk/src/VBox/ValidationKit/tests/usb/usbgadget2.py

    r60489 r60493  
    416416                        return None;
    417417                    abPayload.extend(u32ToByteArray(o));
     418                elif isinstance(o, types.IntType):
     419                    if o < 0 or o > 0xffffffff:
     420                        reporter.fatal('sendMsg: uint32_t payload is out of range: %s' % (hex(o)));
     421                        return None;
     422                    abPayload.extend(u32ToByteArray(o));
    418423                elif isinstance(o, array.array):
    419424                    abPayload.extend(o);
     
    627632        if sOpcode == "ACK":
    628633            return True;
    629         return (sOpcode, getSZ(abPayload, 0, sOpcode));
     634        return (sOpcode, getSZ(abPayload, 16, sOpcode));
    630635
    631636    def recvAckLogged(self, sCommand, fNoDataOk = False):
     
    659664        if sOpcode == "FALSE":
    660665            return False;
    661         reporter.maybeErr(self.fErr, 'recvAckLogged: %s response was %s: %s' % (sCommand, sOpcode, getSZ(abPayload, 0, sOpcode)));
     666        reporter.maybeErr(self.fErr, 'recvAckLogged: %s response was %s: %s' % (sCommand, sOpcode, getSZ(abPayload, 16, sOpcode)));
    662667        return None;
    663668
     
    721726        sHostname = socket.gethostname().lower();
    722727        cbFill = 68 - len(sHostname) - 1;
    723         rc = self.sendMsg("HOWDY", (long((1 << 16) | 0), long(0x1), long(len(sHostname)), sHostname, zeroByteArray(cbFill)));
     728        rc = self.sendMsg("HOWDY", ((1 << 16) | 0, 0x1, len(sHostname), sHostname, zeroByteArray(cbFill)));
    724729        if rc is True:
    725730            rc = self.recvAckLogged("HOWDY", self.fTryConnect);
     
    746751    def taskGadgetCreate(self, iGadgetType, iGadgetAccess):
    747752        """Creates a new gadget on UTS"""
    748         fRc = self.sendMsg("GDGTCRT", (iGadgetType, iGadgetAccess, 0));
     753        fRc = self.sendMsg("GDGTCRT", (iGadgetType, iGadgetAccess, 0, 0));
    749754        if fRc is True:
    750755            fRc = self.recvAckLogged("GDGTCRT");
     
    842847        """
    843848        return self.startTask(cMsTimeout, fIgnoreErrors, "GadgetCreate", self.taskGadgetCreate, \
    844                               (long(iGadgetType), long(iGadgetAccess)));
     849                              (iGadgetType, iGadgetAccess));
    845850
    846851    def syncGadgetCreate(self, iGadgetType, iGadgetAccess, cMsTimeout = 30000, fIgnoreErrors = False):
     
    857862        """
    858863        return self.startTask(cMsTimeout, fIgnoreErrors, "GadgetDestroy", self.taskGadgetDestroy, \
    859                               (long(iGadgetId), ));
     864                              (iGadgetId, ));
    860865
    861866    def syncGadgetDestroy(self, iGadgetId, cMsTimeout = 30000, fIgnoreErrors = False):
     
    13271332        fRc = False;
    13281333        if sImpersonation == g_ksGadgetImpersonationTest:
    1329             fRc = self.oUtsSession.syncGadgetCreate(g_kiGadgetTypeTest);
     1334            fRc = self.oUtsSession.syncGadgetCreate(g_kiGadgetTypeTest, g_kiGadgetAccessUsbIp);
    13301335        else:
    13311336            reporter.log('Invalid or unsupported impersonation');
     
    13581363                print 'connect: waitForTask -> %s, result %s' % (fDone, self.oUtsSession.getResult());
    13591364                if fDone is True and self.oUtsSession.isSuccess():
    1360                     fRc = True;
     1365                    # Parse the reply.
     1366                    _, _, abPayload = self.oUtsSession.getLastReply();
     1367
     1368                    if getU32(abPayload, 20) is g_kiGadgetAccessUsbIp:
     1369                        fRc = True;
     1370                        self.iUsbIpPort = getU32(abPayload, 24);
     1371                    else:
     1372                        reporter.log('Gadget doesn\'t support access over USB/IP despite being requested');
     1373                        fRc = False;
    13611374                else:
    13621375                    fRc = False;
     
    13761389
    13771390        self._clearImpersonation();
    1378         self._cleanupGadget();
    13791391        if self.oUtsSession is not None:
    13801392            fRc = self.oUtsSession.syncDisconnect();
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