# -*- coding: utf-8 -*-
# $Id$
# pylint: disable=C0302
"""
VirtualBox USB gadget control class
"""
__copyright__ = \
"""
Copyright (C) 2014 Oracle Corporation
This file is part of VirtualBox Open Source Edition (OSE), as
available from http://www.virtualbox.org. This file is free software;
General Public License (GPL) as published by the Free Software
Foundation, in version 2 as it comes in the "COPYING" file of the
VirtualBox OSE distribution. VirtualBox OSE is distributed in the
hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
The contents of this file may alternatively be used under the terms
of the Common Development and Distribution License Version 1.0
(CDDL) only, as it comes in the "COPYING.CDDL" file of the
VirtualBox OSE distribution, in which case the provisions of the
CDDL are applicable instead of those of the GPL.
You may elect to license modified versions of this file under the
terms and conditions of either the GPL or the CDDL or both.
"""
# Validation Kit imports.
"""
USB Gadget control class using the TesteXecService to talk to the external
board behaving like a USB device.
The board needs to run an embedded Linux system with the TXS service running.
"""
self.oTxsSession = None;
"""
Loads the given module on the USB gadget.
Returns True on success.
Returns False otherwise.
"""
if self.oTxsSession is not None:
# For the ODroid-XU3 gadget we have to do a soft connect for the attached host to recognise the device.
return fRc;
"""
Unloads the given module on the USB gadget.
Returns True on success.
Returns False otherwise.
"""
if self.oTxsSession is not None:
# For the ODroid-XU3 gadget we do a soft disconnect before unloading the gadget driver.
return fRc;
"""
Removes the current impersonation of the gadget.
"""
return True;
else:
return False;
"""
Impersonate a given device.
"""
# Clear any previous impersonation
if sImpersonation == 'Invalid':
return False;
elif sImpersonation == 'Test':
elif sImpersonation == 'Msd':
# @todo: Not complete
elif sImpersonation == 'Webcam':
# @todo: Not complete
elif sImpersonation == 'Network':
else:
return False;
"""
Connects to the specified target device.
Returns True on Success.
Returns False otherwise.
"""
if uPort is None:
else:
if self.oTxsSession is None:
return False;
else:
return fRc;
"""
Disconnects from the target device.
"""
if self.oTxsSession is not None:
return fRc;