コード例 #1
0
    def do_dftp_connect(self, s):
        """
Usage:
    dftp_connect

Connect to device for dftp session.
What version of DFTP it attempts to connect with depends on the device profile
 that has been loaded.
 
Will attempt to configure IPs or mount points as needed.

This could take a minute or so, if you just booted the device.
        """
        try:
            if not self._lm.is_client(self._dftp_client):
                try:
                    if self._profile.get['firmware']['dftp_version'] == 1:
                        ci = conn_iface(net_connection(self.host_id, self.device_id, self.debug))
                        print 'Connecting with DFTP v1 Networking.'
                    elif self._profile.get['firmware']['dftp_version'] == 2:
                        ci = conn_iface(mount_connection(self.device_id, 'NULL', self.debug))
                        print 'Connecting with DFTP v2 Mass Storage.'
                    self._dftp_client = dftp_client(ci, self._profile, self.debug)
                    self._lm.remote_connection_init(ci, fs_iface(self._dftp_client), self._dftp_client)
                    self._dftp_client.create_client()
                    self._lm.remote_path_init()
                    #self.dftp_device_info()
                except Exception, e:
                    self._dftp_client = None
                    self._lm.remote_destroy() 
                    self.error(e)                   
            else:
コード例 #2
0
    def do_didj_mount(self, s):
        """
Usage:
    didj_mount

Unlock Didj to allow it to mount on host system.
        """
        try:
            if not self._lm.is_client(self._didj_client):
                try:
                    mc = conn_iface(mount_connection(self.device_id, self.host_id, self.debug))
                    self._didj_client = didj_client(mc, self.debug)                
                    self._lm.remote_connection_init(mc, fs_iface(local_client(self.debug)), self._didj_client)
                    self._didj_client.mount()
                    self._lm.remote_path_init()
                    self.didj_device_info()
                except Exception, e:
                    self._didj_client = None
                    self._lm.remote_destroy()
                    self.error(e)                    
            else:
コード例 #3
0
    def do_surgeon_boot(self, s):
        """
Usage:
    surgeon_boot <path to surgeon.cbf>

Uploads a Surgeon.cbf file to a device in USB Boot mode. 
File can be any name, but must conform to CBF standards.
        """
        try:
            self._lm.is_empty(s)
            self._pager_client = pager_client(self.debug)
            abspath = self._lm.get_abspath(s)

            if not self._lm.fs.is_dir(abspath):
                self._pager_client = pager_client(conn_iface(mount_connection()))
                self._pager_client.upload(abspath)
                print 'Booting surgeon.'
                self._pager_client = None
            else:
                self.error('Path is not a file.')

            self._pager_client = None
        except Exception, e:
            self.perror(e)