Giter Site home page Giter Site logo

Comments (7)

JeffLIrion avatar JeffLIrion commented on August 22, 2024

Could you please post a log from an exec command with the log level set to debug. That way I can add a unit test for this function.

from adb_shell.

T2hhbmEK avatar T2hhbmEK commented on August 22, 2024

Sorry, I am not familiar with adb debugging. I need more detailed information on how to get the log so I can help.

from adb_shell.

JeffLIrion avatar JeffLIrion commented on August 22, 2024

Python logs, not ADB logs. This should work:

import logging

logging.getLogger("adb_shell.adb_device").setLevel(logging.DEBUG)
logging.getLogger("adb_device").setLevel(logging.DEBUG)

from adb_shell.

T2hhbmEK avatar T2hhbmEK commented on August 22, 2024
import logging
from adb_shell.adb_device import AdbDeviceTcp

logging.basicConfig(level=logging.INFO)
logging.getLogger("adb_shell.adb_device").setLevel(logging.DEBUG)
logging.getLogger("adb_device").setLevel(logging.DEBUG)
device = AdbDeviceTcp("127.0.0.1", 7555)
try:
    device.connect()
    r = device._service(b"exec", "echo TEST".encode("utf8"))
    print(r)
finally:
    device.close()
DEBUG:adb_shell.adb_device:bulk_write: b'CNXN\x00\x00\x00\x01\x00\x00\x10\x00\x16\x00\x00\x00\x07\x06\x00\x00\xbc\xb1\xa7\xb1'
DEBUG:adb_shell.adb_device:bulk_write: b'host::DESKTOP-70888G8\x00'
DEBUG:adb_shell.adb_device:bulk_read(24): b'CNXN\x00\x00\x00\x01\x00\x10\x00\x00L\x00\x00\x00\x08\x1c\x00\x00\xbc\xb1\xa7\xb1'
DEBUG:adb_shell.adb_device:bulk_read(76): b'device::ro.product.name=cancro;ro.product.model=MuMu;ro.product.device=x86;\x00'
DEBUG:adb_shell.adb_device:bulk_write: b'OPEN\x01\x00\x00\x00\x00\x00\x00\x00\x0f\x00\x00\x00\xde\x04\x00\x00\xb0\xaf\xba\xb1'
DEBUG:adb_shell.adb_device:bulk_write: b'exec:echo TEST\x00'
DEBUG:adb_shell.adb_device:bulk_read(24): b'OKAY\x14\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xb0\xb4\xbe\xa6'
DEBUG:adb_shell.adb_device:bulk_read(24): b'WRTE\x14\x00\x00\x00\x01\x00\x00\x00\x05\x00\x00\x00J\x01\x00\x00\xa8\xad\xab\xba'
DEBUG:adb_shell.adb_device:bulk_read(5): b'TEST\n'
DEBUG:adb_shell.adb_device:bulk_write: b'OKAY\x01\x00\x00\x00\x14\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xb0\xb4\xbe\xa6'
DEBUG:adb_shell.adb_device:bulk_write: b''
DEBUG:adb_shell.adb_device:bulk_read(24): b'CLSE\x14\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xbc\xb3\xac\xba'
DEBUG:adb_shell.adb_device:bulk_write: b'CLSE\x01\x00\x00\x00\x14\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xbc\xb3\xac\xba'
DEBUG:adb_shell.adb_device:bulk_write: b''
TEST

from adb_shell.

T2hhbmEK avatar T2hhbmEK commented on August 22, 2024

The difference between exec and shell is that shell will turn \n into \r\n.

from adb_shell.

JeffLIrion avatar JeffLIrion commented on August 22, 2024

Thanks, I can work with that.

From https://www.linux-magazine.com/Issues/2017/195/Ask-Klaus:

adb exec-out "<command>"

Run command on Android and capture its unfiltered binary output (stdout)

I think I'll keep the default value of decode=true for this function, although it seems like this will produce the same results as shell, aside from the \n vs. \r\n difference that you pointed out.

from adb_shell.

JeffLIrion avatar JeffLIrion commented on August 22, 2024

Closed via #142

from adb_shell.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.