Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ADB shell showing weird chars #22752

Open
trufae opened this issue Mar 26, 2024 · 5 comments
Open

ADB shell showing weird chars #22752

trufae opened this issue Mar 26, 2024 · 5 comments

Comments

@trufae
Copy link
Collaborator

trufae commented Mar 26, 2024

maybe it is unrelated.
I tried use my build on emulator and xiaomi android 14 device through adb shell
On both appear artifacts around cursor:

image

by @docds

reported #22750 (comment)

@trufae
Copy link
Collaborator Author

trufae commented Mar 26, 2024

@docds are you on windows? or which terminal is this that doesnt support ansi?

can you try appluing this patch and see if at least the 2K disappears?

diff --git a/libr/cons/dietline.c b/libr/cons/dietline.c
index 229aaf451d..25a1e6d65d 100644
--- a/libr/cons/dietline.c
+++ b/libr/cons/dietline.c
@@ -1760,7 +1752,7 @@ R_API const char *r_line_readline_cb(RLineReadCallback cb, void *user) {
                bool o_do_setup_match = I.history.do_setup_match;
                I.history.do_setup_match = true;
                if (I.echo && cons->context->color_mode) {
-                       r_cons_clear_line (0);
+               //      r_cons_clear_line (0);
                }
                (void) r_cons_get_size (&rows);
                switch (*buf) {

@docds
Copy link

docds commented Mar 26, 2024

I make build on Debian 12.5 with default terminal (VirtualBox), but testing from Windows 10 (cmd)
I clone master "git clone https://github.com/radareorg/radare2.git" and rebuild project.

image

After start r2 in cmd through "adb shell" terminal looks like that:

./r2 --
←[0m[0x00000000]> ←[0m

Wen I pres first key "d":

./r2 --
←[0m[0x00000000]> ←[0md[0m←[2K

"dc" pressed

./r2 --
←[0m[0x00000000]> ←[0mdc[0m←[2K

"Enter" pressed

./r2 --
[0x00000000]> ←[0mdc←[0m[0m←[2K
ERROR: Cannot continue, run ood?
←[0m[0x00000000]> ←[0m

@trufae
Copy link
Collaborator Author

trufae commented Mar 28, 2024

Ah that makes sense, those escape codes are ANSI and windows terminal doesnt support them, so i would suggest you to do the following thing:

adb shell r2 -e scr.fgets=true --

this will use fgets instead of the dietline input method, which will not have autocompletion or ansi escape codes. but i would suggest you to try another terminal that supports this or just use ssh into the device.

are the colors working? or you need to do -e scr.color=0 too?

@docds
Copy link

docds commented Mar 29, 2024

Thanks. Cmd indeed was culprit.
When use -e scr.fgets=true parameter no weird chars appear.
Colors works just fine.

image

I found brand new replacement for CMD from Microsoft. Leave it here for feather generations. :-).
ANSI Terminal support
The ANSI features are designed to be compatible with the xterm-based terminals. For more information, see xterm in Wikipedia.
On Windows 10 and higher, the Windows Console Host is xterm compatible. The Windows Terminal application is also xterm compatible.

Start just "r2 --"
image
image

I will going to get some Raspberry Pi (4/5) device and put there Android and do some experiment.
When I run Android arm emulator on x86 platform it work really slow and I don’t wont to root my personal cell phone.

@trufae
Copy link
Collaborator Author

trufae commented Mar 30, 2024

But still. its weird because the colors work in cmd->adb, the issue seems to be only in the repl prompt 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants