(self, cmd, timeout=60)
return ret_val
Helper for calling root/su cmds
Helper for calling root/su cmds
Helper for calling root / su cmds
def su_cmd(self, cmd, timeout=60):
        """ Helper for calling root/su cmds
        """
        if not self.available():
            return None

        ret_val = None
        if self._is_su:
            if self._alternate_su_binary:
                ret_val = self._do_adb_command(
                    'shell su 0 ' + cmd, timeout=timeout)
            else:
                ret_val = self._do_adb_command(
                    'shell su -c ' + cmd, timeout=timeout)
                
                if ret_val and 'Unknown id:' in ret_val:
                    self._alternate_su_binary = True
                    return self.su_cmd(cmd, timeout)

                if ret_val and 'su: invalid option' in ret_val:
                    ret_val = self._do_adb_command(
                        'shell su -c "' + cmd + '"', timeout=timeout)

        elif self._is_root:
            ret_val = self._do_adb_command('shell ' + cmd, timeout=timeout)

        return ret_val
def su_cmd ( self , cmd , timeout = 60 ) : if not self . available ( ) : return None ret_val = None if self . _is_su : if self . _alternate_su_binary : ret_val = self . _do_adb_command ( 'shell su 0 ' + cmd , timeout = timeout ) else : ret_val = self . _do_adb_command ( 'shell su -c ' + cmd , timeout = timeout ) if ret_val and 'Unknown id:' in ret_val : self . _alternate_su_binary = True return self . su_cmd ( cmd , timeout ) if ret_val and 'su: invalid option' in ret_val : ret_val = self . _do_adb_command ( 'shell su -c "' + cmd + '"' , timeout = timeout ) elif self . _is_root : ret_val = self . _do_adb_command ( 'shell ' + cmd , timeout = timeout ) return ret_val