def initialize_device(self, device_serial):

        log.d(TAG, "Preparing device: %s" % device_serial)

        touch(utils.CONFIG_FILE_NAME)

        set_prop('Info', 'serial', device_serial)

        # Since we have a serial now, lets create a new DtfAdb instance
        self.adb = DtfAdb.DtfAdb()

        # Kernel
        self.adb.shell_command('cat /proc/version')
        kernel = self.adb.get_output()[0]
        log.d(TAG, "Kernel version: %s" % kernel)
        set_prop('Info', 'kernel', kernel)

        # SDK
        sdk = self.getprop('ro.build.version.sdk')
        log.d(TAG, "Using SDK API %s" % sdk)
        set_prop('Info', 'SDK', sdk)

        self.adb.shell_command('set')
        set_output = self.adb.get_output()

        # $PATH
        path = get_set_value(set_output, 'PATH')
        if path is None:
            log.e(TAG, "Unable to get $PATH variable!")
            self.do_shutdown(None, None)
        log.d(TAG, "PATH : %s" % path)
        set_prop('Info', 'path', path)

        # $BOOTCLASSPTH
        bootclasspath = get_set_value(set_output, 'BOOTCLASSPATH')
        if bootclasspath is None:
            log.e(TAG, "Unable to get $BOOTCLASSPATH variable!")
            self.do_shutdown(None, None)
        log.d(TAG, "BOOTCLASSPATH : %s" % bootclasspath)
        set_prop('Info', 'bootclasspath-jars', bootclasspath)

        # Version string
        version_string = self.generate_version_string()

        log.d(TAG, "Using version string: %s" % version_string)
        set_prop('Info', 'version-string', version_string)

        # Determine CPU bitness
        cpu_bits = self.determine_cpu_bits()
        if cpu_bits is None:
            self.do_shutdown(None, None)

        log.d(TAG, "Using %s-bit CPU" % cpu_bits)
        set_prop('Info', 'cpu-bits', cpu_bits)

        # Set the VM type (Dalvik|Art)
        vm_type = self.determine_vm_type(sdk, cpu_bits)
        if vm_type is None:
            self.do_shutdown(None, None)

        log.d(TAG, "Determined runtime: %s" % vm_type)
        set_prop('Info', 'vmtype', vm_type)

        # Make project directories
        mkdir(REPORTS_DIRECTORY)
        mkdir(DBS_DIRECTORY)
        mkdir(LOCAL_MODULES_DIRECTORY)

        set_prop('Local', 'reports-dir', REPORTS_DIRECTORY)
        set_prop('Local', 'db-dir', DBS_DIRECTORY)

        # Invoke client installation
        rtn = pkg.launch_builtin_module('client', ['install'])
        if rtn != 0:
            log.w(TAG, "Unable to install dtf client. Try manually.")

        return 0
Perform the actual initialization
dataset/ETHPy150Open jakev/dtf/src/dtf/core/cmds/init.py/init.initialize_device