FORUMS
Remove All Ads from XDA

[TOOLS][ZIPS][SCRIPTS] osm0sis' Odds and Ends [Multiple Devices/Platforms]

13,844 posts
Thanks Meter: 30,680
 
By osm0sis, Recognized Developer / Recognized Contributor on 18th April 2013, 01:37 AM
Post Reply Email Thread
11th December 2019, 05:03 AM |#2581  
Member
Thanks Meter: 5
 
More
Quote:
Originally Posted by osm0sis

Honestly not sure, all I can tell you is adbd (the server) is part of the ROM, so I'm not sure why it wouldn't work as with other clients.

Did you try running `stop adbd; start adbd;` first to make sure it's also running as root?

Edit: Searching the thread, here's what our resident adb hacking guru @Surge1223 suggested back in the day for localhost adb: https://forum.xda-developers.com/sho...9#post68334459

Yes. I have always been doing:
Code:
F5321: / $ su
F5321: / # setprop service.adb.tcp.port 5555
F5321: / # adb kill-server
F5321: / # adb tcpip 5555
F5321: / # stop adbd
F5321: / # start adbd
F5321: / # adb connect localhost:5555
And it always asks for authorization as the first time.

---------- Post added at 07:03 PM ---------- Previous post was at 06:11 PM ----------

Quote:
Originally Posted by Surge1223

There's quite a bit behind this, it depends on the env in root shell, uid or the process that executed "adb shell" or "adb connect" etc, also depends the order of which dirs it scans to find the keys, I don't quite remember the order anymore but back when I made this I prioritized having it search /sdcard instead of /data/misc because the idea was to gain uid 2000 (shell) perms without using a pc or having root

Thank you, Surge.
Sorry for a dumb question, but what is "it" that is scanning for "the keys"? Which keys?
Are you saying something is searching for adb_keys in /sdcard instead of /data/misc?
If so, should I copy /data/misc/adb/adb_keys to /sdcard? I will give that a shot.

Quote:
Originally Posted by Surge1223

I don't know why the pop-up is such a big deal, I usually don't get the pop up at all (and I adb on device as my only source or root)

If you don't get the pop up, I can understand that it's not a big deal. I DO get the pop up and want to get rid of it.
One of the app I use draw over other apps and prevent me from tapping "OK" on the auth dialog. I have to disable the app, authorize adb, then enable the app back. I eventually want to script all steps from adb connecting to mounting encrypted volume for easy one click and obviously not being able to click "OK" gets in the way.

Quote:
Originally Posted by Surge1223

If it's bothersome enough, set the persist adb listening port to tcp 5555 on boot and connect to the virtual emulator on 5554 instead of to localhost

What is this virtual emulator on 5554? Is it always there when adb is listening to port 5555? I have seen "emulator-5554" when I try connecting to localhost and wondered what it is. I have seen both at the same time:
Code:
F5321: / # adb connect localhost:5555
F5321: / # adb devices
localhost:5555    unauthorized
emulator-5554     unauthorized
My observations are:
  • "emulator-5554" always asks for authorization even with the key copied in /data/misc/adb/adb_keys, just like localhost.
  • adb shows only one authorization dialog. If I get emulator-5554, that's the only one that gets authorized, effectively preventing me from authorizing localhost.
  • I still have no idea where emulator-5554 came from, but I took a wild guess and uninstalled an app called "WiFI ADB" that I had on my phone. I have not seen emulator-5554 ever since.
If connecting to emulator-5554 does exactly the same as connecting to localhost, I don't mind using either one (if emulator-5554 ever come back). However, emulator-5554 still asks for authorization on my machine, therefore won't solve my problem.
The Following User Says Thank You to tapa_t For This Useful Post: [ View ] Gift tapa_t Ad-Free
11th December 2019, 07:17 AM |#2582  
Surge1223's Avatar
Recognized Contributor
Flag Iowa
Thanks Meter: 7,392
 
Donate to Me
More
Quote:
Originally Posted by tapa_t

Yes. I have always been doing:

Code:
F5321: / $ su
F5321: / # setprop service.adb.tcp.port 5555
F5321: / # adb kill-server
F5321: / # adb tcpip 5555
F5321: / # stop adbd
F5321: / # start adbd
F5321: / # adb connect localhost:5555
And it always asks for authorization as the first time.

---------- Post added at 07:03 PM ---------- Previous post was at 06:11 PM ----------



Thank you, Surge.
Sorry for a dumb question, but what is "it" that is scanning for "the keys"? Which keys?
Are you saying something is searching for adb_keys in /sdcard instead of /data/misc?
If so, should I copy /data/misc/adb/adb_keys to /sdcard? I will give that a shot.



If you don't get the pop up, I can understand that it's not a big deal. I DO get the pop up and want to get rid of it.
One of the app I use draw over other apps and prevent me from tapping "OK" on the auth dialog. I have to disable the app, authorize adb, then enable the app back. I eventually want to script all steps from adb connecting to mounting encrypted volume for easy one click and obviously not being able to click "OK" gets in the way.



What is this virtual emulator on 5554? Is it always there when adb is listening to port 5555? I have seen "emulator-5554" when I try connecting to localhost and wondered what it is. I have seen both at the same time:
Code:
F5321: / # adb connect localhost:5555
F5321: / # adb devices
localhost:5555    unauthorized
emulator-5554     unauthorized
My observations are:
  • "emulator-5554" always asks for authorization even with the key copied in /data/misc/adb/adb_keys, just like localhost.
  • adb shows only one authorization dialog. If I get emulator-5554, that's the only one that gets authorized, effectively preventing me from authorizing localhost.
  • I still have no idea where emulator-5554 came from, but I took a wild guess and uninstalled an app called "WiFI ADB" that I had on my phone. I have not seen emulator-5554 ever since.
If connecting to emulator-5554 does exactly the same as connecting to localhost, I don't mind using either one (if emulator-5554 ever come back). However, emulator-5554 still asks for authorization on my machine, therefore won't solve my problem.

Yeah connecting to emulator is the same, I changed some code to make emulator available because localhost gets blocked by default on some devices. At the time I was exploring virtual qemu ideas.

Same code as before, just modify with the below where appropriate.

Code:
 
adb kill-server
HOME=/data
adb devices
adb connect emulator-5554
adb -s emulator-5554 shell
Quote:

If so, should I copy /data/misc/adb/adb_keys to /sdcard? I will give that a shot.

Yeah check /sdcard/.android add keys as desired

Some background info

Code:
Because

void adb_set_tcp_name(const char* hostname) { 
    __adb_server_name = hostname; 
}


int _adb_connect(const std::string& service, std::string* error) {

    ...skipped obvs defines and initializations of vars

    if (__adb_server_name) {

        fd = network_connect(__adb_server_name, __adb_server_port, SOCK_STREAM, 0, &reason);

        if (fd == -1) {
            *error = android::base::StringPrintf("can't connect to %s:%d: %s", __adb_server_name, __adb_server_port, reason.c_str());

            return -2;
        }
    } else {
        fd = network_loopback_client(__adb_server_port, SOCK_STREAM, &reason);

        if (fd == -1) {
            *error = android::base::StringPrintf("cannot connect to daemon: %s", reason.c_str());
            return -2;
        }
    }
   ...buncha other crap
}



we want it to connect, which requires a hostname, and be signed by keys authorizing it
The Following User Says Thank You to Surge1223 For This Useful Post: [ View ] Gift Surge1223 Ad-Free
11th December 2019, 04:07 PM |#2583  
nemanja066's Avatar
Senior Member
Thanks Meter: 210
 
More
Osmosis FlashAfterUpdate script doesn't work on Lineage 16, but other scripts in /system/addon.d working good, so it's probably not a ROM issue.

I did all as instructed, (permmisions etc...), zip file i copied to data/flashafterupdate folder.

It looks like the script was running fine but the flash process of zip file failed because I can see flashafterupdate folder was created on sdcard as well as disable folder.

I also created a verbose empty file, but nothing was displayed on the screen.

Thanks.
11th December 2019, 04:46 PM |#2584  
osm0sis's Avatar
OP Recognized Developer / Recognized Contributor
Flag Halifax
Thanks Meter: 30,680
 
Donate to Me
More
Quote:
Originally Posted by nemanja066

Osmosis FlashAfterUpdate script doesn't work on Lineage 16, but other scripts in /system/addon.d working good, so it's probably not a ROM issue.

I did all as instructed, (permmisions etc...), zip file i copied to data/flashafterupdate folder.

It looks like the script was running fine but the flash process of zip file failed because I can see flashafterupdate folder was created on sdcard as well as disable folder.

I also created a verbose empty file, but nothing was displayed on the screen.

Thanks.

1) Is your device A/B? The current version of FlashAfterUpdate is an addon.d-v1 script, so addon.d-v2 will skip it. A/B OTAs are a totally different ballgame, but I'm working on a possible solution.

2) If your ROM doesn't request decryption of /sdcard or /data during OTA then neither of those locations would work. Some don't mount /data at all. You'll either have to find a location that works (/cache or /persist maybe if either are a dedicated partition?), or reboot manually to recovery and flash each OTA to make sure things are decrypted.
The Following User Says Thank You to osm0sis For This Useful Post: [ View ]
11th December 2019, 05:10 PM |#2585  
nemanja066's Avatar
Senior Member
Thanks Meter: 210
 
More
Quote:
Originally Posted by osm0sis

1) Is your device A/B? The current version of FlashAfterUpdate is an addon.d-v1 script, so addon.d-v2 will skip it.

2) If your ROM doesn't request decryption of /sdcard or /data during OTA then neither of those locations would work.

1. I think, yes it is, A/B, Xiaomi Mi 8.

2. I searched the topic a bit and I see that you are recommending zip file be moved to the /cache partition. This zip is exactly the zip that disable encryption forcing (disable dm verity & force encrypt).

The magisk script works OK, maybe I need to see where it invokes those required files or what.

Thanks.
11th December 2019, 05:15 PM |#2586  
osm0sis's Avatar
OP Recognized Developer / Recognized Contributor
Flag Halifax
Thanks Meter: 30,680
 
Donate to Me
More
Quote:
Originally Posted by nemanja066

1. I think, yes it is, A/B, Xiaomi Mi 8.

2. I searched the topic a bit and I see that you are recommending zip file be moved to the /cache partition. This zip is exactly the zip that disable encryption forcing (disable dm verity & force encrypt).

The magisk script works OK, maybe I need to see where it invokes those required files or what.

Thanks.

If it's A/B then definitely just #1 then, and #2 wouldn't be a factor. See my edits above.
The Following User Says Thank You to osm0sis For This Useful Post: [ View ]
26th December 2019, 03:08 PM |#2587  
Paget96's Avatar
Recognized Developer / Contributor
Flag Krusevac
Thanks Meter: 33,957
 
Donate to Me
More
Hello @osm0sis, a lot of time passed from when I was here last time.

Two weeks ago I bought Redmi Note 8pro, rooted it and as a kernel tweaker, let's see how the kernel is set up.
One strange thing I have noticed is that almost all the blocks are treated as a rotational storage, and why the heck it have all the merges enabled.
One more strange thing, even is it clustered device it have just global tunable for schedutil which by default have both
up_rate_limit_us and down_rate_limit_us set to 0.
26th December 2019, 04:38 PM |#2588  
osm0sis's Avatar
OP Recognized Developer / Recognized Contributor
Flag Halifax
Thanks Meter: 30,680
 
Donate to Me
More
Quote:
Originally Posted by Paget96

Hello @osm0sis, a lot of time passed from when I was here last time.

Two weeks ago I bought Redmi Note 8pro, rooted it and as a kernel tweaker, let's see how the kernel is set up.
One strange thing I have noticed is that almost all the blocks are treated as a rotational storage, and why the heck it have all the merges enabled.
One more strange thing, even is it clustered device it have just global tunable for schedutil which by default have both
up_rate_limit_us and down_rate_limit_us set to 0.

Hey! Good to see you. And Merry Christmas to all!

rotational 1 is the default because Linux. Most devices aren't tweaked for flash storage by the manufacturer.

I'm not super familiar with schedutil, but that's the default on my OP7T on stock and arter kernel, so I'm guessing not a big deal either?
The Following User Says Thank You to osm0sis For This Useful Post: [ View ]
26th December 2019, 05:02 PM |#2589  
Paget96's Avatar
Recognized Developer / Contributor
Flag Krusevac
Thanks Meter: 33,957
 
Donate to Me
More
Quote:
Originally Posted by osm0sis

Hey! Good to see you. And Merry Christmas to all!

rotational 1 is the default because Linux. Most devices aren't tweaked for flash storage by the manufacturer.

I'm not super familiar with schedutil, but that's the default on my OP7T on stock and arter kernel, so I'm guessing not a big deal either?

Merry Christmas to you and your family also Hmm, so then maybe I should checkout how to optimize that. If you wanna join the development, check this.
https://github.com/Magisk-Modules-Re.../lspeed/binary
Maybe you can help a bit, people just requesting stuff for the new devices, I cannot make them all.

Have a nice day
3rd January 2020, 04:39 PM |#2590  
Senior Member
Thanks Meter: 11
 
More
Where to place file in adb/fastboot , Eg I want to fastboot boot TWRP.img , where should be the twrp.img placed , where is the adb installed?
3rd January 2020, 06:18 PM |#2591  
jd1639's Avatar
Recognized Contributor
Minnesota
Thanks Meter: 5,502
 
Donate to Me
More
Quote:
Originally Posted by Nandan.R.D

Where to place file in adb/fastboot , Eg I want to fastboot boot TWRP.img , where should be the twrp.img placed , where is the adb installed?

Put fastboot and adb in any folder you want. Then in control panel, advanced system settings, environmental variables, edit the path to include the folder that fastboot/adb are in. Then it doesn't matter where the twrp.img is relative to fastboot/adb. Open a power shell in the folder twrp is in and do what you want with it. If you ran snoop's script adb will be in a folder adb.
The Following User Says Thank You to jd1639 For This Useful Post: [ View ] Gift jd1639 Ad-Free
Post Reply Subscribe to Thread

Tags
automation, batch, flashable zip, script, tool

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes