示例#1
0
 def devices_list(self):
     chdkptp = shell('chdkptp')
     chdkptp.sendline('list')
     chdkptp.expect("-1:.*", timeout=20)
     cams = chdkptp.after.decode()
     chdkptp.kill(0)
     return cams.split('\n')[:-1]
 def devices_list(self):
     chdkptp = shell('chdkptp')
     chdkptp.sendline('list')
     chdkptp.expect("-1:.*", timeout=20)
     cams = chdkptp.after.decode()
     chdkptp.kill(0)
     return cams.split('\n')[:-1]
    def connect(self, p_cam_info):
        cam = shell('chdkptp')

        expression = r"(?P<bus>b=[0-9]+) (?P<dev>d=[0-9]+)"

        result = re.search(expression, p_cam_info)
        dev = result.group('dev')
        bus = result.group('bus')

        # Command connect to camera example: connect -b=001 -d=003
        cam.sendline('connect -{0} -{1}'.format(bus, dev))
        cam.sendline('download orientation.txt /tmp/')
        cam.expect('A/.*', timeout=5)

        orientation = check_output('cat /tmp/orientation.txt', shell=True).decode().strip()
        self.cams[orientation] = cam
示例#4
0
    def connect(self, p_cam_info):
        cam = shell('chdkptp')

        expression = r"(?P<bus>b=[0-9]+) (?P<dev>d=[0-9]+)"

        result = re.search(expression, p_cam_info)
        dev = result.group('dev')
        bus = result.group('bus')

        # Command connect to camera example: connect -b=001 -d=003
        cam.sendline('connect -{0} -{1}'.format(bus, dev))
        cam.sendline('download orientation.txt /tmp/')
        cam.expect('A/.*', timeout=5)

        orientation = check_output('cat /tmp/orientation.txt',
                                   shell=True).decode().strip()
        self.cams[orientation] = cam