def enable_otg()

in deepracer_systems_pkg/deepracer_systems_pkg/otg_module/otg_control_node.py [0:0]


    def enable_otg(self):
        """Helper method to enable the otg by executing required commands.

        Returns:
            bool: True if successfully executed the commands.
        """
        # Setup connectivity from  Windows
        usb0 = False
        usb1 = False

        # Setup connectivity from Windows
        if self.execute("ip link set usb0 up"):
            if self.execute("ip addr add 10.0.0.1/30 dev usb0"):
                if self.execute("systemctl restart dnsmasq") and \
                   self.execute("systemctl restart isc-dhcp-server"):
                    usb0 = True
                    self.get_logger().info("Ethernet Over OTG enabled for Windows!")
        if not usb0:
                self.get_logger().error("Ethernet Over OTG enable failed for Windows.")

        # Setup connectivity from Mac
        if self.execute("ip link set usb1 up"):
            if self.execute("ip addr add 10.0.1.1/30 dev usb1"):
                if self.execute("systemctl restart dnsmasq") and \
                   self.execute("systemctl restart isc-dhcp-server"):
                    usb1 = True
                    self.get_logger().info("Ethernet Over OTG enabled for MAC!")
        if not usb1:
                self.get_logger().error("Ethernet Over OTG enable failed for MAC.")

        return True