Exemplo n.º 1
0
def run():
    try:
        caps = get_stdout(cmd_pattern % v4l_get_current_device(),
                          shell=True).split('caps = ')[1].strip().replace(
                              '\\', '')
        msg = "Default caps are: %s" % caps
        return (True, msg)
    except Exception as e:
        print(e)
        return (False, "Autonegociation failed")
def _run():
    try:
        data = get_stdout(cmd_pattern %v4l_get_current_device(), shell=True).strip().split('\n')
        last_bufsize = None
        for line in data:
            bufsize = line.split('akesink0:sink) (')[1].split(' bytes, dts')[0]
            if last_bufsize is None:
                last_bufsize = bufsize
            elif bufsize != last_bufsize:
                return (False, "Buffer size varied")
        return (True, "All buffers had the same size")
    except Exception as e:
        print(e)
        return (False, "Error (%s)" %e)
Exemplo n.º 3
0
def cpu():
    if is_pc():
        cpu = get_stdout('cat /proc/cpuinfo | grep "model name" | tail -n 1',
                         shell=True).split(': ')[1].strip()
        if "Intel" in cpu:
            intel_gpu = get_intel_gen()
            if intel_gpu:
                return "%s %s" % (cpu, intel_gpu)
            else:
                nvidia_gpu = get_nvidia_gpu()
                return "%s %s" % (cpu, nvidia_gpu)
    else:
        if is_pi():
            return get_pi_model()
        else:
            return get_arm_hw()
Exemplo n.º 4
0
def get_gst_version():
    return process.get_stdout('gst-launch-1.0 --gst-version').strip().split(
        ' ')[-1]
Exemplo n.º 5
0
def get_nvidia_gpu():
    return get_stdout(
        'lspci | grep VGA',
        shell=True).strip().split('VGA compatible controller: ')[1]
Exemplo n.º 6
0
def gpu():
    if is_pc():
        return get_stdout('lspci | grep -E "VGA|3D"',
                          shell=True).split('controller: ')[1].strip()
    else:
        return get_arm_hw()
Exemplo n.º 7
0
def get_intel_gen():
    try:
        return get_stdout('vainfo | grep "Driver version"',
                          shell=True).split('driver for ')[1].split(' - ')[0]
    except Exception:
        return ''
Exemplo n.º 8
0
def get_arm_hw():
    try:
        return get_stdout('grep Hardware /proc/cpuinfo',
                          shell=True).split(': ')[1].strip()
    except Exception:
        return ''
Exemplo n.º 9
0
def get_machine():
    #x86_64
    #'armv6l'
    #'armv7l'
    return get_stdout('uname -m')
Exemplo n.º 10
0
def get_pi_model():
    rev = get_stdout('grep Revision /proc/cpuinfo',
                     shell=True).split(': ')[1].strip()
    return "RaspberryPi %s" % RPI_REV[rev]
Exemplo n.º 11
0
def get_free_space_bytes(path="/tmp"):
    cmd = "/bin/df %s --output=avail | tail -n 1" % path
    return int(get_stdout(cmd, shell=True)) * 1024
Exemplo n.º 12
0
def get_free_gpu_mem_rpi_bytes():
    cmd = "sudo LD_LIBRARY_PATH=/opt/vc/lib /opt/vc/bin/vcdbg reloc | grep 'free mem' | cut -f 1 | cut -d M -f 1"
    mem_mb = int(get_stdout(cmd, shell=True)) * 1024 * 1024
    return mem_mb
Exemplo n.º 13
0
def check_path_is_tmpfs(path='/tmp'):
    d = get_stdout('df %s | tail -n 1' % path, shell=True)
    return d.startswith('tmpfs')